for r in index: c = R.gc['media_key'][R.kmax['condition'][r]] if c in ['glc', 'ac', 'glyc', 'xyl_D']: if c == 'xyl_D': c = 'glc' if saturation[c][r] > 0 and backwrdflx[c][r] > 0: s[r] = saturation[c][r] t[r] = backwrdflx[c][r] invivo_kcat = kmax / (s * t) new_index = invivo_kcat.dropna().index names = {k: list(R.rxns[k].genes)[0].name for k in new_index} fig = plt.figure(figsize=(12.5, 12.5)) ax = plt.axes() report_before = generate_figure(kcat[new_index], kmax[new_index], fig, ax, labels=names, hide_overlap=False) r1, pval1 = stats.pearsonr(np.log10(kcat[new_index]), np.log10(kmax[new_index])) report_after = generate_figure(kcat[new_index], invivo_kcat[new_index], fig, ax, fit=True, color='k') r2, pval2 = stats.pearsonr(np.log10(kcat[new_index]), np.log10(invivo_kcat[new_index]))
for r in y.index: c = R.kmax['condition'][r] v[r] = R.flux_data[c][r] E = v[ind] / y min_kmax = y - fva_0.minimum[ind] / E max_kmax = fva_0.maximum[ind] / E - y fig, ax = plt.subplots(1, 1, figsize=(6, 6), sharey=True) fontsize = 20 labels = {'PDX5POi': 'pdxH'} report = generate_figure(x, y, fig, ax, labels=labels, yerr=[min_kmax, max_kmax], fit=True) ax.set_ylabel( r'$k_{\mathrm{max}}^{\mathrm{vivo}}\,\left[s^{-1}\right]$ (in vivo)', size=fontsize, style='italic') ax.set_xlabel(r'$k_{\mathrm{cat}}\,\left[s^{-1}\right]$ (in vitro)', size=fontsize, style='italic') ax.tick_params(axis='both', which='both', top='off', right='off') [tick.label.set_fontsize(fontsize) for tick in ax.xaxis.get_major_ticks()] [tick.label.set_fontsize(fontsize) for tick in ax.yaxis.get_major_ticks()]
x = kcat[ind] y = kmax[ind] v = pd.Series(index=ind) for r in y.index: c = R.kmax['condition'][r] v[r] = R.flux_data[c][r] E = v[ind]/y min_kmax = y - fva_0.minimum[ind]/E max_kmax = fva_0.maximum[ind]/E - y fig, ax = plt.subplots(1, 1, figsize=(6,6), sharey=True) fontsize=20 labels = {'PDX5POi':'pdxH'} report = generate_figure(x, y, fig, ax,labels=labels, yerr = [min_kmax, max_kmax],fit=True) ax.set_ylabel(r'$k_{\mathrm{max}}^{\mathrm{vivo}}\,\left[s^{-1}\right]$ (in vivo)', size=fontsize, style='italic') ax.set_xlabel(r'$k_{\mathrm{cat}}\,\left[s^{-1}\right]$ (in vitro)', size=fontsize, style='italic') ax.tick_params(axis='both', which='both', top='off', right='off') [tick.label.set_fontsize(fontsize) for tick in ax.xaxis.get_major_ticks()] [tick.label.set_fontsize(fontsize) for tick in ax.yaxis.get_major_ticks()] ax.set_xlim(1e-3/4,4*1e3) ax.set_ylim(1e-3/4,4*1e3) plt.tight_layout()
t = pd.Series(index=index) for r in index: c = R.gc['media_key'][R.kmax['condition'][r]] if c in ['glc','ac','glyc','xyl_D']: if c == 'xyl_D': c = 'glc' if saturation[c][r]>0 and backwrdflx[c][r]>0: s[r] = saturation[c][r] t[r] = backwrdflx[c][r] invivo_kcat = kmax / (s * t) new_index = invivo_kcat.dropna().index names = {k:list(R.rxns[k].genes)[0].name for k in new_index} fig = plt.figure(figsize=(12.5,12.5)) ax= plt.axes() report_before = generate_figure(kcat[new_index], kmax[new_index], fig, ax, labels=names, hide_overlap=False) r1, pval1 = stats.pearsonr(np.log10(kcat[new_index]), np.log10(kmax[new_index])) report_after = generate_figure(kcat[new_index], invivo_kcat[new_index], fig, ax, fit=True, color='k') r2, pval2 = stats.pearsonr(np.log10(kcat[new_index]), np.log10(invivo_kcat[new_index])) def stacked_residual(x, y, saturation_effect, thermodynamic_effect, ax): for (x0, y0, s, t) in zip(x, y, saturation_effect, thermodynamic_effect): ax.vlines(x0, y0, y0/s, lw=5, colors='#8383FF') ax.vlines(x0, y0/s, y0/(s*t), lw=5, colors='#FFDA47') stacked_residual(kcat[new_index], kmax[new_index], s[new_index], t[new_index], ax) ax.set_xlim(1e-1*2,1e3*4)