Upcoming SlideShare
×

# The Stochastic Simulation Algorithm

1,717 views

Published on

A description of Gillespie's Stochastic Simulation Algorithm.

Published in: Education
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### The Stochastic Simulation Algorithm

1. 1. Computer Science Large Practical: The Stochastic Simulation Algorithm (SSA) Stephen Gilmore School of Informatics Friday 5th October, 2012Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 1 / 25
2. 2. Stochastic: Random processes Fundamental to the principle of stochastic modelling is the idea that molecular reactions are essentially random processes; it is impossible to say with complete certainty the time at which the next reaction within a volume will occur.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 2 / 25
3. 3. Stochastic: Predictability of macroscopic states In macroscopic systems, with a large number of interacting molecules, the randomness of this behaviour averages out so that the overall macroscopic state of the system becomes highly predictable. It is this property of large scale random systems that enables a deterministic approach to be adopted; however, the validity of this assumption becomes strained in in vivo conditions as we examine small-scale cellular reaction environments with limited reactant populations.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 3 / 25
4. 4. Stochastic: Propensity function As explicitly derived by Gillespie, the stochastic model uses basic Newtonian physics and thermodynamics to arrive at a form often termed the propensity function that gives the probability aµ of reaction µ occurring in time interval (t, t + dt). aµ dt = hµ cµ dt where the M reaction mechanisms are given an arbitrary index µ (1 ≤ µ ≤ M), hµ denotes the number of possible combinations of reactant molecules involved in reaction µ, and cµ is a stochastic rate constant.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 4 / 25
5. 5. Stochastic: Grand probability function The stochastic formulation proceeds by considering the grand probability function Pr(X; t) ≡ probability that there will be present in the volume V at time t, Xi of species Si , where X ≡ (X1 , X2 , . . . XN ) is a vector of molecular species populations. Evidently, knowledge of this function provides a complete understanding of the probability distribution of all possible states at all times.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 5 / 25
6. 6. Stochastic: Inﬁnitesimal time interval By considering a discrete inﬁnitesimal time interval (t, t + dt) in which either 0 or 1 reactions occur we see that there exist only M + 1 distinct conﬁgurations at time t that can lead to the state X at time t + dt. Pr(X; t + dt) = Pr(X; t) Pr(no state change over dt) M + µ=1 Pr(X − vµ ; t) Pr(state change to X over dt) where vµ is a stoichiometric vector deﬁning the result of reaction µ on state vector X, i.e. X → X + vµ after an occurrence of reaction µ.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 6 / 25
7. 7. Stochastic: State change probabilities Pr(no state change over dt) M 1− aµ (X)dt µ=1 Pr(state change to X over dt) M Pr(X − vµ ; t)aµ (X − vµ )dt µ=1Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 7 / 25
8. 8. Stochastic: Partial derivatives We are considering the behaviour of the system in the limit as dt tends to zero. This leads us to consider partial derivatives, which are deﬁned thus: ∂ Pr(X; t) Pr(X; t + dt) − Pr(X; t) = lim ∂t dt→0 dtStephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 8 / 25
9. 9. Stochastic: Chemical Master Equation Applying this, and re-arranging the former, leads us to an important partial diﬀerential equation (PDE) known as the Chemical Master Equation (CME). M ∂ Pr(X; t) = aµ (X − vµ ) Pr(X − vµ ; t) − aµ (X) Pr(X; t) ∂t µ=1Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 9 / 25
10. 10. The problem with the Chemical Master Equation The CME is really a set of nearly as many coupled ordinary diﬀerential equations as there are combinations of molecules that can exist in the system! The CME can be solved analytically for only a very few very simple systems, and numerical solutions are usually prohibitively diﬃcult. D. Gillespie and L. Petzold. chapter Numerical Simulation for Biochemical Kinetics, in System Modelling in Cellular Biology, editors Z. Szallasi, J. Stelling and V. Periwal. MIT Press, 2006.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 10 / 25
11. 11. Advertisement: Athena SWANLast day to take part As part of the School of Informatics’ commitment to diversity, and to a workplace where all students are treated fairly, we have decided to undertake a gender equality culture survey. The focus of this survey is gender diversity, as this is a cross-cutting diversity issue where we feel we can have the greatest positive impact; contributing to development and advancement of the School, for all our students.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 11 / 25
12. 12. Advertisement: Athena SWANLast day to take part The survey results will tell us what we are doing well in terms of gender equality, and where we need to make any improvements. The School is committed to using this data to improve our policies and practices. This will also feed into our Athena SWAN application. The link to the survey is https: //www.survey.ed.ac.uk/informatics_student_culture2012/Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 12 / 25
13. 13. Advertisement: Athena SWANLast day to take part Your response will be conﬁdential and only anonymous results will be seen by management, and communicated to staﬀ (students). The survey should take only about 10 minutes to complete and will be available until 5th October (today).Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 13 / 25
14. 14. Stochastic simulation algorithmsStochastic simulation algorithms Gillespie’s Stochastic Simulation Algorithm (SSA) is essentially an exact procedure for numerically simulating the time evolution of a well-stirred chemically reacting system by taking proper account of the randomness inherent in such a system.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 14 / 25
15. 15. Stochastic simulation algorithmsGillespie’s exact SSA (1977) The algorithm takes time steps of variable length, based on the rate constants and population size of each chemical species. The probability of one reaction occurring relative to another is dictated by their relative propensity functions. According to the correct probability distribution derived from the statistical thermodynamics theory, a random variable is then used to choose which reaction will occur, and another random variable determines how long the step will last. The chemical populations are altered according to the stoichiometry of the reaction and the process is repeated.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 15 / 25
16. 16. Stochastic simulation algorithmsGillespie’s exact SSA (1977)As described by in “Stochastic Simulation Algorithms for Chemical Reactions” by Ahn,Cao and Watson, 2008 Suppose a biochemical system or pathway involves N molecular species {S1 , . . . , SN }. Xi (t) denotes the number of molecules of species Si at time t. People would like to study the evolution of the state vector X (t) = (X1 (t), . . . , XN (t)) given that the system was initially in the state vector X (t0 ). Example The enzyme-substrate example had N = 4 molecular species, (E , S, C , P), and the initial state vector X (t0 ) was (5, 5, 0, 0). If t = 200 we might ﬁnd that X (t) was (5, 0, 0, 5).Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 16 / 25
17. 17. Stochastic simulation algorithmsGillespie’s exact SSA (1977)As described by in “Stochastic Simulation Algorithms for Chemical Reactions” by Ahn,Cao and Watson, 2008 Suppose the system is composed of M reaction channels {R1 , . . . , RM }. In a constant volume Ω, assume that the system is well-stirred and in thermal equilibrium at some constant temperature. Example The enzyme-substrate example had M = 3 reaction channels, f , b and p.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 17 / 25
18. 18. Stochastic simulation algorithmsGillespie’s exact SSA (1977)As described by in “Stochastic Simulation Algorithms for Chemical Reactions” by Ahn,Cao and Watson, 2008 There are two important quantities in reaction channels Rj : the state change vector vj = (v1j , . . . , vNj ), and propensity function aj . vij is deﬁned as the change in the Si molecules’ population caused by one Rj reaction, aj (x)dt gives the probability that one Rj reaction will occur in the next inﬁnitesimal time interval [t, t + dt). Example The reaction f: E + S -> C has state change vector (−1, −1, 1, 0).Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 18 / 25
19. 19. Stochastic simulation algorithmsGillespie’s exact SSA (1977)As described by in “Stochastic Simulation Algorithms for Chemical Reactions” by Ahn,Cao and Watson, 2008 The SSA simulates every reaction event. With X (t) = x, p(τ, j | x, t)dτ is deﬁned as the probability that the next reaction in the system will occur in the inﬁnitesimal time interval [t + τ, t + τ + dτ ), and will be an Rj reaction. M By letting a0 (x) ≡ j=1 aj (x), the equation p(τ, j | x, t) = aj (x) exp(−a0 (x)τ ), can be obtained.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 19 / 25
20. 20. Stochastic simulation algorithmsGillespie’s exact SSA (1977)As described by in “Stochastic Simulation Algorithms for Chemical Reactions” by Ahn,Cao and Watson, 2008 A Monte Carlo method is used to generate τ and j. On each step of the SSA, two random numbers r1 and r2 are generated from the uniform (0,1) distribution. From probability theory, the time for the next reaction to occur is given by t + τ , where 1 1 τ= ln( ). a0 (x) r1Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 20 / 25
21. 21. Stochastic simulation algorithmsGillespie’s exact SSA (1977)As described by in “Stochastic Simulation Algorithms for Chemical Reactions” by Ahn,Cao and Watson, 2008 The next reaction index j is given by the smallest integer satisfying j aj (x) > r2 a0 (x). j =1 After τ and j are obtained, the system states are updated by X (t + τ ) := x + vj , and the time is updated by t := t + τ . This simulation iteration proceeds until the time t reaches the ﬁnal time.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 21 / 25
22. 22. Stochastic simulation algorithmsSampling from a probability distribution In order to sample from a non-uniform probability distribution we can think of an archer repeatedly blindly ﬁring random arrows at a patch of painted ground. Because the arrows are uniformly randomly distributed they are likely to hit the larger painted areas more often than the smaller painted areas. Archer 133 110 50 50 40 30 Note We cannot predict beforehand where any particular arrow will land.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 22 / 25
23. 23. Stochastic simulation algorithmsSampling from a probability distribution Here we interpret the picture as meaning that there are ﬁve reaction channels (the red reaction, the blue reaction, the green reaction, the yellow reaction and the black reaction). These have diﬀerent propensities, with the red reaction being the most likely to ﬁre and the black reaction being the least likely to ﬁre. Archer 133 110 50 50 40 30 Note We know that the blue reaction ﬁres because 110 + 50 > 133.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 23 / 25
24. 24. Stochastic simulation algorithmsGillespie’s SSA is a Monte Carlo Markov Chain simulation The SSA is a Monte Carlo type method. With the SSA one may approximate any variable of interest by generating many trajectories and observing the statistics of the values of the variable. Since many trajectories are needed to obtain a reasonable approximation, the eﬃciency of the SSA is of critical importance.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 24 / 25
25. 25. Stochastic simulation algorithmsExcellent introductory papers T.E. Turner, S. Schnell, and K. Burrage. Stochastic approaches for modelling in vivo reactions. Computational Biology and Chemistry, 28:165–178, 2004. D. Gillespie and L. Petzold. System Modelling in Cellular Biology, chapter Numerical Simulation for Biochemical Kinetics,. MIT Press, 2006.Stephen Gilmore (School of Informatics) Stochastic simulation Friday 5th October, 2012 25 / 25