Sometimes it’s nice to be able to have a codon table handy. Rather than typing out one by hand, theTranslate module contains the codon table of your choice in dictionary form:
from Bio import Translate translater=Translate.unambiguous_dna_by_id[11] bacterial_table=translater.table.forward_table
Note 1: See the NCBI Translation Tables for the correctid number to use for your sequence.
bacterial_table['TAT'] >>>'Y'
And here’s how to easily reverse it, where the keys are amino acids and the values are lists of codons:
back_table = {}
for key,value in bacterial_table.iteritems():
try:
back_table[value].append(key)
except KeyError:
back_table[value]=[key]
0 Responses to “A quick codon table”