โ† Wiki Index / Genetics & Evolution / Codon Substitution Models
๐Ÿงฌ Genetics & Evolution

Codon Substitution Models

Codon substitution models treat sense triplets as the fundamental states of a 61-by-61 continuous-time Markov chain, directly estimating the nonsynonymous-to-synonymous substitution rate ratio across protein-coding phylogenies.

Codon substitution models are continuous-time Markov chain models of molecular evolution that treat the sense triplets of the genetic codeโ€”rather than individual nucleotides or translated amino acidsโ€”as the fundamental discrete states evolving along the branches of a phylogenetic tree. Introduced independently in 1994 by Nick Goldman and Ziheng Yang and by Spencer V. Muse and Brandon S. Gaut, codon models bridge the gap between mutational processes acting at the DNA level (such as transition/transversion bias and uneven nucleotide composition) and natural selection acting on protein structure and function at the amino acid level.

In the universal genetic code, 3 of the 64 possible nucleotide triplets (TAA, TAG, and TGA) are nonsense stop codons whose premature appearance within an open reading frame typically truncates the polypeptide and is eliminated by purifying selection. The remaining 61 sense codons define the state space of a 61 ร— 61 instantaneous substitution rate matrix Q = {qij} (or 60 ร— 60 in vertebrate mitochondrial DNA, where AGA and AGG are also stop codons). By parameterizing the instantaneous rates of synonymous (silent) and nonsynonymous (amino-acid-altering) substitutions within a unified maximum-likelihood phylogenetics framework, codon substitution models provide the standard statistical machinery for estimating the selective pressure parameter ฯ‰ = dN/dS across sites and lineages.

The Instantaneous Rate Matrix Q: Goldman-Yang vs. Muse-Gaut

Structure of the 61 ร— 61 Goldman-Yang (GY94) Matrix

In the Goldman-Yang (GY94) formulation (implemented in the PAML codeml package), the instantaneous rate qij of substitution from sense codon i = (i1, i2, i3) to sense codon j = (j1, j2, j3) (for i โ‰  j) assumes that mutations occur one nucleotide at a time. Any pair of codons differing at two or three nucleotide positions has an instantaneous transition rate of zero (although multiple substitutions can occur over a finite branch length t via the matrix exponential distribution P(t) = exp(Qt)). For codons differing at a single nucleotide position, qij is factored into mutational and selective terms:

  • qij = 0, if codons i and j differ at more than one of the three codon positions;
  • qij = ฮผ ฯ€j, if i โ†’ j is a synonymous transversion;
  • qij = ฮผ ฮบ ฯ€j, if i โ†’ j is a synonymous transition (A โ†” G or C โ†” T);
  • qij = ฮผ ฯ‰ ฯ€j, if i โ†’ j is a nonsynonymous transversion;
  • qij = ฮผ ฮบ ฯ‰ ฯ€j, if i โ†’ j is a nonsynonymous transition.

Here, ฮบ is the transition/transversion rate ratio, ฯ€j is the equilibrium frequency of target codon j (satisfying โˆ‘j=161 ฯ€j = 1), and ฯ‰ = dN/dS is the acceptance ratio of nonsynonymous to synonymous mutations:

  1. ฯ‰ < 1: Indicates purifying selection (negative selection), where deleterious amino acid replacements are eliminated and only a fraction ฯ‰ of nonsynonymous mutations reach fixation.
  2. ฯ‰ = 1: Indicates neutral evolution (as in pseudogenes), where nonsynonymous mutations fix at the same rate as synonymous mutations.
  3. ฯ‰ > 1: Indicates diversifying positive selection (adaptive evolution), where advantageous amino acid replacements fix at a higher rate than neutral synonymous drift.

The diagonal elements of Q are set to qii = โˆ’โˆ‘jโ‰ i qij so that every row sums to zero, and the scaling factor ฮผ is chosen so that the mean substitution rate across all sense codons equals one expected nucleotide substitution per codon per unit branch length: โˆ’โˆ‘i=161 ฯ€i qii = 1.

Muse-Gaut (MG94) Target Nucleotide Parameterization and F1ร—4, F3ร—4, F61

Whereas the Goldman-Yang (GY94) model multiplies every instantaneous rate qij by the equilibrium frequency ฯ€j of the entire target codon j, the Muse-Gaut (MG94) model (widely used in HyPhy) multiplies qij only by the equilibrium frequency ฯ€nj of the single target nucleotide nj โˆˆ {A, C, G, T} at the mutated position k โˆˆ {1, 2, 3}. Because GY94 uses the full codon frequency ฯ€j, changes in nucleotides at non-mutating positions of the codon can subtly influence qij; MG94 isolates single-nucleotide mutational biases from codon-level context.

