[Biopython] Need help in making a back table for the CodonTable object
Peter
biopython at maubp.freeserve.co.uk
Mon Sep 14 05:05:45 EDT 2009
On Mon, Sep 14, 2009 at 5:22 AM, Alexander Castro
<alexanderdcastro at yahoo.com> wrote:
> Hello all, I apologize if this sound elementary but how can create a
> back table that will return more than one codon? For example, for
> table="Bacterial", codons CTT, CTG and CTA code for L (Lysine).
> How can I back out, given "L" get CTT, CTG and CTG. The
> back_table method only returns one value:
> output = bacterial_table.back_table["L"].
> Any help would be greatly appreciated.
> Regards,
> Alexander Castro
I'm curious about what you are trying to do - we talked about the
general problem of back-translation, and there was no consensus
and therefore we didn't add a back translation method directly to
the Seq object. As you are do doubt well aware, back translation
is a one to many mapping, and even with ambiguous codons it
is impossible to capture this fully with a simple string style
representation of the nucleotide sequence.
Anyway, the specific task of back translation of one amino acid
to a list of codons is well defined. How about:
from Bio.Data.CodonTable import unambiguous_dna_by_name
table = unambiguous_dna_by_name["Bacterial"].forward_table
back_table = {}
for codon, amino in table.iteritems() :
try :
back_table[amino].append(codon)
except KeyError :
back_table[amino] = [codon]
print back_table["L"]
Peter
More information about the Biopython
mailing list