1
__author__ = "Gavin Huttley, Anuj Pahwa"
2
__copyright__ = "Copyright 2007-2009, The Cogent Project"
3
__credits__ = ["Gavin Huttley", "Anuj Pahwa"]
6
__maintainer__ = "Gavin Huttley"
7
__email__ = "Gavin.Huttley@anu.edu.au"
8
__status__ = "Development"
10
def MinimalFastqParser(data, strict=True):
11
"""yields name, seq, qual from fastq file
14
- strict: checks the quality and sequence labels are the same
19
# fastq format is very simple, defined by blocks of 4 lines
25
if strict: # make sure the seq and qual labels match
26
assert record[0][1:] == record[2][1:], \
27
'Invalid format: %s -- %s' % (record[0][1:], record[2][1:])
28
yield record[0][1:], record[1], record[3]
33
record.append(line.strip())
36
if strict and record[0]: # make sure the seq and qual labels match
37
assert record[0][1:] == record[2][1:], 'Invalid format'
39
if record[0]: # could be just an empty line at eof
40
yield record[0][1:], record[1], record[3]
43
if type(data) == file: