Examples in SPiM
Andrew Phillips
November 29, 2007
Contents
1 Chemical Examples 21.1 NaCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2 Mg2Cl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.3 KNa2Cl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.4 HCl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.5 HH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.6 RNHCOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.7 Ethylene . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2 Biological Examples 92.1 Repressilator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2 Simplified Mapk Cascade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.3 Bistable Gene Network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.4 Circadian Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.5 Gene Regulation by Positive Feedback . . . . . . . . . . . . . . . . . . . . . . . . . 142.6 Mapk Cascade . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3 Gillespie Examples 183.1 Radioactive Decay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.2 Malek-Mansour and Nicolis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.3 Lotka . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203.4 Oregonator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1
1 Chemical Examples
1.1 NaCl
(* Na + Cl <==> Na+ + Cl- *)directive sample 0.03directive plot Na(); Na_plus()directive graph
new [email protected] : channew [email protected] : chan
let Na() = !ionize; Na_plus()and Na_plus() = ?deionize; Na()
let Cl() = ?ionize; Cl_minus()and Cl_minus() = !deionize; Cl()
run (100 of Na() | 100 of Cl())
2
1.2 Mg2Cl
(* Mg + 2Cl <==> Mg+2 + 2Cl- *)directive sample 0.03directive plot Mg();Mg_plus();Mg_plus2()directive graph
new [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:chan
let Mg() = !ionize1; Mg_plus()and Mg_plus() =do !ionize2; Mg_plus2()or ?deionize1; Mg()
and Mg_plus2() = ?deionize2; Mg_plus()
let Cl() =do ?ionize1; Cl_minus()or ?ionize2; Cl_minus()
and Cl_minus() =do !deionize1; Cl()or !deionize2; Cl()
run (100 of Mg() | 100 of Cl())
3
1.3 KNa2Cl
(* K + Na + 2Cl <==> K+ + Na+ + 2Cl- *)directive sample 0.03directive plot Cl(); Na_plus(); K_plus()directive graph
new [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:chan
let Na() = !ionize1; Na_plus()and Na_plus() = ?deionize1; Na()
let K() = !ionize2; K_plus()and K_plus() = ?deionize2; K()
let Cl() =do ?ionize1; Cl_minus()or ?ionize2; Cl_minus()
and Cl_minus() =do !deionize1; Cl()or !deionize2; Cl()
run (100 of Na() | 100 of Cl() | 100 of K())
4
1.4 HCl
(* H + Cl <==> HCl *)directive sample 0.006 1000directive plot H(); H_Bound(e)directive graph
new [email protected]:chan(chan)
let H() = (new [email protected]: chan()!share(e); H_Bound(e))
and H_Bound(e:chan) = !e; H()
let Cl() = ?share(e); Cl_Bound(e)and Cl_Bound(e:chan) = ?e; Cl()
run (100 of H() | 100 of Cl())
5
1.5 HH
(* H + H <==> H2 *)directive sample 0.2directive plot H(); H_Bound(e)directive graph
new [email protected]:chan(chan)
let H() = (new [email protected]:chando !share(e); H_Bound(e)or ?share(e); H_Bound(e))
and H_Bound(e:chan) =do !e; H()or ?e; H()
run 100 of H()
6
1.6 RNHCOR
(* RNH2 + RCOOH <==> RNHCOR + H2O *)directive sample 0.05directive plot RNH2(); RNHCOR()directive graph
new [email protected]:channew [email protected]:chan
let RNH2() = ?amine; RNHCOR()and RNHCOR() = !hydrolysis; RNH2()
let RCOOH() = !amine; H2O()and H2O() = ?hydrolysis; RCOOH()
run (100 of RNH2() | 100 of RCOOH())
7
1.7 Ethylene
(*Y + Ethylene --> Y:EthylR*)(*:EthylR + Ethylene --> EthylP:EthylR*)(*:EthylR + :EthylR --> End*)directive plot EthylR(); EthylP(); Ethylene()directive graph
new [email protected]:channew [email protected]:channew [email protected]:chan
let Y() = !alkene_Y; Y_bound()and Y_bound() = ()
let Ethylene() =do ?alkene_Y; EthylR()or ?alkene_R; EthylR()
and EthylR() =do !alkene_R; EthylP()or !poly_R; End()or ?poly_R; End()
and EthylP() = ()and End() = ()
run (200 of Ethylene() | 4 of Y())
8
2 Biological Examples
2.1 Repressilator
(* Repressilator *)directive sample 200000.0 1000directive plot Protein(b); Protein(c); Protein(a)directive graph
val t = 0.1val d = 0.001val u = 0.0001val bind = 1.0new a@bind:channew b@bind:channew c@bind:chan
let Gene(a:chan,b:chan) =do delay@t; (Protein(b) | Gene(a,b))or ?a; delay@u; Gene(a,b)
and Protein(b:chan) =do !b; Protein(b)or delay@d
run ( Gene(a,b) | Gene(b,c) | Gene(c,a) )
9
2.2 Simplified Mapk Cascade
(* MAPK cascade *)directive sample 40.0directive plot KKKst(); KKPP(); KPP()directive graph
new [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:chan
let E1() = !a1; E1()let E2() = !a2; E2()
let KKK() = ?a1; KKKst()and KKKst() =do ?a2; KKK()or !a3; KKKst()or !a5; KKKst()
let KK() = ?a3; KKP()
and KKP() =do ?a4; KK()or ?a5; KKPP()
and KKPP() =do ?a6; KKP()or !a7; KKPP()or !a9; KKPP()
let KKPase() =do !a4; KKPase()or !a6; KKPase()
let K() = ?a7; KP()and KP() =do ?a8; K()or ?a9; KPP()
and KPP() = ?a10; KP()
let KPase() =do !a8; KPase()or !a10; KPase()
run ( E1() | 10 of KKK() )run ( 100 of KK() | 100 of K() )run ( E2() | KKPase() | KPase() )
10
2.3 Bistable Gene Network
directive sample 1000.0directive plot A(); B()directive graph
val tA = 0.20val dA = 0.002 (*0.0085*)val tB = 0.37val dB = 0.002 (*0.034*)new [email protected]:chan(chan)val dAB = 0.53new [email protected]:chan(chan)val unbind = 0.42val tB’ = 0.027
let a() = delay@tA; ( A() | a() )
and A() = (new u@unbind:chando delay@dA
or !bind(u); A_B(u)or !inhibit(u); A_b(u)
)and A_b(u:chan) = ?u; A()and A_B(u:chan) = delay@dAB
let b() =do delay@tB; ( B() | b() )or ?inhibit(u); b_A(u)
and b_A(u:chan) =do !u; b()or delay@tB’; ( B() | b_A(u) )
and B() =do ?bind(u); B_A(u)or delay@dB
and B_A(u:chan) = ()
run (a() | b())
11
2.4 Circadian Clock
12
(* Circadian Clock *)directive sample 800.0 1000directive plot RNA_A(); RNA_R(); A(); R(); A_Bound()directive graph
new [email protected]:chan(chan)new [email protected]:chan(chan)new [email protected]:chan(chan)val drA = 1.0 val dA = 0.1val drR = 0.02 val dR = 0.01val tA = 4.0 val tA’ = 40.0 val trA = 1.0val tR = 0.001 val tR’ = 2.0 val trR = 0.1
let DNA_A() =do delay@tA; (RNA_A() | DNA_A())or ?pA(u); DNA_A’(u)
and DNA_A’(u:chan) =do delay@tA’; (RNA_A() | DNA_A’(u))or !u; DNA_A()
and RNA_A() =do delay@trA; (A() | RNA_A())or delay@drA
and A() = (new u:channew [email protected]:channew [email protected]:chando !pA(uA); ?uA; A()or !pR(uR); ?uR; A()or delay@dAor !bind(u); A_Bound(u))
and A_Bound(u:chan) =do delay@dA; !uor ?u; A()
let DNA_R() =do delay@tR; (RNA_R() | DNA_R())or ?pR(u); DNA_R’(u)
and DNA_R’(u:chan) =do delay@tR’; (RNA_R() | DNA_R’(u))or !u; DNA_R()
and RNA_R() =do delay@trR; (R() | RNA_R())or delay@drR
and R() =do delay@dRor ?bind(u); R_Bound(u)
and R_Bound(u:chan) =do ?u; R()or delay@dR; !u
run (DNA_A() | DNA_R())
13
2.5 Gene Regulation by Positive Feedback
(* Gene Regulation by +ve Feedback *)directive sample 50.0 1000directive plot TF(); A()directive graph
val t = 4.0val t’ = 40.0val tr = 1.0val dRNA = 1.0val dP = 0.1new [email protected] : chan(chan,chan,chan)new [email protected]: chan
let DNA(P:proc()) =do delay@t; (RNA(P) | DNA(P))or ?tail; DNA’(P)
and DNA’(P:proc()) =delay@t’; (RNA(P) | DNA(P))
and RNA(P:proc()) =
do delay@tr; (P() | RNA(P))or delay@dRNA
let A() = (new [email protected] : channew [email protected] : channew r@dP: chando delay@dPor !bind(u,a,r); A_Bound(u,a,r)
)and A_Bound(u:chan,a:chan,r:chan) =do !ror ?u; A()or !a;do ?u; A()or !r
and TF() =do delay@dPor ?bind(u,a,r); TF_Bound(u,a,r)
14
and TF_Bound(u:chan,a:chan,r:chan) =do ?ror !u; TF()or ?a; aTF_Bound(u,r)
and aTF_Bound(u:chan,r:chan) =do ?r
or !u; aTF(tail)
and aTF(tail:chan) =do !tail; aTF(tail)or delay@dP
run ( DNA(A) | DNA(TF) )
15
2.6 Mapk Cascade
(* Huang & Ferrell MAPK cascade *)directive sample 40.0 1000directive plot KKKst(); KKPP(); KPP()directive graph
val ra = 1.0 val rd = 1.0 val rk = 1.0val rd1=rd val rk1=rk val rd2=rd val rk2=rkval rd3=rd val rk3=rk val rd4=rd val rk4=rkval rd5=rd val rk5=rk val rd6=rd val rk6=rkval rd7=rd val rk7=rk val rd8=rd val rk8=rkval rd9=rd val rk9=rk val rd10=rd val rk10=rktype bond = chan(chan,chan)
new a1@ra:bond new a2@ra:bond new a3@ra:bondnew a4@ra:bond new a5@ra:bond new a6@ra:bond
16
new a7@ra:bond new a8@ra:bond new a9@ra:bond new a10@ra:bond
let E1() = (new k1@rk1:chan new d1@rd1:chan!a1(d1,k1); do ?d1; E1() or ?k1; E1()
)let E2() = (new k2@rk2:chan new d2@rd2:chan!a2(d2,k2); do ?d2; E2() or ?k2; E2()
)
let KKK() = ?a1(d,k); (do !d; KKK() or !k; KKKst())and KKKst() = (new d3@rd3:chan new k3@rk3:channew d5@rd5:chan new k5@rk5:chando ?a2(d,k); (do !d; KKKst() or !k; KKK())or !a3(d3,k3); (do ?d3; KKKst() or ?k3; KKKst())or !a5(d5,k5); (do ?d5; KKKst() or ?k5; KKKst())
)let KK() = ?a3(d,k); (do !d; KK() or !k; KKP())and KKP() =do ?a4(d,k); (do !d; KKP() or !k; KK())or ?a5(d,k); (do !d; KKP() or !k; KKPP())
and KKPP() = (new d7@rd7:chan new k7@rk7:channew d9@rd9:chan new k9@rk9:chando ?a6(d,k); (do !d; KKPP() or !k; KKP())or !a7(d7,k7); (do ?d7; KKPP() or ?k7; KKPP())or !a9(d9,k9); (do ?d9; KKPP() or ?k9; KKPP())
)let K() = ?a7(d,k); (do !d; K() or !k; KP())and KP() =do ?a8(d,k); (do !d; KP() or !k; K())or ?a9(d,k); (do !d; KP() or !k; KPP())
and KPP() = ?a10(d,k); (do !d; KPP() or !k; KP())
let KKPase() = (new d4@rd4:chan new k4@rk4:channew d6@rd6:chan new k6@rk6:chando !a4(d4,k4); (do ?d4; KKPase() or ?k4; KKPase())or !a6(d6,k6); (do ?d6; KKPase() or ?k6; KKPase())
)let KPase() = (new d8@rd8:chan new k8@rk8:channew d10@rd10:chan new k10@rk10:chando !a8(d8,k8); (do ?d8; KPase() or ?k8; KPase())or !a10(d10,k10); (do ?d10; KPase() or ?k10; KPase())
)run ( E1() | 10 of KKK() | 100 of KK() | 100 of K() )run ( E2() | KKPase() | KPase() )
17
3 Gillespie Examples
3.1 Radioactive Decay
directive sample 10.0directive plot X()directive graph
val c = 0.5let X() = delay@c
run 1000 of X() (*1000,5000,10000*)
18
3.2 Malek-Mansour and Nicolis
directive sample 5.0 10000directive plot Y()directive graph
new [email protected]:channew [email protected]:chan (*0.0025,0.000625*)
let X() = ?c1; X()let Y() =do !c1; (Y() | Y())or !c2; ()or ?c2; ()
run (X() | 10 of Y()) (*(10,3000),(40,12000)*)
19
3.3 Lotka
directive sample 10.0 10000directive plot Y1(); Y2()directive graph
new [email protected]:channew [email protected]:chanval c3 = 10.0
let X() = ?c1; X()let Y1() =do !c1; (Y1() | Y1())or ?c2
let Y2() =do !c2; (Y2() | Y2())or delay@c3
run (X() | 1000 of Y1() | 1000 of Y2())
20
directive sample 35.0 10000directive plot X(); Y1(); Y2()directive graph
new [email protected]:channew [email protected]:chanval c3 = 10.0
let X() = ?c1let Y1() =do !c1; (Y1() | Y1())or ?c2
let Y2() =do !c2; (Y2() | Y2())or delay@c3
run (100000 of X() | 1000 of Y1() | 1000 of Y2())
21
directive sample 30.0 10000directive plot X(); Y1(); Y2()directive graph
new [email protected]:channew [email protected]:chanval c3 = 10.0val c4 = 10.0
let X() = ?c1; X()let Y1() =do !c1; (Y1() | Y1())or ?c2or delay@c4
let Y2() =do !c2; (Y2() | Y2())or delay@c3
run (100000 of X() | 1000 of Y1() | 1000 of Y2())
22
directive sample 30.0 10000directive plot X(); Y1(); Y2()directive graph
new [email protected]:channew [email protected]:chanval c3 = 10.0val c4 = 10.0
let X() = ?c1; X()let Y1() =do !c1; (Y1() | Y1())or ?c2or delay@c4
let Y2() =do !c2; (Y2() | Y2())or delay@c3
run (100000 of X() | 1000 of Y1() | 1000 of Y2())
23
3.4 Oregonator
directive sample 6.0 10000directive plot Y1(); Y2(); Y3()directive graph
new [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:chan (* 0.016 / 2 *)new [email protected]:chan
let X1() = ?c1; X1()let X2() = ?c3; X2()let X3() = ?c5; X3()
let Y1() =do !c2or !c3; (Y3() | Y1() | Y1())or !c4or ?c4
and Y2() =do !c1; Y1()or ?c2
and Y3() = !c5; Y2()
run (X1() | X2() | X3())run (500 of Y1() | 1000 of Y2() | 2000 of Y3())
24
directive sample 6.0 10000directive plot X1(); Y1(); Y2(); Y3()directive graph
new [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:chan (* 0.016 / 2 *)new [email protected]:chan
let X1() = ?c1let X2() = ?c3; X2()let X3() = ?c5; X3()
let Y1() =do !c2or !c3; (Y3() | Y1() | Y1())or !c4or ?c4
and Y2() =do !c1; Y1()or ?c2
and Y3() = !c5; Y2()
run (10000 of X1() | X2() | X3())run (500 of Y1() | 1000 of Y2() | 2000 of Y3())
25
directive sample 6.0 10000directive plot X2(); Y1(); Y2(); Y3()directive graph
new [email protected]:channew [email protected]:channew [email protected]:channew [email protected]:chan (* 0.016 / 2 *)new [email protected]:chan
let X1() = ?c1; X1()let X2() = ?c3let X3() = ?c5; X3()
let Y1() =do !c2or !c3; (Y3() | Y1() | Y1())or !c4or ?c4
and Y2() =do !c1; Y1()or ?c2
and Y3() = !c5; Y2()
run (X1() | 100000 of X2() | X3())run (500 of Y1() | 1000 of Y2() | 2000 of Y3())
26