[Biopython-dev] translate

mhobbs_of_lawson mhobbs_of_lawson at bigpond.com
Tue Oct 9 02:18:39 UTC 2007


Hi,

Please can someone tell me what is wrong here.  I simply want to be able to translate ambiguous DNA which includes an 'NNN' triplet.

Thanks,

Matthew



>>> from Bio import Seq
>>> from Bio.Alphabet import IUPAC
>>> from Bio import Translate
>>> s = "NNNTCAAAAAGGTGCATCTAGATG"
>>> dna = Seq.Seq(s, IUPAC.ambiguous_dna)
>>> trans = Translate.ambiguous_dna_by_id[1]
>>> print trans.translate(dna)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/cygdrive/c/Python24/Lib/site-packages/Bio/Translate.py", line 20, in translate
    append(get(s[i:i+3], stop_symbol))
  File "/cygdrive/c/Python24/Lib/site-packages/Bio/Data/CodonTable.py", line 544, in get
    return self.__getitem__(codon)
  File "/cygdrive/c/Python24/Lib/site-packages/Bio/Data/CodonTable.py", line 577, in __getitem__
    raise TranslationError, codon  # does not code
Bio.Data.CodonTable.TranslationError: NNN




More information about the Biopython-dev mailing list