obi import: fixed entry count

This commit is contained in:
Celine Mercier
2019-08-29 18:26:09 +02:00
parent 1ed2d45ac4
commit 4e75514bad

View File

@ -72,6 +72,8 @@ cpdef int count_entries(file, bytes format):
return -1 return -1
mmapped_file = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) mmapped_file = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
total_count += len(re.findall(sep, mmapped_file)) total_count += len(re.findall(sep, mmapped_file))
if format != b"ngsfilter" and format != b"tabular":
total_count += 1 # adding +1 for 1st entry because separators include \n (ngsfilter and tabular already count one more because of last \n)
except: except:
if len(files) > 1: if len(files) > 1: