Ka/Ks (dN/dS) Selection Calculator

Calculate synonymous and nonsynonymous substitution rates to detect natural selection.

Please check your inputs and try again.

Why the Ratio Detects Selection

Synonymous substitutions do not change the encoded amino acid, so selection is largely blind to them. They therefore accumulate at approximately the neutral mutation rate and serve as an internal control. Non-synonymous changes alter the protein and are visible to selection.

ω = dN/dS = (Ka/N) / (Ks/S)

Dividing by the number of available sites is essential. Roughly three quarters of codon positions are non-synonymous, so raw counts would be badly skewed without normalisation.

ωSelectionFrequency
< 1Purifying — changes removedThe vast majority of genes
= 1NeutralPseudogenes
> 1Positive — changes favouredRare, and interesting

Most protein-coding genes show ω well below 0.2, because most amino acid changes are mildly deleterious. Values above 1 are unusual enough that they identify genes under active adaptive pressure.

Where Positive Selection Is Found

Gene classWhy ω > 1
Immune recognition (MHC)Arms race with pathogens; diversity itself is advantageous
Viral surface proteinsEscaping host antibody recognition
Reproductive proteinsSperm–egg recognition, sexual selection
Toxins and venomsPrey resistance arms race

The common thread is antagonistic coevolution. Where an opponent is also evolving, novelty is rewarded rather than penalised.

Why Whole-Gene ω Misses Most Selection

Averaging across an entire gene almost always gives ω < 1, because a handful of positively selected sites are swamped by many conserved ones. Site-based models that allow ω to vary across codons are far more sensitive, and branch-site models further allow it to vary between lineages — detecting selection that acted on one branch of a phylogeny only.

Saturation is the other limitation. Over long divergence times, synonymous sites accumulate multiple hits and dS is underestimated, inflating ω artefactually. Correction models exist but the method degrades for deeply diverged sequences.

Worked Examples

Example 1: Conserved gene: Ka=2, Ks=30, N=600, S=200
dN=0.0033, dS=0.15
Result: Ka/Ks=0.022 — strong purifying selection
Histones: Ka/Ks ~0.001 (extremely conserved)
Example 2: Rapidly evolving: Ka=15, Ks=10, N=600, S=200
dN=0.025, dS=0.05
Result: Ka/Ks=0.5 — moderate purifying selection
Immune genes often Ka/Ks approaching 1
Example 3: Why site models matter
Whole-gene ω = 0.3, but five codons show ω = 3.5
Result: Positive selection at specific sites
The gene overall is conserved, yet a small number of residues — often in a binding interface — are under adaptive pressure.
Example 4: MHC peptide-binding groove
ω > 1 concentrated in the binding residues
Result: Balancing selection
Diversity at these positions broadens the range of pathogen peptides that can be presented, so novelty is directly advantageous.

Common Mistakes

⚠️
Averaging ω across a whole gene

A few positively selected sites are swamped by many conserved ones, so whole-gene values almost always fall below 1. Use site models to detect selection.

⚠️
Treating ω < 1 as evidence of no selection

It indicates purifying selection, which is itself a strong selective force. Only ω near 1 suggests neutrality.

⚠️
Ignoring saturation in deeply diverged sequences

Multiple hits at synonymous sites underestimate dS and inflate ω. The method becomes unreliable for very distant comparisons.

⚠️
Forgetting to normalise by site counts

About three quarters of codon positions are non-synonymous. Comparing raw substitution counts without dividing by available sites is meaningless.

Frequently Asked Questions

What Ka/Ks tells us?
Synonymous substitutions (silent, don't change amino acid) accumulate at neutral rate. Nonsynonymous change amino acids. If Ka/Ks<1: natural selection removes deleterious AA changes (purifying selection). Ka/Ks>1: positive selection favoring AA changes (arms race, adaptation).
Classic Ka/Ks > 1 examples?
MHC immune genes, sperm-egg recognition proteins (ZP3, ADAM proteins), viral proteins evading immune system, antifreeze proteins in Antarctic fish. Ka/Ks>1 is strong evidence of adaptive evolution.
Why are synonymous substitutions used as the reference?
Because they do not change the protein, so selection is largely blind to them. They accumulate at roughly the neutral mutation rate, providing an internal control.
What does ω greater than 1 mean?
Positive selection — amino acid changes are being favoured. It is rare and typically found in immune genes, viral surface proteins and reproductive proteins.
Why does whole-gene ω usually fall below 1?
Because most residues are conserved and swamp the few under positive selection. Site-based models that allow ω to vary across codons are far more sensitive.
What limits the method?
Saturation at synonymous sites in deeply diverged sequences underestimates dS and artefactually inflates ω.