In both frameworks, the 61 equilibrium codon frequencies ฯ€j are estimated using one of three nested empirical models:

  • F1ร—4 (3 free parameters): Assumes equal nucleotide frequencies (ฯ€A, ฯ€C, ฯ€G, ฯ€T) across all three codon positions, rescaled after removing the 3 stop codons.
  • F3ร—4 (9 free parameters): Estimates distinct nucleotide frequencies (ฯ€A(k), ฯ€C(k), ฯ€G(k), ฯ€T(k)) at the 1st, 2nd, and 3rd codon positions to capture strongly biased third-position GC content (GC3).
  • F61 (60 free parameters): Estimates all 61 empirical sense codon frequencies directly from the observed sequence alignment, fully accounting for translational codon usage bias.

Matrix Exponentiation and Transition Probabilities

Spectral Decomposition of P(t) = exp(Qt)

To compute the probability Pij(t) that codon i evolves into codon j over a phylogenetic branch of length t (measured in expected nucleotide substitutions per codon), the instantaneous rate matrix Q is exponentiated via the matrix exponential distribution:

P(t) = exp(Qt) = โˆ‘m=0โˆž (Qt)m / m!

Because both GY94 and MG94 satisfy the detailed balance (time-reversibility) condition ฯ€i qij = ฯ€j qji for all i and j, the asymmetric matrix Q can be transformed into a real symmetric matrix S = ฮ 1/2 Q ฮ โˆ’1/2, where ฮ  = diag(ฯ€1, ..., ฯ€61). Diagonalizing S = U ฮ› UT yields real eigenvalues ฮ› = diag(ฮป1, ..., ฮป61) (with ฮป1 = 0 and ฮปk < 0 for k โ‰ฅ 2) and orthonormal eigenvectors U, allowing P(t) to be evaluated rapidly for any branch length t:

P(t) = ฮ โˆ’1/2 U exp(ฮ›t) UT ฮ 1/2

Once P(t) is computed for every branch and ฯ‰ category, the log-likelihood of the codon alignment is evaluated over the tree topology via Felsenstein's tree-pruning algorithm.

Site-Specific ฯ‰ Models and Likelihood Ratio Tests

Heterogeneous Selection Across Amino Acid Sites (M0, M1a, M2a, M7, M8)

In almost all functional proteins, the vast majority of structural core residues are under strong purifying selection (ฯ‰ โ‰ช 1), while adaptive positive selection (ฯ‰ > 1) acts on only a small subset of surface or active-site residues. A single average ratio across the whole gene (model M0, one-ratio) averages over all sites and rarely exceeds 1.0 even during intense adaptive evolution. To detect site-specific adaptation, Ziheng Yang and Rasmus Nielsen (1998, 2000) developed random-sites codon models, which treat the selective regime ฯ‰h at each codon column h as a random variable drawn from a discrete mixture distribution across K site classes with proportions p0, p1, ..., pKโˆ’1 (where โˆ‘ pc = 1):

Site ModelFree ฯ‰ ParametersSite Classes & ฯ‰ DistributionBiological HypothesisPaired LRT Comparison (df)
M0 (One-Ratio)1 (ฯ‰)Single uniform ฯ‰ across all codon sitesUniform selective pressure across entire proteinBaseline vs. M3 (df = 4)
M1a (NearlyNeutral)2 (p0, ฯ‰0 < 1)Class 0: 0 < ฯ‰0 < 1 (prop. p0); Class 1: ฯ‰1 = 1 (prop. p1 = 1 โˆ’ p0)Null model: purifying selection + neutral drift onlyNull for M1a vs. M2a (df = 2)
M2a (PositiveSelection)4 (p0, p1, ฯ‰0 < 1, ฯ‰2 > 1)Adds Class 2 with ฯ‰2 > 1 (prop. p2 = 1 โˆ’ p0 โˆ’ p1) to M1aAlternative model allowing positively selected sites2ฮ”โ„“ = 2(โ„“M2a โˆ’ โ„“M1a) ~ ฯ‡22
M7 (beta)2 (p, q > 0)10 equal-probability categories discretized from Beta(p, q) on (0, 1)Flexible null distribution of purifying/neutral rates on [0, 1]Null for M7 vs. M8 (df = 2)
M8 (beta&ฯ‰)4 (p0, p, q, ฯ‰s โ‰ฅ 1)Proportion p0 from Beta(p, q) on (0, 1); prop. p1 = 1 โˆ’ p0 with ฯ‰s โ‰ฅ 1Alternative model adding positive-selection class ฯ‰s to Beta2ฮ”โ„“ = 2(โ„“M8 โˆ’ โ„“M7) ~ ฯ‡22
M8a (beta&ฯ‰s=1)3 (p0, p, q; ฯ‰s = 1 fixed)Proportion p0 from Beta(p, q); proportion 1 โˆ’ p0 fixed at neutral ฯ‰s = 1Strict boundary null model against M82ฮ”โ„“ ~ ยฝฯ‡02 + ยฝฯ‡12

