Numba-Accelerated Toolkit for Analysis of Lifecycle-based population genetic dynamics
Project description
⚡️ NATAL Core
Numba-Accelerated Toolkit for Analysis of Lifecycles.
NATAL Core is a population genetics simulation engine focused on lifecycle-aware modeling. It supports age-structured and discrete-generation populations, sperm storage, gene drive presets, hook-based interventions, and high-performance Numba kernels.
NATAL Core is part of the NATAL project. The full project also includes NATAL Inferencer, a toolkit for parameter inference in population genetics models based on NATAL Core.
Key Features
- 🪲 Lifecycle-aware population modeling (age-structured and discrete-generation).
- 🧬 Genetic architecture definition with chromosomes, loci, and alleles.
- 🚀 Numba-accelerated kernels for high performance.
- 🧩 Built-in genetic presets (for example, homing drives and toxin-antidote drives).
- 🪝 Hook system for custom interventions during simulation.
- 🔍 Observation and filtering utilities for downstream analysis.
- 🌐 Spatial simulation support across multiple demes.
Installation
pip install natal-core
For development:
git clone https://github.com/jyzhu-pointless/natal-core.git
cd natal-core
python -m venv .venv
source .venv/bin/activate
pip install -e .
Quick Start
import natal as nt
species = nt.Species.from_dict(
name="DemoSpecies",
structure={"chr1": {"A": ["WT", "Drive"]}},
)
pop = (
nt.DiscreteGenerationPopulation
.setup(species=species, stochastic=False)
.initial_state(individual_count={"female": {"WT|WT": 100}, "male": {"WT|WT": 100}})
.survival(female_age0_survival=1.0, male_age0_survival=1.0)
.reproduction(eggs_per_female=10)
.competition(low_density_growth_rate=2.0, carrying_capacity=1000)
.build()
)
pop.run(n_steps=10, record_every=1)
print(nt.population_to_readable_dict(pop)["tick"])
Documentation and Links
- Documentation index: https://natal-core.readthedocs.io/en/latest/
- Quickstart guide: https://natal-core.readthedocs.io/en/latest/quickstart/
- API reference overview: https://natal-core.readthedocs.io/en/latest/api/
- PyPI package: https://pypi.org/project/natal-core/
- Source code: https://github.com/jyzhu-pointless/natal-core
- Issue tracker: https://github.com/jyzhu-pointless/natal-core/issues
- Changelog: https://github.com/jyzhu-pointless/natal-core/blob/main/CHANGELOG.md
Demos
- Discrete model demo: https://github.com/jyzhu-pointless/natal-core/blob/main/demos/discrete.py
- Age-structured demo: https://github.com/jyzhu-pointless/natal-core/blob/main/demos/mosquito.py
- Spatial demo: https://github.com/jyzhu-pointless/natal-core/blob/main/demos/spatial.py
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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 natal_core-0.1.0.dev2.tar.gz.
File metadata
- Download URL: natal_core-0.1.0.dev2.tar.gz
- Upload date:
- Size: 792.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bad191c10d3083635f2264c29e9aa1dec5a6161d9b1be97cfb152233920bf36
|
|
| MD5 |
8c400e9e261dfd74f1ed9b4042d84283
|
|
| BLAKE2b-256 |
096bdd09c772fe60755524672304d785e1f9271c67e9ee5dfdde07d15453cbee
|
File details
Details for the file natal_core-0.1.0.dev2-py3-none-any.whl.
File metadata
- Download URL: natal_core-0.1.0.dev2-py3-none-any.whl
- Upload date:
- Size: 252.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ea0d2d668c84aa1758874270ffac0e43928f96a169ea47898dd6db3638ce7a6
|
|
| MD5 |
b902a9aaf0463b89bb33542f99a6c0c9
|
|
| BLAKE2b-256 |
5057bf13e5553aeec78d7c934de03fefaa6baa39f49891d6e43d48a5cb8c1faf
|