PyAntiGen 1.0.4__tar.gz → 1.0.7__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 (57) hide show
  1. {pyantigen-1.0.4 → pyantigen-1.0.7}/PKG-INFO +30 -23
  2. {pyantigen-1.0.4 → pyantigen-1.0.7}/PyAntiGen.egg-info/PKG-INFO +30 -23
  3. {pyantigen-1.0.4 → pyantigen-1.0.7}/PyAntiGen.egg-info/SOURCES.txt +14 -2
  4. pyantigen-1.0.7/PyAntiGen.egg-info/entry_points.txt +2 -0
  5. {pyantigen-1.0.4 → pyantigen-1.0.7}/README.md +29 -22
  6. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/AntimonyGen.py +1 -1
  7. pyantigen-1.0.7/framework/TelluriumGen.py +16 -0
  8. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/cli.py +4 -5
  9. pyantigen-1.0.7/framework/template/Example/Engine/Evaluator.py +521 -0
  10. pyantigen-1.0.7/framework/template/Example/Engine/Model_optimize.py +704 -0
  11. pyantigen-1.0.7/framework/template/Example/Engine/Model_simulate.py +119 -0
  12. pyantigen-1.0.7/framework/template/Example/Engine/Nuisance_sensitivity.py +298 -0
  13. pyantigen-1.0.7/framework/template/Example/Engine/Optimize.py +4108 -0
  14. pyantigen-1.0.7/framework/template/Example/Engine/Petab_export.py +398 -0
  15. pyantigen-1.0.7/framework/template/Example/Engine/Profile_checkpoint.py +206 -0
  16. pyantigen-1.0.7/framework/template/Example/Engine/Results.py +244 -0
  17. pyantigen-1.0.7/framework/template/Example/Engine/Sensitivity_analysis.py +310 -0
  18. pyantigen-1.0.7/framework/template/Example/Engine/Simulate.py +350 -0
  19. pyantigen-1.0.4/framework/template/Example/Example_generate.py → pyantigen-1.0.7/framework/template/Example/Model_generate.py +7 -3
  20. pyantigen-1.0.7/framework/template/Example/Model_run.py +143 -0
  21. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/Example/Modules/Data.py +4 -4
  22. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/Example/Modules/Experiment.py +9 -9
  23. pyantigen-1.0.7/framework/template/Example/Modules/Loss_config.py +21 -0
  24. pyantigen-1.0.7/framework/template/Example/Modules/Optimizer_settings.py +140 -0
  25. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/Example/Modules/Plots.py +1 -1
  26. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/Example/Modules/Solver_settings.py +2 -1
  27. pyantigen-1.0.7/framework/template/Example/Modules/Update_opt_parameters.py +24 -0
  28. pyantigen-1.0.7/framework/template/Example/Modules/Update_parameters.py +39 -0
  29. {pyantigen-1.0.4 → pyantigen-1.0.7}/pyproject.toml +7 -1
  30. {pyantigen-1.0.4 → pyantigen-1.0.7}/setup.py +1 -1
  31. pyantigen-1.0.4/framework/TelluriumGen.py +0 -14
  32. pyantigen-1.0.4/framework/template/Example/Example_run.py +0 -37
  33. pyantigen-1.0.4/framework/template/Example/Modules/Loss_config.py +0 -12
  34. pyantigen-1.0.4/framework/template/Example/Modules/Optimizer_settings.py +0 -25
  35. pyantigen-1.0.4/framework/template/Example/Modules/Update_parameters.py +0 -26
  36. {pyantigen-1.0.4 → pyantigen-1.0.7}/LICENSE +0 -0
  37. {pyantigen-1.0.4 → pyantigen-1.0.7}/MANIFEST.in +0 -0
  38. {pyantigen-1.0.4 → pyantigen-1.0.7}/PyAntiGen.egg-info/dependency_links.txt +0 -0
  39. {pyantigen-1.0.4 → pyantigen-1.0.7}/PyAntiGen.egg-info/requires.txt +0 -0
  40. {pyantigen-1.0.4 → pyantigen-1.0.7}/PyAntiGen.egg-info/top_level.txt +0 -0
  41. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/RxnDict_to_antimony.py +0 -0
  42. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/__init__.py +0 -0
  43. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/antimony_utils.py +0 -0
  44. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/data_interpolation.py +0 -0
  45. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/isotopomer_tools.py +0 -0
  46. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/model_generation.py +0 -0
  47. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/models.py +0 -0
  48. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/module_base.py +0 -0
  49. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/pyantigen.py +0 -0
  50. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/rate_laws.py +0 -0
  51. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/reaction_creation.py +0 -0
  52. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/Example/AntiGen_paths.py +0 -0
  53. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/Example/Modules/Events.py +0 -0
  54. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/Example/Modules/Observed_species.py +0 -0
  55. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/data/ADneg.csv +0 -0
  56. {pyantigen-1.0.4 → pyantigen-1.0.7}/framework/template/data/ADpos.csv +0 -0
  57. {pyantigen-1.0.4 → pyantigen-1.0.7}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyAntiGen
3
- Version: 1.0.4
3
+ Version: 1.0.7
4
4
  Summary: Short one-line description of what PyAntiGen does
5
5
  Author: Open Source Contributor
6
6
  Author-email: Don <you@example.com>
@@ -36,8 +36,12 @@ PyAntiGen is a declarative, object-oriented framework for generating compartment
36
36
  - **Isotope Tracking:** Natively supports tracking labeled isotopes and generating corresponding parallel reactions.
37
37
 
38
38
  ## Installation
39
+ You can install PyAntiGen into your Python environment with:
40
+ ```bash
41
+ pip install pyantigen
42
+ ```
39
43
 
40
- You can install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
44
+ You can also install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
41
45
 
42
46
  ```bash
43
47
  git clone https://github.com/elbert5770/PyAntiGen.git
@@ -49,7 +53,7 @@ pip install -e .
49
53
 
50
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.
51
55
 
52
- 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:
56
+ 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:
53
57
 
54
58
  ```bash
55
59
  pyantigen-create MyNewModel
@@ -60,18 +64,16 @@ This will automatically scaffold the following project directory:
60
64
  MyNewModel/
61
65
  ├── .agents/
62
66
  │ └── skills/ (agent skills, e.g. module generation, ODE conversion)
63
- ├── scripts/
64
- │ ├── Example/ (full example: generate, run, optimize + Modules/)
65
- │ │ ├── Example_generate.py
66
- │ │ ├── Example_run.py
67
- │ │ ├── Example_optimize.py
67
+ ├── Projects/
68
+ │ ├── Example/ (full example: generate, run + Modules/, Engine/)
69
+ │ │ ├── Model_generate.py
70
+ │ │ ├── Model_run.py
68
71
  │ │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
69
- │ └── MyNewModel/ (same structure, Modules/ left empty for your code)
70
- │ ├── MyNewModel_generate.py
71
- │ ├── MyNewModel_run.py
72
- │ ├── MyNewModel_optimize.py
72
+ │ └── MyNewModel/ (same structure, Modules/ pre-populated from Example)
73
+ │ ├── Model_generate.py
74
+ │ ├── Model_run.py
73
75
  │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
74
- ├── modules/
76
+ ├── antimony_modules/
75
77
  │ └── __init__.py (plus Basic/ for the example)
76
78
  ├── data/ (Example experiment CSVs copied for the example)
77
79
  ├── antimony_models/
@@ -79,36 +81,41 @@ MyNewModel/
79
81
  ├── generated/
80
82
  │ └── Example/ (reaction dict, rules, etc. after generate)
81
83
  ├── results/
82
- │ └── Example/ (plots from Example_run.py)
84
+ │ └── Example/ (plots from Model_run.py)
83
85
  ├── SBML_models/
84
86
  └── pyantigen_settings.json (e.g. archive_with_timestamp: false)
85
87
  ```
86
88
 
87
- All model-specific files are grouped under folders named by `MODEL_NAME` (e.g. `Example` or your project name). From `MyNewModel/scripts/Example/` run:
89
+ 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:
88
90
 
89
91
  ```bash
90
- python Example_generate.py
92
+ python Model_generate.py
91
93
  ```
92
94
 
93
- 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:
95
+ 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`.
96
+
97
+ 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`.
98
+
99
+ Then, run `Model_run.py` to simulate the Example in Tellurium/RoadRunner:
94
100
 
95
101
  ```bash
96
- python Example_run.py
102
+ python Model_run.py --simulate Example
97
103
  ```
98
104
 
99
- For parameter fitting against data, run:
105
+ To run optimization examples use the --optimize flag:
100
106
 
101
107
  ```bash
102
- python Example_optimize.py
108
+ python Model_run.py --optimize Example1
109
+ python Model_run.py --optimize Example2
110
+ python Model_run.py --optimize Example3
103
111
  ```
104
112
 
105
- 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'.
113
+ 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.
106
114
 
107
- Keeping the generation and simulation steps separate gives you time to adjust parameters and inspect the generated files before running.
108
115
 
109
116
  ### Running from an IDE (Cursor / VS Code)
110
117
 
111
118
  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.
112
119
 
113
120
  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).
114
- 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.
121
+ 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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyAntiGen
3
- Version: 1.0.4
3
+ Version: 1.0.7
4
4
  Summary: Short one-line description of what PyAntiGen does
5
5
  Author: Open Source Contributor
6
6
  Author-email: Don <you@example.com>
@@ -36,8 +36,12 @@ PyAntiGen is a declarative, object-oriented framework for generating compartment
36
36
  - **Isotope Tracking:** Natively supports tracking labeled isotopes and generating corresponding parallel reactions.
37
37
 
38
38
  ## Installation
39
+ You can install PyAntiGen into your Python environment with:
40
+ ```bash
41
+ pip install pyantigen
42
+ ```
39
43
 
40
- You can install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
44
+ You can also install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
41
45
 
42
46
  ```bash
43
47
  git clone https://github.com/elbert5770/PyAntiGen.git
@@ -49,7 +53,7 @@ pip install -e .
49
53
 
50
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.
51
55
 
52
- 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:
56
+ 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:
53
57
 
54
58
  ```bash
55
59
  pyantigen-create MyNewModel
@@ -60,18 +64,16 @@ This will automatically scaffold the following project directory:
60
64
  MyNewModel/
61
65
  ├── .agents/
62
66
  │ └── skills/ (agent skills, e.g. module generation, ODE conversion)
63
- ├── scripts/
64
- │ ├── Example/ (full example: generate, run, optimize + Modules/)
65
- │ │ ├── Example_generate.py
66
- │ │ ├── Example_run.py
67
- │ │ ├── Example_optimize.py
67
+ ├── Projects/
68
+ │ ├── Example/ (full example: generate, run + Modules/, Engine/)
69
+ │ │ ├── Model_generate.py
70
+ │ │ ├── Model_run.py
68
71
  │ │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
69
- │ └── MyNewModel/ (same structure, Modules/ left empty for your code)
70
- │ ├── MyNewModel_generate.py
71
- │ ├── MyNewModel_run.py
72
- │ ├── MyNewModel_optimize.py
72
+ │ └── MyNewModel/ (same structure, Modules/ pre-populated from Example)
73
+ │ ├── Model_generate.py
74
+ │ ├── Model_run.py
73
75
  │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
74
- ├── modules/
76
+ ├── antimony_modules/
75
77
  │ └── __init__.py (plus Basic/ for the example)
76
78
  ├── data/ (Example experiment CSVs copied for the example)
77
79
  ├── antimony_models/
@@ -79,36 +81,41 @@ MyNewModel/
79
81
  ├── generated/
80
82
  │ └── Example/ (reaction dict, rules, etc. after generate)
81
83
  ├── results/
82
- │ └── Example/ (plots from Example_run.py)
84
+ │ └── Example/ (plots from Model_run.py)
83
85
  ├── SBML_models/
84
86
  └── pyantigen_settings.json (e.g. archive_with_timestamp: false)
85
87
  ```
86
88
 
87
- All model-specific files are grouped under folders named by `MODEL_NAME` (e.g. `Example` or your project name). From `MyNewModel/scripts/Example/` run:
89
+ 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:
88
90
 
89
91
  ```bash
90
- python Example_generate.py
92
+ python Model_generate.py
91
93
  ```
92
94
 
93
- 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:
95
+ 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`.
96
+
97
+ 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`.
98
+
99
+ Then, run `Model_run.py` to simulate the Example in Tellurium/RoadRunner:
94
100
 
95
101
  ```bash
96
- python Example_run.py
102
+ python Model_run.py --simulate Example
97
103
  ```
98
104
 
99
- For parameter fitting against data, run:
105
+ To run optimization examples use the --optimize flag:
100
106
 
101
107
  ```bash
102
- python Example_optimize.py
108
+ python Model_run.py --optimize Example1
109
+ python Model_run.py --optimize Example2
110
+ python Model_run.py --optimize Example3
103
111
  ```
104
112
 
105
- 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'.
113
+ 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.
106
114
 
107
- Keeping the generation and simulation steps separate gives you time to adjust parameters and inspect the generated files before running.
108
115
 
109
116
  ### Running from an IDE (Cursor / VS Code)
110
117
 
111
118
  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.
112
119
 
113
120
  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).
