$\textsf{\textcolor{#0f766e}{Z}OMBI2}$
🌐 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)
Each write fills the directory it is given, so these three share out/; the commands above group
the same run into out/species/, out/genomes/ and out/sequences/, and add a log per level and a
run.zombi2 report. The two routes count families differently, too: the Python result holds an
alignment for every family born, empty where no copy survived, while the commands count the
survivors. run.zombi2 gives both, as families 100 born · 92 surviving · 8 died out.
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 how ZOMBI2 simulates
a scenario where one part of the run controls another — a habitat trait that makes lineages lose genes
four times faster in the water, a gene family whose presence speeds up transfer for the rest of the
genome, a GC content that sets how fast a trait changes. Three parts: the driver, the thing doing
the controlling; the target, the parameter it controls (a rate, an extent, or which lineage
receives a transfer); and the connection between them, which says both how they are joined
(scaled_by) and what each value of the driver is worth.
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 "PerCopy(0.25).scaled_by('out/traits/trait_events.tsv', {'aquatic': 4.0})" --seed 1
Joining
Joining is how ZOMBI2 simulates two levels at the same time, for the scenarios where neither can be grown first because each shapes the other. A trait that speeds up speciation is the standard case: lineages carrying it split more often, so the trait decides the shape of the tree while the tree decides where the trait can go. One run grows both, and the tree comes out as a result rather than going in as an input.
zombi2 joint out/ --birth "PerLineage(1.0).scaled_by('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.
Maintainer, and contributing
ZOMBI2 is maintained and supervised by Adrián Arellano Davín.
Contributions are welcome, from humans and from agents alike — a bug report, a model you wish it could express, a fix, a worked example for the gallery. Start with CONTRIBUTING.md, and open an issue or a pull request.
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.42.1.tar.gz.
File metadata
- Download URL: zombi2-0.42.1.tar.gz
- Upload date:
- Size: 10.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0621960845b55030df94f7338f7bd7589400ae7d5d2e9ef43173f38a3e0d8187
|
|
| MD5 |
f707d882d4d148137bbeeef36837645f
|
|
| BLAKE2b-256 |
02058048770593aaf6d763eb115e0a46f60555cf0a1def51d1aa96e9ed5d118b
|
Provenance
The following attestation bundles were made for zombi2-0.42.1.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.42.1.tar.gz -
Subject digest:
0621960845b55030df94f7338f7bd7589400ae7d5d2e9ef43173f38a3e0d8187 - Sigstore transparency entry: 2489765129
- Sigstore integration time:
-
Permalink:
AADavin/zombi2@7b09abe6ee944f2caa1a67f8acb8a6594f87eb73 -
Branch / Tag:
refs/tags/v0.42.1 - Owner: https://github.com/AADavin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7b09abe6ee944f2caa1a67f8acb8a6594f87eb73 -
Trigger Event:
release
-
Statement type:
File details
Details for the file zombi2-0.42.1-py3-none-any.whl.
File metadata
- Download URL: zombi2-0.42.1-py3-none-any.whl
- Upload date:
- Size: 567.1 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 |
9cbfe8c34f76b72bcae688d72b9f65b133a10841abaf0296d02dce03cb0d8474
|
|
| MD5 |
394cd98dd84d9ab8e790743e6615be4c
|
|
| BLAKE2b-256 |
1f0cf038ce8a566734ec42d4f25edaba0d6caaa6387e18d57a972dffd2037439
|
Provenance
The following attestation bundles were made for zombi2-0.42.1-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.42.1-py3-none-any.whl -
Subject digest:
9cbfe8c34f76b72bcae688d72b9f65b133a10841abaf0296d02dce03cb0d8474 - Sigstore transparency entry: 2489765157
- Sigstore integration time:
-
Permalink:
AADavin/zombi2@7b09abe6ee944f2caa1a67f8acb8a6594f87eb73 -
Branch / Tag:
refs/tags/v0.42.1 - Owner: https://github.com/AADavin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@7b09abe6ee944f2caa1a67f8acb8a6594f87eb73 -
Trigger Event:
release
-
Statement type: