arXiv is now an independent nonprofit! Learn more
License: arXiv.org perpetual non-exclusive license
arXiv:1011.0487v1 [cs.PL] 02 Nov 2010

Stochastic Simulation of Process Calculi for Biology

Andrew Phillips Email: andrew.phillips@microsoft.com Affiliation: Microsoft Research
Cambridge, United Kingdom
Affiliation: Microsoft Research
Cambridge, United Kingdom
Affiliation: IRCCyN, UMR CNRS 6597
École Centrale de Nantes, France
   Matthew R. Lakin Email: v-mlakin@microsoft.com    Loïc Paulevé Email: loic.pauleve@irccyn.ec-nantes.fr
Abstract

Biological systems typically involve large numbers of components with complex, highly parallel interactions and intrinsic stochasticity. To model this complexity, numerous programming languages based on process calculi have been developed, many of which are expressive enough to generate unbounded numbers of molecular species and reactions. As a result of this expressiveness, such calculi cannot rely on standard reaction-based simulation methods, which require fixed numbers of species and reactions. Rather than implementing custom stochastic simulation algorithms for each process calculus, we propose to use a generic abstract machine that can be instantiated to a range of process calculi and a range of reaction-based simulation algorithms. The abstract machine functions as a just-in-time compiler, which dynamically updates the set of possible reactions and chooses the next reaction in an iterative cycle. In this short paper we give a brief summary of the generic abstract machine, and show how it can be instantiated with the stochastic simulation algorithm known as Gillespie’s Direct Method. We also discuss the wider implications of such an abstract machine, and outline how it can be used to simulate multiple calculi simultaneously within a common framework.

1 Introduction

Biological systems typically involve large numbers of components with complex, highly parallel interactions and intrinsic stochasticity. To model this complexity, numerous programming languages based on process calculi have been developed, many of which are expressive enough to generate unbounded numbers of molecular species and reactions. Examples include variants of the stochastic pi-calculus [14, 15, 12], BlenX [4], the kappa calculus [3], and variants of the bioambient calculus [16, 11]. As a result of this expressiveness, such calculi cannot rely on standard reaction-based simulation methods such as [8, 6], which require fixed numbers of species and reactions. Instead, a custom simulation algorithm is typically developed for each calculus. The choice of algorithm depends on the nature of the underlying biological system, such as whether exact simulation is required [7, 6], whether certain reactions operate at different timescales [8, 17], or whether non-Markovian reaction rates are needed [2, 9].

Rather than implementing custom stochastic simulation algorithms for each process calculus, we propose to use a generic abstract machine that can be instantiated to a range of process calculi and a range of reaction-based simulation algorithms. The abstract machine functions as a just-in-time compiler, which dynamically updates the set of possible reactions and chooses the next reaction in an iterative cycle. The abstract machine is instantiated to a particular calculus by defining two functions: one for transforming a process of the calculus to a set of species, and another for computing the set of possible reactions between species. The abstract machine is instantiated to a particular simulation algorithm by definition three functions: one for computing the next reaction, one for computing the reaction activity from an initial set of reactions and species populations, and a third for updating the reaction activity as the species populations change over time. Having a clear separation between the simulation algorithm and the language specification allows us not only to easily instantiate the machine to different process calculi, but also to add new simulation algorithms that can be shared between calculi. Furthermore, the approach could be used to dynamically integrate the simulation of multiple process calculi simultaneously, acting as a common language runtime for the simulation of process calculi for biology.

In this short paper we give a brief summary of the generic abstract machine of [9], and show how it can be instantiated with the stochastic simulation algorithm of [7]. We also discuss the wider implications of such an abstract machine, and outline how it can be used to simulate multiple calculi simultaneously within a common framework.

2 Summary of the Abstract Machine

Table 1: Syntax of the generic abstract machine, where a term TT consists of the current time tt, a species map SS and a reaction map RR. We let I~\widetilde{I} denote a multiset of species {I1,..,IN}\{I_{1},..,I_{N}\} and O~\widetilde{O} denote a set of reactions.

T syntax description
TT (t,S,R)(t,S,R) Time tt, species map SS, reaction map RR
SS {I1i1,..,INiN}\{I_{1}\mapsto i_{1},..,I_{N}\mapsto i_{N}\} Map from a species II to its population ii,
RR {O1A1,..,ONAN}\{O_{1}\mapsto A_{1},..,O_{N}\mapsto A_{N}\} Map from a reaction OO to its activity AA
OO (I~,r,I~)(\widetilde{I},r,\widetilde{I^{\prime}}) Reaction with reactants I~\widetilde{I}, products I~\widetilde{I^{\prime}} and rate rr.

Table 2: Parameterised definition of the generic abstract machine. If I~\widetilde{I} is a multiset {I1,..,IN}\{I_{1},..,I_{N}\} we write I~T\widetilde{I}\oplus T for I1..INTI_{1}\oplus..\oplus I_{N}\oplus T, and TI~T\ominus\widetilde{I} for TI1..INT\ominus I_{1}\ominus..\ominus I_{N} (the order is unimportant). We write 𝑑𝑜𝑚(S){\it dom}(S) for the domain of SS. We also write S(I)S(I) for the value associated with II in SS, and S{Iv}S\{I\mapsto v\} for SS updated so that vv is associated with II.

function definition
PTP\oplus T \triangleq 𝑠𝑝𝑒𝑐𝑖𝑒𝑠(P)T{\it species}(P)\oplus T
I(t,S,R)I\oplus(t,S,R) \triangleq (t,S,RR)(t,S^{\prime},R\cup R^{\prime}) if I~=𝑑𝑜𝑚(S)\widetilde{I^{\prime}}={\it dom}(S); II~I\notin\widetilde{I^{\prime}}; S=S{I1}S^{\prime}=S\{I\mapsto 1\};
O~=𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠(I,I~)\widetilde{O}={\it reactions}(I,\widetilde{I^{\prime}}); R=𝑖𝑛𝑖𝑡(O~,(t,S,R))R^{\prime}={\it init}(\widetilde{O},(t,S^{\prime},R))
I(t,S,R)I\oplus(t,S,R) \triangleq (t,S,RR)(t,S^{\prime},R\cup R^{\prime}) if S(I)=iS(I)=i; S=S{Ii+1}S^{\prime}=S\{I\mapsto i+1\}; R=𝑢𝑝𝑑𝑎𝑡𝑒𝑠(I,(t,S,R))R^{\prime}={\it updates}(I,(t,S^{\prime},R))
(t,S,R)I(t,S,R)\ominus I \triangleq (t,S,RR)(t,S^{\prime},R\cup R^{\prime}) if S(I)=iS(I)=i; S=S{Ii1}S^{\prime}=S\{I\mapsto i-1\}; R=𝑢𝑝𝑑𝑎𝑡𝑒𝑠(I,(t,S,R))R^{\prime}={\it updates}(I,(t,S^{\prime},R))

The syntax of the generic abstract machine is summarised in Table 2, and is based on the definitions of [9]. A machine term TT is a triple (t,S,R)(t,S,R), where tt is the current time, SS is a map from a species II to its population ii, and RR is a map from a reaction OO to its activity AA, which is used to compute the next reaction. Each reaction is represented by a tuple (I~,r,I~)(\widetilde{I},r,\widetilde{I^{\prime}}), where I~\widetilde{I} denotes the multiset of reactant species, I~\widetilde{I^{\prime}} denotes the multiset of product species and rr denotes the reaction rate. The structure of a term of the abstract machine can be summarised as follows.

Machine term TT
Time tt Species map SS Reaction map RR
Species Population Reaction Activity
I1I_{1} i1i_{1} I~1r1I~1\widetilde{I}_{1}\stackrel{{\scriptstyle r_{1}}}{{\longrightarrow}}\widetilde{I}_{1}^{\prime} A1A_{1}
\ldots \ldots \ldots \ldots
INI_{N} iNi_{N} I~MrMI~M\widetilde{I}_{M}\stackrel{{\scriptstyle r_{M}}}{{\longrightarrow}}\widetilde{I}_{M}^{\prime} AMA_{M}

To instantiate the abstract machine with a given process calculus, it is sufficient to define a function 𝑠𝑝𝑒𝑐𝑖𝑒𝑠(P){\it species}(P) for transforming a process PP to a multiset of species, together with a function 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠(I,I~){\it reactions}(I,\widetilde{I^{\prime}}) for computing the set of reactions between a new species II and an existing set of species I~\widetilde{I^{\prime}}. The syntax of species II is specific to the choice of process calculus. The 𝑠𝑝𝑒𝑐𝑖𝑒𝑠{\it species} function is used to initialise the abstract machine at the beginning of a simulation, while the 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠{\it reactions} function is used to update the set of possible reactions dynamically. This allows systems with potentially unbounded numbers of species and reactions to be simulated.

To instantiate the abstract machine with a given simulation algorithm, it is sufficient to define a function 𝑛𝑒𝑥𝑡(T){\it next}(T) for choosing the next reaction from a term TT, a function 𝑖𝑛𝑖𝑡(O~,T){\it init}(\widetilde{O},T) for initialising a term with a set of reactions O~\widetilde{O}, and a function 𝑢𝑝𝑑𝑎𝑡𝑒𝑠(I,T){\it updates}(I,T) for updating the reactions in a term affected by a given species II. The abstract machine is then executed by repeated application of the following rule.

(I~,r,I~),t=𝑛𝑒𝑥𝑡(t,S,R)t,S,R(I~,r,I~)I~((t,S,R)I~)\dfrac{(\widetilde{I},r,\widetilde{I^{\prime}}),t^{\prime}={\it next}(t,S,R)}{t,S,R\stackrel{{\scriptstyle(\widetilde{I},r,\widetilde{I^{\prime}})}}{{\longrightarrow}}\widetilde{I^{\prime}}\oplus((t^{\prime},S,R)\ominus\widetilde{I})}

Each time the next reaction is selected, it is executed by removing the reactants I~\widetilde{I} from the machine term, adding the products I~\widetilde{I^{\prime}} and updating the current time of the machine. Corresponding definitions for adding and removing species are summarised in Table 2. A process PP is added to a machine term TT by computing the multiset of species {I1,,IN}\{I_{1},\dots,I_{N}\} which correspond to PP and then adding each of these species to the term. If a new species II is already present in the term then its population is incremented in SS and the activity of the affected reactions is updated. If the species is not already present in the term, its population is set to 11 in SS and new reactions for the species are computed, together with their activity. The operation TI~T\ominus\widetilde{I} removes the species I~\widetilde{I} from the machine term TT, by decrementing the corresponding species populations and by updating the affected reactions.

3 Instantiating the Abstract Machine

Table 3: Instantiation of the generic abstract machine with the stochastic simulation algorithm of [7]. We write {EiC1;..;CN}\{E_{i}\mid C_{1};..;C_{N}\} to denote the set of elements EiE_{i} that satisfy conditions C1;..;CNC_{1};..;C_{N}. We let n1n_{1} and n2n_{2} denote two random numbers from the standard uniform distribution, U(0,1)U(0,1). The function 𝑝𝑟𝑜𝑝𝑒𝑛𝑠𝑖𝑡𝑦(O,S){\it propensity}(O,S) is defined in the main text.

function definition
𝑛𝑒𝑥𝑡(t,S,R)\mathit{next}(t,S,R) \!\triangleq\! Oμ,t+tO_{\mu},t\!+t^{\prime} if a0=Oi𝑑𝑜𝑚(R)R(Oi)a_{0}=\sum_{O_{i}\in{\it dom}(R)}R(O_{i}); t=(1a0)ln(1n1)t^{\prime}=(\frac{1}{a_{0}})ln(\frac{1}{n_{1}}); i=1μ1ai<n2a0i=1μai\sum_{i=1}^{\mu-1}a_{i}<n_{2}a_{0}\leq\sum_{i=1}^{\mu}a_{i}
𝑖𝑛𝑖𝑡(O~,(t,S,R))\mathit{init}(\widetilde{O},(t,S,R)) \!\triangleq\! {Oi𝑝𝑟𝑜𝑝𝑒𝑛𝑠𝑖𝑡𝑦(Oi,S)OiO~}\{O_{i}\mapsto{\it propensity}(O_{i},S)\>\mid\>O_{i}\in\widetilde{O}\}
𝑢𝑝𝑑𝑎𝑡𝑒𝑠(I,(t,S,R))\mathit{updates}(I,(t,S,R)) \!\triangleq\! {Oi𝑝𝑟𝑜𝑝𝑒𝑛𝑠𝑖𝑡𝑦(Oi,S)Oi𝑑𝑜𝑚(R);Oi=(J~,r,J~);IJ~}\{O_{i}\mapsto{\it propensity}(O_{i},S)\>\mid\>O_{i}\in{\it dom}(R);O_{i}=(\tilde{J},r,\tilde{J^{\prime}});I\in\tilde{J}\}

An instantiation of the abstract machine with the stochastic simulation algorithm of [7] is outlined in Table 3. Each reaction (I~,r,I~)(\widetilde{I},r,\widetilde{I^{\prime}}) is mapped to its propensity aia_{i}, which is computed by multiplying the rate of the reaction by the number of distinct combinations of the reactants I~\widetilde{I}. The function 𝑝𝑟𝑜𝑝𝑒𝑛𝑠𝑖𝑡𝑦(O,S){\it propensity}(O,S) computes the propensity of the reaction OO given the species map SS and is defined as follows, assuming that reactions are either unary or binary and that I1I_{1} and I2I_{2} are distinct species.

𝑝𝑟𝑜𝑝𝑒𝑛𝑠𝑖𝑡𝑦(({I1},r,I~),S)\displaystyle{\it propensity}((\{I_{1}\},r,\widetilde{I^{\prime}}),S) \displaystyle\triangleq r×S(I1)\displaystyle r\times S(I_{1})
𝑝𝑟𝑜𝑝𝑒𝑛𝑠𝑖𝑡𝑦(({I1,I1},r,I~),S)\displaystyle{\it propensity}((\{I_{1},I_{1}\},r,\widetilde{I^{\prime}}),S) \displaystyle\triangleq r×S(I1)×(S(I1)1)/2\displaystyle r\times S(I_{1})\times(S(I_{1})-1)/2
𝑝𝑟𝑜𝑝𝑒𝑛𝑠𝑖𝑡𝑦(({I1,I2},r,I~),S)\displaystyle{\it propensity}((\{I_{1},I_{2}\},r,\widetilde{I^{\prime}}),S) \displaystyle\triangleq r×S(I1)×S(I2)\displaystyle r\times S(I_{1})\times S(I_{2})

The function 𝑖𝑛𝑖𝑡(O~,T){\it init}(\widetilde{O},T) computes the initial propensity for each reaction in O~\widetilde{O}, using the initial species populations in TT, while the function 𝑢𝑝𝑑𝑎𝑡𝑒𝑠(I,T){\it updates}(I,T) updates the propensities of all the reactions in TT for which II is a reactant. Finally, the function 𝑛𝑒𝑥𝑡(T){\it next}(T) chooses a reaction from TT with probability proportional to the reaction propensity, and computes the corresponding duration of the reaction according to [7].

We have also instantiated the abstract machine to the Next Reaction Method of [6] and to the Non-Markovian Next Reaction Method of [9], by defining corresponding 𝑖𝑛𝑖𝑡{\it init}, 𝑛𝑒𝑥𝑡{\it next} and 𝑢𝑝𝑑𝑎𝑡𝑒𝑠{\it updates} functions, as described in [9]. We have used the abstract machine to implement the DNA Strand Displacement (DSD) calculus for modelling DNA circuits [13], the Genetic Engineering of Cells (GEC) calculus for modelling of genetic devices [10], and the Stochastic Pi Machine (SPiM) calculus for general modelling of biological systems [18], by defining appropriate speciesspecies and 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠{\it reactions} functions for each calculus. Simulators for these three calculi are available online at http://research.microsoft.com/dna, http://research.microsoft.com/gec and http://research.microsoft.com/spim, respectively. Technical details of the instantiation of the generic abstract machine with the stochastic pi-calculus and the bioambient calculus are outlined in [9]. We are currently developing an instantiation of the generic abstract machine to the kappa calculus of [3]. Although the idea of integrating different modelling and simulation methods within a common framework is not a new one [5], our approach is the first attempt to formally define a generic framework for simulating a broad range of process calculi with an arbitrary reaction-based simulation algorithm.

4 A Common Simulation Framework

The generic abstract machine can be used to simulate multiple calculi simultaneously by assuming a separate species type ILI_{L} for each calculus LL, together with an initial set of cross-calculus reactions O0~\widetilde{O_{0}}. An example of a cross-calculus reaction is IDSD+ISPiMrISPiM+ISPiMI_{DSD}+I_{SPiM}\stackrel{{\scriptstyle r}}{{\longrightarrow}}I_{SPiM}+I^{\prime}_{SPiM}, which takes a species of the DSD language, such as a known DNA vaccine assembled via strand displacement, together with a species of the SPiM language, such as a polymerase, and produces a corresponding protein species in SPiM together with the original polymerase. The reaction therefore enables the output of a strand displacement model in DSD to interface with a cellular model in SPiM. For each dynamically created species ILI_{L} the function 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠(IL,I~){\it reactions}(I_{L},\widetilde{I^{\prime}}) calls the appropriate calculus-specific function 𝑟𝑒𝑎𝑐𝑡𝑖𝑜𝑛𝑠L(IL,IL~),{\it reactions_{L}}(I_{L},\widetilde{I_{L}^{\prime}}), where IL~\widetilde{I_{L}^{\prime}} denotes the subset of species in I~\widetilde{I^{\prime}} that are of type LL. This approach allows multiple calculi to interact with each other within the same simulation environment, via a fixed set of interface reactions. Further work is needed to formalise the multi-language execution paradigm in more detail.

The generic abstract machine can therefore be used to simulate a range of existing process calculi within a common framework. By decoupling the choice of calculus from the choice of simulation algorithm, multiple calculi can re-use the same algorithm via a common interface, without the need to implement custom simulation algorithms for each calculus. In future, this could allow models to be constructed from components written in different domain-specific languages, each designed to allow a natural, concise encoding of that component. The components could then interact dynamically via a common language runtime, allowing integrated simulation of heterogeneous biological systems.

References

  • [2] Dmitri Bratsun, Dmitri Volfson, Lev S. Tsimring & Jeff Hasty (2005): Delay-induced stochastic oscillations in gene regulation. Proceedings of the National Academy of Sciences of the United States of America 102(41), pp. 14593–14598. Available at http://www.pnas.org/content/102/41/14593.abstract.
  • [3] Vincent Danos, Jéréme Feret, Walter Fontana, Russell Harmer & Jean Krivine (2007): CONCUR 2007 - Concurrency Theory, chapter Rule-Based Modelling of Cellular Signalling, pp. 17–41. Available at http://dx.doi.org/10.1007/978-3-540-74407-8_3.
  • [4] Lorenzo Dematté, Corrado Priami & Alessandro Romanel (2008): Modelling and simulation of biological processes in BlenX. SIGMETRICS Performance Evaluation Review 35(4), pp. 32–39. Available at http://doi.acm.org/10.1145/1364644.1364653.
  • [5] Roland Ewald, Jan Himmelspach, Matthias Jeschke, Stefan Leye & Adelinde M Uhrmacher (2010): Flexible experimentation in the modeling and simulation framework JAMES II – implications for computational systems biology. Brief Bioinform Available at http://dx.doi.org/10.1093/bib/bbp067.
  • [6] Michael A. Gibson & Jehoshua Bruck (2000): Efficient Exact Stochastic Simulation of Chemical Systems with Many Species and Many Channels. The Journal of Physical Chemistry A 104(9), pp. 1876–1889. Available at http://pubs.acs.org/doi/abs/10.1021/jp993732q.
  • [7] Daniel T. Gillespie (1977): Exact stochastic simulation of coupled chemical reactions. J. Phys. Chem. 81(25), pp. 2340–2361.
  • [8] Daniel T. Gillespie (2001): Approximate accelerated stochastic simulation of chemically reacting systems. J. Chem. Phys. 115, pp. 1716–1733.
  • [9] Loïc Paulevé, Simon Youssef, Matthew R. Lakin & Andrew Phillips (2010): A generic abstract machine for stochastic process calculi. In: CMSB ’10: Proceedings of the 8th International Conference on Computational Methods in Systems Biology, ACM, New York, NY, USA, pp. 43–54.
  • [10] Michael Pedersen & Andrew Phillips (2009): Towards programming languages for genetic engineering of living cells. Journal of the Royal Society Interface 6(S4), pp. 437–450.
  • [11] Andrew Phillips (2009): An Abstract Machine for the Stochastic Bioambient Calculus. Electronic Notes in Theoretical Computer Science 227, pp. 143–159.
  • [12] Andrew Phillips & Luca Cardelli (2007): Efficient, Correct Simulation of Biological Processes in the Stochastic Pi-calculus. In: Computational Methods in Systems Biology, LNCS 4695, Springer, pp. 184–199.
  • [13] Andrew Phillips & Luca Cardelli (2009): A programming language for composable DNA circuits. Journal of the Royal Society Interface 6(S4), pp. 419–436.
  • [14] C. Priami, A. Regev, E. Shapiro & W. Silverman (2001): Application of a stochastic name-passing calculus to representation and simulation of molecular processes. Information Processing Letters 80, pp. 25–31.
  • [15] A. Regev, W. Silverman & E. Shapiro (2001): Representation and Simulation of Biochemical Processes Using the pi-Calculus Process Algebra. In: Pacific Symposium on Biocomputing, 6, World Scientific Press, Singapore, pp. 459–470.
  • [16] Aviv Regev, Ekaterina M. Panina, William Silverman, Luca Cardelli & Ehud Y. Shapiro (2004): BioAmbients: an abstraction for biological compartments. Theor. Comput. Sci. 325(1), pp. 141–167. Available at http://dx.doi.org/10.1016/j.tcs.2004.03.061.
  • [17] Tianhai Tian & Kevin Burrage (2004): Binomial leap methods for simulating stochastic chemical kinetics. J. Chem. Phys. 121, pp. 10356–10364.
  • [18] Dennis Y. Q. Wang, Luca Cardelli, Andrew Phillips, Nir Piterman & Jasmin Fisher (2009): Computational modeling of the EGFR network elucidates control mechanisms regulating signal dynamics. BMC Systems Biology 3(118).