def fastqIterate(infile):
    '''iterate over contents of fastq file.'''

    def convert2string(b):
        if type(b) == str:
            return b
        else:
            return b.decode("utf-8")

    while 1:
        line1 = convert2string(infile.readline())
        if not line1:
            break
        if not line1.startswith('@'):
            U.error("parsing error: expected '@' in line %s" % line1)
        line2 = convert2string(infile.readline())
        line3 = convert2string(infile.readline())
        if not line3.startswith('+'):
            U.error("parsing error: expected '+' in line %s" % line3)
        line4 = convert2string(infile.readline())
        # incomplete entry
        if not line4:
            U.error("incomplete entry for %s" % line1)

        yield Record(line1[1:-1], line2[:-1], line4[:-1])
def fastqIterate ( infile ) : def convert2string ( b ) : if type ( b ) == str : return b else : return b . decode ( "utf-8" ) while 1 : line1 = convert2string ( infile . readline ( ) ) if not line1 : break if not line1 . startswith ( '@' ) : U . error ( "parsing error: expected '@' in line %s" % line1 ) line2 = convert2string ( infile . readline ( ) ) line3 = convert2string ( infile . readline ( ) ) if not line3 . startswith ( '+' ) : U . error ( "parsing error: expected '+' in line %s" % line3 ) line4 = convert2string ( infile . readline ( ) ) if not line4 : U . error ( "incomplete entry for %s" % line1 ) yield Record ( line1 [ 1 : - 1 ] , line2 [ : - 1 ] , line4 [ : - 1 ] )
iterate over contents of fastq file.