def cell_cycle_sim(time): exp_time = 0 sim = SSA(gnxp_reactions,init_state) while exp_time < time: exp_time += replication_time sim.run(exp_time) # run until exp_time new_state = [rbinom(n,division_prob) if n > 0 else 0 for n in sim.state] sim.state = new_state print exp_time return sim
from ssa import SSA kr = 1/100.0 gr = 10**4 kp = 500 * gr gp = 6.79 #approx H_500 (harmonic number) k3 = 10**6 gnxp_reactions = [((1,0,0),kr), #mRNA production ((-1,0,0),gr), #mRNA degradation ((-1,0,1),kp), #protein complex formation ((1,1,-1),k3), #protein formation we do things this way #to pack everything into mass action kinetics ((0,-1,0),gp), #protein degradation ] init_state = (0,0,0) gnxp_sim = SSA(gnxp_reactions,init_state) gnxp_sim.verbose = True gnxp_sim.run(1000) print "loaded"