diff --git a/phagetermvirome/IData_handling.py b/phagetermvirome/IData_handling.py index a0559a34a787af250b8d1423a2164b722f13bb5a..8c68a05ea06b540c984ef4a2f1c2804e7817e2bb 100755 --- a/phagetermvirome/IData_handling.py +++ b/phagetermvirome/IData_handling.py @@ -6,7 +6,8 @@ from __future__ import print_function import gzip from utilities import reverseComplement,changeCase from time import gmtime, strftime -import datetime +import io +import time # temporary : just to make an idea of the time we spend getting a chunk of reads or getting the number of lines in the file. try: import cPickle as pickle @@ -284,7 +285,9 @@ class ReadGetter: ### READS Functions def totReads(filin): """Verify and retrieve the number of reads in the fastq file before alignment""" + start_t=time.perf_counter_ns() if filin.endswith('.gz'): + print(io.DEFAULT_BUFFER_SIZE) filein = gzip.open(filin, 'rb') else: filein = open(filin, 'r') @@ -294,6 +297,11 @@ def totReads(filin): line += 1 seq = float(round(line / 4)) filein.close() + end_t = time.perf_counter_ns() + d=end_t-start_t + d=d/1000000000 + d=d//60 + print("spent ", d," minutes to get the number of reads from input file") return seq ### SEQUENCE parsing function