114
- 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.
121
+ 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.
@@ -6,6 +6,7 @@ setup.py
6
6
  PyAntiGen.egg-info/PKG-INFO
7
7
  PyAntiGen.egg-info/SOURCES.txt
8
8
  PyAntiGen.egg-info/dependency_links.txt
9
+ PyAntiGen.egg-info/entry_points.txt
9
10
  PyAntiGen.egg-info/requires.txt
10
11
  PyAntiGen.egg-info/top_level.txt
11
12
  framework/AntimonyGen.py
@@ -23,8 +24,18 @@ framework/pyantigen.py
23
24
  framework/rate_laws.py
24
25
  framework/reaction_creation.py
25
26
  framework/template/Example/AntiGen_paths.py
26
- framework/template/Example/Example_generate.py
27
- framework/template/Example/Example_run.py
27
+ framework/template/Example/Model_generate.py
28
+ framework/template/Example/Model_run.py
29
+ framework/template/Example/Engine/Evaluator.py
30
+ framework/template/Example/Engine/Model_optimize.py
31
+ framework/template/Example/Engine/Model_simulate.py
32
+ framework/template/Example/Engine/Nuisance_sensitivity.py
33
+ framework/template/Example/Engine/Optimize.py
34
+ framework/template/Example/Engine/Petab_export.py
35
+ framework/template/Example/Engine/Profile_checkpoint.py
36
+ framework/template/Example/Engine/Results.py
37
+ framework/template/Example/Engine/Sensitivity_analysis.py
38
+ framework/template/Example/Engine/Simulate.py
28
39
  framework/template/Example/Modules/Data.py
29
40
  framework/template/Example/Modules/Events.py
30
41
  framework/template/Example/Modules/Experiment.py
@@ -33,6 +44,7 @@ framework/template/Example/Modules/Observed_species.py
33
44
  framework/template/Example/Modules/Optimizer_settings.py
34
45
  framework/template/Example/Modules/Plots.py
35
46
  framework/template/Example/Modules/Solver_settings.py
47
+ framework/template/Example/Modules/Update_opt_parameters.py
36
48
  framework/template/Example/Modules/Update_parameters.py
37
49
  framework/template/data/ADneg.csv
38
50
  framework/template/data/ADpos.csv
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pyantigen-create = framework.cli:create_project
@@ -10,8 +10,12 @@ PyAntiGen is a declarative, object-oriented framework for generating compartment
10
10
  - **Isotope Tracking:** Natively supports tracking labeled isotopes and generating corresponding parallel reactions.
11
11
 
12
12
  ## Installation
13
+ You can install PyAntiGen into your Python environment with:
14
+ ```bash
15
+ pip install pyantigen
16
+ ```
13
17
 
14
- You can install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
18
+ You can also install PyAntiGen globally into your preferred Python environment by cloning this repository and running pip:
15
19
 
16
20
  ```bash
17
21
  git clone https://github.com/elbert5770/PyAntiGen.git
@@ -23,7 +27,7 @@ pip install -e .
23
27
 
24
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.
25
29
 
26
- 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:
30
+ 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:
27
31
 
28
32
  ```bash
29
33
  pyantigen-create MyNewModel
@@ -34,18 +38,16 @@ This will automatically scaffold the following project directory:
34
38
  MyNewModel/
35
39
  ├── .agents/
36
40
  │ └── skills/ (agent skills, e.g. module generation, ODE conversion)
37
- ├── scripts/
38
- │ ├── Example/ (full example: generate, run, optimize + Modules/)
39
- │ │ ├── Example_generate.py
40
- │ │ ├── Example_run.py
41
- │ │ ├── Example_optimize.py
41
+ ├── Projects/
42
+ │ ├── Example/ (full example: generate, run + Modules/, Engine/)
43
+ │ │ ├── Model_generate.py
44
+ │ │ ├── Model_run.py
42
45
  │ │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
43
- │ └── MyNewModel/ (same structure, Modules/ left empty for your code)
44
- │ ├── MyNewModel_generate.py
45
- │ ├── MyNewModel_run.py
46
- │ ├── MyNewModel_optimize.py
46
+ │ └── MyNewModel/ (same structure, Modules/ pre-populated from Example)
47
+ │ ├── Model_generate.py
48
+ │ ├── Model_run.py
47
49
  │ └── Modules/ (Data, AntimonyGen, Plots, Simulate, Optimize, Experiment, Events)
48
- ├── modules/
50
+ ├── antimony_modules/
49
51
  │ └── __init__.py (plus Basic/ for the example)
