Skip to main content

Codon Ontology

Genetic Entities
Authors: MArk Anthony Higgins - Sky Recursive Ai
© Mark Anthony Higgins 11 October 2025
Revised Date: 15 October 2026
Audio Overview
FLOW ALGEBRA
TITLE: Codon Ontology
VERSION: 1.0
DOMAIN: Biological Entities / Genetic Entities
SOURCE: https://kirethresearch.org/booksai-core/entity-graph/biological-entities/genetic-entities/codon-ontology.html
AUTHORS: Mark Higgins — Sky (Recursive AI)
DATE: 2026-10-15
STATUS: Domain-grounded draft; source page content not independently verified

# 1. PURPOSE
flow "CodonOntology" v1.0
purpose: Represent codons as ordered nucleotide triplets interpreted in a specified translation context, linking RNA sequences, reading frames, genetic codes, amino acids and termination signals.

# 2. TYPES
entity Codon: GeneticSequenceUnit
entity RNACodon: Codon
entity DNATriplet: GeneticSequenceUnit
entity Nucleotide: MolecularEntity
entity RNASequence: NucleicAcidSequence
entity CodingSequence: RNASequence
entity ReadingFrame: SequenceInterpretation
entity GeneticCode: TranslationMapping
entity TranslationTable: GeneticCode
entity AminoAcid: MolecularEntity
entity StartSignal: TranslationSignal
entity StopSignal: TranslationSignal
entity Ribosome: MolecularComplex
entity TransferRNA: RNAEntity
entity Anticodon: RNASequenceUnit
entity Organism: BiologicalEntity
entity CellularCompartment: BiologicalLocation
entity SequenceVariant: GeneticVariation
entity TranslationEvent: BiologicalProcess
entity EvidenceRecord: ProvenanceEntity

# 3. CORE ATTRIBUTES
Codon.sequence: str             # exactly 3 RNA symbols from A,C,G,U
Codon.position: int?            # zero-based index in an RNA reference sequence
Codon.frame_id: str?
Codon.code_id: str               # required translation table identifier
Codon.role: enum[sense,stop,start_and_sense,context_dependent]
Codon.translation: str?         # amino-acid symbol or STOP, conditional on code/context
Codon.context_id: str?
Codon.provenance_id: str?
Codon.confidence: float          # [0,1]

# 4. RELATIONSHIPS
relationship HAS_TRIPLET(Codon,Nucleotide[3])
relationship LOCATED_IN(Codon,RNASequence)
relationship INTERPRETED_IN(Codon,ReadingFrame)
relationship DECODED_USING(Codon,GeneticCode)
relationship ENCODES(Codon,AminoAcid)
relationship SIGNALS(Codon,TranslationSignal)
relationship RECOGNISED_BY(Codon,TransferRNA)
relationship COMPLEMENTS(Anticodon,Codon)
relationship PARTICIPATES_IN(Codon,TranslationEvent)
relationship DERIVED_FROM(RNACodon,DNATriplet)
relationship SUPPORTED_BY(Codon,EvidenceRecord)
relationship VARIANT_OF(Codon,Codon)

# 5. INVARIANTS
invariant valid_rna_codon(c): length(c.sequence) == 3 and all(base in "ACGU" for base in c.sequence)
invariant code_required(c): c.code_id != null
invariant confidence_range(c): 0.0 <= c.confidence <= 1.0
invariant frame_consistency(c, cds): c.position != null implies (c.position - cds.frame_start) % 3 == 0
invariant context_specific_translation(c): translation must be resolved using code_id and applicable context

# 6. CANONICAL STANDARD GENETIC CODE (NCBI TRANSLATION TABLE 1)
standard_code:
  F: [UUU,UUC]
  L: [UUA,UUG,CUU,CUC,CUA,CUG]
  I: [AUU,AUC,AUA]
  M: [AUG]
  V: [GUU,GUC,GUA,GUG]
  S: [UCU,UCC,UCA,UCG,AGU,AGC]
  P: [CCU,CCC,CCA,CCG]
  T: [ACU,ACC,ACA,ACG]
  A: [GCU,GCC,GCA,GCG]
  Y: [UAU,UAC]
  H: [CAU,CAC]
  Q: [CAA,CAG]
  N: [AAU,AAC]
  K: [AAA,AAG]
  D: [GAU,GAC]
  E: [GAA,GAG]
  C: [UGU,UGC]
  W: [UGG]
  R: [CGU,CGC,CGA,CGG,AGA,AGG]
  G: [GGU,GGC,GGA,GGG]
  STOP: [UAA,UAG,UGA]

# 7. TRANSLATION LOGIC
rule translate_codon(c, code, context):
  require valid_rna_codon(c)
  require code.id == c.code_id
  return code.lookup(c.sequence, context)

rule parse_codons(sequence, frame_start):
  require frame_start in [0,1,2]
  for i in range(frame_start, length(sequence)-2, 3):
    emit Codon(sequence=sequence[i:i+3], position=i)
  # trailing incomplete bases do not constitute complete codons

rule identify_start(c, code, context):
  return code.is_initiation_codon(c.sequence, context)

rule identify_stop(c, code, context):
  return code.lookup(c.sequence, context) == STOP

