ZOMBI2
🌐 Website · Gallery · Documentation · Manual (pdf)
Simulating the evolution of species, genomes, sequences and traits.
ZOMBI2 simulates evolution at four levels: the species tree of lineages, the genomes that evolve along it, the sequences inside each gene, and the traits a lineage carries. Use it to generate benchmark datasets with known ground truth for phylogenetic and comparative methods.
Install
pip install zombi2
Quickstart
zombi2 species out/ --birth 1 --death 0.3 --n-extant 20 --seed 1
zombi2 genomes out/ --duplication 0.2 --transfer 0.1 --loss 0.25 --seed 1
zombi2 sequences out/ --model hky85 --length 1000 --divergence 0.2 --seed 1
From Python, each level is one function, and the result object carries the history:
from zombi2 import species, genomes, sequences
from zombi2.sequences.substitution_models import hky85
sp = species.simulate_species_tree(birth=1.0, death=0.3, n_extant=20, seed=1)
g = genomes.simulate_genomes_family(sp, duplication=0.2, transfer=0.1, loss=0.25, seed=1)
s = sequences.simulate_sequences(g, model=hky85(), length=1000, divergence=0.2, seed=1)
g.gene_trees # the true gene tree of every family
sp.write("out/") # the trees, the event log and the fates
g.write("out/") # gene trees, the event log, profiles
s.write("out/") # alignments and phylograms (ancestral is opt-in)
Levels
ZOMBI2 is organized around four levels of evolution. A genome, a sequence or a trait always evolves along a species tree, so you run whichever you need, composed into one seeded, reproducible run.
- Species trees — a birth–death process with rates that can shift in time, saturate with diversity or drift down the tree, plus mass extinctions, incomplete sampling and fossils.
- Genomes — gene families under duplication, transfer, loss and origination, at three resolutions: gene families, ordered chromosomes with rearrangements, and nucleotide genomes, with real DNA along each chromosome.
- Sequences — nucleotide (JC69, K80, HKY85, GTR) and protein substitution models run down each gene tree, with ancestral sequences at every node.
- Traits — continuous traits that diffuse, revert to an optimum or shift at speciation, and discrete traits switching between states.
Conditioning
Conditioning is a rate reading the state of a level that has already been grown. There are three parts: the driver, the level that is read; the modifier, which turns the driver's state into a factor; and the target, the rate it multiplies.
zombi2 species out/ --birth 1 --death 0.3 --n-extant 20 --seed 1
zombi2 traits out/ --kind discrete --states aquatic,terrestrial --switch 0.4 --seed 1
zombi2 genomes out/ --loss "0.25 * DrivenBy('out/traits/trait_events.tsv', {'aquatic': 4.0})" --seed 1
Joining
Joining is what to reach for when neither level can be grown first, because each drives the other: one run grows both. A trait that speeds up speciation is the standard case: the tree shapes the trait's history and the trait shapes the tree, so the tree is an output of the joint run rather than an input to it.
zombi2 joint out/ --birth "1.0 * DrivenBy('trait', {'small': 1.0, 'large': 3.0})" \
--states small,large --switch 0.3 --n-extant 100 --seed 1
Performance
A species tree of a million leaves takes a few seconds. On the same gene-family task, ZOMBI2 runs about 183× faster than the legacy ZOMBI v1 — both pure Python.
Gallery
The gallery is a page of worked examples, one figure each, with the code that produced it: species trees, genomes, sequences, traits, conditioning and joining. Every figure is drawn with Phylustrator.
Citation
A dedicated ZOMBI2 paper is in preparation. Until then, cite the original ZOMBI.
License
ZOMBI2 is released under the MIT License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zombi2-0.29.0.tar.gz.
File metadata
- Download URL: zombi2-0.29.0.tar.gz
- Upload date:
- Size: 7.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b513fbc89a0b51f225d9643be907b2fb355fd04f72cb12b67d80ef47a3f1cafd
|
|
| MD5 |
329df450d788ea311a63133e5261528f
|
|
| BLAKE2b-256 |
b71d532942bb479e5e5db7e28a02513ef662b1c41eb0f6be5591487c47b2be0b
|
Provenance
The following attestation bundles were made for zombi2-0.29.0.tar.gz:
Publisher:
release.yml on AADavin/zombi2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zombi2-0.29.0.tar.gz -
Subject digest:
b513fbc89a0b51f225d9643be907b2fb355fd04f72cb12b67d80ef47a3f1cafd - Sigstore transparency entry: 2339548188
- Sigstore integration time:
-
Permalink:
AADavin/zombi2@7717f5855fc2838f81e2e160f01143bdbab4fa36 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/AADavin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7717f5855fc2838f81e2e160f01143bdbab4fa36 -
Trigger Event:
release
-
Statement type:
File details
Details for the file zombi2-0.29.0-py3-none-any.whl.
File metadata
- Download URL: zombi2-0.29.0-py3-none-any.whl
- Upload date:
- Size: 415.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22277e5fe353144a8178729bdfcb4927820485c01414161fd616cdc5b821a2bb
|
|
| MD5 |
89729e91dae3d7047d6bfc39f89ee151
|
|
| BLAKE2b-256 |
e25bf45f4e2c367c608d8d3a66f125e0ffea7a32ec76556f08fc485f401dfb83
|
Provenance
The following attestation bundles were made for zombi2-0.29.0-py3-none-any.whl:
Publisher:
release.yml on AADavin/zombi2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
zombi2-0.29.0-py3-none-any.whl -
Subject digest:
22277e5fe353144a8178729bdfcb4927820485c01414161fd616cdc5b821a2bb - Sigstore transparency entry: 2339548196
- Sigstore integration time:
-
Permalink:
AADavin/zombi2@7717f5855fc2838f81e2e160f01143bdbab4fa36 -
Branch / Tag:
refs/tags/v0.29.0 - Owner: https://github.com/AADavin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7717f5855fc2838f81e2e160f01143bdbab4fa36 -
Trigger Event:
release
-
Statement type: