CodonOptimizer
in package
implements
CodonOptimizerInterface
uses
TranslatesUnderGeneticCode
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).
Class CodonOptimizer
Tags
Table of Contents
Interfaces
- CodonOptimizerInterface
- Interface CodonOptimizerInterface - the inverse of CodonAdaptationIndexCalculator : rather than scoring an existing coding sequence against a reference codon usage table, this picks, for each residue of a target protein, the synonymous codon with the highest count in that table - the coding sequence a perfect (CAI = 1) translation of the protein would have.
Constants
- BASES : mixed = ["A", "C", "G", "T"]
Properties
Methods
- __construct() : mixed
- CodonOptimizer constructor.
- optimize() : DnaSequence
- assertSupportedGeneticCode() : void
- bestCodonFor() : string
- everyCodon() : array<string|int, string>
- translateUnder() : string
Constants
BASES
private
mixed
BASES
= ["A", "C", "G", "T"]
Properties
$geneticCodeTranslator
private
AlternateGeneticCodeTranslator|null
$geneticCodeTranslator
= null
$sequenceManager
private
SequenceInterface
$sequenceManager
Methods
__construct()
CodonOptimizer constructor.
public
__construct(SequenceInterface $oSequenceManager) : mixed
Parameters
- $oSequenceManager : SequenceInterface
optimize()
public
optimize(AminoAcidSequence $oProtein, CodonUsageTable $oReferenceTable[, int $iGeneticCode = 1 ]) : DnaSequence
Parameters
- $oProtein : AminoAcidSequence
- $oReferenceTable : CodonUsageTable
- $iGeneticCode : int = 1
-
The NCBI table the protein is back-translated under
Tags
Return values
DnaSequenceassertSupportedGeneticCode()
private
assertSupportedGeneticCode(int $iGeneticCode) : void
Parameters
- $iGeneticCode : int
-
An NCBI table id (see GeneticCodeTable::SUPPORTED_TABLES)
Tags
bestCodonFor()
private
bestCodonFor(string $sResidue, CodonUsageTable $oReferenceTable, int $iGeneticCode) : string
Parameters
- $sResidue : string
-
A single-letter amino acid code, or "*"
- $oReferenceTable : CodonUsageTable
- $iGeneticCode : int
Return values
stringeveryCodon()
private
everyCodon() : array<string|int, string>
Return values
array<string|int, string> —All 64 possible DNA codons
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