Skip to main content

PyAntiGen

PyAntiGen is a declarative, object-oriented framework for generating compartmental biological models in Antimony format. It is designed to abstract away the repetitive boilerplate of defining reactions and compartments manually, allowing researchers to build complex, scalable models using clean Python syntax.

Features

  • Object-Oriented Modules: Encapsulate tissues, flows, synthesis, and excretion into reusable Python classes.
  • Dynamic Registration: Automatically binds reactions, compartments, and species to the global model state when a module is instantiated.
  • Project Scaffolding: Includes a CLI command to instantly spin up new modeling projects with all necessary directories.
  • Isotope Tracking: Natively supports tracking labeled isotopes and generating corresponding parallel reactions.

Installation

You can install PyAntiGen into your Python environment with:

pip install pyantigen

You can also install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:

git clone https://github.com/elbert5770/PyAntiGen.git
cd PyAntiGen
pip install -e .

Quick Start: Creating a New Model

Because PyAntiGen is installed as a system-level Python package, you don't need a copy of the framework files in your working directory.

To start a brand new modeling workspace, just open a terminal and navigate to a folder where you want your project to live (be careful not to build within the PyAntiGen folder itself) and run:

pyantigen-create MyNewModel

This will automatically scaffold the following project directory:

MyNewModel/
├── .agents/
│   └── skills/          (agent skills, e.g. module generation, ODE conversion)
├── Projects/
│   ├── Example/         (full example: generate, run + Modules/, Engine/)
│   │   ├── Model_generate.py
│   │   ├── Model_run.py
│   │   └── Modules/     (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
│   └── MyNewModel/      (same structure, Modules/ pre-populated from Example)
│       ├── Model_generate.py
│       ├── Model_run.py
│       └── Modules/     (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
├── antimony_modules/
│   └── __init__.py      (plus Basic/ for the example)
├── data/                (Example experiment CSVs copied for the example)
├── antimony_models/
│   └── Example/         (Example_parameters.csv, Example_InitialConditions.csv, etc.)
├── generated/
│   └── Example/         (reaction dict, rules, etc. after generate)
├── results/
│   └── Example/         (plots from Model_run.py)
├── SBML_models/
└── pyantigen_settings.json   (e.g. archive_with_timestamp: false)

Every project folder under Projects/ has a script called Model_generate.py that is run to generate the model. MODEL_NAME is derived automatically from the enclosing folder name (see AntiGen_paths.py), so being in the right project folder is all that's needed to generate/run the correct project. From MyNewModel/Projects/Example/ run:

python Model_generate.py

This generates the model from the specified files in 'antimony_modules' and writes outputs to antimony_models/Example/ and generated/Example/. This is entirely optional as Model_run.py also calls the constructor functions in Model_generate.py.

To run a simulation or optimization, you may edit the parameters in antimony_models/Example/Example_parameters.csv, derived parameters in antimony_models/Example/Example_manual.txt, and initial conditions in antimony_models/Example/Example_InitialConditions.csv.

Then, run Model_run.py to simulate the Example in Tellurium/RoadRunner:

python Model_run.py --simulate Example

To run optimization examples use the --optimize flag:

python Model_run.py --optimize Example1
python Model_run.py --optimize Example2
python Model_run.py --optimize Example3

Your own model lives under Projects/MyNewModel/. Modify the code for your model in Projects/MyNewModel/Modules/, Projects/MyNewModel/Model_generate.py, and Projects/MyNewModel/Model_run.py. Your problem will also require new modules in antimony_modules/ to define the model.

Running from an IDE (Cursor / VS Code)

The Play button uses whichever Python interpreter is currently selected. If your environment (conda/venv) isn’t loaded, the run may fail with import or path errors.

  1. Select the correct interpreter: Ctrl+Shift+P (or Cmd+Shift+P on macOS) → Python: Select Interpreter → choose the environment where you ran pip install -e . (e.g. your conda or venv).
  2. Run from project root: Open the project folder (e.g. MyNewModel) as the workspace. Use Run and Debug (or Play on Projects/Example/Model_run.py); the project root is resolved from the script location so antimony_models/Example/, generated/Example/, and results/Example/ resolve correctly.

Metadata

Release files for PyAntiGen 1.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyAntiGen 1.0.5
File Size Uploaded
pyantigen-1.0.5.tar.gz 79.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyAntiGen 1.0.5
File Interpreter ABI Platform
pyantigen-1.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 170.7 kB

Release files / pyantigen-1.0.5.tar.gz

Download URL pyantigen-1.0.5.tar.gz
Size 79.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9c56627b0d90e26b610257f5cc7af9812a1bcbdf10f12530afa613d1d2266ba1
BLAKE2b-256 checksum
How to use checksums
bd0cba5832cf1e734a6f62d7174b59c6b77175b33e27ae03f6c3a977c34f6b8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release files / pyantigen-1.0.5-py3-none-any.whl

Download URL pyantigen-1.0.5-py3-none-any.whl
Size 91.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75e2e1ee5c19e2d99489b0509c7cc8d4a925ff9b4dcc412ee6c518d431e61c99
BLAKE2b-256 checksum
How to use checksums
f20d9fbbd649d563ed24064a1293ff161b35c7bb8126d9cef4162bfabe546c00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 22, 2026.

Transparency log

Release history Release notifications | RSS feed

2.1.5

2 release files

2.1.4

2 release files

2.1.3

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.0.15

2 release files

1.0.14

2 release files

1.0.13

2 release files

1.0.12

2 release files

1.0.9

2 release files

1.0.7

2 release files

This release

1.0.5 This release

2 release files

1.0.4

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page