Skip to main content

Numba-Accelerated Toolkit for Analysis of Lifecycle-based population genetic dynamics

Project description

⚡️ NATAL Core

Numba-Accelerated Toolkit for Analysis of Lifecycles.

GitHub PyPI Python NumPy Numba Docs License

NATAL logo

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

Demos

License

This project is licensed 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

natal_core-0.1.0.dev2.tar.gz (792.9 kB view details)

Uploaded Source

Built Distribution

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

natal_core-0.1.0.dev2-py3-none-any.whl (252.5 kB view details)

Uploaded Python 3

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

Hashes for natal_core-0.1.0.dev2.tar.gz
Algorithm Hash digest
SHA256 5bad191c10d3083635f2264c29e9aa1dec5a6161d9b1be97cfb152233920bf36
MD5 8c400e9e261dfd74f1ed9b4042d84283
BLAKE2b-256 096bdd09c772fe60755524672304d785e1f9271c67e9ee5dfdde07d15453cbee

See more details on using hashes here.

File details

Details for the file natal_core-0.1.0.dev2-py3-none-any.whl.

File metadata

File hashes

Hashes for natal_core-0.1.0.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 2ea0d2d668c84aa1758874270ffac0e43928f96a169ea47898dd6db3638ce7a6
MD5 b902a9aaf0463b89bb33542f99a6c0c9
BLAKE2b-256 5057bf13e5553aeec78d7c934de03fefaa6baa39f49891d6e43d48a5cb8c1faf

See more details on using hashes here.

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