Skip to main content

U-MIMIC

Unified Mechanistic Inference from Multimodal Imaging and Counts

Developed by: Data Analysis Team @KaziLab.se

U-MIMIC is a Python package for modeling and analyzing tumor population dynamics under drug treatment. It combines mechanistic simulation with statistical inference to support both in-vitro and in-vivo experimental workflows.

Features

  • Mechanistic dynamics -- ODE, Gillespie SSA (exact under time-varying exposure via Extrande thinning), and tau-leaping simulation of P/Q/A/R cell-state models with dose-response modulation
  • Phenotype plasticity -- transitions carry a baseline, a fold-change, and an additive induced component, so a route absent without treatment can appear under it. ModelTopology.persister_resistance() provides the P <-> Q -> R persister route into resistance.
  • Pharmacokinetics -- One- and two-compartment PK models with flexible dosing schedules, unified via ExposureProfile
  • Observation models -- Cell counts (Negative Binomial), bioluminescence imaging, tumor volume, and biomarkers; combinable via MultimodalObservation
  • Inference -- MLE (multi-start), MCMC (emcee), SMC/particle MCMC, Kalman filtering, and hierarchical Bayesian estimation. Every configured modality enters the likelihood under conditional independence.
  • Identifiability diagnostics -- umimic.inference.analyze_identifiability reports which parameters a given experimental design can actually constrain, so a converged fit does not imply the data measured anything
  • Public datasets -- Loaders for BESTDR, PhenoPop, Hafner/Niepel GR, TSHS Tumor Growth, and NCI-60
  • CLI -- umimic simulate, fit, generate, config commands with YAML configuration and run logging (umimic --version reports the release)

Installation

pip install umimic

From a source checkout:

pip install .

With optional extras:

pip install ".[inference]"    # MCMC backend (emcee)
pip install ".[all]"          # Everything

Requires Python >= 3.11.

Quickstart

CLI

# Run a dose-response simulation
umimic simulate --drug-type cytotoxic --output results/sim

# Fit model to data
umimic fit --config experiment.yaml --data data.csv --output results/fit

# Generate synthetic data (writes dataset.csv + config.yaml)
umimic generate --config experiment.yaml --output results/synthetic

# ...and fit the dataset that was just generated
umimic fit --config results/synthetic/config.yaml \
           --data results/synthetic/dataset.csv --output results/fit

# Show recommended SAEM coupling tuning ranges
umimic config suggest-coupling-ranges

# Print as YAML for config authoring
umimic config suggest-coupling-ranges --format yaml

With --config, simulation uses the configured kinetics, solver, and PK dosing schedule. --drug-type explicitly overrides the mechanism while retaining the baseline rates. Without a configuration, simulate runs an ODE dose-response demonstration. Output includes simulation.json, the effective config.yaml, and figures. Command logs go to stderr and the run log file so JSON/YAML utility output can be redirected directly.

Python API

from umimic.pipeline.config import ExperimentConfig
from umimic.pipeline.experiment import Experiment

config = ExperimentConfig(
    dosing={"concentrations": [0, 0.1, 1, 10]},
    simulation={"method": "ode", "t_max": 72.0},
)
exp = Experiment(config)

# Simulate
results = exp.simulate(concentrations=[0, 0.1, 1, 10])

# Generate synthetic data and fit
dataset = exp.generate_synthetic()
result = exp.fit(dataset)
print(result.mle.parameters)

Examples

Example notebooks for common workflows are available in examples/:

Additional full validation notebooks are available in notebooks/.

Configuration

U-MIMIC uses YAML configuration validated by Pydantic. See docs/configuration.md for the full reference.

The default dynamics rates (default_birth_base, default_death_base_p, default_death_base_q) are generic baseline kinetics for simulation startup. For biological studies, tune these values to your system or estimate them from data via inference.

Minimal example:

name: my_experiment
dynamics:
  states: [P, Q]
dosing:
  concentrations: [0, 0.1, 0.3, 1, 3, 10, 30]
simulation:
  method: gillespie
  t_max: 72.0
inference:
  mode: mle
  n_restarts: 5

Run Logging

CLI commands support execution logging:

umimic simulate --output results/sim --log-file results/sim/run.log --log-level DEBUG

If --log-file is not provided, a timestamped log file is written to the command output directory. Logging uses a package-scoped logger (umimic) and does not interfere with other logging configuration.

Inference result JSON includes the effective configuration, package version, seed, a fingerprint of the observations, and full MCMC arrays and traces when applicable. Keep the result file alongside the input data for reproducibility.

Documentation

Full documentation is available on Read the Docs. To build locally:

pip install -e ".[docs]"
sphinx-build -b html docs docs/_build/html

Testing and Coverage

Run tests locally:

pip install -e ".[dev]"
pytest

Generate a local coverage report:

pytest --cov=umimic --cov-report=term-missing --cov-report=xml

Contributing

See CONTRIBUTING.md for development setup, code style, and how to add new simulation methods, observation models, or dataset loaders.

Changelog

See CHANGELOG.md for version history.

Citation

If you use U-MIMIC in academic work, please cite it using the metadata in CITATION.cff.

License

MIT

Metadata

Release files for umimic 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for umimic 0.0.4
File Size Uploaded Provenance Actions
umimic-0.0.4.tar.gz 36.9 MB Without provenance Details for umimic-0.0.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for umimic 0.0.4
File Interpreter ABI Platform Actions
umimic-0.0.4-py3-none-any.whl Python 3 none any Details for umimic-0.0.4-py3-none-any.whl

Total release size: 73.8 MB

Release files / umimic-0.0.4.tar.gz

Download URL umimic-0.0.4.tar.gz
Size 36.9 MB
Tags Source
SHA-256 checksum
How to use checksums
36db331017681f525a7ff428ee935ab78ffd9a9475044f4aa01681f6494414a9
BLAKE2b-256 checksum
How to use checksums
5378be18f7fc9a49aae8a684161b7e5d84123a16d35ee4a78b406565c7502111
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / umimic-0.0.4-py3-none-any.whl

Download URL umimic-0.0.4-py3-none-any.whl
Size 36.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
fc28ef94cfbabe69a512e1ca5bd4e4e2d59bf7d5475c2e8429f8900bae271328
BLAKE2b-256 checksum
How to use checksums
90389d2332da9c13dbc2acdbc3efe6274590d99aed89d813741c63a628d671fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Security for umimic 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page