🧪 Phage–Bacteria Coevolution
Bacteriophage and bacteria populations coevolve matching-allele resistance and infectivity genotypes, producing Red Queen oscillations where neither side ever wins outright.
How it Works
Bacteria and phage are each split into several discrete genotype classes arranged on a ring. In this matching-alleles model, a phage of genotype g is only fully able to infect a bacterium of the same genotype g; the matching stringency slider softens that lock-and-key rule into a Gaussian kernel over genotype distance, so a phage can also partially infect bacteria a step or two away on the ring when stringency is low. Each genotype of bacteria grows logistically toward a shared carrying capacity and is killed off in proportion to how much matching phage pressure it experiences, while each genotype of phage grows by successfully infecting matching bacteria and otherwise decays.
Because a phage genotype that becomes very effective quickly drives its matching bacterial genotype down, and a bacterial genotype that becomes rare stops feeding its phage, every genotype eventually rises and falls in turn — the classic Red Queen pattern where being common is itself a disadvantage. A small mutation rate lets a fraction of each generation's offspring drift into a neighbouring genotype class, which is essential: without it any genotype driven to zero simply disappears forever and the whole ring collapses instead of cycling indefinitely.
dB[g]/dt = r·B[g]·(1 − ΣB/K) − infectionRate·B[g]·Σ_p P[p]·kernel(|g-p|)
dP[g]/dt = burst·P[g]·Σ_b B[b]·kernel(|g-b|) − decay·P[g]
mutation: X[g] += mutRate·(X[g-1] + X[g+1] − 2X[g]), X ∈ {B, P}
Frequently Asked Questions
What is the Red Queen hypothesis?
The Red Queen hypothesis, named after the character in Through the Looking-Glass who must keep running just to stay in place, describes how hosts and parasites are locked in perpetual coevolution: as bacteria evolve resistance to the currently common phage genotype, phage that can infect a different, previously rare bacterial genotype gain the advantage, so neither side ever settles into a fixed winning strategy.
What is matching-allele resistance?
In a matching-allele model, a phage can only successfully infect a bacterium if their genotypes correspond to the same allele class, much like a key fitting only one lock. A bacterium is resistant to every phage genotype except the one that matches its own, which is what drives the frequency-dependent selection behind Red Queen cycling.
What does the infection matching stringency slider do?
Stringency controls how narrowly a phage genotype's infectivity is confined to its exactly matching bacterial genotype. At high stringency only bacteria of the identical genotype can be infected; lowering it widens the kernel so phage can also partially infect bacteria of neighbouring genotype classes, softening the strict lock-and-key matching.
Why is mutation necessary for the cycles to continue?
Without mutation, whichever bacterial genotype is currently rare simply grows unopposed until it dominates, and the matching phage genotype eventually drives its target to extinction with nothing to replace it, collapsing the cycle. A small mutation rate continuously reseeds neighbouring genotype classes, keeping every allele class populated so new cycles of resistance and counter-resistance can keep starting.
What does the 'dominant genotype' indicator show?
The dominant genotype indicator highlights whichever allele class currently has the largest population, separately for bacteria and for phage. Watching the highlighted class cycle around the genotype ring over time is a direct visual signature of Red Queen dynamics: the phage indicator chases the bacteria indicator around the ring rather than either one staying fixed.
About this simulation
No single genotype of bacteria or phage ever wins for long in this simulation — every time one colour climbs to the top of the dominance bars, it is only a matter of generations before its matching phage catches up and drags it back down. Watching the coloured bars swap places over and over, with the phage bars always trailing a step behind the bacteria bars, is exactly what the Red Queen hypothesis predicts: constant evolutionary motion is required just to hold a fixed position.
🔬 What it shows
Discrete bacterial and phage genotype classes on a ring, coupled by a matching-alleles infection kernel with logistic bacterial growth, infection-driven phage reproduction, and neighbour-genotype mutation, producing self-sustaining Red Queen cycles.
🎮 How to use
Raise Allele Classes for more genotypes to cycle through, tune Infection Rate and Matching Stringency to change how tightly phage are locked to one genotype, and increase Mutation Rate if the cycling dies out into extinction.
💡 Did you know?
Real Red Queen cycling between bacteriophage and their bacterial hosts has been directly observed in laboratory chemostats, where researchers can freeze samples at different time points and later measure that phage from one time point infect past-host bacteria far better than future-host bacteria — a signature called "time-shift" coevolution.
Frequently asked questions
What is the Red Queen hypothesis?
The Red Queen hypothesis, named after the character in Through the Looking-Glass who must keep running just to stay in place, describes how hosts and parasites are locked in perpetual coevolution: as bacteria evolve resistance to the currently common phage genotype, phage that can infect a different, previously rare bacterial genotype gain the advantage, so neither side ever settles into a fixed winning strategy.
What is matching-allele resistance?
In a matching-allele model, a phage can only successfully infect a bacterium if their genotypes correspond to the same allele class, much like a key fitting only one lock. A bacterium is resistant to every phage genotype except the one that matches its own, which is what drives the frequency-dependent selection behind Red Queen cycling.
What does the infection matching stringency slider do?
Stringency controls how narrowly a phage genotype's infectivity is confined to its exactly matching bacterial genotype. At high stringency only bacteria of the identical genotype can be infected; lowering it widens the kernel so phage can also partially infect bacteria of neighbouring genotype classes, softening the strict lock-and-key matching.
Why is mutation necessary for the cycles to continue?
Without mutation, whichever bacterial genotype is currently rare simply grows unopposed until it dominates, and the matching phage genotype eventually drives its target to extinction with nothing to replace it, collapsing the cycle. A small mutation rate continuously reseeds neighbouring genotype classes, keeping every allele class populated so new cycles of resistance and counter-resistance can keep starting.
What does the 'dominant genotype' indicator show?
The dominant genotype indicator highlights whichever allele class currently has the largest population, separately for bacteria and for phage. Watching the highlighted class cycle around the genotype ring over time is a direct visual signature of Red Queen dynamics: the phage indicator chases the bacteria indicator around the ring rather than either one staying fixed.
Bacteriophage and bacteria populations coevolve matching-allele resistance and infectivity genotypes, producing Red Queen oscillations where neither side ever wins outright.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install