34
Methods of stochastic simulation Computational Systems Biology II lectures by Antti Saarinen 22.4.2008 Methods of stochastic simulation – p. 1/34

Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Methods of stochastic simulation

Computational Systems Biology II

lectures by Antti Saarinen

22.4.2008

Methods of stochastic simulation – p. 1/34

Page 2: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Outline

• What is stochasticity?• Stochastic phenomena in biology• Stochastic simulation methods

◦ Gillespie method for simulating coupled chemicalreactions

◦ Stochastic differential equations (SDEs) and Brownianmotion

Methods of stochastic simulation – p. 2/34

Page 3: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Stochasticity

• from Greek stokhastikos = capable of guessing• "the quality of lacking any predictable order or plan"

(randomness, noise)• "having a probability distribution, usually with finite variance"

(statistical)• "involving a random variable the successive values of which

are not independent" (statistical)

Methods of stochastic simulation – p. 3/34

Page 4: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Stochastic phenomena in biology

• Pollen in water (→ Brownian motion)• Chemical reactions• Diffusion• Bacterial motion• Behaviour of ion channels on cell membrane• Electroresponsiveness of a neuron• Radioactive decay• etc..

Methods of stochastic simulation – p. 4/34

Page 5: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

ODEs

• The time evolution of spatially homogeneous mixture ofchemically reacting molecules is usually calculated bysolving a set of ordinary differential equations.

• N chemical species → N differential equations.• Each equation expresses the rate-of-change of the

molecular concentration of one chemical species as afunction of the molecular concentrations of all the species.

d[Xi]

dt= fi([X1], . . . , [XN ], t)

Methods of stochastic simulation – p. 5/34

Page 6: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

ODEs

• Traditional method based on a deterministic formulation ofchemical kinetics.

• Reaction constants are viewed as "reaction rates".

d[X3]

dt= k1[X1][X2] − k2[X3]

• Concentrations are represented by continuous,single-valued functions of time.

• Although adequate in most cases, there are importantsituations, for which underlying physical assumptions areunrealistic and consequent predictions are unreliable.

Methods of stochastic simulation – p. 6/34

Page 7: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Gillespie’s stochastic method

• Reaction constants are viewed not as "reaction rates", butas "reaction probabilities per unit time".

• Temporal behaviour of a chemically reacting system takesthe form of a Markovian random walk in the N -dimensionalspace of molecular populations.

• The time evolution is described by a single equation for agrand probability function in which time and the Npopulations appear as independent variables (the masterequation).

Methods of stochastic simulation – p. 7/34

Page 8: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Gillespie’s stochastic method

• From a physical point of view, the stochastic formulation issuperior to the deterministic formulation.

• The stochastic approach is always valid whenever thedeterministic approach is valid, and is sometimes validwhen the deterministic approach is not.

• Gillespie presents a feasible method for numericallycalulating the stochastic time evolution of a chemicalsystem.

• Set of deterministic reaction-rate equations for a givenchemical system is much easier to solve than the stochasticmaster equation for the same system.

Methods of stochastic simulation – p. 8/34

Page 9: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Gillespie’s stochastic method

• The general problem: given a volume V which containsmolecules of N chemically active species Si, determine thetime evolution of such a system.

• Xi := current number of molecules of chemical species Si

in V .• Chemical species can participate in M reactions Rm, each

characterised by a reaction parameter cm.• Parameter cm is called the reaction propensity.

Methods of stochastic simulation – p. 9/34

Page 10: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Gillespie’s stochastic method

• (For definiteness) Reaction Rm is one of the following type◦ * → reaction products,◦ Sj → reaction products,◦ Sj + Sk → reaction products,◦ 2Sj → reaction products,◦ Sj + Sk + Sl → reaction products,◦ Sj + 2Sk → reaction products,◦ 3Sj → reaction products.

• Each reaction is unidirectional, so any reversible reactionmust be considered as two separate reactions.

Methods of stochastic simulation – p. 10/34

Page 11: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Gillespie’s stochastic method

• Fundamental hypothesis: cm∆t := average probability thata particular combination of Rm reactant molecules will reactaccordingly in the next time interval ∆t.

• The relationship between the propensity cm and the"reaction rate constant" km which is used in thedeterministic formulation will be examined later.

• Simulate the time evolution of N quantities {Xi}, knowingonly their initial values, the forms of the M reactions {Rm}and the values of the assosiated reaction parameters {cm}.

Methods of stochastic simulation – p. 11/34

Page 12: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Finding the propensity cm

• Let’s look at reaction Rm : S1 + S2 → 2S3.• Molecules are hard spheres with masses mi and diameters

di.• 1–2 collision will occur if the centre-to-centre distance

between an S1 and S2 molecule decreases tod12 := (d1 + d2)/2.

• Let v12 denote the relative speed of the molecules.• In the vanishingly small time interval ∆t molecule 1 sweeps

out relative to molecule 2 a "collision volume"∆Vcoll = πd2

12v12∆t.

• If the center of molecule 2 lies in ∆Vcoll then molecules 1and 2 collide in time ∆t.

Methods of stochastic simulation – p. 12/34

Page 13: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Finding the propensity cm

• Problems in deterministic case (spatially homogeneous)when ∆t → 0, because the number of molecules in ∆Vcoll

will either be 0 or 1.• Averaging leads to more trouble (e.g. the average number

of molecular pairs does not equal to the product of averagenumers of molecules).

• Herein lies the source of the inexact nature of thedeterministic reaction rate equations.

• All these difficulties can be avoided if we consider uniformly(randomly) distributed molecules throughout V .

• Probability that the centre of one S2 molecule will lie inside∆Vcoll is exactly ∆Vcoll/V .

Methods of stochastic simulation – p. 13/34

Page 14: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Finding the propensity cm

• Average probability that a particular 1–2 molecular pair willcollide in the next ∆t is

∆Vcoll

V

=πd2

12〈v12〉∆t

V.

• Average relative velocity can be calculated usingMaxwell-Bolzmann distributions.

• The above expression corresponds exactly to the quantitycm∆t.

Methods of stochastic simulation – p. 14/34

Page 15: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Relation between cm and km

• Mathematical relationship between cm and km is alwaysrather simple (e.g. km = V cm or km = V cm/2), but from aphysical standpoint cm appears to be on much firmerground.

• The stochastic formulation of chemical kinetics for spatiallyhomogenous systems does indeed take proper account ofcorrelations and fluctuations which are ignored in thedeterministic formulation.

• For most systems the difference between the stochastic andthe deterministic formulation is academic. However, nearchemical instabilities in certain nonlinear systems,fluctuations and correlation can produce dramatic effets.

Methods of stochastic simulation – p. 15/34

Page 16: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Reaction probability density

• P (X1, . . . ,XN , t) = the probability that there will be Xi

molecules of Si in V at time t.• The so-called master equation is just the time evolution

equation for the function P (X1, . . . ,XN , t), and it can berigorously derived by using simple probability calculus.

• The master equation is usually intractable, both analyticallyand numerically.

• Problem can be solved using reaction probability densityfunction P (τ,m).

Methods of stochastic simulation – p. 16/34

Page 17: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Reaction probability density

• P (τ,m)dτ = probability at time t that the next reaction in Vwill occur in the differential time interval (t + τ, t + τ + dτ )and will be an Rm reaction.

• After some calculations we get

P (τ,m) = hmcm exp

(

−M∑

i=1

hiciτ

)

,

where hi is the number of distinct molecular reactantcombinations for reaction Rm found to be present in V attime t.

Methods of stochastic simulation – p. 17/34

Page 18: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Simulation algorithm

1) Set t = 0. Specify initial values X1, . . . ,XN and c1, . . . , cm.Calculate h1c1, . . . , hMcM which determine P (τ,m).

2) Generate random pair (τ,m) according to P (τ,m).

3) Using numbers τ and m andvance t by τ , and change Xi

values of those species involved in reaction Rm to reflectthe occurrence of one Rm reaction. Then, recalculate hici

for the new P (τ,m) and go to step 2.

Methods of stochastic simulation – p. 18/34

Page 19: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Simulation algorithm

