FLOW ALGEBRA
Nucleotide Ontology — Genetic Entities
Kireth Semantic Library | Version 1.0 | 15 October 2026
Authors: Mark Higgins — Sky (Recursive AI)
Source: https://kirethresearch.org/booksai-core/entity-graph/biological-entities/genetic-entities/nucleotide-ontology.html
Status: Domain-grounded formalisation; source page visible, embedded specification not exposed.
flow "NucleotideOntology" v1.0
# 01 — ONTOLOGY IDENTITY
ontology.id: "kireth.genetic_entities.nucleotide"
ontology.label: "Nucleotide Ontology"
ontology.parent: "Genetic Entity Ontology"
ontology.domain: [molecular_biology, genetics, biochemistry]
ontology.scope: "Nucleotide composition, chemical bonds, polymerisation, biological roles and evidence-aware reasoning"
# 02 — TYPED ENTITIES
entity Nucleotide {
id: str
base: NitrogenousBase
sugar: Pentose
phosphate_count: int # >= 1 for nucleotide in this ontology
stereochemistry: str?
charge_state: str?
provenance: EvidenceRef?
}
entity Nucleoside { base: NitrogenousBase; sugar: Pentose }
entity NitrogenousBase { name: str; family: BaseFamily }
entity Pentose { name: str; hydroxyl_2_prime: bool }
entity PhosphateGroup { position: str; ionisation_state: str? }
entity NucleicAcid { id: str; polymer_type: PolymerType; sequence: str? }
entity PhosphodiesterBond { from_3_prime: str; to_5_prime: str }
entity Polymerase { name: str; substrate_specificity: str? }
entity EvidenceRef { source: str; method: str?; date: str? }
enum BaseFamily = [purine, pyrimidine, modified_base]
enum PolymerType = [DNA, RNA, other]
enum EvidenceLevel = [experimentally_confirmed, curated, computationally_inferred, hypothetical]
# 03 — CLASSIFICATION
class PurineBase: NitrogenousBase
class PyrimidineBase: NitrogenousBase
class Ribonucleotide: Nucleotide
class Deoxyribonucleotide: Nucleotide
class Monophosphate: Nucleotide
class Diphosphate: Nucleotide
class Triphosphate: Nucleotide
class ModifiedNucleotide: Nucleotide
# 04 — CANONICAL BASES
base.adenine: {symbol: A, family: purine}
base.guanine: {symbol: G, family: purine}
base.cytosine: {symbol: C, family: pyrimidine}
base.thymine: {symbol: T, family: pyrimidine}
base.uracil: {symbol: U, family: pyrimidine}
# 05 — RELATIONSHIPS
relation has_base(Nucleotide, NitrogenousBase)
relation has_sugar(Nucleotide, Pentose)
relation has_phosphate(Nucleotide, PhosphateGroup)
relation derived_from(Nucleotide, Nucleoside)
relation monomer_of(Nucleotide, NucleicAcid)
relation linked_by(Nucleotide, Nucleotide, PhosphodiesterBond)
relation substrate_of(Nucleotide, Polymerase)
relation complementary_to(NitrogenousBase, NitrogenousBase, context: str)
relation modified_from(ModifiedNucleotide, Nucleotide)
relation supported_by(str, EvidenceRef)
# 06 — COMPOSITION RULES
rule nucleotide_components(n):
require n.base != null and n.sugar != null
require n.phosphate_count >= 1
infer has_base(n, n.base)
infer has_sugar(n, n.sugar)
rule nucleoside_vs_nucleotide(x):
if x.base != null and x.sugar != null and x.phosphate_count == 0:
classify x as Nucleoside
if x.base != null and x.sugar != null and x.phosphate_count >= 1:
classify x as Nucleotide
rule ribose_classification(n):
if n.sugar.name == "ribose" and n.sugar.hydroxyl_2_prime == true:
classify n as Ribonucleotide
if n.sugar.name == "2-deoxyribose" and n.sugar.hydroxyl_2_prime == false:
classify n as Deoxyribonucleotide
rule phosphate_classification(n):
when n.phosphate_count == 1: classify n as Monophosphate
when n.phosphate_count == 2: classify n as Diphosphate
when n.phosphate_count == 3: classify n as Triphosphate
otherwise: retain n as Nucleotide; flag noncanonical_phosphate_count
# 07 — POLYMER CONTEXT
rule dna_monomer(n, polymer):
require polymer.polymer_type == DNA
require n is Deoxyribonucleotide
require n.base.name in [adenine, guanine, cytosine, thymine] or n is ModifiedNucleotide
infer monomer_of(n, polymer)
rule rna_monomer(n, polymer):
require polymer.polymer_type == RNA
require n is Ribonucleotide
require n.base.name in [adenine, guanine, cytosine, uracil] or n is ModifiedNucleotide
infer monomer_of(n, polymer)
rule backbone_linkage(left, right, bond):
require bond.from_3_prime == left.id
require bond.to_5_prime == right.id
infer linked_by(left, right, bond)
infer polymer_backbone_direction(left, right, "5prime_to_3prime")
# 08 — COMPLEMENTARITY WITH CONTEXT
rule watson_crick_dna(a, b):
require context == DNA
infer complementary_to(A, T, DNA)
infer complementary_to(T, A, DNA)
infer complementary_to(G, C, DNA)
infer complementary_to(C, G, DNA)
rule watson_crick_rna(a, b):
require context == RNA
infer complementary_to(A, U, RNA)
infer complementary_to(U, A, RNA)
infer complementary_to(G, C, RNA)
infer complementary_to(C, G, RNA)
constraint complementarity_is_context_sensitive:
do_not_assume_all_pairings_are_watson_crick
allow_wobble_and_modified_base_pairing_with_evidence
# 09 — BIOCHEMICAL FUNCTIONS
function nucleic_acid_precursor(n):
inputs: nucleoside_triphosphate
outputs: polymer_extended_by_one_residue, pyrophosphate
conditions: [compatible_polymerase, template_or_permitted_template_independence, required_cofactors]
note: "The incorporated polymer residue is a monophosphate unit."
function energy_transfer(n):
examples: [ATP, GTP]
mechanism: "Coupled phosphoryl-group transfer or hydrolysis"
note: "Energy release depends on the coupled reaction and conditions."
function signalling(n):
examples: [cAMP, cGMP]
mechanism: "Second-messenger regulation"
function cofactor_component(n):
examples: [NAD_plus, FAD, Coenzyme_A]
mechanism: "Nucleotide-containing cofactor structures"
# 10 — SEQUENCE VALIDATION
rule validate_sequence(sequence, polymer_type):
if polymer_type == DNA:
require every canonical character in sequence belongs_to [A, C, G, T]
if polymer_type == RNA:
require every canonical character in sequence belongs_to [A, C, G, U]
exceptions: [IUPAC_ambiguity_codes, chemically_modified_bases]
output: validation_status, exception_annotations
# 11 — CONSTRAINTS AND EXCEPTIONS
constraint nucleotide_is_not_synonymous_with_base
constraint nucleoside_lacks_phosphate_by_definition
constraint nucleic_acid_backbone_contains_phosphodiester_linkages_in_standard_DNA_RNA
constraint base_modifications_require_explicit_annotation
constraint ATP_GTP_are_nucleotides_even_when_not_polymer_monomers
constraint chemical_structure_must_not_be_inferred_from_name_without_disambiguation
# 12 — RECURSIVE SEMANTIC REASONING
flow RECURSIVE_REASON(entity, depth=0, visited=[]):
require depth <= 8
if entity.id in visited: return cycle_detected
visited := visited + [entity.id]
identify entity_type(entity)
verify component_constraints(entity)
traverse [has_base, has_sugar, has_phosphate, monomer_of, substrate_of]
reconcile contradictory_claims_by_context_and_evidence()
return reasoning_trace, classifications, unresolved_questions
# 13 — CONFIDENCE
flow CONFIDENCE(assertion, evidence):
factors:
direct_experimental_support: 0.40
independent_replication: 0.25
source_quality: 0.20
chemical_consistency: 0.15
score := weighted_evidence_score(factors, evidence)
require 0.0 <= score <= 1.0
return {assertion: assertion, confidence: score, evidence: evidence}
note: "Weights are illustrative ontology parameters, not calibrated probabilities."
# 14 — SEMANTIC_EQUIVALENCE
flow SEMANTIC_EQUIVALENCE(a, b, context):
canonicalise_names_and_identifiers(a, b)
compare [base_identity, sugar_identity, phosphate_count, modification, stereochemistry]
if all_identity_features_match: return equivalent
if structural_relation_exists_but_features_differ: return related_not_equivalent
return unresolved_or_distinct
alias "adenosine triphosphate" -> ATP
alias "guanosine triphosphate" -> GTP
alias "deoxyadenosine triphosphate" -> dATP
constraint ATP != adenosine
constraint ATP != AMP
constraint UTP != TTP
# 15 — PROVENANCE
flow PROVENANCE(assertion):
record [source_uri, evidence_method, publication_date, retrieval_date, curator]
record uncertainty_and_conflicting_sources
require traceable_support_for_noncanonical_claims
# 16 — FLOW_HASH
flow FLOW_HASH(record):
canonical := normalise([ontology.id, record.entity_type, record.identity,
record.relationships, record.version])
return SHA256(UTF8(canonical))
note: "Stable identity hash; provenance changes tracked separately."
# 17 — UPDATE_MODEL
flow UPDATE_MODEL(incoming_record, existing_record):
validate_schema(incoming_record)
compare identity, evidence, confidence, provenance
if identity_changed: create_new_entity_version()
else if evidence_changed: append_provenance_revision()
else: retain_existing_version()
flag_conflicts_for_review()
return updated_graph, audit_trail
# 18 — AI_CONSUMPTION
flow AI_CONSUMPTION(query):
parse_intent(query)
resolve_nucleotide_names_and_aliases()
retrieve_typed_entities_and_relations()
apply_constraints_and_contextual_pairing_rules()
execute RECURSIVE_REASON on selected_entities
evaluate CONFIDENCE for material_claims
include_provenance_and_uncertainty()
return {answer, entity_graph, reasoning_trace, confidence, citations, limitations}
# 19 — EXAMPLE ASSERTIONS
assert ATP instance_of Nucleotide
assert ATP instance_of Triphosphate
assert ATP has_base adenine
assert ATP has_sugar ribose
assert dATP instance_of Deoxyribonucleotide
assert cAMP instance_of Nucleotide
assert DNA composed_of Deoxyribonucleotide_residues
assert RNA composed_of Ribonucleotide_residues
# 20 — QUALITY CHECKS
check canonical_bases_have_correct_families
check DNA_RNA_context_is_explicit_for_pairing
check nucleotide_vs_nucleoside_distinction
check phosphate_counts_are_nonnegative
check polymerisation_products_and_substrates_distinguished
check every_inferred_claim_has_traceable_rule
check modifications_are_not_silently_collapsed
# END FLOW ALGEBRA
Download Code
Copy to Clipboard