def vB6f(self, Pox,C,H): """ calculates reaction rate of cytb6f """ ph = pH(H) Keq = self.Keq_cytb6f(ph) v = max(self.par.kCytb6f * ((self.par.PQtot - Pox) * C**2 - (Pox * (self.par.PCtot - C)**2)/Keq), -self.par.kCytb6f) return v
def plotph(self, r=None): """ plot lumenal pH """ if r == None: r = range(len(self.results)) for i in r: plt.plot(self.results[i]['t'],pH(self.results[i]['y'][:,5]))
def plotph(self, r=None): """ :param r: range of steps of simulation for which results we are interested in :return: plot of lumenal ph """ if r is None: r = range(len(self.results)) T = self.getT() H = self.getVar(1) plt.plot(T, misc.pH(H), 'g') plt.title('Lumenal ph')
def vPQox(self, Pred, Hlf, PFD): """ :param Pred: reduced PQ (PQH2) :param ph: lumen pH (free protons) :param PFD: light dependency implicit in b6f, because we do not have PSI in model :return: rate of oxidation of the PQ pool through cytochrome and PTOX """ ph = pH(Hlf) Keq = self.Keq_cytb6f(ph) k = self.par.kCytb6f * PFD kf = k * Keq / (Keq + 1) kr = k / (Keq + 1) kPTOX = self.par.kPTOX * self.par.xO2 # PTOX reaction added v = (kf + kPTOX) * Pred - kr * (self.par.PQtot - Pred) return v
def vPQox(self, Pred, Hlf, PFD): """ :param Pred: reduced PQ (PQH2) :param ph: lumen pH (free protons) :param PFD: light dependency implicit in b6f, because we do not have PSI in model :return: rate of oxidation of the PQ pool through cytochrome and PTOX """ ph = pH(Hlf) Keq = self.Keq_cytb6f(ph) k = self.par.kCytb6f * PFD kf = k * Keq/(Keq+1) kr = k/(Keq+1) kPTOX = self.par.kPTOX * self.par.xO2 # PTOX reaction added v = (kf + kPTOX) * Pred - kr * (self.par.PQtot - Pred) return v
def vATPsynthase(self, A, Hlf, Eact): ph = pH(Hlf) ADP = self.par.APtot - A v = Eact * self.par.kATPsynth * (ADP - A / self.Keq_ATP(ph)) return v
def fig5(self): """ :return: figure visualizing pH dependance of quencher and its components. Upper plot: phase plane trajectories Bottom plots: pH and quencher components for 3 light intensities """ color = list(self.col[i] for i in [1,3,5]) # select 3 distinct colours mark = ['x', 'o', 's'] v = visualizeexperiment.VisualizeExperiment('Arabidopsis', 100, 15) # set up the figure fig = plt.figure(figsize=(7, 10)) #make outer gridspec outer_grid = gridspec.GridSpec(2, 1, hspace=0.2) # gridspec with two adjacent horizontal cellstwo rows ax = plt.subplot(outer_grid[0]) ax.set_ylabel('lumen pH', fontsize=18) ax.set_xlabel('quencher activity [Q]', fontsize=18) ax.set_ylim(3, 8) ax.set_xlim(0.05, 0.4) ax.set_yticks([3,4,5,6,7,8]) ax.set_yticklabels(['',4,5,6,7,8], fontsize=14) ax.set_xticks([0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4]) ax.set_xticklabels(['','0.1','','0.2','','0.3','','0.4'], fontsize=14) # add the steady state m, y0 = loadspecie.loadspecie('Arabidopsis', 'wt') ss = simulate.Sim(m) scan = [10, 50, 100, 120, 150, 200, 220, 300, 320, 330, 340, 350, 400, 500, 600, 700, 800, 900, 1000, 1250, 1500] Y = ss.steadyStateLightScan(scan, y0) ax.plot(m.quencher(Y[:,3], Y[:,4]), misc.pH(Y[:,1]), c='r', linestyle='-') for i in[6, 8, 17]: ax.plot(m.quencher(Y[i,3], Y[i,4]), misc.pH(Y[i,1]), 'o', linestyle='None', markersize=15, mfc='r') upper_cell = outer_grid[1] inner_grid = gridspec.GridSpecFromSubplotSpec(2, 1, upper_cell, hspace=0.0) # From here we can plot using inner_grid's SubplotSpecs ax2 = plt.subplot(inner_grid[0, 0]) # add the three points for the calibrated light intensity PFDs = [cpfd.cpfd('Arabidopsis', 100), cpfd.cpfd('Arabidopsis', 300), cpfd.cpfd('Arabidopsis', 900)] time = [0, 30, 930, 1830, 2130] nsteps = [31, 901, 901, 301] # nr of steps for each integration phase v.setGraphics(time, 9, 1) ax2.set_ylabel('lumen pH', fontsize=14) ax2.set_ylim(2, 9) ax2.get_xaxis().set_visible(False) ax2.get_yaxis().set_visible(True) ax2.set_yticks([2,3,4,5,6,7,8]) ax2.set_yticklabels(['',3,4,5,6,7,8], fontsize=14) ax3 = plt.subplot(inner_grid[1, 0]) ax3.set_ylabel('Q components', fontsize=16) ax3.set_xlabel('time [min]', fontsize=18) ax3.set_xlim([0,time[-1]]) ax3.set_xticks(time[1:]) ax3.set_xticklabels(['30', '14', '30', '35'], fontsize=14) ax3.set_yticks([0, 0.2, 0.5, 0.8, 1.]) ax3.set_yticklabels([0, 0.2, 0.5, 0.8, ''], fontsize=14) for i in range(len(PFDs)): s = simulate.Sim(m) s.clearResults() PFD = PFDs[i] light = [0, PFD, 0, PFD] s.piecewiseConstant(light, time[1:], y0, nsteps) res = npqResults.NPQResults(s) ax.plot(m.quencher(res.getVar(3), res.getVar(4)), misc.pH(res.getVar(1)), c=color[i], marker=mark[i], label=str(self.light_intens[i])) ax2.plot(res.getT(), misc.pH(res.getVar(1)), c=color[i], label=str(self.light_intens[i])) ax3.plot(res.getT(), 1-res.getVar(3), c=color[i], linestyle='--', label=str(self.light_intens[i])) ax3.plot(res.getT(), 1-res.getVar(4), c=color[i], linestyle='-', label=str(self.light_intens[i])) handles, labels = ax.get_legend_handles_labels() leg1 = ax.legend(handles, labels, bbox_to_anchor=(0., 1.02, 1., .102), loc=10, ncol=1, borderaxespad=0.1) if leg1: leg1.draggable() handles, labels = ax3.get_legend_handles_labels() leg = ax3.legend([handles[0], handles[2], handles[4], handles[1], handles[3], handles[5]], [labels[0], labels[2], labels[4], labels[1], labels[3], labels[5]], bbox_to_anchor=(0., 1.02, 1., .102), loc=10, title ='PsbS$^P$ Zx', ncol=2, borderaxespad=0.1) if leg: leg.draggable() self.save_plot(fig, 'Fig5')
for i in range(len(PFDs)): m = npqModel.NPQModel(p, 2) s = simulate.Sim(m) s.clearResults() l = lightProtocol.LightProtocol({'prot':'const', 'PFD':PFDs[i]}) s.timeCourse(l, T, y0) res = npqResults.NPQResults(s) T, F, Fmax, Tm, Fm, Ts, Fs, Bst = res.fluo() Xref[i] = [m.quencher(res.getVar(3), res.getVar(4))[-1], misc.pH(res.getVar(1))[-1], res.getVar(0)[-1], F[-1]] # change the value of gamma parameter by 1% perturb = [1.01, 0.99] # collect new calculated values for perturbated parameters for different light intensities Xgl = np.zeros([len(Pref), 2, len(PFDs), 4]) Rgl = np.zeros([len(Pref), len(PFDs), 4]) for g in range(len(Pref)): p = parameters.NPQmodelParameterSet() m = npqModel.NPQModel(p, 2) for pert in range(len(perturb)): if g==0: m.par.gamma0 = Pref[g] * perturb[pert] elif g==1:
def vATPsynthase(self, A, Hlf): ph = pH(Hlf) ADP = self.par.APtot - A v = self.par.kATPsynth * (ADP - A / self.Keq_ATP(ph)) return v
def fig5(self): """ :return: figure visualizing pH dependance of quencher and its components. Upper plot: phase plane trajectories Bottom plots: pH and quencher components for 3 light intensities """ color = list(self.col[i] for i in [1, 3, 5]) # select 3 distinct colours mark = ['x', 'o', 's'] v = visualizeexperiment.VisualizeExperiment('Arabidopsis', 100, 15) # set up the figure fig = plt.figure(figsize=(7, 10)) #make outer gridspec outer_grid = gridspec.GridSpec( 2, 1, hspace=0.2) # gridspec with two adjacent horizontal cellstwo rows ax = plt.subplot(outer_grid[0]) ax.set_ylabel('lumen pH', fontsize=18) ax.set_xlabel('quencher activity [Q]', fontsize=18) ax.set_ylim(3, 8) ax.set_xlim(0.05, 0.4) ax.set_yticks([3, 4, 5, 6, 7, 8]) ax.set_yticklabels(['', 4, 5, 6, 7, 8], fontsize=14) ax.set_xticks([0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4]) ax.set_xticklabels(['', '0.1', '', '0.2', '', '0.3', '', '0.4'], fontsize=14) # add the steady state m, y0 = loadspecie.loadspecie('Arabidopsis', 'wt') ss = simulate.Sim(m) scan = [ 10, 50, 100, 120, 150, 200, 220, 300, 320, 330, 340, 350, 400, 500, 600, 700, 800, 900, 1000, 1250, 1500 ] Y = ss.steadyStateLightScan(scan, y0) ax.plot(m.quencher(Y[:, 3], Y[:, 4]), misc.pH(Y[:, 1]), c='r', linestyle='-') for i in [6, 8, 17]: ax.plot(m.quencher(Y[i, 3], Y[i, 4]), misc.pH(Y[i, 1]), 'o', linestyle='None', markersize=15, mfc='r') upper_cell = outer_grid[1] inner_grid = gridspec.GridSpecFromSubplotSpec(2, 1, upper_cell, hspace=0.0) # From here we can plot using inner_grid's SubplotSpecs ax2 = plt.subplot(inner_grid[0, 0]) # add the three points for the calibrated light intensity PFDs = [ cpfd.cpfd('Arabidopsis', 100), cpfd.cpfd('Arabidopsis', 300), cpfd.cpfd('Arabidopsis', 900) ] time = [0, 30, 930, 1830, 2130] nsteps = [31, 901, 901, 301] # nr of steps for each integration phase v.setGraphics(time, 9, 1) ax2.set_ylabel('lumen pH', fontsize=14) ax2.set_ylim(2, 9) ax2.get_xaxis().set_visible(False) ax2.get_yaxis().set_visible(True) ax2.set_yticks([2, 3, 4, 5, 6, 7, 8]) ax2.set_yticklabels(['', 3, 4, 5, 6, 7, 8], fontsize=14) ax3 = plt.subplot(inner_grid[1, 0]) ax3.set_ylabel('Q components', fontsize=16) ax3.set_xlabel('time [min]', fontsize=18) ax3.set_xlim([0, time[-1]]) ax3.set_xticks(time[1:]) ax3.set_xticklabels(['30', '14', '30', '35'], fontsize=14) ax3.set_yticks([0, 0.2, 0.5, 0.8, 1.]) ax3.set_yticklabels([0, 0.2, 0.5, 0.8, ''], fontsize=14) for i in range(len(PFDs)): s = simulate.Sim(m) s.clearResults() PFD = PFDs[i] light = [0, PFD, 0, PFD] s.piecewiseConstant(light, time[1:], y0, nsteps) res = npqResults.NPQResults(s) ax.plot(m.quencher(res.getVar(3), res.getVar(4)), misc.pH(res.getVar(1)), c=color[i], marker=mark[i], label=str(self.light_intens[i])) ax2.plot(res.getT(), misc.pH(res.getVar(1)), c=color[i], label=str(self.light_intens[i])) ax3.plot(res.getT(), 1 - res.getVar(3), c=color[i], linestyle='--', label=str(self.light_intens[i])) ax3.plot(res.getT(), 1 - res.getVar(4), c=color[i], linestyle='-', label=str(self.light_intens[i])) handles, labels = ax.get_legend_handles_labels() leg1 = ax.legend(handles, labels, bbox_to_anchor=(0., 1.02, 1., .102), loc=10, ncol=1, borderaxespad=0.1) if leg1: leg1.draggable() handles, labels = ax3.get_legend_handles_labels() leg = ax3.legend([ handles[0], handles[2], handles[4], handles[1], handles[3], handles[5] ], [labels[0], labels[2], labels[4], labels[1], labels[3], labels[5]], bbox_to_anchor=(0., 1.02, 1., .102), loc=10, title='PsbS$^P$ Zx', ncol=2, borderaxespad=0.1) if leg: leg.draggable() self.save_plot(fig, 'Fig5')
m = npqModel.NPQModel(p, 2) s = simulate.Sim(m) s.clearResults() l = lightProtocol.LightProtocol({'prot': 'const', 'PFD': PFDs[i]}) s.timeCourse(l, T, y0) res = npqResults.NPQResults(s) T, F, Fmax, Tm, Fm, Ts, Fs, Bst = res.fluo() Xref[i] = [ m.quencher(res.getVar(3), res.getVar(4))[-1], misc.pH(res.getVar(1))[-1], res.getVar(0)[-1], F[-1] ] # change the value of gamma parameter by 1% perturb = [1.01, 0.99] # collect new calculated values for perturbated parameters for different light intensities Xgl = np.zeros([len(Pref), 2, len(PFDs), 4]) Rgl = np.zeros([len(Pref), len(PFDs), 4]) for g in range(len(Pref)): p = parameters.NPQmodelParameterSet() m = npqModel.NPQModel(p, 2) for pert in range(len(perturb)): if g == 0: