CodonAdaptationIndexCalculator
in package
implements
CodonAdaptationIndexInterface
uses
TranslatesUnderGeneticCode
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.
Class CodonAdaptationIndexCalculator
Tags
Table of Contents
Interfaces
- CodonAdaptationIndexInterface
- Interface CodonAdaptationIndexInterface - scores how well a coding sequence's own codon choices match a reference organism's preferred codons (Sharp & Li, 1987), useful for predicting or optimizing how well a cloned insert is likely to express in a given host.
Constants
- BASES : mixed = ["A", "C", "G", "T"]
Properties
- $geneticCodeTranslator : AlternateGeneticCodeTranslator|null
- $missingCodonWeight : float|null
- $sequenceManager : SequenceInterface
Methods
- __construct() : mixed
- CodonAdaptationIndexCalculator constructor.
- calculate() : CaiResult
- assertSupportedGeneticCode() : void
- countSynonyms() : int
- How many of the 64 possible codons translate to $sAminoAcid, under the standard genetic code - not how many of them happen to appear in a reference table, which could be incomplete.
- everyCodon() : array<string|int, string>
- maxReferenceCount() : int
- translateUnder() : string
Constants
BASES
private
mixed
BASES
= ["A", "C", "G", "T"]
Properties
$geneticCodeTranslator
private
AlternateGeneticCodeTranslator|null
$geneticCodeTranslator
= null
$missingCodonWeight
private
float|null
$missingCodonWeight
$sequenceManager
private
SequenceInterface
$sequenceManager
Methods
__construct()
CodonAdaptationIndexCalculator constructor.
public
__construct(SequenceInterface $oSequenceManager[, float|null $fMissingCodonWeight = null ]) : mixed
Parameters
- $oSequenceManager : SequenceInterface
- $fMissingCodonWeight : float|null = null
-
The relative adaptiveness given to a codon the reference table never uses, the usual remedy for a table built from few genes (0.5 is a common choice, CodonW's). Null, the default, keeps the strict behaviour : such a codon is an error.
Tags
calculate()
public
calculate(DnaSequence $oCodingSequence, CodonUsageTable $oReferenceTable[, int $iGeneticCode = 1 ]) : CaiResult
Parameters
- $oCodingSequence : DnaSequence
- $oReferenceTable : CodonUsageTable
- $iGeneticCode : int = 1
-
The NCBI table that says which codons are synonyms
Tags
Return values
CaiResultassertSupportedGeneticCode()
private
assertSupportedGeneticCode(int $iGeneticCode) : void
Parameters
- $iGeneticCode : int
-
An NCBI table id (see GeneticCodeTable::SUPPORTED_TABLES)
Tags
countSynonyms()
How many of the 64 possible codons translate to $sAminoAcid, under the standard genetic code - not how many of them happen to appear in a reference table, which could be incomplete.
private
countSynonyms(string $sAminoAcid, int $iGeneticCode) : int
Parameters
- $sAminoAcid : string
-
A single-letter amino acid code, as returned by translateCodon()
- $iGeneticCode : int
Return values
inteveryCodon()
private
everyCodon() : array<string|int, string>
Return values
array<string|int, string> —All 64 possible DNA codons
maxReferenceCount()
private
maxReferenceCount(string $sAminoAcid, CodonUsageTable $oReferenceTable, int $iGeneticCode) : int
Parameters
- $sAminoAcid : string
- $oReferenceTable : CodonUsageTable
- $iGeneticCode : int
Return values
int —The highest reference count among every codon translating to $sAminoAcid
translateUnder()
private
translateUnder(string $sCodon, int $iGeneticCode) : string
Parameters
- $sCodon : string
- $iGeneticCode : int
Return values
string —The amino acid, "*" for a stop, "X" for an ambiguous codon