[Biopython] Need help in making a back table for the CodonTable object
Alexander Castro
alexanderdcastro at yahoo.com
Mon Sep 14 14:12:41 UTC 2009
Hello Peter, my goal was replace one codon in a sequence with another to perform a "silent" mutation. I did not want to do this mutation manually and offload the work to BioPython.
Thanks for the code suggestion! I'll try it out as soon as I'm able.
Regards,
Alexander Castro
--- On Mon, 9/14/09, Peter <biopython at maubp.freeserve.co.uk> wrote:
From: Peter <biopython at maubp.freeserve.co.uk>
Subject: Re: [Biopython] Need help in making a back table for the CodonTable object
To: "Alexander Castro" <alexanderdcastro at yahoo.com>
Cc: biopython at lists.open-bio.org
Date: Monday, September 14, 2009, 2:05 AM
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