Entering edit mode
6.8 years ago
grant.hovhannisyan
★
2.6k
I want to print sequences form fasta file which do not have non-canonical nucleotides. Example fasta is:
>1
ATAcctcatctaGTGTG
ATGCTGCTAGTZ
>2
agagagagagagagag
My code is
from Bio import SeqIO
for record in SeqIO.parse("test.fasta", "fasta") :
if set(record.seq) <= "ATCGatcg":
print record
Instead of print the sequence of >2
, it prints both.
What am I doing wrong? Thanks
Thank you Pierre, I accept your answer. But anyways, what is wrong with SeqIO?