def main(): """Simulate temperature dependent aggregation and disaggregation. Clearly need to explicitly write temperature into the simulate method in the future. """ # Rates k1 = 0.01 #disaggregation rate k2 = 0.1 #chaperone degradation rate k3 = 0.00001 #dimerization rate k4 = 0.01 #heat induced chaperone production rate k5 = 0.01 #heat inactivation rate of assembler T1 = 200 T2 = 220 # Species A = Species("A", 100) AA = Species("AA", 0) iAA = Species("iAA", 0) C = Species("C", 10) # Temperature independent reactions disagg = Reactivation("Disagg", [iAA, C], [A, C], k1) deg = UniDeg("C Degredation", [C], [None], k2) # Simulation and Temperature-Dependent Reaction # Temperature ramp = 300, 320, 300 nuc = Temp_Dimerization("Nucleation", [A], [AA], k3, T1) hip = HeatInducedProduction("Heat Induced Production", [iAA], [C], k4, T1) inactivation = HeatInducedInactivation("Inactivation", [AA], [iAA], k5, T1) sp_list = [A, AA, iAA, C] rxn_list = [nuc, inactivation, disagg, hip, deg] system = Network(sp_list, rxn_list) x = system.simulate(0, 20, "None") #nuc = Temp_Dimerization("Nucleation", [A], [AA], k3, 30) #hip = HeatInducedProduction("Heat Induced Production", [iAA], [C], k4, T2) #inactivation = HeatInducedInactivation("Inactivation", [AA], [iAA], k5, T2) #y = system.simulate(x[-1,0], 50, "None") #nuc = Temp_Dimerization("Nucleation", [A], [AA], k3, 10) #hip = HeatInducedProduction("Heat Induced Production", [iAA], [C], k4, T1) #inactivation = HeatInducedInactivation("Inactivation", [AA], [iAA], k5, T1) #z = system.simulate(y[-1,0], 70, "None") #final = np.vstack((x, y, z)) #x2 = [i[-1,0] for i in [x, y, z]] #y2 = [T1, T2, T1] fig, axis = plt.subplots(figsize=(10, 10)) for i in range(1, len(sp_list) + 1): axis.step(x[:, 0], x[:, i], label=sp_list[i - 1].name) plt.legend(loc=0) plt.xlim(0, x[-1, 0]) plt.xlabel("Time") plt.ylabel("Molecular species count") #axis2 = axis.twinx() #axis2.step(x2,y2, c='darkgray') #plt.ylim(T1,T2) #plt.fill_between([x2[0], x2[1]], [220,220], alpha=0.5, color='darkgray') #plt.ylabel("Temperature (T)") #plt.savefig("reactivation_plot.pdf") plt.show()
def main(): """Simulate temperature dependent aggregation and disaggregation. Clearly need to explicitly write temperature into the simulate method in the future. """ # Rates k1 = 0.01 #disaggregation rate k2 = 0.1 #chaperone degradation rate k3 = 0.00001 #dimerization rate k4 = 0.01 #heat induced chaperone production rate k5 = 0.01 #heat inactivation rate of assembler T1 = 200 T2 = 220 # Species A = Species("A", 100) AA = Species("AA", 0) iAA = Species("iAA", 0) C = Species("C", 10) # Temperature independent reactions disagg = Reactivation("Disagg", [iAA, C], [A, C], k1) deg = UniDeg("C Degredation", [C], [None], k2) # Simulation and Temperature-Dependent Reaction # Temperature ramp = 300, 320, 300 nuc = Temp_Dimerization("Nucleation", [A], [AA], k3, T1) hip = HeatInducedProduction("Heat Induced Production", [iAA], [C], k4, T1) inactivation = HeatInducedInactivation("Inactivation", [AA], [iAA], k5, T1) sp_list = [A, AA, iAA, C] rxn_list= [nuc, inactivation, disagg, hip, deg] system = Network(sp_list, rxn_list) x = system.simulate(0, 20, "None") #nuc = Temp_Dimerization("Nucleation", [A], [AA], k3, 30) #hip = HeatInducedProduction("Heat Induced Production", [iAA], [C], k4, T2) #inactivation = HeatInducedInactivation("Inactivation", [AA], [iAA], k5, T2) #y = system.simulate(x[-1,0], 50, "None") #nuc = Temp_Dimerization("Nucleation", [A], [AA], k3, 10) #hip = HeatInducedProduction("Heat Induced Production", [iAA], [C], k4, T1) #inactivation = HeatInducedInactivation("Inactivation", [AA], [iAA], k5, T1) #z = system.simulate(y[-1,0], 70, "None") #final = np.vstack((x, y, z)) #x2 = [i[-1,0] for i in [x, y, z]] #y2 = [T1, T2, T1] fig, axis = plt.subplots(figsize=(10,10)) for i in range(1,len(sp_list)+1): axis.step(x[:,0], x[:,i], label=sp_list[i-1].name) plt.legend(loc=0) plt.xlim(0,x[-1,0]) plt.xlabel("Time") plt.ylabel("Molecular species count") #axis2 = axis.twinx() #axis2.step(x2,y2, c='darkgray') #plt.ylim(T1,T2) #plt.fill_between([x2[0], x2[1]], [220,220], alpha=0.5, color='darkgray') #plt.ylabel("Temperature (T)") #plt.savefig("reactivation_plot.pdf") plt.show()
def main(): """Generate and simulate a model of lemmings approaching and jumping off a cliff. """ L = Species("Lemming", 0) arrival = ConstInduction("Induction", None, [L], 1.0) jump = UniDeg("Degredation", [L], None, 0.1) cliff = Network([L], [arrival, jump]) x = cliff.simulate(0, 200, "dummy_file2.dat") y = x[:,1] print "Mean: %f, Mean/Variance: %f \n (Poisson mean/var = 1)" % (np.mean(y), np.mean(y)/np.var(y)) plt.subplot(121) plt.step(x[:,0], y) plt.title("Lemmings vs. time") plt.xlabel("Time (s)") plt.ylabel("Number of Lemmings") plt.subplot(122) plt.title("Count distribution") plt.hist(y, normed=True) plt.xlabel("Lemming population") plt.show()