gillespy2

Modeling toolkit for biochemical simulation

https://github.com/stochss/gillespy2

Science Score: 20.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: ncbi.nlm.nih.gov
  • Committers with academic emails
    12 of 44 committers (27.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.0%) to scientific vocabulary

Keywords from Contributors

interpretability standardization animal book hack autograder report archiving
Last synced: 11 months ago · JSON representation

Repository

Modeling toolkit for biochemical simulation

Basic Info
Statistics
  • Stars: 78
  • Watchers: 5
  • Forks: 33
  • Open Issues: 8
  • Releases: 39
Created almost 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

GillesPy2 is a Python 3 package for stochastic simulation of biochemical systems. It offers an object-oriented approach for creating mathematical models of biological systems, as well as a variety of methods for performing time simulation of those models. The methods include the Gillespie direct method (SSA), several variant stochastic simulation methods including tau-Leaping, and numerical integration of ODEs. The solvers support a variety of user environments, with optimized code for C++, and NumPy. GillesPy2 also supports SBML.

PLEASE REGISTER AS A USER, so that we can prove GillesPy2 has many users when we seek funding to support development. GillesPy2 is part of the StochSS project.

PyPI - License PyPI - Python Version PyPI Conda (channel only) PyPI - Downloads Conda

Table of contents

Installation

GillesPy2 can be installed on your computer using different methods, as described below.

Using PyPI

On Linux, macOS, and Windows operating systems, you should be able to install GillesPy2 with pip. Please review the official pip documentation for installation instructions and additional information.

Then, to install GillesPy2 from the Python package repository, run the following command: sh python3 -m pip install gillespy2 --user --upgrade

Using the source code repository

As an alternative to getting it from PyPI, you can instruct pip to install GillesPy2 directly from the GitHub repository: sh python3 -m pip install https://github.com/StochSS/GillesPy2/archive/main.zip --user --upgrade

As a final alternative, you can first use git to clone a copy of the GillesPy2 source tree from the GitHub repository to your local computer disk, and then install GillesPy2 using that copy: sh git clone https://github.com/StochSS/GillesPy2.git cd GillesPy2 python3 -m pip install . --user --upgrade

NOTE: to import/export SMBL, libSBML must be installed. It is not installed by default with GillesPy2. To include libSBML in the installation of GillesPy2 use pip install gillespy2[sbml]. If GillesPy2 is already installed use pip install python_libSBML.

Usage

GillesPy2 provides simple object-oriented abstractions for defining a model of a biochemical system and simulating that model using efficient stochastic simulation algorithms. The basic steps to use GillesPy2 are:

  1. Create a GillesPy2.Model containing molecular species, parameters, and reactions (or import it from an SBML file)
  2. Invoke the model's .run() method.

The run() method can be customized using keyword arguments to select different solvers, random seed, data return type and more. For more detailed examples on how to use GillesPy2, please see the Getting Started Jupyter notebook contained in the examples subdirectory.

Simple example to illustrate the use of GillesPy2

