Codon
Table of Contents
Classes
- AlternateGeneticCodeTranslator
- Every alternate table is stored as an OVERLAY of differences from the standard genetic code
(SequenceInterface::translateCodon()'s own, already-wired code, reused rather than duplicated -
the same reuse CodonAdaptationIndexCalculator, OrfFinder and CodonOptimizer already make), exactly
the way NCBI itself documents each alternate table : as a short list of codons that differ from
the standard, not a second full 64-entry table. A codon not present in a table's overlay falls
back to the standard translation.
- CodonAdaptationIndexCalculator
- Reuses SequenceInterface::translateCodon() (the library's own, already-DI-wired genetic code) to
decide which codons are synonymous with each other, rather than hard-coding a second copy of the
genetic code here. Following Sharp & Li's original 1987 definition : a stop codon never counts
towards the score, and neither does a codon for an amino acid that has no synonym under the standard
genetic code (Met, Trp) - not because those two codons are special-cased by name, but because ANY
amino acid with exactly one codon trivially has relative adaptiveness 1 for it, and folding those
guaranteed-1 terms into the geometric mean would systematically inflate the score rather than
reflect a real codon CHOICE. The remaining score is the geometric mean, across every other codon of
the coding sequence, of that codon's count in the reference table divided by the highest count among
its synonyms in that same table.
- CodonOptimizer
- Reuses SequenceInterface::translateCodon() to find every codon synonymous with a residue, the same
reuse CodonAdaptationIndexCalculator already makes, rather than hard-coding a second copy of the
genetic code. When every synonym of a residue is tied (most commonly because the reference table
has no observation for any of them at all), the tie is broken deterministically by codon
enumeration order (A<C<G<T, most to least significant base) - an arbitrary but reproducible choice,
the same kind of tie-break already used elsewhere in this project (e.g. NeighborJoiningTreeBuilder).
- CodonUsageTableBuilder
- Pure counting, no genetic code involved : which codons are synonymous with each other is
CodonAdaptationIndexCalculator's concern when the table is later used, not this builder's. Only
complete trailing codons are counted, the same convention CodonAdaptationIndexCalculator already
uses when scoring a coding sequence.
Traits
- TranslatesUnderGeneticCode
- Shared by the services that read codons (ORF search, CAI, codon optimization) : the standard code
(table 1) goes through SequenceInterface::translateCodon(), as they always did, and any other
NCBI table through AlternateGeneticCodeTranslator. The class using it holds the
SequenceInterface in $this->sequenceManager.