diff --git a/phagetermvirome/IData_handling.py b/phagetermvirome/IData_handling.py index dc7d31a24eb234ac81baebf68099cce3b46e834c..b75abe58db871d23cd9423cfe1953715a9aea209 100755 --- a/phagetermvirome/IData_handling.py +++ b/phagetermvirome/IData_handling.py @@ -286,14 +286,15 @@ class ReadGetter: def totReads(filin): """Verify and retrieve the number of reads in the fastq file before alignment""" start_t=time.perf_counter_ns() + bufsize=102400 if filin.endswith('.gz'): print(io.DEFAULT_BUFFER_SIZE) filein = gzip.open(filin, 'rb') else: filein = open(filin, 'r') - line = 0 - while filein.readline(): + with io.BufferedReader(filein, buffer_size=bufsize) as buffered_f: + #while filein.readline(): line += 1 seq = float(round(line / 4)) filein.close()