Aug 16, 2009 ... Spatial Extension. JSPiM. Continuous and Spatial Extension of Stochastic π
Calculus. Anton Stefanek. Supervised by Dr. Maria Vigliotti.
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Continuous and Spatial Extension of Stochastic π Calculus Anton Stefanek Supervised by Dr. Maria Vigliotti Second marker Dr. Jeremy Bradley
August 16, 2009
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Overview
1 2
Why Systems Biology and Stochastic Process Algebras? Theoretical contribution Continuous semantics Spatial extension
3
Practical contribution JSPiM
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Systems Biology Experiment Differential Equations Stochastic simulation
Biological System
Model System 100 KKKst KKPP KPP
90
Model Analysis
80 70 60
System
50 100
KKKst KKPP KPP
40 30 80 20 10 60 0 0
5
10
15
20
25
30
35
40
40
20
0 0
Anton Stefanek
5
10
15
20
25
30
35
40
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Stochastic Process Algebras (SPAs)
From performance analysis of computer and communications sytems 1
Formal
2
Compositional Different forms of analysis
3
ordinary differential equations (ODEs) stochastic simulation model checking and others 4
Directly implementable – tools
Applied to biology – PEPA, BioPEPA, Stochastic π calculus, sCCP
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
SPAs in Systems Biology Experiment Description in Stochastic Process Algebra Biological System
Formal Model System 100 KKKst KKPP KPP
90
Model Analysis
80 70 60
System
50 100
KKKst KKPP KPP
40 30 80 20 10 60 0 0
5
10
15
20
25
30
35
40
40
20
0 0
Anton Stefanek
5
10
15
20
25
30
35
40
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Stochastic π Calculus Based on π calculus Used to model biological systems – e.g. signalling pathways, chemical reactions. Growing community, accepted by Biologists (paper in Nature) State of the art tool SPiM, collection of models ⇒ Worth of further research Problem Does not provide continuous semantics. Our solution We will extend it with continuous semantics and provide a tool.
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Stochastic π calculus – Syntax Processes communicating over channels Actions α On channel a: (rate ra )
output action !ahmi input action ?a(x)
silent action:
Processes Zero Summation Parallel composition Restriction Identifier instance
0 α1 .P1 + · · · + αn .Pm P|Q (new e@r )P Ahbi def
Environment a set of defining equations A(x) = P + top-level process ⇒ System Anton Stefanek
τ @r
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Stochastic π calculus – Discrete semantics Important Rules r
τ @r .P −→ P r
a !ahbi.P | ?a(x).Q −→ P | Q{x 7→ b}
r
a (new e)!ahei | ?a(x).Q −→ (new e)(P| Q{x 7→ e})
Exponential delays ⇒ Continuous Time Markov Chain r1
0|τ @r2 .0
r2
τ @r1 .0|τ @r2 .0
0|0 r2
Anton Stefanek
τ @r1 .0|0
r1
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Simulation Problem Each process a single entity Large populations – many states and transitions e.g. 5 transitions from P|P|P|P|P Our solution We use structural congruence to represent processes as multisets, e.g. P | Q | Q | P | P ≡ {|3 × P , 2 × Q |} We describe explicit enumeration of the transitions (mass action) ⇒ efficient stochastic simulation of CTMC (based on the Gillespie algorithm) SPiM uses abstract machine instead Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Example: SIR model (Kermack-McKendrick)
S I R System
{|200 × S , 2 × I |}
CTMC
Model def
=
def
=
def
= =
{|k × S , n × I , m × R |}
?i.I !i.I + τ @rrec .R
n × rrec
0 200 × S |2 × I
{|(k − 1) × S , (n + 1) × I , m × R |} {|k × S , (n − 1) × I , (m + 1) × R |} System
200 S I R
150
100
50
0 0
20
40
60
80
Anton Stefanek
k × n × ri
100
120
140
160
180
200
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Continuous semantics
Problem How to get a continuous, deterministic interpretation of the model? Our solution We define continuous semantics providing this interpretation in terms of a set of ODEs.
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Continuous semantics – Intuition Each state of the form {|k × S , n × I , m × R |} ) S decrease ri when S | I −→ 2× I I increase ) I decrease rrec R when I −→ R increase Take real valued functions s(t), i(t), r (t) ⇒ system of coupled ODEs ds/dt = −s(t)i(t)ri di/dt = s(t)i(t)ri − i(t)rrec dr /dt = i(t)rrec Initial values s(0) = 200, i(0) = 2 Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Continuous semantics – General case
Define all the possible “species” that can arise Definition P is a prime process if there exist no Q, R s.t. P ≡ Q|R. Prime b processes of a system (S, E ) is P(S, E ) all P s.t. S −→∗ P| · · · We can represent reachable processes as a multisets of species {|k × , n × , m × Theorem Every process can be expressed as a parallel composition of prime processes in a unique way.
Anton Stefanek
|}
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
R|T
Q τ @r
a
Enter
·|U
Exit
P τ @q
Definition Define Enter and Exit multisets for channels b Enterch,S,E (P) = {|n × (a, R, T ) | R, T ∈ P(S, E ), r
a R|T −→ {|n × P, . . . |}|}. ra b Exitch,S,E (P) = {|(a, U) | U ∈ P(S, E ), P|U −→ ·|}
Similar for silent actions. Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Definition b For each prime process P in P(S, E ) define a real valued function [P] expressing population of P over time. Using the enumeration: R|T
Q
r [Q]
a
τ @r
a
+
ra [P][U]
−
d[P]/dt
P τ @q
ra [R][T ]
·|U
q[P]
Anton Stefanek
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Definition b The set of ODEs for (S, E ) contains for each P ∈ P(S, E) d[P] = dt
X (r ,Q)∈Enterτ,S,E (P)
−
X
r [Q] +
X
ra [R][T ]
(a,R,T )∈Enterch,S,E (P)
X
q[P] −
q∈Exitτ,S,E (P)
(a,U)∈Exitch,S,E (P)
with initial conditions [P](0) = S#P.
Anton Stefanek
ra [P][U],
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Example: SIR model Prime processes { S , I , R }
Model S I R System
def
=
def
=
def
= =
d[ S ]/dt = −ri [ S ][ I ] d[ I ]/dt = ri [ S ][ I ] − rrec [ I ] d[ R ]/dt = rrec [ I ]
?i.I !i.I + τ @rrec .R 0 200 × S |2 × I
Initial values [ S ](0) = 200, [ I ](0) = 2, [ R ](0) = 0 System
200 S I R
150
100
50
0 0
20
40
60
80
Anton Stefanek
100
120
140
160
180
200
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Finiteness Problem b P(S, E ) can become infinite def
P = (new e)(!shei|?e) def
Q = ?s(x).F hxi def
F (x) = τ @r .(!e|F hxi) Then prime processes include (new e)(?e| !e | F hei ) , (new e)(?e| !e | !e | F hei ) , . . . (new e)(?e| !e | !e | · · · | !e | F hei )
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Finiteness
Our solution Conditions for finiteness For Chemical Ground Form (CGF) always finite subset with no new operator and message passing can translate from Sπ to CGF (most of the models)
⇒ Implementation requires CGF
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Spatial extension Problem Want to model system with important spatial features – compartments, tissues.
Our solution We extend stochastic π calculus. We allow reuse of models and keep continuous semantics.
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Spatial modelling in Systems Biology Solution Spatial extension Description in Stochastic Process Algebra
Experiment Problem Spatial properties Biological System
Formal Model
Model Analysis
Anton Stefanek
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Spatial Extension – Syntax Lπ Our extension of stochastic π calculus Static compartments with constant volume Random movement between compartments (given by m) Processes embedded in Location Graphs Location graphs [l1 : P1 , . . . , ln : Pn ]v ,m li location names, v volume function m movement function Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Spatial Extension – Semantics Internal transitions from communication affected by v Processes move between locations by movement function New rules r
a If P −→ Q then
[. . . , li : P , . . . ]v ,m
τ @ra /v (li )
−→
[. . . , li : Q , . . . ]v ,m
If P is a summation or an identifier instance,m(li , lj , P ) 6= 0 [. . . , li : P |Q, lj : R, . . . ]v ,m
τ @m(li ,lj ,
−→
P)
[. . . , li : Q, lj : P |R, . . . ]v ,m
Exponential delays ⇒ still CTMC (aggregation applies) Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Example: SIR with quarantine Location graph [a : System, b : 0]1,m m(a, b, I ) = rdiagnose m(b, a, R ) = rdischarge
CTMC states pairs of multisets {|ka × S , na × I , ma × R |}, {|nb × I , mb × R |} Results SystemQ:a
SystemQ:b
200
25 S I R
S I R 20
150
15 100 10
50 5
0
0 0
20
40
60
80
100
120
140
160
Anton Stefanek
180
200
0
20
40
60
80
100
120
140
160
180
200
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Example: plant tissue
Cell =?attack.(Life|6 × Reistance|4 × Warning )+?warn.RCell, RCell =?attack.(Life|20 × Reistance|4 × Warning )+?warn.RCell, Resistance =!defeat.!defeated + delay @expire, Life =?fight+?defeated.RCell, Virus =!attack.(!fight.(2 × Virus)+?defeat) c0,0 : Cell
c0,1 : Cell
c0,2 : Cell
c0,3 : Cell
c1,0 : Cell
c1,1 : Cell | Virus
c1,2 : Cell
c1,3 : Cell
c2,0 : Cell
c2,1 : Cell
c2,2 : Cell
c2,3 : Cell
c3,0 : Cell
c3,1 : Cell
c3,2 : Cell
c3,3 : Cell
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Example: plant tissue
Cell
RCell
Anton Stefanek
Virus
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Continuous semantics Can extend continuous semantics – prime processes and real valued functions for each location [P]l R|T in l move from j
Q in l a
m(j, l, P)
τ @r
Enter
P in l τ @q
move to k ·|U in l
Anton Stefanek
Exit
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Definition The set of ODEs for location graph contains for each prime P and location l d[P]l = dt
X (r ,Q)∈Enterτ,S,E (P)
X
−
X
ra [R]l [T ]l /v (l)
(a,R,T )∈Enterch,S,E (P)
X
q[P]l −
q∈Exitτ,S,E (P)
+
X
r [Q]l +
ra [P]l [U]l /v (l)
(a,U)∈Exitch,S,E (P)
m(j, l, P)[P]j −
m(j,l,P)6=0
X m(l,k,P)6=0
with initial conditions [P]l (0) = Pl #P.
Anton Stefanek
m(l, k, P)[P]l
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Example: SIR model d[ S ]a /dt = −ri [ S ]a [ I ]a d[ I ]a /dt = ri [ S ]a [ I ]a − rrec [ I ]a − rdiag [ I ]a d[ R ]a /dt = rrec [ I ]a + rdis [ R ]b d[ I ]b /dt = rdiag [ I ]a − rrec [ I ]b d[ R ]b /dt = rrec [ I ]b − rdis [ R ]b SystemQ:a
SystemQ:b
200
20 S I R
S I R
18 16
150 14 12 100
10 8 6
50 4 2 0
0 0
20
40
60
80
100
120
140
160
180
Anton Stefanek
200
0
20
40
60
80
100
120
140
160
180
200
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
JSPiM
Tool bringing the formalisms to the community Features Editor with GUI to show results Simulation of Sπ and Lπ systems ODE solution of CGF systems and CGF subset of Lπ
Written in Java (∼ 6KLOC), ANTLR for parsing, JFreeChart Directly related to the theory – multisets from google-collections
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
JSPiM – Editor
Anton Stefanek
Spatial Extension
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
JSPiM – Commands (Simulation,ODE)
Anton Stefanek
Spatial Extension
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
JSPiM – Spatial Commands
Anton Stefanek
Spatial Extension
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Spatial Extension
Summary
1
Theoretical contributions Multiset representation Continuous semantics Spatial extension Investigations into relationship of the two semantics
2
Practical contributions JSPiM Collection of existing models
3
Future work Formal relationship between the two semantics Spatial models Release and open source of JSPiM
Anton Stefanek
JSPiM
Introduction
Stochastic π Calculus
Continuous semantics
Thank you. Questions?
Anton Stefanek
Spatial Extension
JSPiM
Some observations Original
Scaled by 10
Clocknn
Scaled by 100
Clocknn
450
400
Clocknn
4500
RNAAnn RNARnn Ann Rnn AComplexB
45000
RNAAnn RNARnn Ann Rnn AComplexB
4000
350
3500
35000
300
3000
30000
250
2500
25000
200
2000
20000
150
1500
15000
100
1000
10000
50
500
0
5000
0 0
100
200
300
400
500
600
700
800
0 0
100
200
300
Clocknn
400
500
600
700
800
0
RNAAnn RNARnn Ann Rnn AComplexB
4000
35000
300
3000
30000
250
2500
25000
200
2000
20000
150
1500
15000
100
1000
10000
50
500
0 500
600
700
800
500
600
700
800
RNAAnn RNARnn Ann Rnn AComplexB
5000
0 400
400
40000
3500
300
300
45000
350
200
200
Clocknn
4500
RNAAnn RNARnn Ann Rnn AComplexB
400
100
100
Clocknn
450
0
RNAAnn RNARnn Ann Rnn AComplexB
40000
0 0
100
200
300
Anton Stefanek
400
500
600
700
800
0
100
200
300
400
500
600
700
800