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.

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.dev1.tar.gz (5.8 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.dev1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file natal_core-0.1.0.dev1.tar.gz.

File metadata

  • Download URL: natal_core-0.1.0.dev1.tar.gz
  • Upload date:
  • Size: 5.8 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.dev1.tar.gz
Algorithm Hash digest
SHA256 31568af50bba0ef5aca8b52d35cb25af7b22f0115038f36aa2bb97398e41e888
MD5 964bf4eb6d51e7200d15c079490d18f1
BLAKE2b-256 ae5b1e811d7e2190da899a69767cbc390718be85ce1368ad1a908f6179d58e39

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for natal_core-0.1.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 20f652518721197603e1d64ff4db8e944927b2fe289988856f505e396ee81c9f
MD5 09d0aa1a0051de3da5af5d3d3abb41b8
BLAKE2b-256 b21ca880eea4b135a27c6048d675b466205bf7819be9bd6e0f219b814721d72b

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