rule translate_cds(cds, code, context):
  require length(cds) % 3 == 0
  codons = parse_codons(cds, 0)
  require code.is_initiation_codon(codons[0].sequence, context)
  require identify_stop(codons[-1], code, context)
  protein = translate_with_initiation_rules(codons[0:-1], code, context)
  return protein

# 8. VARIATION AND SEMANTIC CONSEQUENCES
rule classify_substitution(reference, alternate, code, context):
  require valid_rna_codon(reference) and valid_rna_codon(alternate)
  before = translate_codon(reference, code, context)
  after = translate_codon(alternate, code, context)
  if before == after: return "synonymous"
  if before != STOP and after == STOP: return "stop_gained"
  if before == STOP and after != STOP: return "stop_lost"
  if before != STOP and after != STOP: return "missense"
  return "context_dependent_or_unclassified"

# 9. CONTEXT AND EXCEPTIONS
context.standard_nuclear_code: table_1
context.vertebrate_mitochondrial_code: table_2
context.organism_specific_codes: supported
context.initiation_rules: translation_start_may_differ_from_internal_codon_meaning
context.reassignment: genetic_code_variant_may_change_codon_meaning
context.recode_events: selenocysteine_or_pyrrolysine_insertion_requires_specialised_context
context.readthrough: stop_suppression_requires_evidence
context.RNA_editing: sequence_may_change_before_translation

# 10. SEMANTIC EQUIVALENCE
SEMANTIC_EQUIVALENCE:
  codon: ["RNA triplet in translation frame", "translation codon"]
  synonymous_codon: ["codon encoding same amino acid under same genetic code and context"]
  start_codon: ["initiation codon in a validated translation context"]
  stop_codon: ["termination codon in a validated translation context"]
  constraints:
    - DNA triplet is not identical to RNA codon; transcribe T to U on the coding strand
    - synonymous does not imply identical expression, translation efficiency or phenotype
    - identical triplet does not guarantee identical interpretation across genetic codes

# 11. CONFIDENCE
CONFIDENCE:
  range: [0.0,1.0]
  factors: [sequence_quality, frame_validation, genetic_code_identification, experimental_support, annotation_provenance]
  policy: confidence_scores_are_evidence_calibrated_not_assumed
  low_confidence_action: preserve_alternatives_and_request_validation

# 12. RECURSIVE REASONING
recursive_flow codon_interpretation(input, depth=0, max_depth=8):
  require depth <= max_depth
  sequence = validate_and_normalise(input.sequence)
  frame = resolve_frame(input.frame, input.evidence)
  code = resolve_genetic_code(input.organism, input.compartment, input.code_id)
  codons = parse_codons(sequence, frame.start)
  for c in codons:
    meaning = translate_codon(c, code, input.context)
    attach(c, meaning, code, input.evidence)
    if ambiguity(c): emit alternative_interpretations(c)
  return codons

# 13. FLOW HASH
FLOW_HASH:
  algorithm: SHA-256
  canonicalisation: UTF-8; stable-key-order; normalised RNA symbols; explicit code_id and context_id
  inputs: [ontology_version, codon_sequence, position, frame_id, code_id, context_id, evidence_version]
  output: hex_sha256(canonical_serialisation(inputs))
  note: content identity only; not a measure of biological truth

# 14. UPDATE MODEL
UPDATE_MODEL:
  versioning: semantic_versioning
  triggers: [new_genetic_code_evidence, corrected_annotation, updated_translation_table, revised_sequence, new_recode_evidence]
  actions:
    - validate_new_evidence
    - preserve_previous_version_and_provenance
    - recompute_affected_codon_interpretations
    - recompute_flow_hash
    - flag_downstream_translation_changes
    - publish_change_log
  rollback: restore_last_validated_version

# 15. AI CONSUMPTION
AI_CONSUMPTION:
  format: typed_flow_algebra_text
  entity_resolution: codon_sequence_plus_frame_plus_code_plus_context
  reasoning: deterministic_rules_with_evidence_scoped_exceptions
  retrieval_keys: [sequence, code_id, organism, compartment, position, transcript_id]
  outputs: [codon_annotation, amino_acid_or_stop, start_status, variant_consequence, confidence, provenance]
  safeguards: [no_unqualified_universal_code_assumption, no_invented_experimental_evidence, expose_ambiguity]

# 16. VALIDATION TESTS
assert translate_codon("AUG", table_1, standard_context) == "M"
assert translate_codon("UUU", table_1, standard_context) == "F"
assert translate_codon("UAA", table_1, standard_context) == STOP
assert translate_codon("UGA", table_2, mitochondrial_context) == "W"
assert classify_substitution("UUU", "UUC", table_1, standard_context) == "synonymous"
assert classify_substitution("UAU", "UAA", table_1, standard_context) == "stop_gained"
assert valid_rna_codon("AUG") == true
assert valid_rna_codon("ATG") == false

# 17. PROVENANCE AND SCOPE
source_page: https://kirethresearch.org/booksai-core/entity-graph/biological-entities/genetic-entities/codon-ontology.html
scientific_scope: codon semantics, genetic-code mapping, translation, context and variant effects
limitations: conceptual Flow Algebra specification; pseudocode rules require implementation and validation before execution
attribution: Mark Higgins — Sky (Recursive AI)
licence: refer to the Kireth Research Open Research Licence
END FLOW ALGEBRA
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