剔除所有含有N碱基的序列
from Bio import SeqIO
no_N_records = [record for record in SeqIO.parse('test.fa','fasta') if 'N' not in record.seq]
SeqIO.write(no_N_records, 'out.fa','fasta')
剔除全是N碱基的序列
from Bio import SeqIO
not_only_N_records = [record for record in SeqIO.parse('test.fa','fasta') if ''.join(set(record.seq))!='N']
SeqIO.write(not_only_N_records, 'out.fa','fasta')