This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
biological_systems:examples1 [Thursday, 12 March 2009 : 11:13:53] s040995 |
biological_systems:examples1 [Monday, 23 March 2009 : 11:54:09] (current) s040995 |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== DEM Examples ====== | ||
+ | ===== Substrate-Enzyme Reaction ===== | ||
+ | <code chi> | ||
+ | type item = nat // id # manufacturing time | ||
+ | proc BS( chan a!,b?,c?: item, val S0: nat ) = | ||
+ | |[ var S,S2: nat | ||
+ | :: S:= S0 | ||
+ | ; S > 0 | ||
+ | *> ( a!S; S:= S - 1 | ||
+ | ; !! 1,"\t", S,"\t", time,"\n" | ||
+ | ) | ||
+ | || *(( b?S2 | c?S2 ); S:= S + 1 ) | ||
+ | ]| | ||
+ | |||
+ | proc BE( chan a!,b?,c?,d?: item, val E0: nat ) = | ||
+ | |[ var E,E2: nat | ||
+ | :: E:= E0 | ||
+ | ; E > 0 | ||
+ | *> ( a!E; E:= E - 1 | ||
+ | ; !! 2,"\t", E,"\t", time,"\n" | ||
+ | ) | ||
+ | || *(( b?E2 | c?E2 | d?E2 ); E:= E + 1 ) | ||
+ | ]| | ||
+ | |||
+ | proc BC( chan a!,b!,c?: item, val C0: nat ) = | ||
+ | |[ var C: nat, C2: item | ||
+ | :: C:= 10 + C0 | ||
+ | ; *( ( a!C | b!C ) | ||
+ | ; C:= C - 1 | ||
+ | ; !! 3,"\t", C,"\t", time,"\n" | ||
+ | ) | ||
+ | || *( c?C2; C:= C + 1 ) | ||
+ | ]| | ||
+ | |||
+ | // Machine M1 must receive both enzyme E and substrate S to form complex C. If only one of the two molecules | ||
+ | // is recieved the system waits a certain time for the other molecule. If this time is over and the other molecule | ||
+ | // is not received, the machine sends the recieved molecule back to its corresponding buffer. | ||
+ | |||
+ | proc M1( chan a?,b?,c!,d!,e!: item, val k1,Vmax: real ) = | ||
+ | |[var E, S: item, ts: real, W: nat = 0 | ||
+ | :: *( W = 0-> W:= 0 | ||
+ | ;( a?S; ( b?E ; W:= 1 | ||
+ | | delay 2.0; e!E | ||
+ | ) | ||
+ | | b?E; ( a?S; W:= 1 | ||
+ | | delay 2.0; d!S | ||
+ | ) | ||
+ | ) | ||
+ | ) | ||
+ | || *( W = 1 -> ts:= ( Vmax / (k1 * E * S) - 1) / Vmax | ||
+ | ; delay 1 / Vmax | ||
+ | ; c!E | ||
+ | ; delay ts | ||
+ | ; W:= 0 | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | proc M23( chan a?,b!,c!: item, val k23,Vmax: real ) = | ||
+ | |[ var C: nat, ts: real | ||
+ | :: *( a?C | ||
+ | ; delay 1 / Vmax | ||
+ | ; b!C; c!C | ||
+ | ; ts:= ( Vmax / (k23 * C) - 1) / Vmax | ||
+ | ; delay ts | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | |||
+ | proc E( chan a?: item, val P0: nat ) = | ||
+ | |[var P: item, i:nat = 1 | ||
+ | :: i:= P0 | ||
+ | ; *( a?P | ||
+ | ; i:= i + 1 | ||
+ | ; !!4, "\t", i, "\t", time, "\n" | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | model L() = | ||
+ | |[ chan a,b,c,d,e,f,g,h,i,j,k: item | ||
+ | :: BS(a,i,j,500) // S0 | ||
+ | || BE(b,f,h,k,200) // E0 | ||
+ | || BC(d,g,c,0) // C0 | ||
+ | || M1(a,b,c,j,k,0.001,100.0) // k1, Vmax1 | ||
+ | || M23(g,h,i,0.0001,0.020) // k2, Vmax2 | ||
+ | || M23(d,e,f,0.1,20.0) // k3, Vmax3 | ||
+ | || E(e,0) | ||
+ | ]| | ||
+ | </code> | ||
+ | |||
+ | |||
+ | ===== Michaelis-Menten Reaction ===== | ||
+ | Chi code: | ||
+ | <code chi> | ||
+ | from standardlib import * | ||
+ | |||
+ | type item = (nat,real) // id # creation time | ||
+ | |||
+ | proc BS( chan a!: item, val S0:nat ) = | ||
+ | |[ var i : nat | ||
+ | :: i:= S0 | ||
+ | ; i > 0 | ||
+ | *> ( a!(i,time) | ||
+ | ; !! 1,"\t", i ,"\t", time ,"\n" | ||
+ | ; i := i - 1 | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | |||
+ | proc M( chan a?,b!: item, val tr,Km,Vmax: real ) = | ||
+ | |[ var S: item, ts,v : real | ||
+ | :: *( a?S | ||
+ | ; delay tr | ||
+ | ; b!S | ||
+ | ; v := (Vmax*S.0)/(Km +S.0) | ||
+ | ; ts:=((Vmax/v)-1)*tr | ||
+ | ; delay ts | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | |||
+ | proc BP( chan a?: item , val P0: nat ) = | ||
+ | |[var P: item, i: nat | ||
+ | :: i:= P0 | ||
+ | ; *( a?P | ||
+ | ; !!3,"\t", i,"\t", time ,"\n" | ||
+ | ; i:= i + 1 | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | |||
+ | model L() = | ||
+ | |[ chan a,b: item | ||
+ | :: BS(a, 500) // initial value S | ||
+ | || M(a,b,0.05,100.1,20.0) // value tr, Km, Vmax | ||
+ | || BP(b,0) // initial value P | ||
+ | ]| | ||
+ | </code> | ||
+ | |||
+ | ===== Effects of Molecular timing ===== | ||
+ | The model for simulating molecular timing exists of a generator G, which generates substrate molecules at a fixed rate. Buffer B recieves the generated molecules and sends them to enzyme M if the enzyme is ready to receive a substrate molecule ( flag = true ), else the molecule is send to the loss buffer L. Enzyme M processes the molecule at a fixed rate and sends the processed molecule to exit buffer E. For monitoring the process information of the molecule is also send to monitor U. A representation of the model is presented in Figure 1.\\ | ||
+ | |||
+ | |||
+ | {{ :biological_systems:kjmodel.png?300 |}}\\ | ||
+ | <sup>Figure 1: Representation of substrate-enzyme model. </sup> | ||
+ | <code chi> | ||
+ | from standardlib import * | ||
+ | |||
+ | type item = (nat,real,real) // id # creation time # process time | ||
+ | |||
+ | proc G( chan a!: item, val lambda: real ) = | ||
+ | |[ var x: nat = 1, u: -> real = exponential(1 / lambda), t: real | ||
+ | :: *( a!(x,time,0.0); t:= sample u; delay t; x:= x + 1 ) | ||
+ | ]| | ||
+ | |||
+ | proc B( chan a?,b!,c!: item, d?: bool ) = | ||
+ | |[ var x: item, flag: bool = true | ||
+ | :: *( a?x | ||
+ | ;( flag -> b!x ; flag:= false | ||
+ | | not flag -> c!x | ||
+ | ) | ||
+ | ) | ||
+ | || *d?flag | ||
+ | ]| | ||
+ | |||
+ | proc L( chan a?: item) = | ||
+ | |[var x: item | ||
+ | :: *a?x | ||
+ | ]| | ||
+ | |||
+ | proc M( chan a?,b!,c!: item, d!: bool, val mu: real ) = | ||
+ | |[ var x: item, u: -> real = exponential(1 / mu) | ||
+ | :: *( a?x | ||
+ | ; x.2:= sample u | ||
+ | ; delay x.2 | ||
+ | ; b!x; c!x; d!true | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | proc E( chan a?: item ) = | ||
+ | |[var x: item | ||
+ | :: *a?x | ||
+ | ]| | ||
+ | |||
+ | proc U( chan a?: item, val lambda,mu: real ) = | ||
+ | |[var x: item, rho: real, i: nat = 0 , tproc: real = 0.0 | ||
+ | :: rho:= lambda/mu | ||
+ | ; *( a?x ; i:= i + 1 ; tproc:= tproc + x.2 | ||
+ | ;(i = 1000 ->!! time, "\tU\t",rho,"\t", tproc/time,"\n" | ||
+ | |i /= 1000 -> skip | ||
+ | ) | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | model S( val lambda,mu: real ) = | ||
+ | |[ chan a,b,c,d,u: item, p: bool | ||
+ | :: G(a,lambda) | ||
+ | || B(a,b,c,p) | ||
+ | || L(c) | ||
+ | || M(b,d,u,p,mu) | ||
+ | || E(d) | ||
+ | || U(u,lambda,mu) | ||
+ | ]| | ||
+ | </code> | ||
+ | |||
+ | |||
+ | Hybrid Chi: | ||
+ | <code chi> | ||
+ | from standardlib import * | ||
+ | |||
+ | type item = (nat,real,real) // id # creation time # process time | ||
+ | |||
+ | proc G( chan a!: item, val lambda: real ) = | ||
+ | |[ var x: nat = 1, u: -> real = exponential(1 / lambda), t: real | ||
+ | :: *( a!(x,time,0.0); t:= sample u; delay t; x:= x + 1 ) | ||
+ | ]| | ||
+ | |||
+ | proc B( chan a?,b!,c!: item, d?: bool ) = | ||
+ | |[ var x: item = ( 0 , 0.0 , 0.0 ), flag: bool = true | ||
+ | :: *( a?x | ||
+ | ;( flag -> b!x ; flag:= false | ||
+ | | not flag -> c!x | ||
+ | ) | ||
+ | ) | ||
+ | || *d?flag | ||
+ | ]| | ||
+ | |||
+ | proc L( chan a?: item) = | ||
+ | |[var x: item = ( 0 , 0.0 , 0.0 ) | ||
+ | :: *a?x | ||
+ | ]| | ||
+ | |||
+ | proc M( chan a?,b!,c!: item, d!: bool, val mu0: real ) = | ||
+ | |[ var x: item = ( 0 , 0.0 , 0.0 ), i: nat = 0 , mu: real = 0.0 | ||
+ | , u: -> real = exponential( mu0 ) | ||
+ | , cont P : real = 0.0 | ||
+ | :: eqn dot P = mu | ||
+ | || *( a?x | ||
+ | ; i:= i+1; mu:= sample u; x.2:= 1 / mu | ||
+ | ; P >= i -> mu:= 0.0 | ||
+ | ; b!x; c!x; d!true | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | proc E( chan a?: item ) = | ||
+ | |[var x: item = ( 0 , 0.0 , 0.0 ) | ||
+ | :: *a?x | ||
+ | ]| | ||
+ | |||
+ | model S( val lambda,mu: real ) = | ||
+ | |[ chan a,b,c,d,u: item, p: bool | ||
+ | , var x: item = ( 0 , 0.0 , 0.0 ), i: nat = 0, tproc: real = 0.0, rho: real = lambda / mu, throughput: real = 0.0 | ||
+ | :: *( u?x; i:= i + 1 | ||
+ | ; tproc:= tproc + x.2 | ||
+ | ; throughput:= tproc / time | ||
+ | ) | ||
+ | |||
+ | || G(a,lambda) | ||
+ | || B(a,b,c,p) | ||
+ | || L(c) | ||
+ | || M(b,d,u,p,mu) | ||
+ | || E(d) | ||
+ | ]| | ||
+ | </code> | ||
+ | |||
+ | ===== Signal-Receptor response ===== | ||
+ | The model for simulating the substrate-enzyme model with different responses is presented in Figure 2. This system is modeled by expanding the previous system with response 2 (deactivation), response 3 (inactivation) and response 4 (superactivation). These responses are only possible if the enzyme is processing a substrate molecule (flag = true) and a new substrate molecule is ready to be processed. The choice of responses depends on an uniform distribution in such a way that the percentages of occurrence of responses 2, 3 and 4 can be entered (respectively p2, p3 and p4). Buffer B sends the chosen response to the monitor via channel //v// and to the enzyme via channel //q//. If the enzyme is processing a substrate molecule and receives response 2 from the buffer, it processes the remaining part 8 times faster. Response 3 delays the system for 20 seconds and response 4 lets the enzyme process substrates 4 times faster during 10 seconds. The enzyme does not recieve new responses during inactivation or superactivation (responses 3 or 4). A boolean guard, busy, is sent via channel r to process B if the response 3 or 4 is triggered. While busy is true no new responses are send to process M. The process U monitors the utilisation and throughput and process V monitors the responses.\\ | ||
+ | |||
+ | |||
+ | {{ :biological_systems:kjmodelresp.png?300 |}}\\ | ||
+ | <sup>Figure 2: Representation of substrate-enzyme model with all responses. </sup> | ||
+ | |||
+ | <code chi> | ||
+ | from standardlib import * | ||
+ | |||
+ | type item = (nat,real,real) // id # creation time # process time | ||
+ | |||
+ | proc G( chan a!: item, val lambda: real ) = | ||
+ | |[ var x: nat = 1, u: -> real = exponential(1 / lambda), t: real | ||
+ | ::*( a!(x,time,0.0); t:= sample u; delay t; x:= x + 1 ) | ||
+ | ]| | ||
+ | |||
+ | |||
+ | proc B( chan a?,b!,c!: item, d?,e?: bool, f!,v!: nat, val q,r,s: nat ) = | ||
+ | |[ var x: item, flag: bool = true, busy: bool = false, p: nat | ||
+ | , w: -> nat = uniform( 0 , 100 ) | ||
+ | :: *( a?x | ||
+ | ;( flag -> b!x; flag:= false | ||
+ | | not flag and not busy -> c!x; p:= sample w | ||
+ | ;( p > 100 - q -> f!2; v!2 //2: deactivation A% | ||
+ | | p < r + s and p < r -> f!3; v!3 //3: inactivation B% | ||
+ | | p < r + s and p >= r -> f!4; v!4 //4: superactivation C% | ||
+ | | p >= r + s and p <= 100 - q -> v!5; skip //5: unaffected | ||
+ | ) | ||
+ | | not flag and busy -> c!x | ||
+ | ) | ||
+ | ) | ||
+ | || *( d?flag | e?busy ) | ||
+ | ]| | ||
+ | |||
+ | proc L( chan a?: item ) = | ||
+ | |[ var x: item :: *a?x ]| | ||
+ | |||
+ | proc M( chan a?,b!,c!: item, d!,e!: bool, f?:nat, val mu: real ) = | ||
+ | |[ var x: item, r: nat = 0, t,t2,t4: real, u: -> real = exponential(1 / mu), busy: bool = false | ||
+ | :: *( a?x | ||
+ | ; t:= sample u; t2:= time | ||
+ | ;( delay t | ||
+ | | r = 2 -> r:= 0; delay (t2 + t - time) / 8 // deactivation (finish remaining 8 times faster) | ||
+ | | r = 3 -> busy:= true; e!busy; delay 20 + (t2 + t - time); e!false; r:= 0 // inactivation (20 time units) | ||
+ | | r = 4 -> busy:= true; delay (t2 + t - time) / 4 // superactivation (10 seconds 4 times process rate) | ||
+ | ) | ||
+ | ; x.2:= time - t2; b!x; c!x; d!true | ||
+ | ) | ||
+ | || *f?r | ||
+ | || *( busy -> e!busy; delay 10.0; busy:= false; r:= 0; e!busy ) | ||
+ | ]| | ||
+ | |||
+ | proc E( chan a?: item ) = | ||
+ | |[ var x: item :: *a?x ]| | ||
+ | |||
+ | proc U( chan a?: item, val lambda,mu: real ) = | ||
+ | |[ var x: item, t2: real, i: nat = 0, tproc: real = 0.0, r: nat, k: bool = false | ||
+ | :: *( a?x; i:= i + 1; tproc:= tproc + x.2; t2:= time; !! time,"\tU\t", i,"\t",i/time,"\t",tproc/time,"\n" | ||
+ | ;(t2 > 1900 and not k -> k:=true; !! time,"\tUT\t",lambda / mu,"\t", tproc / time,"\t",i / time,"\n" | ||
+ | |t2 <= 1900 or k -> skip | ||
+ | ) | ||
+ | ) | ||
+ | ]| | ||
+ | |||
+ | proc V( chan a?: nat ) = | ||
+ | |[ var r:nat :: *( a?r; !!time,"\tR\t", r ,"\n" ) ]| | ||
+ | |||
+ | model S( val lambda,mu: real, p2,p3,p4: nat ) = | ||
+ | |[ chan a,b,c,d,u: item, p,r: bool, q,v: nat | ||
+ | :: G(a,lambda) | ||
+ | || B(a,b,c,p,r,q,v,p2,p3,p4) | ||
+ | || L(c) | ||
+ | || M(b,d,u,p,r,q,mu) | ||
+ | || E(d) | ||
+ | || U(u,lambda,mu) | ||
+ | || V(v) | ||
+ | ]| | ||
+ | </code> | ||
+ | |||
+ | |||
+ | Hybrid Chi: | ||
+ | <code chi> | ||
+ | from standardlib import * | ||
+ | |||
+ | type item = (nat,real,real) // id # creation time # process time | ||
+ | |||
+ | proc G( chan a!: item, val lambda: real ) = | ||
+ | |[ var x: nat = 1, u: -> real = exponential(1 / lambda), t: real | ||
+ | ::*( a!(x,time,0.0); t:= sample u; delay t; x:= x + 1 ) | ||
+ | ]| | ||
+ | |||
+ | |||
+ | proc B( chan a?,b!,c!: item, d?,e?: bool, f!,v!: nat, val q,r,s: nat ) = | ||
+ | |[ var x: item = ( 0 , 0.0 , 0.0 ), flag: bool = true, busy: bool = false, p: nat = 0 | ||
+ | , w: -> nat = uniform( 0 , 100 ) | ||
+ | :: *( a?x | ||
+ | ;( flag -> b!x; flag:= false | ||
+ | | not flag and not busy -> c!x; p:= sample w | ||
+ | ;( p > 100 - q -> f!2; v!2 //2: deactivation A% | ||
+ | | p < r + s and p < r -> f!3; v!3 //3: inactivation B% | ||
+ | | p < r + s and p >= r -> f!4; v!4 //4: superactivation C% | ||
+ | | p >= r + s and p <= 100 - q -> v!5; skip //5: unaffected | ||
+ | ) | ||
+ | | not flag and busy -> c!x | ||
+ | ) | ||
+ | ) | ||
+ | || *d?flag || *e?busy | ||
+ | ]| | ||
+ | |||
+ | proc L( chan a?: item ) = | ||
+ | |[ var x: item = ( 0 , 0.0 , 0.0 ) :: *a?x ]| | ||
+ | |||
+ | proc M( chan a?,b!,c!: item, d!,e!: bool, f?:nat, val mu0: real ) = | ||
+ | |[ var x: item = ( 0 , 0.0 , 0.0 ), mu: real = 0.0 | ||
+ | , r: nat = 0, t: real = 0.0, t2: real = 0.0, i: nat = 0 | ||
+ | , u: -> real = exponential(mu0), busy: bool = false , cont P : real = 0.0 | ||
+ | :: eqn dot P = mu | ||
+ | || *( a?x ; i:= i + 1 | ||
+ | ; mu:= sample u; t2:= time | ||
+ | ;( r = 2 -> mu:= 8 * mu0 // deactivation | ||
+ | | r = 3 -> mu:= 0.0; e!true; delay 10.0; mu:= sample u; e!false // inactivation | ||
+ | | r = 4 or busy -> busy:= true; mu:= 4 * mu0 // superactivation | ||
+ | | P >= i -> skip | ||
+ | ) | ||
+ | ;P >= i -> mu:= 0.0; b!(x.0,x.1,time - t2); c!(x.0,x.1,time - t2); d!true; r:= 0 | ||
+ | ) | ||
+ | || *( busy -> e!busy; delay 5.0; busy:= false; r:= 0; e!busy ) | ||
+ | || *(f?r) | ||
+ | ]| | ||
+ | |||
+ | proc E( chan a?: item ) = | ||
+ | |[ var x: item = ( 0 , 0.0 , 0.0 ) :: *a?x ]| | ||
+ | |||
+ | model S( val lambda,mu: real, p2,p3,p4: nat ) = | ||
+ | |[ chan a,b,c,d,u: item, p,r: bool, q,v: nat | ||
+ | , var x: item = ( 0 , 0.0 , 0.0 ), i: nat = 0, throughput: real = 0.0, utilisation: real = 0.0 | ||
+ | , tproc: real = 0.0, resp: nat = 0 | ||
+ | :: *( u?x; i:= i + 1 | ||
+ | ; tproc:= tproc + x.2 | ||
+ | ; utilisation:= tproc / time | ||
+ | ; throughput:= i / time | ||
+ | ) | ||
+ | || *( v?resp; delay 0.001; resp:=0 ) | ||
+ | || G(a,lambda) | ||
+ | || B(a,b,c,p,r,q,v,p2,p3,p4) | ||
+ | || L(c) | ||
+ | || M(b,d,u,p,r,q,mu) | ||
+ | || E(d) | ||
+ | ]| | ||
+ | </code> |