Bioscrape


NameBioscrape JSON
Version 1.3.0 PyPI version JSON
download
home_pageNone
SummaryBiological Stochastic Simulation of Single Cell Reactions and Parameter Estimation
upload_time2025-02-16 03:53:22
maintainerNone
docs_urlNone
authorAyush Pandey, William Poole, Anandh Swaminathan, Richard M Murray
requires_python>=3.7
licenseMIT License Copyright (c) 2023, Biocircuits, California Institute of Technology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords sbml synthetic biology modeling chemical reaction network crn simulator stochastic parameter inference
VCS
bugtrack_url
requirements setuptools matplotlib pytest numpy scipy Cython python-libsbml beautifulsoup4 sympy emcee lmfit pandas corner
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Bioscrape — Biological Stochastic Simulation of Single Cell Reactions and Parameter Estimation
## Python toolbox to simulate, analyze, and learn biological system models

[![Build Status](https://github.com/biocircuits/bioscrape/actions/workflows/deploy_bioscrape.yml/badge.svg)](https://github.com/biocircuits/bioscrape/actions/workflows/deploy_bioscrape.yml)
[![PyPI version](https://badge.fury.io/py/bioscrape.svg)](https://badge.fury.io/py/bioscrape)
[![status](https://joss.theoj.org/papers/5935db21ffab5b33069d05b7adbdf094/status.svg)](https://joss.theoj.org/papers/5935db21ffab5b33069d05b7adbdf094)

* Getting started with Bioscrape: [![Bioscrape Core](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/biocircuits/bioscrape/blob/colab-ipynb/examples/Basic%20Examples%20-%20START%20HERE.ipynb#scrollTo=Jmm8mTPfhMMS)

* Bioscrape analysis features: [![Bioscrape Sensitivity Analysis](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/biocircuits/bioscrape/blob/colab-ipynb/examples/Sensitivity%20Analysis%20using%20Bioscrape.ipynb#scrollTo=Gu1r4H4ti_z7)

* Parameter inference with Bioscrape: [![Bioscrape Inference](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/biocircuits/bioscrape/blob/colab-ipynb/inference%20examples/Bioscrape%20Inference%20-%20Getting%20Started.ipynb#scrollTo=yvYVliBgjyzF)

Bioscrape is a Systems Biology Markup Language (SBML) simulator written in Cython for speed and Python compatibility. It can be used for deterministic, stochastic, or single cell simulation and also has parameter inference capabilities.

- **Mailing list:** [SBTools Google Group](https://groups.google.com/g/sbtools/) Email: sbtools@googlegroups.com
- **Source:** https://github.com/biocircuits/bioscrape
- **Preprint:** - [Fast and flexible simulation and parameter estimation for synthetic biology using bioscrape](https://www.biorxiv.org/content/10.1101/121152v3)
- **Bug reports:** https://github.com/biocircuits/bioscrape/issues
- **Slack** Join the #bioscrape channel on SBTools slack: Ask on the public SBTools Google group to be added or send a message to one of the maintainers. 

# Example 1: Simulating an SBML

Bioscrape allows for deterministic and stochastic simulation of SBML models:

```python
from bioscrape.types import Model
# Load an SBML file repressilator.xml 
# (you can find this file in `examples/models` directory)
M = Model(sbml_filename = 'repressilator_sbml.xml')
# Simulate the model
from bioscrape.simulator import py_simulate_model
import numpy as np
tp = np.linspace(0,256,100)
result = py_simulate_model(timepoints=tp, Model=M, stochastic=True)
# Plot the simulation result (the result is a Pandas dataframe)
import matplotlib.pyplot as plt
plt.plot(tp, result['X'])
```

# Example 2: Run Bayesian inference with Bioscrape 

Bioscrape can be used to identify model parameters using experimental data. In the example below, we show the user-friendly plug-and-play nature of bioscrape inference. We load the data as a Pandas dataframe and the model as an SBML file. The Bayesian inference is implemented as a wrapper for Python emcee that implements Markov Chain Monte Carlo (MCMC) sampler. Bioscrape inference provides various features such as: multiple data conditions, multiple data trajectories, deterministic inference, automatic visualization of posteriors, convergence checking tools, built-in and customizable priors, and lots more!

```python
from bioscrape.types import Model
import pandas as pd
from bioscrape.inference import py_inference

# Load an SBML model 
# (you can get this file in `inference examples/models/` directory)
M = Model(sbml_filename='toy_sbml_model.xml')

# Load experimental data 
# (you can find test data in `inference examples/data/` directory)
df = pd.read_csv('test_data.csv', delimiter = '\t', 
                 names = ['X','time'], skiprows = 1)

# Use built-in priors, 
# For 'd1': a Gaussian distribution of mean 0.2 and standard deviation of 20,
# while ensuring the parameter remains positive
# For 'k1': a Uniform distribution with minimum value 0 and maximum value 100

prior = {'d1' : ['gaussian', 0.2, 20, 'positive'], 'k1' : ['uniform', 0, 100]}

# Run Bayesian inference
sampler, pid = py_inference(Model = M, exp_data = df, measurements = ['X'], 
                            time_column = ['time'], nwalkers = 20, nsteps = 5500,
                            params_to_estimate = ['d1', 'k1'], prior = prior)
# A sampler object containing all samples is returned.
# The pid object consists of various utilities for further analysis.
# This will plot the resulting posterior parameter distributions as well.
```


All examples can be found in the [examples](https://github.com/biocircuits/bioscrape/tree/master/examples), the [inference examples](https://github.com/biocircuits/bioscrape/tree/master/inference%20examples), and the [lineage examples](https://github.com/biocircuits/bioscrape/tree/master/lineage%20examples) folders. If you prefer to run the package without installing the package, please use the Google Colab links above. If you want a local installation for bioscrape (recommended for faster speeds), follow the steps below: 

# Installation

Install the latest version of Bioscrape::

    $ pip install bioscrape
    

Please note that Bioscrape is a Cython extension module and requires a C++ compiler to be set up on your computer for installation. With the PyPi distribution, you can only install the core Bioscrape without the additional lineages package. To install lineages, clone the GitHub repository and run `python setup.py install lineage` from the bioscrape directory.

Try online without installing, open self-explanatory jupyter notebooks with Google Colab (linked at the top of this README).

Further details about the installation process can be found in the [Bioscrape wiki](https://github.com/biocircuits/bioscrape/wiki#installation).

# Bugs and Contributing to Bioscrape

Please report any bugs that you find [here](https://github.com/biocircuits/bioscrape/issues).
Or, even better, fork the repository on [GitHub](https://github.com/biocircuits/bioscrape),
and create a pull request (PR). We welcome all changes, big or small, and we
will help you make the PR if you are new to `git` (just ask on the issue). The [CONTRIBUTING.md](https://github.com/biocircuits/bioscrape/blob/master/CONTRIBUTING.md) file has more detailed set of instructions on contributing to the software.

# Versions

Bioscrape versions:

* 1.3.0 (latest release): To install run `pip install bioscrape` 
* 1.2.2 (tagged stable release): To install run `pip install bioscrape==1.2.2`
* 1.0.4 (beta release): To install run `pip install bioscrape==1.0.4`

# License
Released under the MIT License (see `LICENSE`)

Copyright (c) 2022, Biocircuits, California Institute of Technology. All rights reserved.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "Bioscrape",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "SBML, synthetic biology, modeling, Chemical Reaction Network, CRN simulator, stochastic, parameter inference",
    "author": "Ayush Pandey, William Poole, Anandh Swaminathan, Richard M Murray",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# Bioscrape — Biological Stochastic Simulation of Single Cell Reactions and Parameter Estimation\n## Python toolbox to simulate, analyze, and learn biological system models\n\n[![Build Status](https://github.com/biocircuits/bioscrape/actions/workflows/deploy_bioscrape.yml/badge.svg)](https://github.com/biocircuits/bioscrape/actions/workflows/deploy_bioscrape.yml)\n[![PyPI version](https://badge.fury.io/py/bioscrape.svg)](https://badge.fury.io/py/bioscrape)\n[![status](https://joss.theoj.org/papers/5935db21ffab5b33069d05b7adbdf094/status.svg)](https://joss.theoj.org/papers/5935db21ffab5b33069d05b7adbdf094)\n\n* Getting started with Bioscrape: [![Bioscrape Core](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/biocircuits/bioscrape/blob/colab-ipynb/examples/Basic%20Examples%20-%20START%20HERE.ipynb#scrollTo=Jmm8mTPfhMMS)\n\n* Bioscrape analysis features: [![Bioscrape Sensitivity Analysis](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/biocircuits/bioscrape/blob/colab-ipynb/examples/Sensitivity%20Analysis%20using%20Bioscrape.ipynb#scrollTo=Gu1r4H4ti_z7)\n\n* Parameter inference with Bioscrape: [![Bioscrape Inference](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/biocircuits/bioscrape/blob/colab-ipynb/inference%20examples/Bioscrape%20Inference%20-%20Getting%20Started.ipynb#scrollTo=yvYVliBgjyzF)\n\nBioscrape is a Systems Biology Markup Language (SBML) simulator written in Cython for speed and Python compatibility. It can be used for deterministic, stochastic, or single cell simulation and also has parameter inference capabilities.\n\n- **Mailing list:** [SBTools Google Group](https://groups.google.com/g/sbtools/) Email: sbtools@googlegroups.com\n- **Source:** https://github.com/biocircuits/bioscrape\n- **Preprint:** - [Fast and flexible simulation and parameter estimation for synthetic biology using bioscrape](https://www.biorxiv.org/content/10.1101/121152v3)\n- **Bug reports:** https://github.com/biocircuits/bioscrape/issues\n- **Slack** Join the #bioscrape channel on SBTools slack: Ask on the public SBTools Google group to be added or send a message to one of the maintainers. \n\n# Example 1: Simulating an SBML\n\nBioscrape allows for deterministic and stochastic simulation of SBML models:\n\n```python\nfrom bioscrape.types import Model\n# Load an SBML file repressilator.xml \n# (you can find this file in `examples/models` directory)\nM = Model(sbml_filename = 'repressilator_sbml.xml')\n# Simulate the model\nfrom bioscrape.simulator import py_simulate_model\nimport numpy as np\ntp = np.linspace(0,256,100)\nresult = py_simulate_model(timepoints=tp, Model=M, stochastic=True)\n# Plot the simulation result (the result is a Pandas dataframe)\nimport matplotlib.pyplot as plt\nplt.plot(tp, result['X'])\n```\n\n# Example 2: Run Bayesian inference with Bioscrape \n\nBioscrape can be used to identify model parameters using experimental data. In the example below, we show the user-friendly plug-and-play nature of bioscrape inference. We load the data as a Pandas dataframe and the model as an SBML file. The Bayesian inference is implemented as a wrapper for Python emcee that implements Markov Chain Monte Carlo (MCMC) sampler. Bioscrape inference provides various features such as: multiple data conditions, multiple data trajectories, deterministic inference, automatic visualization of posteriors, convergence checking tools, built-in and customizable priors, and lots more!\n\n```python\nfrom bioscrape.types import Model\nimport pandas as pd\nfrom bioscrape.inference import py_inference\n\n# Load an SBML model \n# (you can get this file in `inference examples/models/` directory)\nM = Model(sbml_filename='toy_sbml_model.xml')\n\n# Load experimental data \n# (you can find test data in `inference examples/data/` directory)\ndf = pd.read_csv('test_data.csv', delimiter = '\\t', \n                 names = ['X','time'], skiprows = 1)\n\n# Use built-in priors, \n# For 'd1': a Gaussian distribution of mean 0.2 and standard deviation of 20,\n# while ensuring the parameter remains positive\n# For 'k1': a Uniform distribution with minimum value 0 and maximum value 100\n\nprior = {'d1' : ['gaussian', 0.2, 20, 'positive'], 'k1' : ['uniform', 0, 100]}\n\n# Run Bayesian inference\nsampler, pid = py_inference(Model = M, exp_data = df, measurements = ['X'], \n                            time_column = ['time'], nwalkers = 20, nsteps = 5500,\n                            params_to_estimate = ['d1', 'k1'], prior = prior)\n# A sampler object containing all samples is returned.\n# The pid object consists of various utilities for further analysis.\n# This will plot the resulting posterior parameter distributions as well.\n```\n\n\nAll examples can be found in the [examples](https://github.com/biocircuits/bioscrape/tree/master/examples), the [inference examples](https://github.com/biocircuits/bioscrape/tree/master/inference%20examples), and the [lineage examples](https://github.com/biocircuits/bioscrape/tree/master/lineage%20examples) folders. If you prefer to run the package without installing the package, please use the Google Colab links above. If you want a local installation for bioscrape (recommended for faster speeds), follow the steps below: \n\n# Installation\n\nInstall the latest version of Bioscrape::\n\n    $ pip install bioscrape\n    \n\nPlease note that Bioscrape is a Cython extension module and requires a C++ compiler to be set up on your computer for installation. With the PyPi distribution, you can only install the core Bioscrape without the additional lineages package. To install lineages, clone the GitHub repository and run `python setup.py install lineage` from the bioscrape directory.\n\nTry online without installing, open self-explanatory jupyter notebooks with Google Colab (linked at the top of this README).\n\nFurther details about the installation process can be found in the [Bioscrape wiki](https://github.com/biocircuits/bioscrape/wiki#installation).\n\n# Bugs and Contributing to Bioscrape\n\nPlease report any bugs that you find [here](https://github.com/biocircuits/bioscrape/issues).\nOr, even better, fork the repository on [GitHub](https://github.com/biocircuits/bioscrape),\nand create a pull request (PR). We welcome all changes, big or small, and we\nwill help you make the PR if you are new to `git` (just ask on the issue). The [CONTRIBUTING.md](https://github.com/biocircuits/bioscrape/blob/master/CONTRIBUTING.md) file has more detailed set of instructions on contributing to the software.\n\n# Versions\n\nBioscrape versions:\n\n* 1.3.0 (latest release): To install run `pip install bioscrape` \n* 1.2.2 (tagged stable release): To install run `pip install bioscrape==1.2.2`\n* 1.0.4 (beta release): To install run `pip install bioscrape==1.0.4`\n\n# License\nReleased under the MIT License (see `LICENSE`)\n\nCopyright (c) 2022, Biocircuits, California Institute of Technology. All rights reserved.\n",
    "bugtrack_url": null,
    "license": "MIT License\n         \n        Copyright (c) 2023, Biocircuits, California Institute of Technology\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "Biological Stochastic Simulation of Single Cell Reactions and Parameter Estimation",
    "version": "1.3.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/biocircuits/bioscrape/issues",
        "Homepage": "https://github.com/biocircuits/bioscrape/"
    },
    "split_keywords": [
        "sbml",
        " synthetic biology",
        " modeling",
        " chemical reaction network",
        " crn simulator",
        " stochastic",
        " parameter inference"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c77ad632320e71f449e91d3adeadd6252841fdd750b1e65dcc86c2de564215d9",
                "md5": "fd63d122b2bf01e2d71c2b037796fb64",
                "sha256": "2f63da7681688cb2f483e90148bc4383c8bc9b02d88c4b48eb0ff049a558e9ce"
            },
            "downloads": -1,
            "filename": "Bioscrape-1.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl",
            "has_sig": false,
            "md5_digest": "fd63d122b2bf01e2d71c2b037796fb64",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 8905338,
            "upload_time": "2025-02-16T03:53:22",
            "upload_time_iso_8601": "2025-02-16T03:53:22.446614Z",
            "url": "https://files.pythonhosted.org/packages/c7/7a/d632320e71f449e91d3adeadd6252841fdd750b1e65dcc86c2de564215d9/Bioscrape-1.3.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-16 03:53:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "biocircuits",
    "github_project": "bioscrape",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "setuptools",
            "specs": []
        },
        {
            "name": "matplotlib",
            "specs": []
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.16.5"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    ">=",
                    "1.5.4"
                ]
            ]
        },
        {
            "name": "Cython",
            "specs": []
        },
        {
            "name": "python-libsbml",
            "specs": []
        },
        {
            "name": "beautifulsoup4",
            "specs": []
        },
        {
            "name": "sympy",
            "specs": []
        },
        {
            "name": "emcee",
            "specs": [
                [
                    ">=",
                    "3.0.2"
                ]
            ]
        },
        {
            "name": "lmfit",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "corner",
            "specs": []
        }
    ],
    "lcname": "bioscrape"
}
        
Elapsed time: 1.37379s