msprime is a fast, scalable Python library for simulating genealogical trees and genomic sequence data under population genetic models using the coalescent with recombination. Current version 1.4.1 supports Python >=3.11. Released under GPL, maintained by the TSKIT team with regular updates.
pip install msprimeVerified import paths — ran on the pinned version, not inferred.
Simulate a basic coalescent tree sequence with recombination.
Replace `Ne=X` with `population_size=X`. Ensure you use msprime 1.x imports.
Run `ts = msprime.simulate(...)` then `ts = msprime.mutate(ts, rate=1e-8)`. See docs for details.
Use different seeds (e.g., derived from process ID) when running parallel simulations.
Pass a list: `sample_size=[5,5]` for two populations. Do not pass total 10.
Upgrade Python to 3.11 or later.