• By carrying out the above procedure one obtains onepossible realisation of the stochastic process.

• In order to get statistically complete picture of the temporalevolution of the system, one must actually carry out severalindependend simulations with same initial conditions.

• Expected number of Si molecules, variance or standarddeviation for describing the fluctuations which mayreasonably be expected.

Methods of stochastic simulation – p. 19/34

Page 20: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Summary of Gillespie method

• Relatively simple procedure for calculating the timeevolution of any spatially homogeneous chemical system.

• Commonly used in biological stochastic simulations.• Implemented in many softwares.• Improved versions also available ("direct" method, "first

reaction" method, τ -leap . . . ).

Methods of stochastic simulation – p. 20/34

Page 21: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Example

The Brusselator, a "limit cycle" chemical oscillator

(1) X1c1→ Y1

(2) X2 + Y1c2→ Y2 + Z1

(3) 2Y1 + Y2c3→ 3Y1

(4) Y1c4→ Z2

Methods of stochastic simulation – p. 21/34

Page 22: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Example

Methods of stochastic simulation – p. 22/34

Page 23: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Example

Methods of stochastic simulation – p. 23/34

Page 24: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Example

Methods of stochastic simulation – p. 24/34

Page 25: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Example

Methods of stochastic simulation – p. 25/34

Page 26: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

SDEs and Brownian motion

• SDE models play a prominent role in a range of aplicationareas, including biology, chemistry, epidemiology,mechanics, microelectronics, economics and finance.

• Complete understanding requires familiarity with advancedprobability theory and stochastic processes.

• Simple simulation can be carried out just with backgroundknowledge of Euler’s method for ODEs and an intuitiveunderstanding of random variables (..says Higham).

Methods of stochastic simulation – p. 26/34

Page 27: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

SDEs and Brownian motion

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1−0.5

0

0.5

1

t

W(t)

A sample path of one-dimensional Brownian motion.

Methods of stochastic simulation – p. 27/34

Page 28: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

SDEs and Brownian motion

• Brownian motion incorporates the natural randomnessobserved in biological phenomena into the biologicalmodels.

• A proper stochastic process (unlike commonly used "whitenoise").

• Brownian motion has analytically desirable properties (e.g.normally distributed, independent increments).

Methods of stochastic simulation – p. 28/34

Page 29: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

SDEs and Brownian motion

• (ODE) dX(t)dt

= f(X(t), t)

⇒ X(t) = X(0) +

∫ t

0f(X(t), t)dt.

• (SDE) dX(t) = f(X(t), t)dt + g(X(t), t)dW

⇒ X(t) = X(0) +

∫ t

0f(X(t), t)dt

+

∫ t

0g(X(t), t)dW.

Methods of stochastic simulation – p. 29/34

Page 30: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

SDEs and Brownian motion

• Handling of stochastic integrals needs new type of calculus.• Derivation of analytical results is possible, but usually

tedious.• Simulation of SDEs is, on the other hand, rather

straightforward.• Presently not implemented in existing simulation software.• Own simulation software needed (e.g. MATLAB scripts).

Methods of stochastic simulation – p. 30/34

Page 31: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

SDEs and Brownian motion

Deterministic and stochastic model for cerebellar granule cell.

Methods of stochastic simulation – p. 31/34

Page 32: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

SDEs and Brownian motion

A)

B)

C)

Methods of stochastic simulation – p. 32/34

Page 33: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

Exercises

Simulation of a barnacle muscle fibre.

Methods of stochastic simulation – p. 33/34

Page 34: Computational Systems Biology II lectures by Antti Saarinen 22.4 · 2008-04-21 · Simulating the Stochastic Time Evolution of Coupled Chemical Reactions," Journal of Computational

References

• Daniel T. Gillespie, "A General Method for NumericallySimulating the Stochastic Time Evolution of CoupledChemical Reactions," Journal of Computational Physics,vol. 22, no. 4, 1976.

• Desmond J. Higham, "An Algorithmic Introduction toNumerical Simulation of Stochastic Differential Equations,"SIAM Review, vol. 43, no. 3, 2001.

Methods of stochastic simulation – p. 34/34