##################################################### # # Simulation of the C.elegans egg-laying circuit # ##################################################### # # Zhang Mi, William R. Schafer, R. Breitling # ##################################################### # Parameters timepoints = 12000 tau = 0.5 # size of simulation time step N = 10; # replicates of stochastic simulation to be run # Constants Thalf=140 p0=exp(-tau*log(2)/Thalf) # half time of clearance is about 140 seconds. lambda1 = 1/23*tau; lambda2 = 1/1800*tau; clusterN = 3 # threshold indicating uv1 sensitivity to neurotransmitter and # thus controlling the number of eggs per cluster # Initial state transition probabilities p1=1 p2=lambda1 p3=0 p4=lambda2 p5=0 p6=0 p7=1 eggnumber = CN = c(); # output statistics: eggnumber = rate egg-laying events/second; CN, egg-laying events/cluster for (k in 1:N) { # Variable initialization egg = eggn = 0 hsn = hsnn = 1 vc = vcn = 0 uv1 = uv1n = 0 count = 0 eggs = vcs = uv1s = counts = clusters = hsns = c() for (t in 1:timepoints) { # update of probabilities and state transitions if (egg==1) {p1=1} else {p1=0} if (vc==0 && runif(1)=clusterN) {p3=1} else {p3=0} if (uv1==0 && runif(1)