PyAntiGen 1.0.14__tar.gz → 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. {pyantigen-1.0.14 → pyantigen-2.0.0}/.github/workflows/publish.yml +9 -3
  2. pyantigen-2.0.0/.github/workflows/tests.yml +46 -0
  3. {pyantigen-1.0.14 → pyantigen-2.0.0}/.gitignore +1 -1
  4. {pyantigen-1.0.14 → pyantigen-2.0.0}/MANIFEST.in +1 -2
  5. {pyantigen-1.0.14/PyAntiGen.egg-info → pyantigen-2.0.0}/PKG-INFO +99 -18
  6. pyantigen-1.0.14/README.md → pyantigen-2.0.0/PyAntiGen.egg-info/PKG-INFO +115 -8
  7. pyantigen-2.0.0/PyAntiGen.egg-info/SOURCES.txt +98 -0
  8. pyantigen-2.0.0/PyAntiGen.egg-info/entry_points.txt +2 -0
  9. {pyantigen-1.0.14 → pyantigen-2.0.0}/PyAntiGen.egg-info/requires.txt +4 -0
  10. {pyantigen-1.0.14 → pyantigen-2.0.0}/PyAntiGen.egg-info/scm_file_list.json +104 -57
  11. pyantigen-2.0.0/PyAntiGen.egg-info/scm_version.json +8 -0
  12. pyantigen-2.0.0/PyAntiGen.egg-info/top_level.txt +1 -0
  13. pyantigen-1.0.14/PKG-INFO → pyantigen-2.0.0/README.md +83 -34
  14. pyantigen-2.0.0/docs/PROTOCOL_LAYER.md +140 -0
  15. pyantigen-2.0.0/docs/V2_DESIGN.md +167 -0
  16. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/.agents/skills/module_generation/SKILL.md +2 -2
  17. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/_version.py +3 -3
  18. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/cli.py +7 -18
  19. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Anchor_cache.py +1 -1
  20. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Deadline.py +1 -1
  21. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Evaluator.py +45 -26
  22. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Fast_profile.py +6 -6
  23. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Fit_cache.py +9 -9
  24. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Identifiability.py +3 -3
  25. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Model_optimize.py +17 -20
  26. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Model_simulate.py +19 -12
  27. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Noise_floor.py +4 -4
  28. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Optimize.py +259 -81
  29. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Petab_export.py +1 -1
  30. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Preequil_cache.py +2 -2
  31. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Profile_checkpoint.py +51 -12
  32. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Results.py +33 -1
  33. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Sensitivity_analysis.py +7 -7
  34. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Simulate.py +1 -1
  35. pyantigen-2.0.0/pyantigen/engine/__init__.py +6 -0
  36. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/AntimonyGen.py +1 -1
  37. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/RxnDict_to_antimony.py +2 -2
  38. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/TelluriumGen.py +1 -1
  39. pyantigen-2.0.0/pyantigen/generate/__init__.py +4 -0
  40. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/antimony_utils.py +1 -1
  41. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/model_generation.py +2 -2
  42. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/pyantigen.py +3 -3
  43. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/reaction_creation.py +1 -1
  44. pyantigen-2.0.0/pyantigen/study/__init__.py +38 -0
  45. pyantigen-2.0.0/pyantigen/study/assay.py +543 -0
  46. pyantigen-2.0.0/pyantigen/study/describe.py +191 -0
  47. pyantigen-2.0.0/pyantigen/study/design.py +405 -0
  48. pyantigen-2.0.0/pyantigen/study/lower_v1.py +315 -0
  49. pyantigen-2.0.0/pyantigen/study/optimization.py +228 -0
  50. pyantigen-2.0.0/pyantigen/study/params.py +141 -0
  51. pyantigen-2.0.0/pyantigen/study/quantity.py +324 -0
  52. pyantigen-2.0.0/pyantigen/study/reagent.py +159 -0
  53. pyantigen-2.0.0/pyantigen/study/refs.py +42 -0
  54. pyantigen-2.0.0/pyantigen/study/remarks.py +107 -0
  55. pyantigen-2.0.0/pyantigen/study/serialize.py +191 -0
  56. pyantigen-2.0.0/pyantigen/study/validate.py +223 -0
  57. pyantigen-2.0.0/pyantigen/template/Example/AntiGen_paths.py +53 -0
  58. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Model_generate.py +1 -1
  59. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Model_run.py +5 -3
  60. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Events.py +1 -1
  61. pyantigen-2.0.0/pyantigen/template/Example/optimizations/Example1_ADneg.json +9 -0
  62. pyantigen-2.0.0/pyantigen/template/Example/optimizations/Example1_ADpos.json +12 -0
  63. pyantigen-2.0.0/pyantigen/template/Example/optimizations/Example3_joint.json +13 -0
  64. pyantigen-2.0.0/pyantigen/template/Example/optimizations/Example4_flipflop.json +13 -0
  65. pyantigen-2.0.0/pyantigen/template/Example/optimizations/example.py +76 -0
  66. pyantigen-2.0.0/pyantigen/template/Example/studies/example.json +46 -0
  67. pyantigen-2.0.0/pyantigen/template/Example/studies/example.py +88 -0
  68. pyantigen-2.0.0/pyantigen/template/Example/studies/flipflop.json +55 -0
  69. pyantigen-2.0.0/pyproject.toml +84 -0
  70. pyantigen-1.0.14/PyAntiGen.egg-info/SOURCES.txt +0 -73
  71. pyantigen-1.0.14/PyAntiGen.egg-info/entry_points.txt +0 -2
  72. pyantigen-1.0.14/PyAntiGen.egg-info/scm_version.json +0 -8
  73. pyantigen-1.0.14/PyAntiGen.egg-info/top_level.txt +0 -1
  74. pyantigen-1.0.14/framework/template/Example/AntiGen_paths.py +0 -23
  75. pyantigen-1.0.14/pyproject.toml +0 -57
  76. pyantigen-1.0.14/setup.py +0 -31
  77. {pyantigen-1.0.14 → pyantigen-2.0.0}/.vscode/launch.json +0 -0
  78. {pyantigen-1.0.14 → pyantigen-2.0.0}/LICENSE +0 -0
  79. {pyantigen-1.0.14 → pyantigen-2.0.0}/PyAntiGen.egg-info/dependency_links.txt +0 -0
  80. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/.agents/skills/ode_conversion_antimony/SKILL.md +0 -0
  81. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/.agents/skills/ode_extraction_pipeline/SKILL.md +0 -0
  82. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/.gitignore +0 -0
  83. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/__init__.py +0 -0
  84. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Differential_evolution.py +0 -0
  85. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Event_times.py +0 -0
  86. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/Nelder_mead.py +0 -0
  87. {pyantigen-1.0.14/framework/template/Example/Engine → pyantigen-2.0.0/pyantigen/engine}/README.md +0 -0
  88. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/data_interpolation.py +0 -0
  89. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/isotopomer_tools.py +0 -0
  90. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/models.py +0 -0
  91. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/module_base.py +0 -0
  92. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen/generate}/rate_laws.py +0 -0
  93. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Flipflop_reference.py +0 -0
  94. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Data.py +0 -0
  95. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Experiment.py +0 -0
  96. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Loss_config.py +0 -0
  97. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Observed_species.py +0 -0
  98. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Optimizer_settings.py +0 -0
  99. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Plots.py +0 -0
  100. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Solver_settings.py +0 -0
  101. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Update_opt_parameters.py +0 -0
  102. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/Example/Modules/Update_parameters.py +0 -0
  103. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/data/ADneg.csv +0 -0
  104. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/data/ADpos.csv +0 -0
  105. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/data/Flipflop.csv +0 -0
  106. {pyantigen-1.0.14/framework → pyantigen-2.0.0/pyantigen}/template/data/make_flipflop_data.py +0 -0
  107. {pyantigen-1.0.14 → pyantigen-2.0.0}/setup.cfg +0 -0
@@ -3,21 +3,27 @@ name: Publish to PyPI
3
3
  on:
4
4
  push:
5
5
  tags:
6
- - "v*" # triggers on any tag like v0.1.0, v1.2.3
6
+ - "v*" # triggers on any tag like v2.0.0
7
7
 
8
8
  jobs:
9
+ test:
10
+ uses: ./.github/workflows/tests.yml
11
+
9
12
  build-and-publish:
13
+ needs: test # a failing test or build blocks the upload
10
14
  runs-on: ubuntu-latest
11
- environment: pypi # matches the environment name from Step 1
15
+ environment: pypi # the environment configured for PyPI trusted publishing
12
16
  permissions:
13
17
  id-token: write # required for trusted publishing
14
18
 
15
19
  steps:
16
20
  - uses: actions/checkout@v4
21
+ with:
22
+ fetch-depth: 0 # setuptools-scm reads the version from the tag
17
23
 
18
24
  - uses: actions/setup-python@v5
19
25
  with:
20
- python-version: "3.11"
26
+ python-version: "3.12"
21
27
 
22
28
  - name: Install build
23
29
  run: pip install build
@@ -0,0 +1,46 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main, v2]
6
+ pull_request:
7
+ workflow_call: # lets publish.yml gate a release on these tests
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.11", "3.12"]
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0 # setuptools-scm needs the tags
20
+
21
+ - uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install
26
+ run: pip install -e ".[test]"
27
+
28
+ - name: Test
29
+ run: python -m pytest tests -q
30
+
31
+ package:
32
+ runs-on: ubuntu-latest
33
+ steps:
34
+ - uses: actions/checkout@v4
35
+ with:
36
+ fetch-depth: 0
37
+
38
+ - uses: actions/setup-python@v5
39
+ with:
40
+ python-version: "3.12"
41
+
42
+ - name: Build and check the distributions
43
+ run: |
44
+ pip install build twine
45
+ python -m build
46
+ twine check dist/*
@@ -25,4 +25,4 @@ venv/
25
25
  ENV/
26
26
 
27
27
  # Written at build time by setuptools-scm (see [tool.setuptools_scm])
28
- framework/_version.py
28
+ pyantigen/_version.py
@@ -4,5 +4,4 @@
4
4
  include README.md
5
5
  prune tests
6
6
  prune .git
7
- recursive-exclude __pycache__ *
8
- recursive-exclude *.pyc *
7
+ global-exclude __pycache__ *.py[cod]
@@ -1,16 +1,20 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyAntiGen
3
- Version: 1.0.14
4
- Summary: Short one-line description of what PyAntiGen does
5
- Author: Open Source Contributor
6
- Author-email: Don <you@example.com>
7
- License: MIT
8
- Project-URL: Homepage, https://github.com/you/PyAntiGen
9
- Keywords: alzheimer,immunology,simulation
3
+ Version: 2.0.0
4
+ Summary: Declarative generation, simulation and identifiability analysis of compartmental Antimony/SBML models
5
+ Author-email: Don Elbert <elbert5770@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/elbert5770/PyAntiGen
8
+ Project-URL: Repository, https://github.com/elbert5770/PyAntiGen
9
+ Project-URL: Issues, https://github.com/elbert5770/PyAntiGen/issues
10
+ Keywords: systems biology,antimony,SBML,tellurium,pharmacokinetics,alzheimer,simulation
10
11
  Classifier: Programming Language :: Python :: 3
11
- Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
12
14
  Classifier: Operating System :: OS Independent
13
- Requires-Python: >=3.9
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
17
+ Requires-Python: >=3.11
14
18
  Description-Content-Type: text/markdown
15
19
  License-File: LICENSE
16
20
  Requires-Dist: tellurium
@@ -21,13 +25,21 @@ Requires-Dist: numdifftools
21
25
  Requires-Dist: openpyxl
22
26
  Requires-Dist: matplotlib
23
27
  Requires-Dist: pypesto
24
- Dynamic: author
28
+ Requires-Dist: SALib
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest; extra == "test"
25
31
  Dynamic: license-file
26
32
 
27
33
  # PyAntiGen
28
34
 
29
35
  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.
30
36
 
37
+ > **PyAntiGen 2 is a breaking release.** The package is now `pyantigen`
38
+ > (was `framework`): model generation is `pyantigen.generate`, and the Engine
39
+ > is `pyantigen.engine`, imported from the installed package instead of being
40
+ > copied into every project. See [Migrating from 1.x](#migrating-from-1x) and
41
+ > `docs/V2_DESIGN.md`.
42
+
31
43
  ## Features
32
44
 
33
45
  - **Object-Oriented Modules:** Encapsulate tissues, flows, synthesis, and excretion into reusable Python classes.
@@ -36,22 +48,91 @@ PyAntiGen is a declarative, object-oriented framework for generating compartment
36
48
  - **Isotope Tracking:** Natively supports tracking labeled isotopes and generating corresponding parallel reactions.
37
49
 
38
50
  ## Installation
39
- You can install PyAntiGen into your Python environment with:
51
+
52
+ PyAntiGen needs **Python 3.11 or newer**. Install it into a virtual environment
53
+ that belongs to your project, not into your system Python: the dependencies
54
+ (Tellurium/RoadRunner, SciPy, pyPESTO, ...) are large and version-sensitive,
55
+ and every result records the PyAntiGen version that produced it.
56
+
57
+ ### Recommended: a project-local environment with uv
58
+
59
+ [uv](https://docs.astral.sh/uv/) creates environments in well under a second and
60
+ installs from a shared download cache, so each additional environment costs
61
+ little disk space beyond the first. From your project folder:
62
+
40
63
  ```bash
64
+ uv venv --python 3.12 .venv
65
+ uv pip install --python .venv/bin/python pyantigen # Windows: .venv\Scripts\python
66
+ ```
67
+
68
+ Activate it (`source .venv/bin/activate`, or `.venv\Scripts\activate` on
69
+ Windows), or call `.venv/bin/python` directly. For a reproducible environment,
70
+ pin exact versions in a `requirements.txt` and install with
71
+ `uv pip install -r requirements.txt`.
72
+
73
+ ### Standard library `venv` + pip
74
+
75
+ ```bash
76
+ python -m venv .venv
77
+ .venv/bin/python -m pip install pyantigen # Windows: .venv\Scripts\python
78
+ ```
79
+
80
+ A fully populated environment is roughly 0.9 GB with plain pip, so keep one per
81
+ project repository (and add `.venv/` to `.gitignore`) rather than one per model.
82
+
83
+ ### conda / mamba
84
+
85
+ ```bash
86
+ conda create -n pyantigen python=3.12
87
+ conda activate pyantigen
41
88
  pip install pyantigen
42
89
  ```
43
90
 
44
- You can also install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
91
+ ### Check the installation
92
+
93
+ ```bash
94
+ python -c "import pyantigen, pyantigen.engine; print(pyantigen.__version__)"
95
+ ```
96
+
97
+ If a project's `AntiGen_paths.py` raises "PyAntiGen 2 ... is not installed",
98
+ the wrong environment is active: activate the one you installed into.
99
+
100
+ ### Developing PyAntiGen itself
101
+
102
+ Clone this repository and install it editable, with the test dependencies, into
103
+ its own environment:
45
104
 
46
105
  ```bash
47
106
  git clone https://github.com/elbert5770/PyAntiGen.git
48
107
  cd PyAntiGen
49
- pip install -e .
108
+ uv venv --python 3.12 .venv
109
+ uv pip install --python .venv/bin/python -e ".[test]"
110
+ .venv/bin/python -m pytest tests
50
111
  ```
51
112
 
113
+ An editable install means edits take effect immediately, in every project that
114
+ uses that environment. There is still only one copy of the Engine.
115
+
116
+ ### Migrating from 1.x
117
+
118
+ 1.x copied an `Engine/` folder into every project, so projects drifted apart.
119
+ In 2.x the Engine is `pyantigen.engine` and projects hold none. To move a
120
+ project:
121
+
122
+ * `from framework.<module> import ...` becomes `from pyantigen.generate.<module> import ...`.
123
+ * `from Engine.<module> import ...` becomes `from pyantigen.engine.<module> import ...`;
124
+ delete the project's `Engine/` folder.
125
+ * Pass `MODEL_NAME` and `REPO_ROOT` in the settings given to `setup_simulation` /
126
+ `setup_optimization_from_groups` (see `Projects/Example/Model_run.py`).
127
+ * Replace `AntiGen_paths.py` with the 2.x version from `pyantigen-create`; it
128
+ also refuses to run if the Engine is missing or a local `Engine/` reappears.
129
+ * Regenerated Antimony may differ textually (for example constant compartment
130
+ volumes are written `compartment X := V_X`); compare simulated time courses,
131
+ not file contents.
132
+
52
133
  ## Quick Start: Creating a New Model
53
134
 
54
- Because PyAntiGen is installed as a system-level Python package, you don't need a copy of the framework files in your working directory.
135
+ Because PyAntiGen is an installed package, you don't need a copy of its code in your working directory.
55
136
 
56
137
  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:
57
138
 
@@ -65,14 +146,14 @@ MyNewModel/
65
146
  ├── .agents/
66
147
  │ └── skills/ (agent skills, e.g. module generation, ODE conversion)
67
148
  ├── Projects/
68
- │ ├── Example/ (full example: generate, run + Modules/, Engine/)
149
+ │ ├── Example/ (full example: generate, run + Modules/)
69
150
  │ │ ├── Model_generate.py
70
151
  │ │ ├── Model_run.py
71
- │ │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
152
+ │ │ └── Modules/ (Data, Events, Experiment, Loss_config, Optimizer_settings, Plots, ...)
72
153
  │ └── MyNewModel/ (same structure, Modules/ pre-populated from Example)
73
154
  │ ├── Model_generate.py
74
155
  │ ├── Model_run.py
75
- │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
156
+ │ └── Modules/ (Data, Events, Experiment, Loss_config, Optimizer_settings, Plots, ...)
76
157
  ├── antimony_modules/
77
158
  │ └── __init__.py (plus Basic/ for the example)
78
159
  ├── data/ (Example experiment CSVs copied for the example)
@@ -125,5 +206,5 @@ Your own model lives under `Projects/MyNewModel/`. Modify the code for your mode
125
206
 
126
207
  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.
127
208
 
128
- 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).
209
+ 1. **Select the correct interpreter**: `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS) → **Python: Select Interpreter** → choose the environment you installed PyAntiGen into (e.g. your project's `.venv` or conda environment).
129
210
  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.
@@ -1,7 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: PyAntiGen
3
+ Version: 2.0.0
4
+ Summary: Declarative generation, simulation and identifiability analysis of compartmental Antimony/SBML models
5
+ Author-email: Don Elbert <elbert5770@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/elbert5770/PyAntiGen
8
+ Project-URL: Repository, https://github.com/elbert5770/PyAntiGen
9
+ Project-URL: Issues, https://github.com/elbert5770/PyAntiGen/issues
10
+ Keywords: systems biology,antimony,SBML,tellurium,pharmacokinetics,alzheimer,simulation
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Intended Audience :: Science/Research
16
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: tellurium
21
+ Requires-Dist: scipy
22
+ Requires-Dist: numpy
23
+ Requires-Dist: pandas
24
+ Requires-Dist: numdifftools
25
+ Requires-Dist: openpyxl
26
+ Requires-Dist: matplotlib
27
+ Requires-Dist: pypesto
28
+ Requires-Dist: SALib
29
+ Provides-Extra: test
30
+ Requires-Dist: pytest; extra == "test"
31
+ Dynamic: license-file
32
+
1
33
  # PyAntiGen
2
34
 
3
35
  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.
4
36
 
37
+ > **PyAntiGen 2 is a breaking release.** The package is now `pyantigen`
38
+ > (was `framework`): model generation is `pyantigen.generate`, and the Engine
39
+ > is `pyantigen.engine`, imported from the installed package instead of being
40
+ > copied into every project. See [Migrating from 1.x](#migrating-from-1x) and
41
+ > `docs/V2_DESIGN.md`.
42
+
5
43
  ## Features
6
44
 
7
45
  - **Object-Oriented Modules:** Encapsulate tissues, flows, synthesis, and excretion into reusable Python classes.
@@ -10,22 +48,91 @@ PyAntiGen is a declarative, object-oriented framework for generating compartment
10
48
  - **Isotope Tracking:** Natively supports tracking labeled isotopes and generating corresponding parallel reactions.
11
49
 
12
50
  ## Installation
13
- You can install PyAntiGen into your Python environment with:
51
+
52
+ PyAntiGen needs **Python 3.11 or newer**. Install it into a virtual environment
53
+ that belongs to your project, not into your system Python: the dependencies
54
+ (Tellurium/RoadRunner, SciPy, pyPESTO, ...) are large and version-sensitive,
55
+ and every result records the PyAntiGen version that produced it.
56
+
57
+ ### Recommended: a project-local environment with uv
58
+
59
+ [uv](https://docs.astral.sh/uv/) creates environments in well under a second and
60
+ installs from a shared download cache, so each additional environment costs
61
+ little disk space beyond the first. From your project folder:
62
+
63
+ ```bash
64
+ uv venv --python 3.12 .venv
65
+ uv pip install --python .venv/bin/python pyantigen # Windows: .venv\Scripts\python
66
+ ```
67
+
68
+ Activate it (`source .venv/bin/activate`, or `.venv\Scripts\activate` on
69
+ Windows), or call `.venv/bin/python` directly. For a reproducible environment,
70
+ pin exact versions in a `requirements.txt` and install with
71
+ `uv pip install -r requirements.txt`.
72
+
73
+ ### Standard library `venv` + pip
74
+
75
+ ```bash
76
+ python -m venv .venv
77
+ .venv/bin/python -m pip install pyantigen # Windows: .venv\Scripts\python
78
+ ```
79
+
80
+ A fully populated environment is roughly 0.9 GB with plain pip, so keep one per
81
+ project repository (and add `.venv/` to `.gitignore`) rather than one per model.
82
+
83
+ ### conda / mamba
84
+
14
85
  ```bash
86
+ conda create -n pyantigen python=3.12
87
+ conda activate pyantigen
15
88
  pip install pyantigen
16
89
  ```
17
90
 
18
- You can also install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
91
+ ### Check the installation
92
+
93
+ ```bash
94
+ python -c "import pyantigen, pyantigen.engine; print(pyantigen.__version__)"
95
+ ```
96
+
97
+ If a project's `AntiGen_paths.py` raises "PyAntiGen 2 ... is not installed",
98
+ the wrong environment is active: activate the one you installed into.
99
+
100
+ ### Developing PyAntiGen itself
101
+
102
+ Clone this repository and install it editable, with the test dependencies, into
103
+ its own environment:
19
104
 
20
105
  ```bash
21
106
  git clone https://github.com/elbert5770/PyAntiGen.git
22
107
  cd PyAntiGen
23
- pip install -e .
108
+ uv venv --python 3.12 .venv
109
+ uv pip install --python .venv/bin/python -e ".[test]"
110
+ .venv/bin/python -m pytest tests
24
111
  ```
25
112
 
113
+ An editable install means edits take effect immediately, in every project that
114
+ uses that environment. There is still only one copy of the Engine.
115
+
116
+ ### Migrating from 1.x
117
+
118
+ 1.x copied an `Engine/` folder into every project, so projects drifted apart.
119
+ In 2.x the Engine is `pyantigen.engine` and projects hold none. To move a
120
+ project:
121
+
122
+ * `from framework.<module> import ...` becomes `from pyantigen.generate.<module> import ...`.
123
+ * `from Engine.<module> import ...` becomes `from pyantigen.engine.<module> import ...`;
124
+ delete the project's `Engine/` folder.
125
+ * Pass `MODEL_NAME` and `REPO_ROOT` in the settings given to `setup_simulation` /
126
+ `setup_optimization_from_groups` (see `Projects/Example/Model_run.py`).
127
+ * Replace `AntiGen_paths.py` with the 2.x version from `pyantigen-create`; it
128
+ also refuses to run if the Engine is missing or a local `Engine/` reappears.
129
+ * Regenerated Antimony may differ textually (for example constant compartment
130
+ volumes are written `compartment X := V_X`); compare simulated time courses,
131
+ not file contents.
132
+
26
133
  ## Quick Start: Creating a New Model
27
134
 
28
- Because PyAntiGen is installed as a system-level Python package, you don't need a copy of the framework files in your working directory.
135
+ Because PyAntiGen is an installed package, you don't need a copy of its code in your working directory.
29
136
 
30
137
  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:
31
138
 
@@ -39,14 +146,14 @@ MyNewModel/
39
146
  ├── .agents/
40
147
  │ └── skills/ (agent skills, e.g. module generation, ODE conversion)
41
148
  ├── Projects/
42
- │ ├── Example/ (full example: generate, run + Modules/, Engine/)
149
+ │ ├── Example/ (full example: generate, run + Modules/)
43
150
  │ │ ├── Model_generate.py
44
151
  │ │ ├── Model_run.py
45
- │ │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
152
+ │ │ └── Modules/ (Data, Events, Experiment, Loss_config, Optimizer_settings, Plots, ...)
46
153
  │ └── MyNewModel/ (same structure, Modules/ pre-populated from Example)
47
154
  │ ├── Model_generate.py
48
155
  │ ├── Model_run.py
49
- │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
156
+ │ └── Modules/ (Data, Events, Experiment, Loss_config, Optimizer_settings, Plots, ...)
50
157
  ├── antimony_modules/
51
158
  │ └── __init__.py (plus Basic/ for the example)
52
159
  ├── data/ (Example experiment CSVs copied for the example)
@@ -99,5 +206,5 @@ Your own model lives under `Projects/MyNewModel/`. Modify the code for your mode
99
206
 
100
207
  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.
101
208
 
102
- 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).
209
+ 1. **Select the correct interpreter**: `Ctrl+Shift+P` (or `Cmd+Shift+P` on macOS) → **Python: Select Interpreter** → choose the environment you installed PyAntiGen into (e.g. your project's `.venv` or conda environment).
103
210
  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.
@@ -0,0 +1,98 @@
1
+ .gitignore
2
+ LICENSE
3
+ MANIFEST.in
4
+ README.md
5
+ pyproject.toml
6
+ .github/workflows/publish.yml
7
+ .github/workflows/tests.yml
8
+ .vscode/launch.json
9
+ PyAntiGen.egg-info/PKG-INFO
10
+ PyAntiGen.egg-info/SOURCES.txt
11
+ PyAntiGen.egg-info/dependency_links.txt
12
+ PyAntiGen.egg-info/entry_points.txt
13
+ PyAntiGen.egg-info/requires.txt
14
+ PyAntiGen.egg-info/scm_file_list.json
15
+ PyAntiGen.egg-info/scm_version.json
16
+ PyAntiGen.egg-info/top_level.txt
17
+ docs/PROTOCOL_LAYER.md
18
+ docs/V2_DESIGN.md
19
+ pyantigen/.gitignore
20
+ pyantigen/__init__.py
21
+ pyantigen/_version.py
22
+ pyantigen/cli.py
23
+ pyantigen/.agents/skills/module_generation/SKILL.md
24
+ pyantigen/.agents/skills/ode_conversion_antimony/SKILL.md
25
+ pyantigen/.agents/skills/ode_extraction_pipeline/SKILL.md
26
+ pyantigen/engine/Anchor_cache.py
27
+ pyantigen/engine/Deadline.py
28
+ pyantigen/engine/Differential_evolution.py
29
+ pyantigen/engine/Evaluator.py
30
+ pyantigen/engine/Event_times.py
31
+ pyantigen/engine/Fast_profile.py
32
+ pyantigen/engine/Fit_cache.py
33
+ pyantigen/engine/Identifiability.py
34
+ pyantigen/engine/Model_optimize.py
35
+ pyantigen/engine/Model_simulate.py
36
+ pyantigen/engine/Nelder_mead.py
37
+ pyantigen/engine/Noise_floor.py
38
+ pyantigen/engine/Optimize.py
39
+ pyantigen/engine/Petab_export.py
40
+ pyantigen/engine/Preequil_cache.py
41
+ pyantigen/engine/Profile_checkpoint.py
42
+ pyantigen/engine/README.md
43
+ pyantigen/engine/Results.py
44
+ pyantigen/engine/Sensitivity_analysis.py
45
+ pyantigen/engine/Simulate.py
46
+ pyantigen/engine/__init__.py
47
+ pyantigen/generate/AntimonyGen.py
48
+ pyantigen/generate/RxnDict_to_antimony.py
49
+ pyantigen/generate/TelluriumGen.py
50
+ pyantigen/generate/__init__.py
51
+ pyantigen/generate/antimony_utils.py
52
+ pyantigen/generate/data_interpolation.py
53
+ pyantigen/generate/isotopomer_tools.py
54
+ pyantigen/generate/model_generation.py
55
+ pyantigen/generate/models.py
56
+ pyantigen/generate/module_base.py
57
+ pyantigen/generate/pyantigen.py
58
+ pyantigen/generate/rate_laws.py
59
+ pyantigen/generate/reaction_creation.py
60
+ pyantigen/study/__init__.py
61
+ pyantigen/study/assay.py
62
+ pyantigen/study/describe.py
63
+ pyantigen/study/design.py
64
+ pyantigen/study/lower_v1.py
65
+ pyantigen/study/optimization.py
66
+ pyantigen/study/params.py
67
+ pyantigen/study/quantity.py
68
+ pyantigen/study/reagent.py
69
+ pyantigen/study/refs.py
70
+ pyantigen/study/remarks.py
71
+ pyantigen/study/serialize.py
72
+ pyantigen/study/validate.py
73
+ pyantigen/template/Example/AntiGen_paths.py
74
+ pyantigen/template/Example/Flipflop_reference.py
75
+ pyantigen/template/Example/Model_generate.py
76
+ pyantigen/template/Example/Model_run.py
77
+ pyantigen/template/Example/Modules/Data.py
78
+ pyantigen/template/Example/Modules/Events.py
79
+ pyantigen/template/Example/Modules/Experiment.py
80
+ pyantigen/template/Example/Modules/Loss_config.py
81
+ pyantigen/template/Example/Modules/Observed_species.py
82
+ pyantigen/template/Example/Modules/Optimizer_settings.py
83
+ pyantigen/template/Example/Modules/Plots.py
84
+ pyantigen/template/Example/Modules/Solver_settings.py
85
+ pyantigen/template/Example/Modules/Update_opt_parameters.py
86
+ pyantigen/template/Example/Modules/Update_parameters.py
87
+ pyantigen/template/Example/optimizations/Example1_ADneg.json
88
+ pyantigen/template/Example/optimizations/Example1_ADpos.json
89
+ pyantigen/template/Example/optimizations/Example3_joint.json
90
+ pyantigen/template/Example/optimizations/Example4_flipflop.json
91
+ pyantigen/template/Example/optimizations/example.py
92
+ pyantigen/template/Example/studies/example.json
93
+ pyantigen/template/Example/studies/example.py
94
+ pyantigen/template/Example/studies/flipflop.json
95
+ pyantigen/template/data/ADneg.csv
96
+ pyantigen/template/data/ADpos.csv
97
+ pyantigen/template/data/Flipflop.csv
98
+ pyantigen/template/data/make_flipflop_data.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyantigen-create = pyantigen.cli:create_project
@@ -6,3 +6,7 @@ numdifftools
6
6
  openpyxl
7
7
  matplotlib
8
8
  pypesto
9
+ SALib
10
+
11
+ [test]
12
+ pytest