Skip to content
Snippets Groups Projects
Commit 9d746b0d authored by Veronique Legrand's avatar Veronique Legrand
Browse files

work in progress: testing the impact of underlying buffer size when reading gzip fasta files

parent 8ac42f86
No related branches found
No related tags found
No related merge requests found
Pipeline #153219 failed
...@@ -286,14 +286,15 @@ class ReadGetter: ...@@ -286,14 +286,15 @@ class ReadGetter:
def totReads(filin): def totReads(filin):
"""Verify and retrieve the number of reads in the fastq file before alignment""" """Verify and retrieve the number of reads in the fastq file before alignment"""
start_t=time.perf_counter_ns() start_t=time.perf_counter_ns()
bufsize=102400
if filin.endswith('.gz'): if filin.endswith('.gz'):
print(io.DEFAULT_BUFFER_SIZE) print(io.DEFAULT_BUFFER_SIZE)
filein = gzip.open(filin, 'rb') filein = gzip.open(filin, 'rb')
else: else:
filein = open(filin, 'r') filein = open(filin, 'r')
line = 0 line = 0
while filein.readline(): with io.BufferedReader(filein, buffer_size=bufsize) as buffered_f:
#while filein.readline():
line += 1 line += 1
seq = float(round(line / 4)) seq = float(round(line / 4))
filein.close() filein.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment