Simulation and Modelling - Imperial College Londonjb/teaching/simulation-and-modelling/... · 2008....
Transcript of Simulation and Modelling - Imperial College Londonjb/teaching/simulation-and-modelling/... · 2008....
Simulation and Modelling
Tony Field and Jeremy Bradley
Room 372. Email: [email protected]
Department of Computing, Imperial College London
Produced with prosper and LATEX
SM [11/08] – p. 1
Chemical Reactions and Simulation
With thanks to Daniel Gillespie!
Daniel T. Gillespie, Simulation Methods inSystems Biology. SFM 2008, LNCS 5016, pp.
125–167, 2008. Springer-Verlag.
Daniel T. Gillespie, Exact stochastic simulation ofcoupled chemical reactions. J. Phys. Chem.,
81(25), pp. 2340–2361, 1977.DOI: 10.1021/j100540a008
SM [11/08] – p. 2
Simulating Large Stochastic Models
Examples: Chemical reactions, biologicalsystems, epidemic models and parallel anddistributed systems
Underlying genuinely stochastic models,often reasonable to assume Markovianbehaviour, reactions between elementsconsitute synchronisation in a model
SM [11/08] – p. 3
Reaction: Mass action
Reaction between e.g. well-mixed fluids andgases
Molecules diffuse (Brownian motion)
Molecules can potentially react with any otherco-reagant molecule
Example reaction:
A + Bλ
−→ AB
Initially m A molecules, n B molecules
SM [11/08] – p. 4
Reaction: Mass action
A
B
SM [11/08] – p. 5
Reaction: Mass action
A
B
´´
´3
QQs
-J
JJ
JJ
JJ
AAAAAAAAAAU
SM [11/08] – p. 5
Reaction: Mass action
A
B
´´
´3
QQs
-J
JJ
JJ
JJ
AAAAAAAAAAU
´´
´3
QQs
-J
JJ
JJ
JJ
Á
SM [11/08] – p. 5
Reaction: Mass action
A
B
´´
´3
QQs
-J
JJ
JJ
JJ
AAAAAAAAAAU
´´
´3
QQs
-J
JJ
JJ
JJ
Á
´´
´3
QQs
-
Á
¢¢¢¢¢¢¢¢¢¢
Total number of possible interactions: mn
SM [11/08] – p. 5
Reaction: Mass action
´´
´´
QQQ
Total number of actual AB products: min(m, n)
SM [11/08] – p. 6
Reaction: Local action
Reaction between e.g. surface of two solids,two jellies, two very viscous fluids
No molecule diffusion
Molecules react with closest local neighbour
No reaction competition
Example reaction:
A + Bλ
−→ AB
Initially m A molecules, n B molecules
SM [11/08] – p. 7
Reaction: Local actionA B
-
-
-
Total number of possible reactions: min(m, n)
SM [11/08] – p. 8
Reaction: Local action
Total number of AB products: min(m, n)
SM [11/08] – p. 9
Reaction: Passive action
Reaction catalysed by one or more passivemolecules
Heavily spatially dependent on catalystshape/configuration
Example reaction:
A + Bλ
−→ A + B′
Initially 1 A molecule, n B molecules
SM [11/08] – p. 10
Reaction: Passive action
A
B
Total number of possible reactions: I(m > 0) n
SM [11/08] – p. 11
Reaction: Catalyst
A
B′
Total number of B′ products: I(m > 0) n
SM [11/08] – p. 12
Chemical Systems
Consider a system of molecules of Nchemical species S1, . . . , SN, which interactthrough M reaction channels R1, . . . , RM inreaction vessel of volume Ω
The state of a general chemical systemrequires giving the instantaneous position,velocity, and species of each molecule in thesystem
SM [11/08] – p. 13
Chemical Systems
Specifying the state of a well-stirred system ismuch easier – we need only specify thevector
~X(t) = (X1(t), . . . , XN(t))
where Xi(t) is the number of Si moleculescontained in a container at time t
The state-change vector ~νj = (ν1j, . . . , νNj)where νij is defined to be the change in the Si
molecular population caused by one Rj
reaction event
SM [11/08] – p. 14
Propensity
So now we can say that reaction Rj producesthe following change in the system state
~x → ~x + ~νj
where xi is the number Si molecules in aparticular state
Propensity function aj(~x) represents, for a givensystem state ~x, the propensity of reaction Rj
to occur
SM [11/08] – p. 15
Propensity
Fundamental premise of stochastic chemicalkinetics, for a given system state ~x:
aj(~x)δt = IP(for state ~x, reaction Rj will occurinside Ω in the next infinitesimaltime interval [t, t + δt) | ~X(t) = ~x)
Used to express Chemical Master Equation(CME) for finding P (~x, t), probability system isin state ~x at time t:
P (~x, t) = IP( ~X(t) = ~x | ~X(t0) = ~x0 for t0 ≤ t)
SM [11/08] – p. 16
Example Propensity Functions
Under reaction Rj happening with reaction rateconstant cj, there are 3 possibilities (assumingno n-way reactions for n > 2):
If S1cj
−→ products aj(~x) = cjx1
If S1 + S2cj
−→ products aj(~x) = cjx1x2
If 2S1cj
−→ products aj(~x) = cj12x1(x1 − 1)
SM [11/08] – p. 17
Chemical Master Equation
Consider the possible ways that a system canreach state ~x by time t + δt:
P (~x, t + δt) = P (~x, t) ×
(
1 −
M∑
j=1
(aj(~x)δt)
)
︸ ︷︷ ︸
IP(System does not undergo a reaction in δt)
+M∑
j=1
P (~x − ~νj, t) × (aj(~x − ~νj)δt)
︸ ︷︷ ︸
IP(System does undergo a reaction Rj in δt)
(∗)
SM [11/08] – p. 18
Chemical Master Equation
Subtracting P (~x, t) from both sides of (∗),dividing by δx and letting δx → 0, we get a partialderivative expression:
∂P (~x, t)
∂t=
M∑
j=1
[aj(~x − ~νj)P (~x − ~νj, t) − aj(~x)P (~x, t)]
This is the Chemical Master Equation (CME) for thesystem
In theory the CME completely defines thebehaviour of the system – in practice difficult tosolve analytically for all but the simplest of aj(·)
SM [11/08] – p. 19
Average Behaviour
If we define the mean behaviour of ~X to be:
IE(f( ~X)) =∑
~x
f(~x)P (~x, t)
We can sum CME over all possible states ~x toget a simpler expression defining the averageevolution of the system:
dIE( ~X)
dt=
M∑
j=1
~νjIE(aj( ~X))
SM [11/08] – p. 20
Reaction Rate Equation
If we assume that there is no variance in theindividual trajectories of Xi, we can rewrite theprevious equation as:
dIE( ~X)
dt=
M∑
j=1
~νj(aj(IE( ~X)))
This is the Reaction Rate Equation. It assumes thatthe mean trajectory dominates the system andany fluctations in ~X decay
This is the standard set of ODEs used to modelmany biochemical systems.
SM [11/08] – p. 21
Gillespie’s Algorithm
Instead of trying to solve the CME, Gillespie’sAlgorithm produces a simulated trace ofexecution of ~X(t)
Looking at the mean of many such traces willusually give a good approximation to IE( ~X)
SM [11/08] – p. 22
Gillespie’s SSA
1. Initialization: Initialize no. of molecules inthe system, reactions constants, and randomnumber generators
2. Monte Carlo Step: Generate random nos. to de-termine next reaction to occur as well as timeinterval
3. Update: Increase the time step by the ran-domly generated time in Step 2. Update themolecule count based on reaction that oc-curred
4. Iterate: Go back to Step 2 unless no. of reac-tants is zero or the simulation time is exceeded
SM [11/08] – p. 23
SSA in Action
0
20
40
60
80
100
0 2 4 6 8 10
Num
ber
of a
ctiv
e co
mpo
nent
s
Time, t
Voters (ODEs)Pollers (ODEs)
Counters (ODEs)Voters (SS)Pollers (SS)
Counters (SS)
SM [11/08] – p. 24
SSA in Action
0
200
400
600
800
1000
0 2 4 6 8 10
Num
ber
of a
ctiv
e co
mpo
nent
s
Time, t
Voters (ODEs)Pollers (ODEs)
Counters (ODEs)Voters (SS)Pollers (SS)
Counters (SS)
SM [11/08] – p. 24
SSA in Action
0
2000
4000
6000
8000
10000
0 2 4 6 8 10
Num
ber
of a
ctiv
e co
mpo
nent
s
Time, t
Voters (ODEs)Pollers (ODEs)
Counters (ODEs)Voters (SS)Pollers (SS)
Counters (SS)
SM [11/08] – p. 24