![Package](https://img.shields.io/pypi/v/simbio?label=simbio)
![CodeStyle](https://img.shields.io/badge/code%20style-black-000000.svg)
![License](https://img.shields.io/pypi/l/simbio?label=license)
![PyVersion](https://img.shields.io/pypi/pyversions/simbio?label=python)
[![CI](https://github.com/hgrecco/simbio/actions/workflows/ci.yml/badge.svg)](https://github.com/hgrecco/simbio/actions/workflows/ci.yml)
# SimBio
`simbio` is a Python-based package for simulation of Chemical Reaction Networks (CRNs).
It extends [`poincare`](https://github.com/maurosilber/poincare),
a package for modelling dynamical systems,
to add functionality for CRNs.
## Usage
To create a system with two species $A$ and $B$
and a reaction converting $2A \\rightarrow B$ with rate 1:
```python
>>> from simbio import Compartment, Species, RateLaw, initial
>>> class Model(Compartment):
... A: Species = initial(default=1)
... B: Species = initial(default=0)
... r = RateLaw(
... reactants=[2 * A],
... products=[B],
... rate_law=1,
... )
```
This corresponds to the following system of equations
$$
\\begin{cases}
\\frac{dA}{dt} = -2 \\
\\frac{dB}{dt} = +1
\\end{cases}
$$
with initial conditions
$$
\\begin{cases}
A(0) = 1 \\
B(0) = 0
\\end{cases}
$$
In CRNs,
we usually deal with [mass-action](https://en.wikipedia.org/wiki/Law_of_mass_action) reactions.
Using `MassAction` instead of `Reaction` automatically adds the reactants to the rate law:
```python
>>> from simbio import MassAction
>>> class MassActionModel(Compartment):
... A: Species = initial(default=1)
... B: Species = initial(default=0)
... r = MassAction(
... reactants=[2 * A],
... products=[B],
... rate=1,
... )
```
generating the following equations:
$$
\\begin{cases}
\\frac{dA}{dt} = -2 A^2 \\
\\frac{dB}{dt} = +1 A^2
\\end{cases}
$$
To simulate the system,
use the `Simulator.solve` which outputs a `pandas.DataFrame`:
```python
>>> from simbio import Simulator
>>> Simulator(MassActionModel).solve(save_at=range(5))
A B
time
0 1.000000 0.000000
1 0.333266 0.333367
2 0.199937 0.400032
3 0.142798 0.428601
4 0.111061 0.444470
```
For more details into SimBio's capabilities,
we recommend reading [poincaré's README](https://github.com/maurosilber/poincare).
## SBML
SimBio can import models from Systems Biology Markup Language (SBML) files:
```python
>>> from simbio.io import sbml
>>> sbml.load("repressilator.sbml")
Elowitz2000 - Repressilator
-----------------------------------------------------------------------------------
type total names
---------- ------- --------------------------------------------------------------
variables 6 PX, PY, PZ, X, Y, Z
parameters 17 cell, beta, alpha0, alpha, eff, n, KM, tau_mRNA, tau_prot, ...
equations 12 Reaction1, Reaction2, Reaction3, Reaction4, Reaction5, ...
```
or download them from the [BioModels](https://www.ebi.ac.uk/biomodels/) repository:
```python
>>> from simbio.io import biomodels
>>> biomodels.load("BIOMD12")
Elowitz2000 - Repressilator
-----------------------------------------------------------------------------------
type total names
---------- ------- --------------------------------------------------------------
variables 6 PX, PY, PZ, X, Y, Z
parameters 17 cell, beta, alpha0, alpha, eff, n, KM, tau_mRNA, tau_prot, ...
equations 12 Reaction1, Reaction2, Reaction3, Reaction4, Reaction5, ...
```
## Installation
It can be installed from [PyPI](https://pypi.org/p/simbio) with `pip`:
```
pip install simbio
```
Or, to additionally install the SBML importer:
```
pip install simbio[io]
```
While `poincaré` is installed automatically as a dependency,
if you are using conda/mamba,
you might prefer to install it from conda-forge:
```
conda install --channel conda-forge poincare
```
Raw data
{
"_id": null,
"home_page": null,
"name": "SimBio",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "mass action, michaelis menten, ode, compartment, reaction, SBML, poincare",
"author": null,
"author_email": "\"Hern\u00e1n E. Grecco\" <hernan.grecco@gmail.com>, Mauro Silberberg <maurosilber@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/f4/e1/0699a58f39f10dfa2f2e715ebbfb0d32fe603895ddb557a3db919e195025/simbio-0.4.tar.gz",
"platform": null,
"description": "![Package](https://img.shields.io/pypi/v/simbio?label=simbio)\n![CodeStyle](https://img.shields.io/badge/code%20style-black-000000.svg)\n![License](https://img.shields.io/pypi/l/simbio?label=license)\n![PyVersion](https://img.shields.io/pypi/pyversions/simbio?label=python)\n[![CI](https://github.com/hgrecco/simbio/actions/workflows/ci.yml/badge.svg)](https://github.com/hgrecco/simbio/actions/workflows/ci.yml)\n\n# SimBio\n\n`simbio` is a Python-based package for simulation of Chemical Reaction Networks (CRNs).\nIt extends [`poincare`](https://github.com/maurosilber/poincare),\na package for modelling dynamical systems,\nto add functionality for CRNs.\n\n## Usage\n\nTo create a system with two species $A$ and $B$\nand a reaction converting $2A \\\\rightarrow B$ with rate 1:\n\n```python\n>>> from simbio import Compartment, Species, RateLaw, initial\n>>> class Model(Compartment):\n... A: Species = initial(default=1)\n... B: Species = initial(default=0)\n... r = RateLaw(\n... reactants=[2 * A],\n... products=[B],\n... rate_law=1,\n... )\n```\n\nThis corresponds to the following system of equations\n\n$$\n\\\\begin{cases}\n\\\\frac{dA}{dt} = -2 \\\\\n\\\\frac{dB}{dt} = +1\n\\\\end{cases}\n$$\n\nwith initial conditions\n\n$$\n\\\\begin{cases}\nA(0) = 1 \\\\\nB(0) = 0\n\\\\end{cases}\n$$\n\nIn CRNs,\nwe usually deal with [mass-action](https://en.wikipedia.org/wiki/Law_of_mass_action) reactions.\nUsing `MassAction` instead of `Reaction` automatically adds the reactants to the rate law:\n\n```python\n>>> from simbio import MassAction\n>>> class MassActionModel(Compartment):\n... A: Species = initial(default=1)\n... B: Species = initial(default=0)\n... r = MassAction(\n... reactants=[2 * A],\n... products=[B],\n... rate=1,\n... )\n```\n\ngenerating the following equations:\n\n$$\n\\\\begin{cases}\n\\\\frac{dA}{dt} = -2 A^2 \\\\\n\\\\frac{dB}{dt} = +1 A^2\n\\\\end{cases}\n$$\n\nTo simulate the system,\nuse the `Simulator.solve` which outputs a `pandas.DataFrame`:\n\n```python\n>>> from simbio import Simulator\n>>> Simulator(MassActionModel).solve(save_at=range(5))\n A B\ntime\n0 1.000000 0.000000\n1 0.333266 0.333367\n2 0.199937 0.400032\n3 0.142798 0.428601\n4 0.111061 0.444470\n```\n\nFor more details into SimBio's capabilities,\nwe recommend reading [poincar\u00e9's README](https://github.com/maurosilber/poincare).\n\n## SBML\n\nSimBio can import models from Systems Biology Markup Language (SBML) files:\n\n```python\n>>> from simbio.io import sbml\n>>> sbml.load(\"repressilator.sbml\")\nElowitz2000 - Repressilator\n-----------------------------------------------------------------------------------\ntype total names\n---------- ------- --------------------------------------------------------------\nvariables 6 PX, PY, PZ, X, Y, Z\nparameters 17 cell, beta, alpha0, alpha, eff, n, KM, tau_mRNA, tau_prot, ...\nequations 12 Reaction1, Reaction2, Reaction3, Reaction4, Reaction5, ...\n```\n\nor download them from the [BioModels](https://www.ebi.ac.uk/biomodels/) repository:\n\n```python\n>>> from simbio.io import biomodels\n>>> biomodels.load(\"BIOMD12\")\nElowitz2000 - Repressilator\n-----------------------------------------------------------------------------------\ntype total names\n---------- ------- --------------------------------------------------------------\nvariables 6 PX, PY, PZ, X, Y, Z\nparameters 17 cell, beta, alpha0, alpha, eff, n, KM, tau_mRNA, tau_prot, ...\nequations 12 Reaction1, Reaction2, Reaction3, Reaction4, Reaction5, ...\n```\n\n## Installation\n\nIt can be installed from [PyPI](https://pypi.org/p/simbio) with `pip`:\n\n```\npip install simbio\n```\n\nOr, to additionally install the SBML importer:\n\n```\npip install simbio[io]\n```\n\nWhile `poincar\u00e9` is installed automatically as a dependency,\nif you are using conda/mamba,\nyou might prefer to install it from conda-forge:\n\n```\nconda install --channel conda-forge poincare\n```\n",
"bugtrack_url": null,
"license": null,
"summary": "Simulation of Biological Systems",
"version": "0.4.0",
"project_urls": {
"Bug Tracker": "https://github.com/hgrecco/simbio/issues",
"Homepage": "https://github.com/hgrecco/simbio"
},
"split_keywords": [
"mass action",
" michaelis menten",
" ode",
" compartment",
" reaction",
" sbml",
" poincare"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8c6f8702ef324cf2e176949384522005af9d8ba9a2a198e3d0fa7f5c45559fa7",
"md5": "e46652f2d79b856c3a768aec08e48fed",
"sha256": "ef6648965917fbb4d7d1093b5dae7ccdfec3be8705bcdd74a0d6f416a0000451"
},
"downloads": -1,
"filename": "SimBio-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e46652f2d79b856c3a768aec08e48fed",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 29021,
"upload_time": "2024-04-12T19:07:01",
"upload_time_iso_8601": "2024-04-12T19:07:01.002569Z",
"url": "https://files.pythonhosted.org/packages/8c/6f/8702ef324cf2e176949384522005af9d8ba9a2a198e3d0fa7f5c45559fa7/SimBio-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f4e10699a58f39f10dfa2f2e715ebbfb0d32fe603895ddb557a3db919e195025",
"md5": "44bdea84b8aacec089714af01165b27a",
"sha256": "231ab510c35760f6a0e9c1e1eea1828c4799bc40fbe5e3794faa992f7e8ee6ca"
},
"downloads": -1,
"filename": "simbio-0.4.tar.gz",
"has_sig": false,
"md5_digest": "44bdea84b8aacec089714af01165b27a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 40216,
"upload_time": "2024-04-12T19:07:02",
"upload_time_iso_8601": "2024-04-12T19:07:02.465359Z",
"url": "https://files.pythonhosted.org/packages/f4/e1/0699a58f39f10dfa2f2e715ebbfb0d32fe603895ddb557a3db919e195025/simbio-0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-12 19:07:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hgrecco",
"github_project": "simbio",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "poincare",
"specs": [
[
">=",
"0.3.1"
]
]
}
],
"lcname": "simbio"
}