package phylogenetics

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Universal genetic code module.

This module provides an implementation of the universal genetic code, which is the default genetic code used in most organisms.

The universal genetic code consists of 64 codons, out of which 61 encode specific amino acids, and the remaining 3 codons serve as stop signals, indicating the termination of protein synthesis. The specific mapping between codons and amino acids is the same across different species, allowing genetic information to be accurately transferred and translated into proteins.

This module provides an implementation of the universal genetic code, including functions to check for stop codons, retrieve the amino acid encoded by a codon, and determine if two codons are synonymous.

type codon = t
val stop_codons : codon list
val is_stop_codon : codon -> bool

is_stop_codon c is true if c is a stop codon.

Example :

let codon_option = Codon.of_string "TAA" in
match codon_option with
| None -> failwith "Invalid codon string"
| Some codon ->
  assert (Codon.is_stop_codon codon = true)

A stop codon is a specific codon in the genetic code that signals the termination of protein synthesis. When a stop codon is encountered during translation, the ribosome releases the newly synthesized polypeptide chain and the translation process comes to a halt. In the universal genetic code, there are three stop codons: "TAA", "TAG", and "TGA". These codons do not encode any amino acid and serve as termination signals for the protein synthesis machinery.

val aa_of_codon : codon -> Amino_acid.t option

aa_of_codon c is -- it exists -- the amino acid encoded by c

let codon = Codon.of_string "ATG" in
let amino_acid_option = Codon.aa_of_codon codon in
match amino_acid_option with
| Some amino_acid -> assert (amino_acid = Amino_acid.Met)
| None -> failwith "No matching amino acid found"
val synonym : codon -> codon -> bool

Tests if two codons are synonymous.

Example :

let codon1_option = Codon.of_string "ATG" in
let codon2_option = Codon.of_string "ATA" in
match codon1_option, codon2_option with
| None, _ | _, None -> failwith "Invalid codon string"
| Some codon1, Some codon2 ->
  assert (Codon.synonym codon1 codon2 = false)

In this example, the codons are compared to check if they are synonymous. Two codons are synonymous if they encode the same amino acid.

module NS : sig ... end
OCaml

Innovation. Community. Security.