Bio.Data.CodonTable module¶
Codon tables based on those from the NCBI.
These tables are based on parsing the NCBI file ftp://ftp.ncbi.nih.gov/entrez/misc/data/gc.prt using Scripts/update_ncbi_codon_table.py
Last updated at Version 4.4 (May 2019)
- exception Bio.Data.CodonTable.TranslationError¶
Bases:
Exception
Container for translation specific exceptions.
- class Bio.Data.CodonTable.CodonTable(nucleotide_alphabet=None, protein_alphabet=None, forward_table=forward_table, back_table=back_table, start_codons=start_codons, stop_codons=stop_codons)¶
Bases:
object
A codon-table, or genetic code.
- __init__(self, nucleotide_alphabet=None, protein_alphabet=None, forward_table=forward_table, back_table=back_table, start_codons=start_codons, stop_codons=stop_codons)¶
Initialize the class.
- forward_table = {}¶
- back_table = {}¶
- start_codons = []¶
- stop_codons = []¶
- __str__(self)¶
Return a simple text representation of the codon table.
e.g.:
>>> import Bio.Data.CodonTable >>> print(Bio.Data.CodonTable.standard_dna_table) Table 1 Standard, SGC0 | T | C | A | G | --+---------+---------+---------+---------+-- T | TTT F | TCT S | TAT Y | TGT C | T T | TTC F | TCC S | TAC Y | TGC C | C ... G | GTA V | GCA A | GAA E | GGA G | A G | GTG V | GCG A | GAG E | GGG G | G --+---------+---------+---------+---------+-- >>> print(Bio.Data.CodonTable.generic_by_id[1]) Table 1 Standard, SGC0 | U | C | A | G | --+---------+---------+---------+---------+-- U | UUU F | UCU S | UAU Y | UGU C | U U | UUC F | UCC S | UAC Y | UGC C | C ... G | GUA V | GCA A | GAA E | GGA G | A G | GUG V | GCG A | GAG E | GGG G | G --+---------+---------+---------+---------+--
- Bio.Data.CodonTable.make_back_table(table, default_stop_codon)¶
Back a back-table (naive single codon mapping).
ONLY RETURNS A SINGLE CODON, chosen from the possible alternatives based on their sort order.
- class Bio.Data.CodonTable.NCBICodonTable(id, names, table, start_codons, stop_codons)¶
Bases:
Bio.Data.CodonTable.CodonTable
Codon table for generic nucleotide sequences.
- nucleotide_alphabet = None¶
- protein_alphabet = 'ACDEFGHIKLMNPQRSTVWY'¶
- __init__(self, id, names, table, start_codons, stop_codons)¶
Initialize the class.
- __repr__(self)¶
Represent the NCBI codon table class as a string for debugging.
- class Bio.Data.CodonTable.NCBICodonTableDNA(id, names, table, start_codons, stop_codons)¶
Bases:
Bio.Data.CodonTable.NCBICodonTable
Codon table for unambiguous DNA sequences.
- nucleotide_alphabet = 'GATC'¶
- class Bio.Data.CodonTable.NCBICodonTableRNA(id, names, table, start_codons, stop_codons)¶
Bases:
Bio.Data.CodonTable.NCBICodonTable
Codon table for unambiguous RNA sequences.
- nucleotide_alphabet = 'GAUC'¶
- class Bio.Data.CodonTable.AmbiguousCodonTable(codon_table, ambiguous_nucleotide_alphabet, ambiguous_nucleotide_values, ambiguous_protein_alphabet, ambiguous_protein_values)¶
Bases:
Bio.Data.CodonTable.CodonTable
Base codon table for ambiguous sequences.
- __init__(self, codon_table, ambiguous_nucleotide_alphabet, ambiguous_nucleotide_values, ambiguous_protein_alphabet, ambiguous_protein_values)¶
Initialize the class.
- __getattr__(self, name)¶
Forward attribute lookups to the original table.
- Bio.Data.CodonTable.list_possible_proteins(codon, forward_table, ambiguous_nucleotide_values)¶
Return all possible encoded amino acids for ambiguous codon.
- Bio.Data.CodonTable.list_ambiguous_codons(codons, ambiguous_nucleotide_values)¶
Extend a codon list to include all possible ambigous codons.
e.g.:
['TAG', 'TAA'] -> ['TAG', 'TAA', 'TAR'] ['UAG', 'UGA'] -> ['UAG', 'UGA', 'URA']
Note that [‘TAG’, ‘TGA’] -> [‘TAG’, ‘TGA’], this does not add ‘TRR’ (which could also mean ‘TAA’ or ‘TGG’). Thus only two more codons are added in the following:
e.g.:
['TGA', 'TAA', 'TAG'] -> ['TGA', 'TAA', 'TAG', 'TRA', 'TAR']
Returns a new (longer) list of codon strings.
- class Bio.Data.CodonTable.AmbiguousForwardTable(forward_table, ambiguous_nucleotide, ambiguous_protein)¶
Bases:
object
Forward table for translation of ambiguous nucleotide sequences.
- __init__(self, forward_table, ambiguous_nucleotide, ambiguous_protein)¶
Initialize the class.
- __contains__(self, codon)¶
Check if codon works as key for ambiguous forward_table.
Only returns ‘True’ if forward_table[codon] returns a value.
- get(self, codon, failobj=None)¶
Implement get for dictionary-like behaviour.
- __getitem__(self, codon)¶
Implement dictionary-like behaviour for AmbiguousForwardTable.
forward_table[codon] will either return an amino acid letter, or throws a KeyError (if codon does not encode an amino acid) or a TranslationError (if codon does encode for an amino acid, but either is also a stop codon or does encode several amino acids, for which no unique letter is available in the given alphabet.
- Bio.Data.CodonTable.register_ncbi_table(name, alt_name, id, table, start_codons, stop_codons)¶
Turn codon table data into objects (PRIVATE).
The data is stored in the dictionaries.