Skip to main content

Short one-line description of what PyAntiGen does

Project description

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 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 it to live (not PyAntiGen) and run:

pyantigen-create MyNewModel

This will automatically scaffold the following project directory:

MyNewModel/
├── .agents/
│   └── skills/          (agent skills, e.g. module generation, ODE conversion)
├── scripts/
│   ├── Example/         (full example: generate, run, optimize + Modules/)
│   │   ├── Example_generate.py
│   │   ├── Example_run.py
│   │   ├── Example_optimize.py
│   │   └── Modules/     (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
│   └── MyNewModel/      (same structure, Modules/ left empty for your code)
│       ├── MyNewModel_generate.py
│       ├── MyNewModel_run.py
│       ├── MyNewModel_optimize.py
│       └── Modules/     (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
├── 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 Example_run.py)
├── SBML_models/
└── pyantigen_settings.json   (e.g. archive_with_timestamp: false)

All model-specific files are grouped under folders named by MODEL_NAME (e.g. Example or your project name). From MyNewModel/scripts/Example/ run:

python Example_generate.py

This generates the model and writes outputs to antimony_models/Example/ and generated/Example/. Edit parameters if desired in antimony_models/Example/Example_parameters.csv, then run:

python Example_run.py

For parameter fitting against data, run:

python Example_optimize.py

Your own model lives under scripts/MyNewModel/ with the same files as the Example. Modify the code for your model in scripts/MyNewModel/Modules/ and scripts/MyNewModel/MyNewModel_generate.py, scripts/MyNewModel/MyNewModel_run.py, and `scripts/MyNewModel/MyNewModel_optimize.py'. Your problem will also require new modules in folder 'modules'.

Keeping the generation and simulation steps separate gives you time to adjust parameters and inspect the generated files before running.

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 scripts/Example/Example_run.py); the project root is resolved from the script location so antimony_models/Example/, generated/Example/, and results/Example/ resolve correctly.

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

pyantigen-1.0.4.tar.gz (31.6 kB view details)

Uploaded Source

Built Distribution

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

pyantigen-1.0.4-py3-none-any.whl (38.3 kB view details)

Uploaded Python 3

File details

Details for the file pyantigen-1.0.4.tar.gz.

File metadata

  • Download URL: pyantigen-1.0.4.tar.gz
  • Upload date:
  • Size: 31.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyantigen-1.0.4.tar.gz
Algorithm Hash digest
SHA256 814402664465d52e85aeb4b651d8195cce835e9d84e51e441dc7f5c89e0f019d
MD5 e7f5cd8099ff2fd26633e0ceb1901b7e
BLAKE2b-256 e194c743e64cefdf734584253f596b15d0e7807c79a8453d58ed305bda7a09fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyantigen-1.0.4.tar.gz:

Publisher: publish.yml on elbert5770/PyAntiGen

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

File details

Details for the file pyantigen-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: pyantigen-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 38.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyantigen-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f431533f1513a45db5eec500b33d1c9d165a3ee5e98a97e2ac45b16ef1766857
MD5 3a48784d36dacbb072bc52e1fdaff92a
BLAKE2b-256 0a07956c4df3a5c8e590716dbfd0625a6511c8a930e2647d505d15711f809d9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyantigen-1.0.4-py3-none-any.whl:

Publisher: publish.yml on elbert5770/PyAntiGen

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