def iter_canonical_fasta(fastafile):
    canonical = "ACGTN"
    totalbad = 0
    for header, seq in parse_fasta(fastafile):
        badcounts = sum(1 for x in seq if x not in canonical)
        seq = "".join((x if x in canonical else 'N') for x in seq)
        totalbad += badcounts
        yield header, seq

    logging.debug("Total bad char: {0}".format(totalbad))
dataset/ETHPy150Open tanghaibao/jcvi/formats/fasta.py/iter_canonical_fasta/original