Biopython Translate With N In The Sequence
1
0
Entering edit mode
10.5 years ago
Richard ▴ 580

Hi. I have the following sequence:

CAGGTGCAGCTGGTGCAGAGCGGCAGCGAGCTGAAGAAACCTGGCGCCTCCGTGAAGGTGTCCTGCAAGGCCAGCGGCTACACCTTCACCAGCTACGCCATGAACTGGGTCCGCCAGGCCCCAGGCCAGGGACTGGAATGGATGGGCTGGATCAACACCAACACCGGCAACCCCACCTACGCCCAGGGCTTCACCGGCAGATTCGTGTTCAGCTTCGACACCAGCGTGTCCACCGCCTACCTGCAGATCTGTAGCCTGAAGGCCGAGGACACCGCCGTGTATTNNTGTGCGA

There are a couple of N's in there. I would like to use biopython's translate function on the seuqence, but this throws the following error: "Codon TNN is invalid"

Is there a way to get this function to return a default amino acid such as 'X' when the translation is unsuccessful? Any ideas?

biopython • 3.4k views
ADD COMMENT
0
Entering edit mode

which version of biopython are you using?

ADD REPLY
2
Entering edit mode
10.5 years ago
Geparada ★ 1.5k

I don't have any problem to translate your sequence using biopyhton

>>> from Bio.Seq import Seq
>>> dna = Seq("CAGGTGCAGCTGGTGCAGAGCGGCAGCGAGCTGAAGAAACCTGGCGCCTCCGTGAAGGTGTCCTGCAAGGCCAGCGGCTACACCTTCACCAGCTACGCCATGAACTGGGTCCGCCAGGCCCCAGGCCAGGGACTGGAATGGATGGGCTGGATCAACACCAACACCGGCAACCCCACCTACGCCCAGGGCTTCACCGGCAGATTCGTGTTCAGCTTCGACACCAGCGTGTCCACCGCCTACCTGCAGATCTGTAGCCTGAAGGCCGAGGACACCGCCGTGTATTNNTGTGCGA")    
>>> dna.translate()
Seq('QVQLVQSGSELKKPGASVKVSCKASGYTFTSYAMNWVRQAPGQGLEWMGWINTN...XCA', ExtendedIUPACProtein())

The TNN codon is valid, and it's translated to X, just as you suggested.

Cheers!!

ADD COMMENT
1
Entering edit mode

AHHH, Looks like my problem was my alphabet. I hadn't noticed that I was using UnambiguousDNA. Using generic_dna fixed the issue

ADD REPLY
0
Entering edit mode

please mark the answer as accepted if you think that it's correct. You and the person who answered will receive extra score.

ADD REPLY
0
Entering edit mode

thank you for marking it!

ADD REPLY

Login before adding your answer.

Traffic: 1365 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6