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
0
Entering edit mode

which version of biopython are you using?

2
Entering edit mode
10.5 years ago

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!!

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

0
Entering edit mode

0
Entering edit mode

thank you for marking it!