Skip to content

Commit 913291f

Browse files
Merge pull request #244 from misialq/issue-230
fix: change read mode in `is_valid_bed`
2 parents cc82f38 + 183e449 commit 913291f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

quast_libs/ra_utils/misc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def sambamba_view(in_fpath, out_fpath, max_threads, err_fpath, logger, filter_ru
403403

404404
def is_valid_bed(bed_fpath):
405405
# check last 10 lines
406-
with open(bed_fpath, 'r') as f:
406+
with open(bed_fpath, 'rb') as f:
407407
lines_found = []
408408
block_counter = -1
409409
_buffer = 1024
@@ -415,10 +415,10 @@ def is_valid_bed(bed_fpath):
415415
lines_found = f.readlines()
416416
break
417417
lines_found = f.readlines()
418-
block_counter -= 1
419-
for line in lines_found:
420-
if not line.startswith('#'):
421-
fs = line.split('\t')
418+
block_counter -= 1
419+
for line in lines_found[-10:]:
420+
if not line.startswith(b'#'):
421+
fs = line.decode().split('\t')
422422
try:
423423
align1 = (int(fs[1]), int(fs[2]), correct_name(fs[0]), fs[6])
424424
align2 = (int(fs[4]), int(fs[5]), correct_name(fs[3]), fs[6])

0 commit comments

Comments
 (0)