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: Indicates purifying selection (negative selection), where deleterious amino acid replacements are eliminated and only a fraction ฯ of nonsynonymous mutations reach fixation.
- ฯ = 1: Indicates neutral evolution (as in pseudogenes), where nonsynonymous mutations fix at the same rate as synonymous mutations.
- ฯ > 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 Model | Free ฯ Parameters | Site Classes & ฯ Distribution | Biological Hypothesis | Paired LRT Comparison (df) |
|---|---|---|---|---|
| M0 (One-Ratio) | 1 (ฯ) | Single uniform ฯ across all codon sites | Uniform selective pressure across entire protein | Baseline 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 only | Null 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 M1a | Alternative model allowing positively selected sites | 2ฮโ = 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 โฅ 1 | Alternative model adding positive-selection class ฯs to Beta | 2ฮโ = 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 = 1 | Strict boundary null model against M8 | 2ฮโ ~ ยฝฯ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
- 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
- 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
- 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
- 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