biocantor.gene.codon

Module Contents

Classes

TranslationTable

NCBI maintains a set of translation tables:

Codon

Enum-like class for dealing with Codons

Attributes

START_CODONS_BY_TRANSLATION_TABLE

class biocantor.gene.codon.TranslationTable

Bases: enum.IntEnum

NCBI maintains a set of translation tables:

https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi?chapter=tgencodes#SG11

For most purposes, the only two tables that are relevant are:

  • Table 1: The Standard Code (vertebrates)

  • Table 11: The Bacterial, Archaeal and Plant Plastid Code

The only difference between these two tables are the choice of initiator codons. While the standard start codon is ATG, in certain eukaryotes it is possible for TTG and CTG to be start codons.

In table 11, it is possible for any of the following codons to be considered initiator codons:

ATG, TTG, CTG, ATT, ATC, ATA, GTG

These alternative initiator codons do see usage regularly, with approximately 3% of E. coli using TTG.

For this enumeration, the above two tables are included, as well as the default ATG-only option. This is because for many uses, ATG is the only one worth considering.

DEFAULT = 0
STANDARD = 1
PROKARYOTE = 11
class biocantor.gene.codon.Codon(codon: Union[str, inscripta.biocantor.sequence.sequence.Sequence])

Enum-like class for dealing with Codons

property value: str

The string value of the codon, to maintain enum-like functionality

property name: str

The string value of the codon, to maintain enum-like functionality

property is_stop_codon: bool

Whether the codon is a stop codon or not

Returns

Whether the codon is a stop codon (True) or not (False)

Return type

bool

property is_strict_codon: bool

Whether the codon is a strict ATGC containing codon or not

Returns

Whether the codon is a strict ATGC codon (True) or not (False)

Return type

bool

property is_canonical_start_codon: bool

Whether the codon is a canonical start codon or not

Returns

Whether the codon is a canonical start codon (True) or not (False)

Return type

bool

__slots__ = ['_val']
_singletons_
__eq__(other) bool

Check equality through singleton comparison

__repr__() str

Representation string of codon, equal to what would come out of an Enum object

__str__() str

The codon as a string

__hash__() int

Hash of the codon string value

translate(strict: bool = True) str

Returns string symbol of translated amino acid

Parameters

strict – Whether to only use strict ATGC codon translations, or allow translation using extended IUPAC sequence. Untranslatable amino acids, whether through strict or simply unknown, will be represented with an “X” Default True (strict ATGC only translation)

synonymous_codons(include_self: bool = False) List[Codon]

Returns list of synonymous codons

Parameters

include_self – Include this codon in returned list

Returns

The synonymous codons for the current codon.

Return type

List[Codon]

Notes

For extended IUPAC codons, this function will still try and translate the codon in an attempt to get synonymous codons. If it can, the function will send out all strict ATGC codons for that amino acid. If it can’t, it will send out either no codons or just self, if include_self is True.

is_start_codon_in_specific_translation_table(translation_table: Optional[TranslationTable] = TranslationTable.DEFAULT) bool

Whether the codon is a start codon according to the given translation_table

Parameters

translation_table – What translation table to check for start codon validation.

Returns

Whether the codon is a start codon (True) or not (False)

Return type

bool

Notes

Prokaryotes have a wider pool of valid start codons than eukaryotes who use the canonical ATG only

biocantor.gene.codon.START_CODONS_BY_TRANSLATION_TABLE