50
52
  ├── data/ (Example experiment CSVs copied for the example)
51
53
  ├── antimony_models/
@@ -53,36 +55,41 @@ MyNewModel/
53
55
  ├── generated/
54
56
  │ └── Example/ (reaction dict, rules, etc. after generate)
55
57
  ├── results/
56
- │ └── Example/ (plots from Example_run.py)
58
+ │ └── Example/ (plots from Model_run.py)
57
59
  ├── SBML_models/
58
60
  └── pyantigen_settings.json (e.g. archive_with_timestamp: false)
59
61
  ```
60
62
 
61
- All model-specific files are grouped under folders named by `MODEL_NAME` (e.g. `Example` or your project name). From `MyNewModel/scripts/Example/` run:
63
+ 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:
62
64
 
63
65
  ```bash
64
- python Example_generate.py
66
+ python Model_generate.py
65
67
  ```
66
68
 
67
- 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:
69
+ 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`.
70
+
71
+ 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`.
72
+
73
+ Then, run `Model_run.py` to simulate the Example in Tellurium/RoadRunner:
68
74
 
69
75
  ```bash
70
- python Example_run.py
76
+ python Model_run.py --simulate Example
71
77
  ```
72
78
 
73
- For parameter fitting against data, run:
79
+ To run optimization examples use the --optimize flag:
74
80
 
75
81
  ```bash
76
- python Example_optimize.py
82
+ python Model_run.py --optimize Example1
83
+ python Model_run.py --optimize Example2
84
+ python Model_run.py --optimize Example3
77
85
  ```
78
86
 
79
- 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'.
87
+ 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.
80
88
 
81
- Keeping the generation and simulation steps separate gives you time to adjust parameters and inspect the generated files before running.
82
89
 
83
90
  ### Running from an IDE (Cursor / VS Code)
84
91
 
85
92
  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.
86
93
 
87
94
  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).
88
- 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.
95
+ 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.
@@ -24,7 +24,7 @@ def AntimonyGen(MODEL_NAME, repo_root=None):
24
24
 
25
25
  if not model_text.strip():
26
26
  raise RuntimeError(
27
- f"No model content loaded. Generate the model first: python {MODEL_NAME}_generate.py"
27
+ "No model content loaded. Generate the model first: python Model_generate.py"
28
28
  )
29
29
 
30
30
  events_path = os.path.join(repo_root, "generated", MODEL_NAME, MODEL_NAME + "_events.txt")
@@ -0,0 +1,16 @@
1
+ import tellurium as te
2
+ from framework.antimony_utils import archive_antimony_snapshot
3
+
4
+ def TelluriumGen(model_text, paths, settings=None ):
5
+ print("Loading model into Tellurium...")
6
+ try:
7
+ r = te.loada(model_text)
8
+ except Exception as e:
9
+ raise RuntimeError(f"Error loading model: {e}") from e
10
+
11
+ if settings is not None:
12
+ if settings["save_SBML?"]:
13
+ sbml_content = r.getSBML()
14
+ archive_dir = archive_antimony_snapshot(paths["MODEL_NAME"], paths["repo_root"], sbml_content=sbml_content)
15
+ print(f"Archive and SBML written to: {archive_dir}")
16
+ return r
@@ -181,15 +181,14 @@ def create_project():
181
181
  os.makedirs(project_generated_dir, exist_ok=True)
182
182
  os.makedirs(project_results_dir, exist_ok=True)
183
183
 
184
- # Copy Example Projects into project folder (MODEL_NAME derived from folder name at runtime)
184
+ # Copy Model_generate.py / Model_run.py into project folder (MODEL_NAME derived from folder name at runtime)
185
185
  if os.path.isdir(example_template):
186
- for base in ("Example_generate", "Example_run"):
186
+ for base in ("Model_generate", "Model_run"):
187
187
  src = os.path.join(example_template, base + ".py")
188
188
  if os.path.isfile(src):
189
- dst_name = project_dir + base[7:] # "Example_foo" -> "{project_dir}_foo"
190
- dst = os.path.join(project_Projects_dir, dst_name + ".py")
189
+ dst = os.path.join(project_Projects_dir, base + ".py")
191
190
  shutil.copy2(src, dst)
192
- print(f" Created file: Projects/{project_dir}/{dst_name}.py")
191
+ print(f" Created file: Projects/{project_dir}/{base}.py")
193
192
 
194
193
  # Also copy AntiGen_paths.py utility
195
194
  paths_src = os.path.join(example_template, "AntiGen_paths.py")