Skip to main content

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.

Project description

Latest release Tests

mgrowthctrl

A Python package for parameter inference, mechanistic microbiome modeling, and control, based on a consumer–resource model (CRM).

Detailed documentation is available at Documentation.

Key features of mgrowthctrl include:

  • An API for defining and simulating ODE-based microbiome dynamics.
  • A data loader that allows users to retrieve data from mGrowthDB.
  • A parameter estimation backend offering both least-squares and Markov Chain Monte Carlo (MCMC) optimization.
  • Built-in visualization utilities for evaluating trajectories and analyzing posteriors.
  • A controller framework based on neural ODEs.
  • A modular architecture designed to facilitate the extension and integration of custom models, controllers, and data processing workflows.

Features

Models

  • An implementation of a CRM (CRModel).
  • Scalable design supporting both single-species and multi-species systems.
  • A unified engine (BaseODEModel) with NumPy and PyTorch backends.
  • Extensible base classes enabling straightforward implementation of custom ODE models.

Controllers

  • BaseController provides an abstract interface with simulate and fit methods.
  • OpenLoopNeuralController implements time-dependent control functions.
  • ClosedLoopNeuralController implements state-dependent control functions.

Fitting Backend

  • Least-squares parameter optimization (crm_fit_mechanistic).
  • Bayesian parameter inference through MCMC sampling (crm_fit_mcmc).

Plotting

  • Tools for visualizing coupled metabolite and species population dynamics.
  • Plots of empirical data, spline interpolations, and simulated trajectories.
  • Integration of MCMC outputs to show credible intervals.

Code Structure

src/mgrowthctrl/

├── backends/
   ├── array.py        # Array backend interfaces for NumPy and PyTorch
   └── __init__.py

├── controllers/
   ├── base.py         # BaseController interface with simulate and fit methods
   ├── closed_loop.py  # ClosedLoopNeuralController
   └── open_loop.py    # OpenLoopNeuralController

├── models/
   ├── base.py         # ODE base class (uses dependency injection)
   └── crm/
       ├── fit.py      # LSQ + MCMC fitting engine
       ├── model.py    # Mechanistic CRM using BaseODEModel
       └── utils.py    # Shared utilities

├── utils/
   ├── data.py         # Data loading functions with a public DataLoader-style API
   ├── plot.py         # Plotting utilities
   ├── save.py         # Saving / loading utilities
   └── __init__.py

└── __init__.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mgrowthctrl-0.1.0.tar.gz (17.9 MB view details)

Uploaded Source

Built Distribution

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

mgrowthctrl-0.1.0-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file mgrowthctrl-0.1.0.tar.gz.

File metadata

  • Download URL: mgrowthctrl-0.1.0.tar.gz
  • Upload date:
  • Size: 17.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mgrowthctrl-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e220173ff66a23a67141ac4d3e6b4ba5b83fc7b076c90fa68661fa95b6fd287c
MD5 4acec296b8c7d17dab1d5f654d5ab6c5
BLAKE2b-256 4330d633e2d8b6664854460b2e04c1bdba7d310fc5695017cc3d294764d99ec9

See more details on using hashes here.

File details

Details for the file mgrowthctrl-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mgrowthctrl-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mgrowthctrl-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2359b2d606eddcd6acfa00292839cd6a1a588612773a794a9f9899a54e3712da
MD5 3b9b99a0de3ab7e466ac4d5ad998d656
BLAKE2b-256 f02bb3ec5125b56a76f668b4a00a7e95a5e49185f9ebbbf3e63520de2975dd15

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page