Dimerization is a process in which two molecules of some molecular species (known as a "monomer" in this situation – let's call it "M" for short) come together to create a new molecule (call it "D"), but do so in a way that is reversible, meaning the combined structure can also decay or dissociate back into "M". A simple model of the dimerization process represents it as two reactions: a reaction in which one molecule of "M" reacts with another molecule of "M" to form one new molecule ("D"), and another reaction in which a molecule of "D" breaks apart into two molecules of "M". In terms of biochemical reactions, it looks like this (where kc and kd represent the rate constants for creation and dissociation of the dimer, respectively; M represents the number of molecules of "M"; and D is the number of molecules of "D"):

     kc
2 M  ⟷ D
     kd

In GillesPy2, a model is expressed as an object. Components, such as the reactions, molecular species, and characteristics such as the time span for simulation, are all defined within the model. The following Python code represents our dimerization model using GillesPy2's facility:

```python def createdimerization(parametervalues=None): # First call the gillespy2.Model initializer. model = gillespy2.Model(name='Dimerization')

# Define parameters for the rates of creation and dissociation.
k_c = gillespy2.Parameter(name='k_c', expression=0.005)
k_d = gillespy2.Parameter(name='k_d', expression=0.08)
model.add_parameter([k_c, k_d])

# Define variables for the molecular species representing M and D.
m = gillespy2.Species(name='monomer', initial_value=30)
d = gillespy2.Species(name='dimer',   initial_value=0)
model.add_species([m, d])

# The list of reactants and products for a Reaction object are each a
# Python dictionary in which the dictionary keys are Species objects
# and the values are stoichiometries of the species in the reaction.
r_c = gillespy2.Reaction(name="r_creation", rate=k_c, reactants={m:2}, products={d:1})
r_d = gillespy2.Reaction(name="r_dissociation", rate=k_d, reactants={d:1}, products={m:2})
model.add_reaction([r_c, r_d])

# Set the timespan for the simulation.
tspan = gillespy2.TimeSpan.linspace(t=100, num_points=101)
model.timespan(tspan)
return model

```

Given the model creation function above, the model can be simulated by first instantiating the model object, and then invoking the run() method on the object. The following code will run the model 10 times to produce 10 sample trajectories:

python model = create_dimerization() results = model.run(number_of_trajectories=10)

The results are then stored in a class Results object for single trajectory or for multiple trajectories. Results can be plotted with matplotlib using plot() or in plotly (offline) using plotplotly(). For additional plotting options such as plotting from a selection of species, or statistical plotting, please see the documentation.:

python results.plot()

Alternatively, the results object inherits python-builtin UserDict for single trajectories, and UserList for multiple trajectories. Results can be plotted easily using any plotting library such as matplotlib as shown below:

python for index in range(0, 10): trajectory = results[index] plt.plot(trajectory['time'], trajectory['monomer'], 'r') plt.plot(trajectory['time'], trajectory['dimer'], 'b')

With a few additional Python matplotlib commands to create figure labels and such, we end up with a plot like this:

Getting help

GillesPy2's online documentation provides more details about using the software. If you find any problem with GillesPy2 or the documentation, please report it using the GitHub issue tracker for this repository. You can also contact Dr. Brian Drawert directly with questions and suggestions.

Contributing

We would be happy to receive your help and participation with enhancing GillesPy2! The UML class diagram and Pynsource UML class model may help you familiarize yourself with the existing code. Please follow the guidelines described in CONTRIBUTING.md.

New developments happen primarily in the develop branch. New releases are put in the main branch.

| Main Branch | Develop Branch | Test Coverage | Maintainability | |:---------------:|:--------------:|:--------:|:---------------:| | Build Status | Build Status | Test Coverage | Maintainability |

License

GillesPy2 is licensed under the GNU General Public License version 3. Please see the file LICENSE for more information.

Authors and history

Acknowledgments

This work has been funded by National Institutes of Health (NIH) NIBIB Award No. 2R01EB014877-04A1.

GillesPy2 uses numerous open-source packages, without which it would have been effectively impossible to develop this software with the resources we had. We want to acknowledge this debt. In alphabetical order, the packages are:

  • Jupyter – web application for creating documents containing code, visualizations and narrative text
  • libSBML – a library for reading, writing, and manipulating SBML content
  • lxml – an XML parsing library for Python
  • MatplotLib – Python plotting library
  • Plotly – Graphing library for making interactive, publication-quality graphs
  • Numpy – the fundamental package for scientific computing with Python
  • Scipy – Python-based ecosystem of open-source software for mathematics, science, and engineering

Finally, we are grateful for institutional resources made available by the University of North Carolina at Asheville, the University of California at Santa Barbara, Uppsala University, and the California Institute of Technology.

           

Owner

  • Name: StochSS
  • Login: StochSS
  • Kind: organization
  • Email: contact@stochss.org

Stochastic Simulation Service

GitHub Events

Total
  • Issues event: 1
  • Watch event: 5
  • Delete event: 1
  • Push event: 9
  • Pull request event: 5
  • Fork event: 3
  • Create event: 1
Last Year
  • Issues event: 1
  • Watch event: 5
  • Delete event: 1
  • Push event: 9
  • Pull request event: 5
  • Fork event: 3
  • Create event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 2,526
  • Total Committers: 44
  • Avg Commits per committer: 57.409
  • Development Distribution Score (DDS): 0.804
Past Year
  • Commits: 173
  • Committers: 9
  • Avg Commits per committer: 19.222
  • Development Distribution Score (DDS): 0.497
Top Committers
Name Email Commits
Sean Matthew s****2@u****u 495
Bryan Rumsey b****y@g****m 348
Brian Drawert b****n@d****t 281
ethangreen-dev e****4@u****u 236
Josh C j****0@g****m 200
Fin Carter f****r@u****u 165
Dalton Nickerson d****n@g****m 114
Matthew Dippel m****6@g****m 86
hodgespodge s****s@u****u 85
Michael Hucka m****a@c****u 74
Jesse Reeve e****e@g****m 63
JoshuaFisherC 7****C 51
Mason 3****l 40
Joshua Cooper j****h@j****m 36
George M. Hall g****0@g****m 28
Josh C j****6@u****u 28
jackson w****1@u****u 22
georgemhall g****l 19
github-actions[bot] 4****] 19
BryanRumsey 4****y 18
Momentopolis e****r@u****u 18
Fin109 5****9 15
Brian Drawert b****t 14
Dalton Nickerson d****s@u****u 13
Eliot Dixon e****1@u****u 11
Dalton T****n 9
hodgespodge 4****e 7
Dalton t****n@g****m 6
Ghilman Brock g****k@g****m 4
Renato Lombardo r****o@u****t 3
and 14 more...

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 95
  • Total pull requests: 68
  • Average time to close issues: over 1 year
  • Average time to close pull requests: 2 months
  • Total issue authors: 20
  • Total pull request authors: 10
  • Average comments per issue: 0.78
  • Average comments per pull request: 0.29
  • Merged pull requests: 45
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 10
  • Average time to close issues: N/A
  • Average time to close pull requests: 41 minutes
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.0
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • briandrawert (38)
  • BryanRumsey (18)
  • jtcooper10 (9)
  • seanebum (7)
  • ethangreen-dev (3)
  • TorkelE (3)
  • jonrkarr (2)
  • vwiela (2)
  • frascalise (1)
  • jonstrutz11 (1)
  • JoshuaFisherC (1)
  • maurosilber (1)
  • RichardBruskiewich (1)
  • benblamey (1)
  • mdip226 (1)
Pull Request Authors
  • briandrawert (32)
  • BryanRumsey (14)
  • jtcooper10 (8)
  • seanebum (4)
  • mdip226 (3)
  • ethangreen-dev (3)
  • deroulers (2)
  • himoto (2)
  • benblamey (2)
  • JoshuaFisherC (1)
Top Labels
Issue Labels
enhancement (28) bug (24) ✔️​ (13) Cleanup (6) help wanted (6) question (5) good first issue (3) Docs (2) answered (1) wontfix (1)
Pull Request Labels
enhancement (14) bug (8) Cleanup (4)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 542 last-month
  • Total dependent packages: 1
  • Total dependent repositories: 12
  • Total versions: 47
  • Total maintainers: 3
pypi.org: gillespy2

Python interface for Gillespie-style biochemical simulations

  • Versions: 47
  • Dependent Packages: 1
  • Dependent Repositories: 12
  • Downloads: 542 Last month
Rankings
Dependent packages count: 3.2%
Dependent repos count: 4.2%
Average: 6.4%
Forks count: 7.2%
Stargazers count: 8.2%
Downloads: 9.1%
Last synced: 11 months ago