Skip to main content

Simulating the evolution of species trees, genomes, sequences and traits

Project description

ZOMBI2 ZOMBI2 logo

🌐 Website · Documentation · Manual (pdf)

CI PyPI Docs License: MIT Python 3.10+

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. Each level runs on its own, conditioned on another, or jointly with it, and every run records the true history behind the dataset. Use it to generate benchmark datasets with known ground truth for phylogenetic and comparative methods.


Install

pip install zombi2

Pure Python — NumPy and tqdm, no build step and no compiler.


Quickstart

Each level is its own subcommand. Here a dated species tree, then gene families evolving along it under duplication, transfer, loss and origination, then sequences down each gene tree:

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 --origination 0.5 --seed 42
zombi2 sequences out/ --model hky85 --length 1000 --seed 1

zombi2 <command> -h documents each of species, genomes, sequences and traits, with its own examples.

From Python, each level is one function, and the result object carries the history:

from zombi2 import species
from zombi2.genomes import simulate_genomes_unordered

sp = species.simulate_species_tree(birth=1.0, death=0.3, n_extant=20, seed=1)
g  = simulate_genomes_unordered(sp, duplication=0.2, transfer=0.1, loss=0.25,
                                origination=0.5, initial_families=20, seed=42)

g.gene_trees                    # the true gene tree of every family
g.write("run/")                 # the event log and the copy-number profiles

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.

The four levels of evolution ZOMBI2 simulates: species, genomes and sequences in a chain, with traits branching off species

  • 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. Extinct lineages are kept, so the complete tree and the extant one are both available.
  • Genomes — gene families under duplication, transfer, loss and origination, at three resolutions: unordered families, ordered chromosomes with rearrangements, and nucleotide genomes where genes are blocks of DNA.
  • 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.

Combining levels

A level can be conditioned on another — a rate reads a value some other level produced — or the two can be grown jointly, when neither can be simulated first because each drives the other. Both are one mechanism, DrivenBy(source, mapping), on any rate. See conditioning and joining.


Citation

A dedicated ZOMBI2 paper is in preparation. Until then, cite the original ZOMBI.

License

ZOMBI2 is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zombi2-0.3.0.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zombi2-0.3.0-py3-none-any.whl (210.7 kB view details)

Uploaded Python 3

File details

Details for the file zombi2-0.3.0.tar.gz.

File metadata

  • Download URL: zombi2-0.3.0.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for zombi2-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ba0cc4e7a7e3b00c31c64c8737fc933cdc10d15f1e4ceb1177f6a094f186e795
MD5 1dbc162793735b0c3c2fb2eeb788cefa
BLAKE2b-256 80eb567c33f642f0257c18dd28b08917296d0b48f8a97728ec90d879ec47d7f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for zombi2-0.3.0.tar.gz:

Publisher: release.yml on AADavin/zombi2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zombi2-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: zombi2-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 210.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for zombi2-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7746535acb6d5a3c3c1e5d2ddd7742977e8ed493e37f1ca006bd42d23dad04fa
MD5 c4141e4f78a8443dfd9b9ccf53c5088d
BLAKE2b-256 9c0afcdb3e0a3112299b931ad2f16790f42749976de90f7bba0c60ee839d13a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for zombi2-0.3.0-py3-none-any.whl:

Publisher: release.yml on AADavin/zombi2

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page