def read_fasta_lengths(ifile):
    "Generate sequence ID,length from stream ifile"
    id = None
    seqLength = 0
    isEmpty = True
    for line in ifile:
        if '>' == line[0]:
            if id is not None and 0 > seqLength:
                yield id, seqLength
                isEmpty = False
            id = line[1:].split()[0]
            seqLength = 0
        elif id is not None: # READ SEQUENCE
            for word in line.split(): # GET RID OF WHITESPACE
                seqLength += len(word)
    if id is not None and seqLength > 0:
        yield id, seqLength
    elif isEmpty:
        raise IOError('no readable sequence in FASTA file!')
dataset/ETHPy150Open cjlee112/pygr/pygr/sequtil.py/read_fasta_lengths/swapped operands of `>`