To test statistically for the presence of positively selected sites, a Likelihood Ratio Test (LRT) compares twice the log-likelihood difference, 2ฮ”โ„“ = 2(โ„“1 โˆ’ โ„“0), between a nested null model that forbids ฯ‰ > 1 (such as M1a or M7) and an alternative model that adds an extra site class with ฯ‰ > 1 (such as M2a or M8) against a ฯ‡2 distribution with 2 degrees of freedom (critical values 5.99 at ฮฑ = 0.05 and 9.21 at ฮฑ = 0.01) or via the Akaike information criterion. When the global LRT rejects the null hypothesis, individual positively selected codon sites are pinpointed by computing posterior probabilities via Bayes Empirical Bayes site selection.

Frequently Asked Questions

Why do codon substitution models have 61 states instead of 64?

Three of the 64 triplets in the standard genetic code (TAA, TAG, and TGA) are nonsense stop codons that terminate translation. Because a mutation from a sense codon to a premature stop codon within a protein-coding gene almost always destroys protein function and is rapidly purged by purifying selection, standard codon models assign zero probability to internal stop codons and restrict the continuous-time Markov chain to the 61 sense codons.

Why were the original M1 (Neutral) and M2 (Selection) models replaced by M1a and M2a?

In the original Yang et al. (2000) M1 and M2 models, the purifying-selection class was fixed strictly at ฯ‰0 = 0, forcing any moderately conserved site with 0 < ฯ‰ < 1 (such as ฯ‰ = 0.25) to be absorbed into the neutral class (ฯ‰1 = 1) or the positive-selection class (ฯ‰2). In 2005, Yang, Wong, and Nielsen replaced ฯ‰0 = 0 with a freely estimated parameter 0 < ฯ‰0 < 1 in M1a (NearlyNeutral) and M2a (PositiveSelection), eliminating false positives caused by weakly constrained residues.

What is the difference between site models, branch models, and branch-site models?

Site models (such as M1a/M2a and M7/M8) allow ฯ‰ to vary among codon columns while holding ฯ‰ constant across all branches of the phylogenetic tree. Branch models hold ฯ‰ uniform across sites but allow a designated foreground lineage to have a different ฯ‰fg from background lineages ฯ‰bg. Branch-site models (such as Model A) allow ฯ‰ to vary simultaneously across both codon sites and specific foreground branches, detecting episodic bursts of positive selection along a single evolutionary lineage.

References

  1. Goldman, N., & Yang, Z. (1994). "A codon-based model of nucleotide substitution for protein-coding DNA sequences." Molecular Biology and Evolution, 11(5), 725โ€“736. https://doi.org/10.1093/oxfordjournals.molbev.a040153
  2. Muse, S. V., & Gaut, B. S. (1994). "A likelihood approach for comparing synonymous and nonsynonymous nucleotide substitution rates, with application to the chloroplast genome." Molecular Biology and Evolution, 11(5), 715โ€“724. https://doi.org/10.1093/oxfordjournals.molbev.a040152
  3. Yang, Z., Nielsen, R., Goldman, N., & Pedersen, A.-M. K. (2000). "Codon-substitution models for heterogeneous selection pressure at amino acid sites." Genetics, 155(1), 431โ€“449. https://doi.org/10.1093/genetics/155.1.431
  4. Yang, Z. (2007). "PAML 4: Phylogenetic Analysis by Maximum Likelihood." Molecular Biology and Evolution, 24(8), 1586โ€“1591. https://doi.org/10.1093/molbev/msm088
๐Ÿงฌ Support Open Science
Explore interactive science games on LowKey Games or browse scientific apparel & accessories in the CRV Science Shop.
๐Ÿ’ก Spot an inaccuracy or have primary literature to expand this article?
Submit a citation or revision note using your shared CRV Science / LowKey Games profile ID.
Suggest Revision