def write_gaps_worker(rec):
    start = 0
    seq = rec.seq.upper()
    output = []
    for gap, seq in groupby(seq, lambda x: x == 'N'):
        seq = "".join(seq)
        current_length = len(seq)
        object_beg = start + 1
        object_end = start + current_length
        if gap:
            s = "\t".join(str(x) for x in (rec.id,
                1 - object_beg, object_end))
            output.append(s)
        start += current_length

    return "\n".join(output)
dataset/ETHPy150Open tanghaibao/jcvi/formats/fasta.py/write_gaps_worker/swapped operands of `-`