mgrowthctrl 0.1.0__tar.gz → 0.1.1__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 (149) hide show
  1. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/LICENSE +2 -2
  2. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/PKG-INFO +13 -7
  3. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/README.md +8 -2
  4. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/__init__.py +0 -0
  5. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/.gitkeep +0 -0
  6. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/base_class_simple_example.png +0 -0
  7. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/basic_closed_loop_control_inputs.png +0 -0
  8. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/basic_closed_loop_result.png +0 -0
  9. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/basic_open_loop_control_inputs.png +0 -0
  10. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/basic_open_loop_result.png +0 -0
  11. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/closed_loop_control_inputs.png +0 -0
  12. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/closed_loop_result.png +0 -0
  13. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/crm_mcmc_example.png +0 -0
  14. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/crm_simple_example.png +0 -0
  15. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/css/customizations.css +0 -0
  16. mgrowthctrl-0.1.1/docs/_static/detoxification_example.png +0 -0
  17. mgrowthctrl-0.1.1/docs/_static/diauxic_shift_plot.png +0 -0
  18. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/example_plot.png +0 -0
  19. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/example_plot_adjusted_rates.png +0 -0
  20. mgrowthctrl-0.1.1/docs/_static/glv_discrete_transplant.png +0 -0
  21. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/mcmc_error.png +0 -0
  22. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/open_loop_control_inputs.png +0 -0
  23. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/open_loop_result.png +0 -0
  24. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_static/param_dist.png +0 -0
  25. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_templates/autosummary/class.rst +0 -0
  26. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_templates/autosummary/function.rst +0 -0
  27. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/_templates/autosummary/module.rst +0 -0
  28. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/conf.py +0 -0
  29. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/control/base.rst +0 -0
  30. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/control/closed_loop.rst +0 -0
  31. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/control/introduction.rst +0 -0
  32. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/control/open_loop.rst +0 -0
  33. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/fitting/lsq.rst +0 -0
  34. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/fitting/mcmc.rst +0 -0
  35. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/index.rst +5 -0
  36. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/intro/get_started.rst +0 -0
  37. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/intro/installation.rst +6 -0
  38. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/models/base_model.rst +1 -1
  39. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/models/consumer_resource_model.rst +2 -2
  40. mgrowthctrl-0.1.1/docs/models/diauxic_shift_model.rst +193 -0
  41. mgrowthctrl-0.1.1/docs/models/generalized_lotka_volterra_model.rst +53 -0
  42. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/requirements.txt +0 -0
  43. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/tutorials/advanced_closed_loop_control_fitting.rst +0 -0
  44. mgrowthctrl-0.1.1/docs/tutorials/advanced_detoxification.rst +156 -0
  45. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/tutorials/advanced_open_loop_control_fitting.rst +0 -0
  46. mgrowthctrl-0.1.1/docs/tutorials/foodnet_crm.rst +156 -0
  47. mgrowthctrl-0.1.1/docs/tutorials/glv_discrete_transplant.rst +306 -0
  48. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/tutorials/simple_crm.rst +0 -0
  49. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/utilities/data_loader.rst +92 -2
  50. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/utilities/saving.rst +0 -0
  51. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/docs/utilities/visualization.rst +0 -0
  52. mgrowthctrl-0.1.1/example_plot_metabolites.png +0 -0
  53. mgrowthctrl-0.1.1/example_plot_species.png +0 -0
  54. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/datasets/BT_WC_export.csv +0 -0
  55. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/datasets/BT_WC_export_average.csv +0 -0
  56. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/datasets/Control.csv +0 -0
  57. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/datasets/No_perturbations_6species.csv +0 -0
  58. mgrowthctrl-0.1.0/src/mgrowthctrl/__init__.py → mgrowthctrl-0.1.1/examples/datasets/SMGDB00000002/.gitkeep +0 -0
  59. mgrowthctrl-0.1.1/examples/datasets/SMGDB00000002/README.md +19 -0
  60. mgrowthctrl-0.1.1/examples/datasets/SMGDB00000002/RI_WC.csv +15 -0
  61. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/datasets/SMGDB00000011/README.md +0 -0
  62. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/datasets/SMGDB00000011/no_perturbations.csv +0 -0
  63. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/datasets/bhbtri_3species.csv +0 -0
  64. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/single_species_fits/01_lsq_fit_metabolites.png +0 -0
  65. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/single_species_fits/01_lsq_fit_species.png +0 -0
  66. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/single_species_fits/02_mcmc_error.png +0 -0
  67. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/single_species_fits/03_param_dist.png +0 -0
  68. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/single_species_fits/04_final_mcmc_fit_metabolites.png +0 -0
  69. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/single_species_fits/04_final_mcmc_fit_species.png +0 -0
  70. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/single_species_fits/single_species_trajectory.csv +0 -0
  71. mgrowthctrl-0.1.1/examples/results/six_plus_one_species_fits_with_metabolites/00_initial_simulation_metabolites.png +0 -0
  72. mgrowthctrl-0.1.1/examples/results/six_plus_one_species_fits_with_metabolites/00_initial_simulation_species.png +0 -0
  73. mgrowthctrl-0.1.1/examples/results/six_plus_one_species_fits_with_metabolites/01_initial_simulation_samples_metabolites.png +0 -0
  74. mgrowthctrl-0.1.1/examples/results/six_plus_one_species_fits_with_metabolites/01_initial_simulation_samples_metabolites_Nissle.png +0 -0
  75. mgrowthctrl-0.1.1/examples/results/six_plus_one_species_fits_with_metabolites/01_initial_simulation_samples_species.png +0 -0
  76. mgrowthctrl-0.1.1/examples/results/six_plus_one_species_fits_with_metabolites/01_initial_simulation_samples_species_Nissle.png +0 -0
  77. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/six_species_fits/00_initial_simulation_metabolites.png +0 -0
  78. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/six_species_fits/00_initial_simulation_species.png +0 -0
  79. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/six_species_fits/01_lsq_fit_metabolites.png +0 -0
  80. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/six_species_fits/6_species_trajectory.csv +0 -0
  81. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/six_species_fits_with_metabolites/00_initial_simulation_metabolites.png +0 -0
  82. mgrowthctrl-0.1.1/examples/results/six_species_fits_with_metabolites/00_initial_simulation_species.png +0 -0
  83. mgrowthctrl-0.1.1/examples/results/six_species_fits_with_metabolites/01_initial_simulation_samples_metabolites.png +0 -0
  84. mgrowthctrl-0.1.1/examples/results/six_species_fits_with_metabolites/01_initial_simulation_samples_species.png +0 -0
  85. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits/01_lsq_fit_metabolites.png +0 -0
  86. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits/01_lsq_fit_species.png +0 -0
  87. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits/3_species_trajectory.csv +0 -0
  88. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits_chemostat/00_initial_simulation_metabolites.png +0 -0
  89. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits_chemostat/00_initial_simulation_species.png +0 -0
  90. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits_chemostat/01_lsq_fit_metabolites.png +0 -0
  91. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits_chemostat/01_lsq_fit_species.png +0 -0
  92. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/results/three_species_fits_chemostat/3_species_chemostat_trajectory.csv +0 -0
  93. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/run_fitting_3species_batch.ipynb +0 -0
  94. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/run_fitting_3species_chemostat.ipynb +0 -0
  95. mgrowthctrl-0.1.1/examples/run_fitting_6+1_species_chemostat_with_metabolites.ipynb +1203 -0
  96. mgrowthctrl-0.1.1/examples/run_fitting_6+1_species_chemostat_with_metabolites_after_equilibration.ipynb +1295 -0
  97. mgrowthctrl-0.1.1/examples/run_fitting_6+1_species_chemostat_with_metabolites_robustness_check.ipynb +1295 -0
  98. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/run_fitting_6species_chemostat.ipynb +0 -0
  99. mgrowthctrl-0.1.1/examples/run_fitting_6species_chemostat_with_metabolites.ipynb +1229 -0
  100. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/examples/run_fitting_single.ipynb +0 -0
  101. mgrowthctrl-0.1.1/experiment_push_plot_metabolites.png +0 -0
  102. mgrowthctrl-0.1.1/experiment_push_plot_species.png +0 -0
  103. mgrowthctrl-0.1.1/experiment_push_test.py +50 -0
  104. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/pyproject.toml +3 -3
  105. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/scripts/extract_doc_examples.py +0 -0
  106. {mgrowthctrl-0.1.0/src/mgrowthctrl/utils → mgrowthctrl-0.1.1/src/mgrowthctrl}/__init__.py +0 -0
  107. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/backends/__init__.py +0 -0
  108. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/backends/array.py +1 -1
  109. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/controllers/__init__.py +0 -0
  110. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/controllers/base.py +5 -6
  111. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/controllers/closed_loop.py +0 -0
  112. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/controllers/open_loop.py +0 -0
  113. mgrowthctrl-0.1.1/src/mgrowthctrl/models/__init__.py +3 -0
  114. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/models/base.py +25 -9
  115. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/models/crm/fit.py +0 -0
  116. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/models/crm/model.py +2 -3
  117. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/models/crm/utils.py +0 -0
  118. mgrowthctrl-0.1.1/src/mgrowthctrl/models/glv.py +140 -0
  119. mgrowthctrl-0.1.1/src/mgrowthctrl/utils/__init__.py +0 -0
  120. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/utils/data.py +192 -26
  121. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/utils/plot.py +10 -8
  122. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/src/mgrowthctrl/utils/save.py +8 -8
  123. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/tags +32 -6
  124. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/tests/conftest.py +0 -0
  125. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/tests/test_base_controller.py +0 -0
  126. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/tests/test_dataloader.py +124 -1
  127. mgrowthctrl-0.1.1/tests/test_glv.py +112 -0
  128. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/tests/test_models.py +1 -1
  129. mgrowthctrl-0.1.1/workspace_push_test.py +41 -0
  130. mgrowthctrl-0.1.0/TODO.md +0 -11
  131. mgrowthctrl-0.1.0/example_plot_metabolites.png +0 -0
  132. mgrowthctrl-0.1.0/example_plot_species.png +0 -0
  133. mgrowthctrl-0.1.0/examples/results/six_species_fits_with_metabolites/00_initial_simulation_species.png +0 -0
  134. mgrowthctrl-0.1.0/examples/results/six_species_fits_with_metabolites/01_lsq_fit_metabolites.png +0 -0
  135. mgrowthctrl-0.1.0/examples/results/six_species_fits_with_metabolites/01_lsq_fit_species.png +0 -0
  136. mgrowthctrl-0.1.0/examples/results/six_species_fits_with_metabolites/6_species_trajectory.csv +0 -501
  137. mgrowthctrl-0.1.0/examples/run_fitting_6species_chemostat_with_metabolites.ipynb +0 -1123
  138. mgrowthctrl-0.1.0/src/mgrowthctrl/models/__init__.py +0 -2
  139. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/.flake8 +0 -0
  140. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/.gitignore +0 -0
  141. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/.gitlab-ci.yml +0 -0
  142. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/.python_tools.json +0 -0
  143. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/.readthedocs.yaml +0 -0
  144. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/_project.vim +0 -0
  145. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/plot_test.py +0 -0
  146. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/run_plot_example.py +0 -0
  147. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/saved_data.csv +0 -0
  148. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/scripts/build-docs +0 -0
  149. {mgrowthctrl-0.1.0 → mgrowthctrl-0.1.1}/tmp.csv +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Jiawei Li, Thomas Asikis, Ioannis Fragkos, and Lucas Boettcher
3
+ Copyright (c) 2026, I. Thelaganathan, A. Radev, J. Li, L. Böttcher.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
21
+ SOFTWARE.
@@ -1,14 +1,14 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: mgrowthctrl
3
- Version: 0.1.0
4
- Summary: mgrowthctrl is a software package for modeling, visualization, and control of microbiome growth dynamics. It provides tools to simulate microbial community dynamics, fit predictive models to experimental data, and steer community composition using control and optimization methods.
3
+ Version: 0.1.1
4
+ Summary: mGrowthCtrl is a software package for modeling, visualization, and control of microbiome growth dynamics. It provides tools to simulate microbial community dynamics, fit predictive models to experimental data, and steer community composition using control and optimization methods.
5
5
  Project-URL: Homepage, https://gitlab.com/ComputationalScience/mgrowthctrl
6
6
  Project-URL: Documentation, https://mgrowthctrl.readthedocs.io/en/latest/
7
7
  Project-URL: Issues, https://gitlab.com/ComputationalScience/mgrowthctrl/-/issues
8
- Author-email: Indrah Thelaganathan <indrah2003@gmail.com>, Andrew Radev <andrey.radev@gmail.com>, Jiawei Li <pushup-prong-ashen@duck.com>, Lucas Boettcher <l.boettcher@fs.de>
8
+ Author-email: Lucas Boettcher <l.boettcher@fs.de>, Indrah Thelaganathan <indrah2003@gmail.com>, Andrew Radev <andrey.radev@gmail.com>, Jiawei Li <pushup-prong-ashen@duck.com>
9
9
  License: MIT License
