[Biopython] Degenerated Codons

Matthias Bernt MatatTHC at gmx.de
Thu Feb 23 21:09:18 UTC 2012


hi peter,

Thank you for the suggestions. I will try to create the functions as
suggested.
Should I post them here?


> Where table could be ambiguous or unambiguous,
> DNA or RNA? Something like this works nicely for
> unambiguous tables:
>
> from Bio.Data.CodonTable import unambiguous_dna_by_id
> for table in [unambiguous_dna_by_id[1], unambiguous_dna_by_id[2]]:
>    print table.id
>    for codon in  ["AAA", "ATT"]:
>        amino = table.forward_table[codon]
>        alt_codons = [k for (k,v) in table.forward_table.iteritems()
> if v==amino]
>        print "%s -> %s, %i codons for this amino acid" % (codon,
> amino, len(alt_codons))
>
> Giving:
>
> 1
> AAA -> K, 2 codons for this amino acid
> ATT -> I, 3 codons for this amino acid
> 2
> AAA -> K, 2 codons for this amino acid
> ATT -> I, 2 codons for this amino acid
>
>
> > But maybe its possible to modify the backward_table such
> > that it stores all codons (as list) for a amino acid. For the other
> > functions building on it (back translation...) it would be possible
> > to take the first element of the list.
>
> We can't change that for backwards compatibility, but we
> could add a alt_backward_table or something instead
>

I think we keep it as it is at the moment. Performance is not so important
for me .. so far.
Optimisation can still be done later.

Matthias



More information about the Biopython mailing list