Skip to main content
`Ctrl`+`K`

# cogent3.core.genetic_code.GeneticCode

class GeneticCode(ID: int, name: str, ncbi_code_sequence: dataclasses.InitVar[str], ncbi_start_codon_map: dataclasses.InitVar[str], moltype: MolType[str] = MolType(('T', 'C', 'A', 'G')))

  Holds codon to amino acid mapping, and vice versa.

  Attributes:
    sense_codons
    start_codons
    stop_codons
    synonyms

  Methods

  `get_alphabet`(*[, include_gap, ...]) | returns a codon alphabet
  `is_start`(codon) | Returns True if codon is a start codon, False otherwise.
  `is_stop`(codon) | Returns True if codon is a stop codon, False otherwise.
  `sixframes`(seq) | Returns the six reading frames of the genetic code.
  `to_regex`(seq) | returns a regex pattern with an amino acid expanded to its codon set
  `to_table`() | returns aa to codon mapping as a cogent3 Table
  `translate`(dna[, start, rc, incomplete_ok]) | Translates DNA to protein.

  Notes

  We add additional states to the genetic code to represent gapped codons and missing data.