I have already know what dna sequence I exactly needed. I need to copy sequence from http://www.ncbi.nlm.nih.gov/
Hello!
I have wrote this code in Python:
from Bio import SeqIO
fasta_file="OXA_finds.fasta"
output=open(fasta_file,'w')
gb_file="OXA_test.gb"
wanted=["Beta-lactamase class D"]
for record in SeqIO.parse(open(gb_file,"r"),"genbank"):
print("Name %s, %i features" % (record.name,len(record.features)))
print(repr(record.seq))
for f in record.features:
if f.type=="CDS" and "product" in f.qualifiers:
product=f.qualifiers["product"][0]
if product in wanted:
output.write(">%s,%s from %s\n%s\n" % (f.qualifiers['product'][0],f.qualifiers['locus_tag'][0],record.name,f.extract(record.seq)))
output.close()
So this code gives me a lot 'N' in FASTA file, and I want a dna string here. How can I handle that?
Thanks in advance!
1 answer
The Ns are not a problem, you often find Ns in sequences. N corresponds to any nucleotide (not a gap). It means they didn't succeed to determine the base during the sequencing at this position.
If you prefer, adding a "if" statement, you can choose to avoid to work with sequences containing any N. I think is not a good idea because even with the presence of N, as they succeeded to determine that the sequence has "Beta-lactamase class D" as product, it means there is enough information in the sequence for determining the function (domains, orthology, etc ...).
Log in to answer this question.
Hello fiascox12!
It appears that your post has been cross-posted to another site: http://stackoverflow.com/questions/30344503
This is typically not recommended as it runs the risk of annoying people in both communities.