def count_seqs_in_files(fhands, file_format=GUESS_FORMAT): 'It counts the seqs in the given files' count = 0 for fhand in fhands: if file_format == GUESS_FORMAT or file_format is None: file_format = guess_format(fhand) else: file_format = file_format if file_format == 'fasta': count += _count_seqs_in_fasta(fhand) elif 'fastq' in file_format: count += length(QualityIO.FastqGeneralIterator(fhand)) else: count += length(read_seqrecords([fhand])) return count
def test_length(self): 'We can count an iterator' items = xrange(10) assert length(items) == 10