[Biopython-dev] translate

Matthew Hobbs mhobbs_of_lawson at bigpond.com
Tue Oct 9 23:07:43 UTC 2007


Thanks Peter for your reply.

Peter wrote:
> mhobbs_of_lawson wrote:
>> Please can someone tell me what is wrong here.  I simply want to be 
>> able to translate ambiguous DNA which includes an 'NNN' triplet.
> 
> A very reasonable request.  I assume you expect just an X for an NNN codon?

yep

> In the short term, manually adding additional mappings to the forward 
> table (a python dictionary) would probably "fix" your specific issue.

OK - so this works:

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]
trans.table.forward_table.forward_table['NNN'] = 'X'
print trans.translate(dna)

> While we are on this topic, we use "*" for stop codons and "X" for an 
> ambiguous amino acid - but is anyone aware of a character convention for 
> something that might be either a stop codon or an amino acid? (other 
> than just using "X" for this too)?

No I don't know

Thanks,


Matthew




More information about the Biopython-dev mailing list