Skip to main content

lightweight library that allows to automatically parse and convert SBML models into python models written end-to-end in JAX

Project description

SBMLtoODEjax

About

SBMLtoODEjax is a lightweight library that allows to automatically parse and convert SBML models into python models written end-to-end in JAX, a high-performance numerical computing library with automatic differentiation capabilities. SBMLtoODEjax is targeted at researchers that aim to incorporate SBML-specified ordinary differential equation (ODE) models into their python projects and machine learning pipelines, in order to perform efficient numerical simulation and optimization with only a few lines of code (by taking advantage of JAX’s core transformation features).

SBMLtoODEjax extends SBMLtoODEpy, a python library developed in 2019 for converting SBML files into python files written in Numpy/Scipy. The chosen conventions for the generated variables and modules are slightly different from the standard SBML conventions (used in the SBMLtoODEpy library) with the aim here to accommodate for more flexible manipulations while preserving JAX-like functional programming style.

In short, SBMLtoODEjax facilitates the re-use of biological network models and their manipulation in python projects while tailoring them to take advantage of JAX main features for efficient and parallel computations. For more details, check our 👀 Why use SBMLtoODEjax? and 🎨 Design Principles pages.

Documentation

The documentation is available at https://developmentalsystems.org/sbmltoodejax/. It provides details about SBMLtoODEjax’s main design principles, advantages and limitations, and the full API docs.

👉 The documentation includes various hands-on tutorials for:

  1. Loading and simulating models from BioModels website
  2. Running simulations in parallel for a batch of initial conditions
  3. Using gradient descent to optimize model parameters

Installation

The latest stable release of SBMLtoODEjax can be installed via pip:

pip install sbmltoodejax

Requires SBMLtoODEpy, JAX (cpu) and Equinox.

Quick Start

With only a few lines of python code, you can load and simulate existing SBML models. Below is an example code and output snapshot for reproducing simulation results of biomodel #10, from Kholodenko 2000’s paper.

import matplotlib.pyplot as plt
from sbmltoodejax.utils import load_biomodel

# load and simulate model 
model, _, _, _ = load_biomodel(10)
n_secs = 150*60
n_steps = int(n_secs / model.deltaT)
ys, ws, ts = model(n_steps)

# plot time course simulation as in original paper
y_indexes = model.modelstepfunc.y_indexes
plt.figure(figsize=(6, 4))
plt.plot(ts/60, ys[y_indexes["MAPK"]], color="lawngreen", label="MAPK")
plt.plot(ts/60, ys[y_indexes["MAPK_PP"]], color="blue", label="MAPK-PP")
plt.xlim([0,150])
plt.ylim([0,300])
plt.xlabel("Reaction time (mins)")
plt.ylabel("Concentration")
plt.legend()
plt.show()

biomodel #10 default simulation

Contributing

SBMLtoODEjax is in its early stage and any sort of contribution will be highly appreciated. To learn how you can get involved, please read our guide for contributing.

License

The SBMLtoODEjax project is licensed under the MIT license.

Acknowledgements

SBMLtoODEjax builds on:

  • SBMLtoODEpy's parsing and conversion of SBML files, by Steve M. Ruggiero and Ashlee N. Ford
  • JAX's composable transformations, by the Google team
  • Equinox's module abstraction, by Patrick Kidger
  • BasiCO's access the BioModels REST api, by the COPASI team

Our documentation was also inspired by the GPJax documentation, by Thomas Pinder and team.

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

sbmltoodejax-0.3.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

sbmltoodejax-0.3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file sbmltoodejax-0.3.tar.gz.

File metadata

  • Download URL: sbmltoodejax-0.3.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for sbmltoodejax-0.3.tar.gz
Algorithm Hash digest
SHA256 120792d6de1c71b1e1532f931a40c02b49a2e889289e5886cc37d99cb4192367
MD5 310b518c52929e7261bcdd44bff652f3
BLAKE2b-256 44f2a906c6a0092b63a9740e3791a5bb17ad7bfd697e11c73537d8a9f91c7eca

See more details on using hashes here.

File details

Details for the file sbmltoodejax-0.3-py3-none-any.whl.

File metadata

  • Download URL: sbmltoodejax-0.3-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for sbmltoodejax-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 db5eb33d837dbac853f3248c8805489b01179259bda47d6425c28a7442f8da03
MD5 43aa61dd6210d37d495efe5b16f5ec44
BLAKE2b-256 e8769401b8c22dd0c91292d38813dc0801eab6694cf480cbd643d17ba0161917

See more details on using hashes here.

Supported by

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