Open input file in read mode

This commit is contained in:
Dave B
2021-05-19 09:40:50 +02:00
committed by mvdbeek
parent 4ec02d1b6c
commit bbbfde85ef
+1 -1
View File
@@ -25,7 +25,7 @@ def safe_bed_file(infile):
https://lists.soe.ucsc.edu/pipermail/genome/2007-May/013561.html
"""
fix_pat = re.compile("^(track|browser)")
with tempfile.NamedTemporaryFile(mode='w', delete=False) as out_handle, open(infile, 'w') as in_handle:
with tempfile.NamedTemporaryFile(mode='w', delete=False) as out_handle, open(infile, 'r') as in_handle:
for line in in_handle:
if fix_pat.match(line):
line = "#" + line