Stochastic chemical kinetics library using Gillespie algorithm (also stochastic simulation algorithm or SSA) and chemical master equation (CME), with application to enzyme kinetics. What follows are the graphs obtained using the library. See the experiments folder for the source code of the Python scripts.
cme_averages.py | cme_completion_times.py | cme_example.py | cme_stationary_dist.py |
---|---|---|---|
gillespie_averages.py | gillespie_completion_times.py | gillespie_example.py | gillespie_stationary_dist.py |
---|---|---|---|
Bibliography:
- D. T. Gillespie, Exact Stochastic Simulation of Coupled Chemical Reactions, The Journal of Physical Chemistry, Vol. 81, No. 25, 1977.
- L. A. Segel, M. Slemrod, The quasi-steady-state assumption: a case study in perturbation, SIAM Rev. 1989; 31(3):446-477.
- J. Borghans, R. de Boer, L. Segel, Extending the quasi-steady state approximation by changing variables, Bull. Math. Biol. 58 (1996) 43-63.
- R. A. Copeland, ENZYMES: A Practical Introduction to Structure, Mechanism, and Data Analysis, second edition, Wiley-VCH, 2000.
- A. R. Tzafriri, Michaelis-Menten kinetics at high enzyme concentrations, Bull. Math. Biol. 2003; 65(6):1111-1129.
- D. T. Gillespie, Stochastic Simulation of Chemical Kinetics, Annu. Rev. Phys. Chem. 2007, 58:35-55.
- M. G. Pedersen, A. M. Bersani, E. Bersani, G. Cortese, The total quasi-steady-state approximation for complex enzyme reactions, Mathematics and Computers in Simulation 79 (2008) 1010-1019.
- Y. Cao, D. C. Samuels, Discrete Stochastic Simulation Methods for Chemically Reacting Systems, Methods Enzymol. 2009; 454: 115-140.
- K. R. Sanft, D. T. Gillespie, L. R. Petzold, Legitimacy of the stochastic Michaelis-Menten approximation, IET Syst. Biol., 2011, Vol. 5, Iss. 1, pp. 58-69.
- V. Sunkara, On the Properties of the Reaction Counts Chemical Master Equation, Entropy 2019, 21(6), 607.
- J. K. Kim, J. J. Tyson, Misuse of the Michaelis-Menten rate law for protein interaction networks and its remedy, PLoS Computational Biology 16(10), 2020.
- T.-H. Ahn, Y. Cao, L. T. Watson, Stochastic Simulation Algorithms for Chemical Reactions, Virginia Polytechnic Institute and State University, Blacksburg, Virginia.
The code is written as a library in C++20 with Python bindings using Pybind11. The repository is structured in the following way:
experiments
: directory containing example code using the library and experiments for University projects.include/sck
: directory containing the C++ header files to include in implementation files.cme.hpp
: it includes classes for generic CME equation integration and applications to enzyme kinetics.gillespie.hpp
: it includes classes for generic Gillespie algorithm and applications to enzyme kinetics.runge_kutta.hpp
: explicit Runge-Kutta methods used for integration of the CME equation.tensor.hpp
: classes, aliases and data structures for vectors, matrices and tensors with some helper functions.
pybind
: directory containing C++ implementation files that binds the code inside theinclude
directory. It also contains the Windows dynamic-link libraries which can be directly imported in Python scripts (on Linux, you will need to recompile them).cme_pybind.cpp
: Python bindings for CME.gillespie_pybind.cpp
: Python bindings for Gillespie algorithm.runge_kutta_pybind.cpp
: Python bindings for Runge-Kutta methods.
tests
: Tests that verify the correctness of the current implementation.
The C++ header files have no dependencies other than a C++20-complying compiler. To compile the Python bindings, Pybind11 must be installed on the current machine. For more information on how to compile these bindings, see the individual files inside the pybind
folder. Rename the library paths accordingly, if needed.
The resulting Python library will require NumPy 1.7.0 or any later version.
The chemical master equation (CME) is given by
where
Sunkara (2019) found an equivalent formulation of the CME, where the probability of certain species counts
where
Note that this map is not in general bijective. Given a solution to the reaction count CME
where
Both these formulations can be casted into a system of ordinary differential equations with many different variables depending on the maximum allowed population numbers or reaction numbers. For small enough systems, these equations can be simply solved using a standard integration method, for example a Runge-Kutta method. However, we are quickly caught by the curse of dimensionality for systems with many chemical species: a lot of computer memory may be required to perform a simulation.
An alternative way to solve the CME is through a Monte-Carlo method, i.e., performing several stochastic realizations, and then calculating the relevant statistics. Gillespie (1977) found such algorithm, which is based on the reaction probability density function:
where
while
and, finally, carry out the reaction by replacing
Note that, since we require a large amount of realizations to obtain statistically significant results, stochastic simulation algorithm can be slower than direct integration of the CME for systems with few chemical species or small populations. In practice, this algorithm is useful when solving the CME directly would be prohibitively expensive in terms of required memory or computational time.
A single-substrate enzyme-catalyzed reaction can be described by the following chain of reactions
which correspond, due to the mass action law, to the following system of ordinary differential equations (ODEs):
where
The number of independent variables can be further reduced to one using approximations.
The quasi-steady state approximation (QSSA, or sQSSA, meaning standard QSSA) is obtained under the assumption that
from which we obtain a closed expression for the enzyme-substrate complex concentration
where
which is the Michaelis-Menten rate law. Segel and Slemrod (1989) showed that this approximation is valid for
Introduced by Borghans et al. (1996), this approximation is analogous to QSSA, with the difference that we perform a change of variable before applying the condition
Following the same steps as before, we obtain the following expression for
From the validity condition given by Tzafriri (2003), one can show that this approximation is reasonably accurate even in the worst case, so the range of validity is much wider for tQSSA than standard QSSA. Substituting in the products rate equation, we obtain
which can also be rewritten so that it is more computationally stable for small values of
Note that
The propensity functions for a single-substrate enzyme-catalyzed reaction are associated to each reaction channel:
So, the three propensity functions are given by
where
where
Remembering that we have only two independent variables thanks to the conservation of
where
where
This can be viewed as having only one monomolecular reaction described by
The Goldbeter-Koshland (GK) switch consists of a substrate-product pair
These reactions are commonly used to describe phosphorylation and dephosphorylation processes, where
Like for the single-substrate case, we have conserved quantities: the total substrate concentration
The QSSA can be obtained by assuming
from which we obtain
where
Substituting into the equation for
Note that
Then, applying the quasi-steady state condition as before, we obtain the following expression for the phosphorylated substrate concentration:
Note that
Choosing the coordinates
For stochastic tQSSA, we have only two reactions corresponding to
for which the propensity functions are given by
with only one independent variable since