10
10
 
11
- Copyright (c) 2021 Jiawei Li, Thomas Asikis, Ioannis Fragkos, and Lucas Boettcher
11
+ Copyright (c) 2026, I. Thelaganathan, A. Radev, J. Li, L. Böttcher.
12
12
 
13
13
  Permission is hereby granted, free of charge, to any person obtaining a copy
14
14
  of this software and associated documentation files (the "Software"), to deal
@@ -49,7 +49,7 @@ Description-Content-Type: text/markdown
49
49
 
50
50
  # mgrowthctrl
51
51
 
52
- A Python package for parameter inference, mechanistic microbiome modeling, and control, based on a consumer–resource model (CRM).
52
+ A Python package for parameter inference, mechanistic microbiome modeling, and control, with consumer–resource (CRM) and generalized Lotka–Volterra (gLV) models.
53
53
 
54
54
  Detailed documentation is available at [Documentation](https://mgrowthctrl.readthedocs.io/en/latest/).
55
55
 
@@ -57,7 +57,7 @@ Key features of mgrowthctrl include:
57
57
 
58
58
  - An API for defining and simulating ODE-based microbiome dynamics.
59
59
  - A data loader that allows users to retrieve data from [mGrowthDB](https://mgrowthdb.gbiomed.kuleuven.be).
60
- - A parameter estimation backend offering both least-squares and Markov Chain Monte Carlo (MCMC) optimization.
60
+ - A parameter estimation backend for the CRM offering both least-squares and Markov Chain Monte Carlo (MCMC) optimization.
61
61
  - Built-in visualization utilities for evaluating trajectories and analyzing posteriors.
62
62
  - A controller framework based on neural ODEs.
63
63
  - A modular architecture designed to facilitate the extension and integration of custom models, controllers, and data processing workflows.
@@ -65,7 +65,9 @@ Key features of mgrowthctrl include:
65
65
  ## Features
66
66
 
67
67
  ### Models
68
+
68
69
  - An implementation of a CRM (`CRModel`).
70
+ - A species-only gLV model (`GLVModel`) with intrinsic growth rates and pairwise interactions.
69
71
  - Scalable design supporting both single-species and multi-species systems.
70
72
  - A unified engine (`BaseODEModel`) with NumPy and PyTorch backends.
71
73
  - Extensible base classes enabling straightforward implementation of custom ODE models.
@@ -77,6 +79,9 @@ Key features of mgrowthctrl include:
77
79
 
78
80
 
79
81
  ### Fitting Backend
82
+
83
+ Parameter fitting is currently available for the CRM.
84
+
80
85
  - Least-squares parameter optimization (`crm_fit_mechanistic`).
81
86
  - Bayesian parameter inference through MCMC sampling (`crm_fit_mcmc`).
82
87
 
@@ -101,6 +106,7 @@ src/mgrowthctrl/
101
106
  │
102
107
  ├── models/
103
108
  │ ├── base.py # ODE base class (uses dependency injection)
109
+ │ ├── glv.py # Generalized Lotka–Volterra model and parameters
104
110
  │ └── crm/
105
111
  │ ├── fit.py # LSQ + MCMC fitting engine
106
112
  │ ├── model.py # Mechanistic CRM using BaseODEModel
@@ -3,7 +3,7 @@
3
3
 
4
4
  # mgrowthctrl
5
5
 
6
- A Python package for parameter inference, mechanistic microbiome modeling, and control, based on a consumer–resource model (CRM).
6
+ A Python package for parameter inference, mechanistic microbiome modeling, and control, with consumer–resource (CRM) and generalized Lotka–Volterra (gLV) models.
7
7
 
8
8
  Detailed documentation is available at [Documentation](https://mgrowthctrl.readthedocs.io/en/latest/).
9
9
 
@@ -11,7 +11,7 @@ Key features of mgrowthctrl include:
11
11
 
12
12
  - An API for defining and simulating ODE-based microbiome dynamics.
13
13
  - A data loader that allows users to retrieve data from [mGrowthDB](https://mgrowthdb.gbiomed.kuleuven.be).
14
- - A parameter estimation backend offering both least-squares and Markov Chain Monte Carlo (MCMC) optimization.
14
+ - A parameter estimation backend for the CRM offering both least-squares and Markov Chain Monte Carlo (MCMC) optimization.
15
15
  - Built-in visualization utilities for evaluating trajectories and analyzing posteriors.
16
16
  - A controller framework based on neural ODEs.
17
17
  - A modular architecture designed to facilitate the extension and integration of custom models, controllers, and data processing workflows.
@@ -19,7 +19,9 @@ Key features of mgrowthctrl include:
19
19
  ## Features
20
20
 
21
21
  ### Models
22
+
22
23
  - An implementation of a CRM (`CRModel`).
24
+ - A species-only gLV model (`GLVModel`) with intrinsic growth rates and pairwise interactions.
23
25
  - Scalable design supporting both single-species and multi-species systems.
24
26
  - A unified engine (`BaseODEModel`) with NumPy and PyTorch backends.
25
27
  - Extensible base classes enabling straightforward implementation of custom ODE models.
@@ -31,6 +33,9 @@ Key features of mgrowthctrl include:
31
33
 
32
34
 
33
35
  ### Fitting Backend
36
+
37
+ Parameter fitting is currently available for the CRM.
38
+
34
39
  - Least-squares parameter optimization (`crm_fit_mechanistic`).
35
40
  - Bayesian parameter inference through MCMC sampling (`crm_fit_mcmc`).
36
41
 
@@ -55,6 +60,7 @@ src/mgrowthctrl/
55
60
  │
56
61
  ├── models/
57
62
  │ ├── base.py # ODE base class (uses dependency injection)
63
+ │ ├── glv.py # Generalized Lotka–Volterra model and parameters
58
64
  │ └── crm/
59
65
  │ ├── fit.py # LSQ + MCMC fitting engine
60
66
  │ ├── model.py # Mechanistic CRM using BaseODEModel
File without changes
@@ -52,8 +52,11 @@ Example Usage
52
52
  :caption: Tutorials
53
53
 
54
54
  tutorials/simple_crm
55
+ tutorials/foodnet_crm
56
+ tutorials/advanced_detoxification
55
57
  tutorials/advanced_open_loop_control_fitting
56
58
  tutorials/advanced_closed_loop_control_fitting
59
+ tutorials/glv_discrete_transplant
57
60
 
58
61
  .. toctree::
59
62
  :hidden:
@@ -61,6 +64,8 @@ Example Usage
61
64
  :caption: Models
62
65
 
63
66
  models/consumer_resource_model
67
+ models/generalized_lotka_volterra_model
68
+ models/diauxic_shift_model
64
69
  models/base_model
65
70
 
66
71
  .. toctree::
@@ -35,6 +35,12 @@ environment:
35
35
 
36
36
  pip install -e .
37
37
 
38
+ You can also install the package via `PyPi <https://pypi.org/project/mgrowthctrl/>`_:
39
+
40
+ .. code-block:: bash
41
+
42
+ pip install mgrowthctrl
43
+
38
44
  For optional features (neural controllers and MCMC), install with extras:
39
45
 
40
46
  .. code-block:: bash
@@ -2,7 +2,7 @@
2
2
  Advanced: Base Model Class
3
3
  **************************
4
4
 
5
- The :class:`~mgrowthctrl.models.base.BaseODEModel` class provides the foundation for adding ODE-based models to `mGrowthCtrl`. It handles numerical integration, backend selection (`NumPy` or `PyTorch`), and provides hooks for control inputs. The :class:`~mgrowthctrl.models.crm.model.CRModel` is currently the main concrete subclass (see :doc:`consumer_resource_model`).
5
+ The :class:`~mgrowthctrl.models.base.BaseODEModel` class provides the foundation for adding ODE-based models to `mGrowthCtrl`. It handles numerical integration, backend selection (`NumPy` or `PyTorch`), and provides hooks for control inputs. Concrete subclasses include :class:`~mgrowthctrl.models.crm.model.CRModel` (see :doc:`consumer_resource_model`) and the species-only :class:`~mgrowthctrl.models.glv.GLVModel` (see :doc:`generalized_lotka_volterra_model`).
6
6
 
7
7
  Overview
8
8
  ========
@@ -2,7 +2,7 @@
2
2
  Consumer-Resource Model
3
3
  ***********************
4
4
 
5
- In this section, we provide background information on the equations used in the mechanistic :class:`~mgrowthctrl.models.crm.model.CRModel`. There exist several variants of consumer-resource models in the literature, see the references below. The consumer–resource model we use is inspired by Niehaus et al. (2019) and builds on Monod kinetics, extending it to multi-species, multi-resource systems.
5
+ Here, we provide background information on the equations used in the mechanistic :class:`~mgrowthctrl.models.crm.model.CRModel`. There exist several variants of consumer-resource models in the literature, see the references below. The consumer–resource model we use is inspired by Niehaus et al. (2019) and builds on Monod kinetics, extending it to multi-species, multi-resource systems.
6
6
 
7
7
  Assumptions
8
8
  ===========
@@ -34,7 +34,7 @@ Including the death rate of species :math:`i`, :math:`k_i`, and dilution :math:`
34
34
 
35
35
  .. math::
36
36
 
37
- \frac{\mathrm{d}X_i}{\mathrm{d}t} = X_i (\mu_i(\mathbf{S}) - k_i - D)= X_i \left( \sum_{j=1}^{m} r_{ij} \mu_{ij}(S_j) - k_i - D \right)\,.
37
+ \frac{\mathrm{d}X_i}{\mathrm{d}t} = X_i (\mu_i(\mathbf{S}) - k_i - D)= X_i \left( \sum_{j=1}^{m} \mu_{ij}(S_j) - k_i - D \right)\,.
38
38
 
39
39
  In the :class:`~mgrowthctrl.models.crm.model.CRModel` implementation, the dilution :math:`D` can be either constant or time-dependent.
40
40
 
@@ -0,0 +1,193 @@
1
+ ******************************
2
+ Advanced: Diauxic Shift Model
3
+ ******************************
4
+
5
+ This example is based on `Roseburia intestinalis` growth data from
6
+ `mGrowthDB study SMGDB00000002 <https://mgrowthdb.gbiomed.kuleuven.be/study/SMGDB00000002/>`_ and shows how to implement diauxic-shift behavior as a small extension of the :class:`~mgrowthctrl.models.crm.model.CRModel`. The model follows the standard consumer-resource equations, but secondary-substrate uptake is suppressed while glucose is available.
7
+
8
+ We model the switch using
9
+
10
+ .. math::
11
+
12
+ \phi(S_{\mathrm{glucose}}) =
13
+ \frac{K_{\mathrm{shift}}}{K_{\mathrm{shift}} + S_{\mathrm{glucose}}}\,.
14
+
15
+ When glucose is abundant, :math:`\phi` is close to zero, so secondary-substrate uptake is nearly switched off. As glucose is depleted, :math:`\phi` approaches one and secondary-substrate uptake is switched on.
16
+
17
+ Custom CRM Class
18
+ ================
19
+
20
+ The example below uses the NumPy backend and overrides only :meth:`~mgrowthctrl.models.base.BaseODEModel.compute_rhs`. All other functionalities are inherited from :class:`~mgrowthctrl.models.crm.model.CRModel`.
21
+
22
+ .. code-block:: python
23
+
24
+ class DiauxicShiftCRModel(CRModel):
25
+ """CRM with glucose-gated secondary-substrate uptake."""
26
+
27
+ def __init__(
28
+ self,
29
+ names,
30
+ params,
31
+ *,
32
+ K_shift,
33
+ glucose_idx,
34
+ secondary_idxs,
35
+ post_glucose_secretion_factors=None,
36
+ ):
37
+ super().__init__(names=names, params=params, backend="numpy")
38
+ self.K_shift = float(K_shift)
39
+ self.glucose_idx = int(glucose_idx)
40
+ self.secondary_idxs = list(secondary_idxs)
41
+
42
+ # Fraction of secretion that remains after glucose depletion.
43
+ # Unspecified secondary substrates default to zero.
44
+ self.post_glucose_secretion_factors = {
45
+ int(j): float(v)
46
+ for j, v in (post_glucose_secretion_factors or {}).items()
47
+ }
48
+
49
+ def compute_rhs(self, t, X, S):
50
+ X_kin = np.maximum(np.asarray(X, dtype=float), 0.0)
51
+ S_arr = np.asarray(S, dtype=float)
52
+ S_kin = np.maximum(S_arr, 0.0)
53
+ D = self._D_at(t)
54
+
55
+ # Low during glucose availability, high after glucose depletion.
56
+ phi = self.K_shift / (self.K_shift + S_kin[self.glucose_idx] + 1e-12)
57
+
58
+ # Diauxic shift: suppress secondary-substrate growth rates by phi.
59
+ r_eff = self.r.copy()
60
+ r_eff[:, self.secondary_idxs] *= phi
61
+
62
+ # Glucose-dependent byproduct secretion.
63
+ b_eff = self.b.copy()
64
+ for j in self.secondary_idxs:
65
+ residual = self.post_glucose_secretion_factors.get(j, 0.0)
66
+ b_eff[:, j] *= (1.0 - phi) + phi * residual
67
+
68
+ monod = S_kin[None, :] / (S_kin[None, :] + self.K_ij + 1e-12)
69
+ growth_terms = r_eff * monod
70
+
71
+ growth = growth_terms.sum(axis=1)
72
+ secretion = (b_eff * X_kin[:, None]).sum(axis=0)
73
+ uptake = (self.a * growth_terms * X_kin[:, None]).sum(axis=0)
74
+
75
+ dX_dt = (growth - self.k - D) * X_kin
76
+ dS_dt = secretion - uptake + D * (self.S_in - S_arr)
77
+ return dX_dt, dS_dt
78
+
79
+ Load Data and Build the Model
80
+ =============================
81
+
82
+ The parameters are initialized manually; no fitting optimizer is called.
83
+
84
+ .. code-block:: python
85
+
86
+ from mgrowthctrl.utils.data import Dataloader
87
+
88
+ data = Dataloader()
89
+ data.load_local_data(
90
+ "examples/datasets/SMGDB00000002/RI_WC.csv",
91
+ x_selector=r"Cells",
92
+ s_selector=[
93
+ "acetate (mM)", "butyrate (mM)", "formate (mM)", "glucose (mM)",
94
+ "lactate (mM)", "pyruvate (mM)", "trehalose (mM)",
95
+ ],
96
+ )
97
+
98
+ s_names = data.S_names
99
+ idx = {name: s_names.index(name) for name in s_names}
100
+
101
+ params = CRModelParams.from_shapes(n=1, m=len(s_names))
102
+ params.K_ij[0] = 2.0 * data.df[s_names].max().to_numpy(dtype=float)
103
+
104
+ model = DiauxicShiftCRModel(
105
+ names=data.names,
106
+ params=params,
107
+ K_shift=0.5,
108
+ glucose_idx=idx["glucose (mM)"],
109
+ secondary_idxs=[
110
+ idx[c] for c in ["acetate (mM)", "lactate (mM)", "butyrate (mM)"]
111
+ ],
112
+ post_glucose_secretion_factors={
113
+ idx["butyrate (mM)"]: 1.5e-2,
114
+ },
115
+ )
116
+
117
+ Parameters that remain zero are inactive. For example, we assume trehalose consumption to be vanishingly small, which is consistent with the underlying data. The ``post_glucose_secretion_factors`` argument specifies the fraction of
118
+ byproduct secretion that remains after glucose depletion. Here, butyrate keeps a small residual secretion rate, while acetate and lactate secretion vanish after glucose is depleted.
119
+
120
+ The nonzero entries below specify primary growth on glucose and pyruvate, delayed use of lactate and acetate, and glucose-coupled production of selected byproducts.
121
+
122
+ .. code-block:: python
123
+
124
+ p = model.get_params()
125
+
126
+ p.r[0, idx["glucose (mM)"]] = 0.9
127
+ p.a[0, idx["glucose (mM)"]] = 1e-8
128
+
129
+ p.r[0, idx["pyruvate (mM)"]] = 0.7
130
+ p.a[0, idx["pyruvate (mM)"]] = 1e-8
131
+
132
+ p.r[0, idx["lactate (mM)"]] = 3e-4
133
+ p.a[0, idx["lactate (mM)"]] = 1e-6
134
+ p.b[0, idx["lactate (mM)"]] = 6e-10
135
+
136
+ p.r[0, idx["acetate (mM)"]] = 8e-6
137
+ p.a[0, idx["acetate (mM)"]] = 1e-5
138
+ p.b[0, idx["acetate (mM)"]] = 1.1e-9
139
+
140
+ p.b[0, idx["butyrate (mM)"]] = 1.8e-9
141
+ p.b[0, idx["formate (mM)"]] = 6e-12
142
+ p.k[0] = 0.03
143
+
144
+ model.set_params(p)
145
+
146
+ Simulation
147
+ ==========
148
+
149
+ We will now simulate the model and plot the results.
150
+
151
+ .. code-block:: python
152
+
153
+ from mgrowthctrl.utils.plot import plot_data_with_overlay
154
+
155
+ t_sim = np.linspace(data.start_time, data.end_time, 500)
156
+ sim = model.simulate(data.y0, t_sim)
157
+
158
+ plot_data_with_overlay(
159
+ df=data.df,
160
+ sim=sim,
161
+ overlay="both",
162
+ time_col=data.time_col,
163
+ x_cols=data.X_names,
164
+ s_cols=data.S_names,
165
+ save_prefix="diauxic_shift_plot",
166
+ )
167
+
168
+ Here's what the diauxic-shift simulation looks like:
169
+
170
+ .. image:: ../_static/diauxic_shift_plot.png
171
+ :alt: Diauxic shift model simulation
172
+ :align: center
173
+
174
+ Optional: Parameter Fitting
175
+ ---------------------------
176
+
177
+ One can also let the custom model use the inherited :meth:`~mgrowthctrl.models.crm.model.CRModel.fit_least_squares` method.
178
+
179
+ .. code-block:: python
180
+
181
+ # Optional: Adjust parameters with the inherited CRM optimizer.
182
+ # This updates the model parameters in place.
183
+
184
+ theta_opt, sim_fit, fit_info = model.fit_least_squares(
185
+ df=data.df,
186
+ time_col=data.time_col,
187
+ x_cols=data.X_names,
188
+ s_cols=data.S_names,
189
+ include_metabolites=True,
190
+ weight="median",
191
+ )
192
+
193
+ print(f"Converged: {fit_info['success']} residual: {fit_info['cost']:.4g}")
@@ -0,0 +1,53 @@
1
+ ***************************************
2
+ Generalized Lotka--Volterra Model (gLV)
3
+ ***************************************
4
+
5
+ The :class:`~mgrowthctrl.models.glv.GLVModel` describes a community through intrinsic growth rates and pairwise interactions. Unlike the :doc:`consumer_resource_model`, it does not track explicit resources.
6
+
7
+ Species dynamics
8
+ ================
9
+
10
+ For species abundances :math:`X_i`, the equations are
11
+
12
+ .. math::
13
+
14
+ \frac{\mathrm{d}X_i}{\mathrm{d}t} = X_i\left(b_i + \sum_{j=1}^{n} m_{ij}X_j\right)\,,
15
+
16
+ where :math:`b` is growth-rate vector and interaction-matrix entries :math:`m_{ij}` describe the
17
+ effect of species :math:`j` on species :math:`i`. Positive values promote growth and negative values inhibit growth. Diagonal entries describe self-interactions.
18
+
19
+ Usage
20
+ =====
21
+
22
+ Names and parameters follow the same conventions as the consumer--resource model. We set ``S=[]`` because gLV has no resource states.
23
+
24
+ .. code-block:: python
25
+
26
+ import numpy as np
27
+ from mgrowthctrl.models import GLVModel, GLVModelParams, ModelNames
28
+
29
+ names = ModelNames(X=["species A", "species B"], S=[])
30
+ params = GLVModelParams(
31
+ b=np.array([0.5, 0.3]),
32
+ M=np.array([[-0.5, -0.1], [-0.2, -0.4]]),
33
+ )
34
+ model = GLVModel(names=names, params=params)
35
+ times = np.linspace(0, 20, 101)
36
+ sim = model.simulate(y0=[0.1, 0.2], t=times)
37
+
38
+ print(sim.X.shape) # (2, 101): species by time
39
+ print(sim.S.shape) # (0, 101): no explicit resources
40
+
41
+ The inherited ``predict``, ``solve``, and ``evaluate`` methods are available. For positive initial abundances, ``log_space=True`` integrates the logarithms of abundances. The base solver clips zero initial abundances to a small positive value in that mode.
42
+
43
+ Both "numpy" and "torch" backends are supported. You can set the backend when constructing a model by providing the string "numpy" or "torch", or an instance of ``NumpyBackend`` or ``TorchBackend`` from the ``mgrowthctrl.backends`` module (see :doc:`base_model`). This model does not yet provide parameter-fitting methods.
44
+
45
+ For a control example, see the :doc:`../tutorials/glv_discrete_transplant` tutorial.
46
+
47
+ API documentation
48
+ =================
49
+
50
+ .. automodule:: mgrowthctrl.models.glv
51
+ :members:
52
+ :member-order: bysource
53
+ :show-inheritance: