This is the 2D companion to the "Molecular Evolution: dN/dS Substitution Simulator" 3D sim, built on a genuinely different mechanic. That 3D version watches individual codons and accepts or rejects each candidate mutation with a probability read directly off the ω dial — a fast heuristic. This page instead runs the real population-genetic process each new mutation actually undergoes: a Wright-Fisher model with genetic drift and selection, and lets dN/dS emerge from it.
selection step: p_sel = p(1+s) / (1 + s·p)
genetic drift: p' ~ Binomial(N, p_sel) / N (resample N individuals)
fixed when p'=1, lost when p'=0 — repeat until one happens
Kimura (1962) fixation probability of a new mutation (p0=1/N):
u(s) = (1 − e^(−2s)) / (1 − e^(−2Ns)) [u(0) = 1/N]
Theoretical dN/dS = u(s_nonsyn) / u(0)
Every new mutation starts as a single copy (frequency 1/N) and is tracked generation-by-generation as a scrolling trajectory. Synonymous mutations (s=0, blue) drift neutrally; nonsynonymous mutations use your selection coefficient s (orange trajectories tinted by outcome — green flash on fixation, red fade on loss). The realized dN and dS are simply the fraction of each class that reaches frequency 1, and the bottom strip tracks the running empirical ω against the closed-form Kimura prediction — the same relationship (Ns) population geneticists use to interpret real dN/dS scans for selection.
- s < 0 — purifying selection. Nonsynonymous lineages are pushed toward loss faster than drift alone would; most vanish before ever approaching fixation.
- s ≈ 0 — neutral evolution. Nonsynonymous and synonymous lineages fix at the same rate (both are pure drift), so ω → 1.
- s > 0 — positive selection. Selection actively drags nonsynonymous frequency upward, fixing far more often and typically much faster than neutral drift.
- Population size N controls how strongly drift can override weak selection — the diffusion-theory quantity that matters is Ns, not s alone, which is why the same s gives a different ω at different N.