some foundations of cellular simulation nathan addy scientific programmer the molecular sciences...

50
Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Upload: sade-debell

Post on 15-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Some foundations of Cellular Simulation

Nathan AddyScientific Programmer

The Molecular Sciences InstituteNovember 19, 2007

Page 2: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

The alpha pathway:The system we study here at the Molecular Sciences Institute

A full model of this system requires one simulation algorithm per chemical reaction.

Page 3: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

There are two basic methods for simulating cellular systems.

• Stochastic Algorithms • Differential Equations

Page 4: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Stochastic Simulation algorithms

Use probabilities and the random numbers generation togenerate a statistically accurate time course of the system.

Define Initial Conditions

State

Probability distributionsSample random numbers

Page 5: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A

B

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C

C

A+

+A

B +

A A

A

B

C

A well-mixed container. 3 reactions.

B

Page 6: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

B

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C +A AB

Propensity = 39 * pAB

3 * 13 ways this reaction can occur

pAB = ‘intrinsic’ probability of the A + B reaction

Page 7: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C

Propensity = 6 * pAA

3 * 2 ways this reaction can occur

pAA = ‘intrinsic’ probability of the A + A reaction

A A+ A A

Page 8: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C

Propensity = 13 * pBC

13 * 1 ways this reaction can occur

pBC = ‘intrinsic’ probability of the B + C reaction

CB +B

C

Page 9: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C

Total propensity = propensityAB + propensityAA + propensityBC

Page 10: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C

Probability that the next reaction to occur given this state will be the ‘A + A’ reaction is

Propensity of ‘A + A’ reaction Total Propensity

6 * pAA 39 * pAB + 6 * pAA + 13 * pBC

Page 11: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C

P(A + A) =

P(B + C) =

P(A + B) =

6 * pAA 39 * pAB + 6 * pAA + 13 * pBC

13 * pBC 39 * pAB + 6 * pAA + 13 * pBC

39 * pAB 39 * pAB + 6 * pAA + 13 * pBC

Page 12: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A

AA

B

BB

B

B

B

B

B

B

B

B

B

C

Sample the uniform distribution to determine which reaction fires next.

Sample the exponential distribution to determine what time the next reaction will occur at.

Page 13: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

Define Initial Conditions

State

Probability distributionsSample random numbers

Page 14: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

Population of A starts at 3.Population of B starts at 13.Population of C starts at 1.

State

Probability distributionsSample random numbers

Page 15: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A = 3B = 13C = 1

Probability distributionsSample random numbers

Page 16: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A = 3B = 13C = 1

Sample random numbers P(rxni) =Propensity(rxni)

Propensity( rxnn )

Page 17: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A = 3B = 13C = 1

Random number generated.Suppose A + B->AB occurs

P(rxni) =Propensity(rxni)

Propensity( rxnn )

Page 18: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A = 2B = 12C = 1AB = 1

Random number generated.A + B->AB occurs

P(rxn0) =Propensity(rxni)

Propensity( rxnn )

Page 19: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm

A = 2B = 12C = 1AB = 1

Probability distributionsSample random numbers

Page 20: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Gillespie Algorithm(standing in for all stochastic algorithms)

Pros:• Simulates things exactly, at the level of the individual molecules.• Assumptions don’t break down in very small systems. • Model behavior includes noise, which is often important in celluart behavior

Cons:• Very Slow compared with other methods because reactions only happen one at a time.• Generates statistically accurate simulations, so multiple runs may be needed.

Page 21: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Differential Equations

Equations that describe the behavior of objects over time in terms of their derivatives.

Simplest example:

Solving

dy

dt f (t)

y(t) f (x)dx0

tA car a starts from rest at position 0 at time 0 and travels with velocityv(t) = 10m/s * t afterwards. Where is it after 10 seconds?

Page 22: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Differential Equations

A very common style of mathematical modeling:

F md2p

dt 2m1

m2

m3

F Gm1m2

r2N-body problem

Page 23: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Differential Equations

Assumptions that differential equations make:

• All variables have continuous derivatives.

• Change to model state happens deterministically. There is no system noise.

Page 24: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

A form of differential equations that model reversible chemical reactions.

Mass Action equations

A

AA A

A

AA A

forward

backward

Page 25: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Mass Action equations

Assumptions:

• Everything is well mixed.• Reaction mechanism is very simple.• Everything is in high enough concentrations so that lack of noise and continuous changes to populations of species are acceptable.

Page 26: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Mass action equations say that the rates of both the forward and backward reactions are proportional to the product of their concentrations raised to the power of their stochiometries.

Mass Action equations

A A

dforward

dtp

forward[A] [B]

The p’s are the proportionality constants that act as rate constants.

dreverse

dtp

reverse[AB]

B

B

The reaction 1A + 1B 1AB comes out to have equations

Page 27: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Mass Action equations

Ste2 Ste2

On and off rates for mass action equations are determined Experimentally, and recorded at places like the alpha modelwiki.

kon ?

koff ?

yeastpheromonemodel.org

Page 28: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Mass Action equations

Ste2 Ste2

kon ?

koff ?

* koff = 9 * 10-4 s-1. Experiment was done using 35S-labeled pheromone at 22°C. TAME was used to prevent pheromone degradation, and cells were treated with NaN3 and KF to prevent growth and other energy-dependent processes. Kd was also measured, but later discounted by the same group. Jenness et al. 1983 PMID 6360378

* From a computational model. kon = 2 * 104 M-1 s-1, koff = 1 * 10-2 s-1 (corresponding to a Kd = 500nM) was used. This these numbers were referenced to Yi et al 2003 PMID 12960402 who used the same koff, but a kon 100x greater. Kofahl and Klipp 2004 PMID 15300679

yeastpheromonemodel.org

Page 29: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Simulating mass action equations

If we have a system composed of multiple mass action equations, we cannot find solutions analytically; we can (and must) solve them numerically.

In general, systems of differential equations must be solved numerically.

Page 30: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Numerical methods for solving DiffEqs

We saw before the simplest types of differential equations involvesimple integrals. If we cannot solve the system directly, we canapproximate a solution by using Riemann sums.

A car a starts from rest at position 0 at time 0 and travels with velocity . What is its position after 10 seconds?

v(t) Sin(Cos(1 t1 t 2

))

Page 31: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Numerical methods for solving DiffEqs

By taking Riemann sums, we can approximate a solution to this differential equation.

Where the error is

Where M2 is the maximum absolute value of f’’(x) on the interval.

Page 32: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

Define Initial Conditions

State

Calculate derivativesUpdate state

Page 33: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

State

Calculate derivativesUpdate state

dreverse

dtp

reverse[AB]

dforward

dtp

forward[A] [B] A and B start at an initial concentration of 1M.

AB starts at an initial concentration of 0M.

Page 34: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

Calculate derivativesUpdate state

t = 0[A] =1M[B] = 1M[AB] = 0M.

Page 35: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

t = 0[A] =1M[B] = 1M[AB] = 0M.

Update State

dAB

dtpon[A][B] poff [AB]

dA

dtdBdt

poff [AB] pon[A][B]

Assume pon = .005 s-1 M-1 and poff = .001 s-1

dAB

dt t0

.005s 1M 1 *1M *1M .001s 10M .005Ms 1

dAdt t0

dBdt t0

poff [AB] pon[A][B] .001s 10M .005s 1M 1 *1M *1M .005Ms 1

Page 36: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

t = 0[A] =1M[B] = 1M[AB] = 0M.

With a time step of .2 seconds:

dAB

dtpon[A][B] poff [AB]

dA

dtdBdt

poff [AB] pon[A][B]

dAB

dt t0

.005s 1M 1 *1M *1M .001s 10M .005Ms 1

dAdt t0

dBdt t0

poff [AB] pon[A][B] .001s 10M .005s 1M 1 *1M *1M .005Ms 1

ABdAB

dt* t .005Ms 1 * .2s.001M

ABdAdt

* t .005Ms 1 * .2s .001M

Page 37: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

t = .2[A] =.999M[B] = .999M[AB] = .001M.

With a time step of .2 seconds:

dAB

dtpon[A][B] poff [AB]

dA

dtdBdt

poff [AB] pon[A][B]

dAB

dt t0

.005s 1M 1 *1M *1M .001s 10M .005Ms 1

dAdt t0

dBdt t0

poff [AB] pon[A][B] .001s 10M .005s 1M 1 *1M *1M .005Ms 1

ABdAB

dt* t .005Ms 1 * .2s.001M

ABdAdt

* t .005Ms 1 * .2s .001M

Page 38: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

We have an error condition for solutions producted usingthis method:

If

If we expand y(t0 + h) as a Taylor series around t0 in h We get

Error rises with h2.

Page 39: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Euler’s method as a numerical solution to mass action equations.

We can use this error condition to alter the step size as we go along, in order to minimize global error.

Page 40: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Other numerical methodsThere are other more complicated and more accurate methodsfor simulating differential equations.

They all typically use current state to simulate into the future by small time steps. Some use a history of past state as well.

Fourth order Runge-Kutta:

Cumulative error is on the order of h4

Page 41: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Other numerical methodsDifferent methods can be particularly good for particular systems. (fewer steps, less error)

A good ODE solver can combine different numerical methods and switch between them during simulation in order to maximize performance.

Pros:Usually much faster than stochastic simulation

Cons:Eliminates some biological information.Maybe oversimplifies the system.

Page 42: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Parameter Estimation

We have a system of differential equations. We have measured mostof the reaction constants, but a few are left unknown.

We have done experiments that give us overall system input/outputrelationships.

Our system can be represented as:

OF(I, p,t)

where O is system output,

I is system input,

and p is the value of the unknown parameter.

Page 43: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Parameter Estimation

x

0 Oexperimental(t) F(Iexp, p, t) dt

Parameter estimation here can be thought of as equivalentTo trying to find the value of p that minimizes the function

Page 44: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Sensitivity Analysis

The majority of parameters in pathway models aren’t known.

Some parameters are more important than others.

It would be nice to be able to find the really important ones, sothat we can focus on energy on them. This is sensitivity analysis.

Page 45: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Sensitivity Analysis

If we have our model

OF(I, p,t)

where O is system output,

I is system input,

and p is the value of the unknown parameter.

Sensitivity analysis is trying to find parameters, such that the partial derivative is maximized.

piF(I, p, t)

Page 46: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

AnalysisParameter analysis and sensitivity analysis can be used with models of all sorts, not just differential equations.

Because the systems have to be solved numerically, solving theseproblems directly is usually impossible.

Numerical methods for solving these problems must be used.

• Numerical methods for finding zeroes of functions.• Numerical methods for function minimization.

Page 47: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Hybrid modelsWe have seen examples of modeling using stochastic algorithmsand modeling using ODEs.

Both have strengths and weaknesses.

If…Speed is important.We don’t believe noise is relevant.We can get by approximating integer populations as continuous concentrations.

ODES are probably best.If….

Population numbers are low.Noise may be important.

Stochastic algorithms are probably best.

Page 48: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Hybrid models

When we want to make large models, some parts will probably bebest represented with ODEs, others stochastic algorithms.

Hybrid models are models that use both types of algorithms.

Methods have been developed to simulate models that are built from both differential equations and stochastic equations.

They amount to interpreting the process of solving differential equations numerically as a “discrete event process” in the same way that stochastic algorithms produce discrete events.

Page 49: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

Hybrid models

Simulating a hybrid model amounts to having a list of events that occur at discrete times. These events can either be stochastic eventsor corrections to differential equations.

These events are executed in order and after each event, any dependent events are rescheduled.

This type of modeling combines the strengths of both types of algorithm.

Page 50: Some foundations of Cellular Simulation Nathan Addy Scientific Programmer The Molecular Sciences Institute November 19, 2007

ConclusionReactions can be modeled either using differential equations or stochastic simulations.

Systems can be modeled using combinations of both types. Eachhas advantages/disadvantages.

Numerical methods for solving systems of differential equationstypically amount to extensions of methods you are familiar with: Riemann sums, the parallelogram method, approximation with Taylor series, etc.

Analyzing model output often requires solving minimizationAnd maximization problems, although these two must usuallybe solved numerically.