diff --git a/code/figures/fig10-S1a_ribosome_as_limit.py b/code/figures/fig10-S1a_ribosome_as_limit.py deleted file mode 100644 index beadb0b5..00000000 --- a/code/figures/fig10-S1a_ribosome_as_limit.py +++ /dev/null @@ -1,177 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -from scipy.optimize import curve_fit -def func(x, a, c, d): - return a*np.exp(-c*x)+d - -# # Load the compiled data -data = pd.read_csv('../../data/compiled_absolute_measurements.csv') - -L_R = 7459.0 # length of all subunits in ribosomes, in amino acids - -ribosome_genes = ['rpsA', 'rpsB', 'rpsC', 'rpsD', 'rpsE', - 'rpsF', 'rpsG', 'rpsH', 'rpsI', 'rpsJ', 'rpsK', - 'rpsL', 'rpsM', 'rpsN', 'rpsO', 'rpsP', 'rpsQ', - 'rpsR', 'rpsS', 'rpsT', 'rpsU', 'sra', 'rplA', 'rplB', - 'rplC', 'rplD', 'rplE', 'rplF', 'rplJ', - 'rplL', 'rplI', 'rplK', 'rplM', 'rplN', 'rplO', 'rplP', 'rplQ', - 'rplR', 'rplS','rplT', 'rplU', 'rplV', 'rplW', 'rplX', 'rplY', - 'rpmA', 'rpmB', 'rpmC', 'rpmD', 'rpmE', 'rpmF', 'rpmG', 'rpmH', - 'rpmI', 'rpmJ', 'ykgM', 'ykgO'] - -# %% -###################### -# plot configuration # -###################### -fig = plt.figure(figsize = (6,5)) -widths = [5, 2, 2] -heights = [2, 4, 6] -spec = fig.add_gridspec(ncols=3, nrows=3, width_ratios=widths, - height_ratios=heights) - -ax1 = fig.add_subplot(spec[2, 0]) - -# %% -###################### -# ribosomal fraction information# -###################### -# determine ribosome fraction in proteomic data sets -df_ribo_frac = pd.DataFrame() -for c, d in data.groupby(['dataset', 'condition', 'growth_rate_hr', 'dataset_name']): - mass_ribo = d[d['gene_name'].isin(ribosome_genes)].fg_per_cell.sum() - frac_ribo = (mass_ribo )/ d.fg_per_cell.sum() - - data_list = {'frac_ribo' : frac_ribo, - 'dataset' : c[0], - 'condition' : c[1], - 'growth_rate_hr' : c[2], - 'dataset_name' : c[3]} - - df_ribo_frac = df_ribo_frac.append(data_list, - ignore_index = True) - -# add in data from Scott et al. -[lambda_scott, R_P_scott] = np.array(\ - [[0.4, 0.177], - [0.57, 0.230], - [0.71, 0.221], - [1.00, 0.287], - [1.31, 0.414], - [1.58, 0.466]]).T - -# Add in data from Forchhammer & Lindahl -[lambda_for, R_P_for] = np.array(\ - [[0.38, 0.189], - [0.60, 0.224], - [1.04, 0.295], - [1.46, 0.421], - [1.73, 0.469]]).T - -# Bremmer and Dennis -[lambda_brem, R_P_brem] = np.array(\ - [[0.42, 0.200], - [0.69, 0.225], - [1.04, 0.331], - [1.39, 0.391], - [1.73, 0.471]]).T - -# Load the full Si 2017 SI -data_si = pd.read_csv('../../data/si_2017_raw/si2017_full.csv') - -# consider the mean values for each strain/condition they considered -data_si_mean = pd.DataFrame() -for c, d in data_si.groupby(['strain type (background)', 'growth media', 'inducer or drug added', 'concentration ', 'type of perturbation']): - data_list = {'strain' : c[0], - 'growth media' : c[1], - 'inducer or drug added' : c[2], - 'concentration': c[3], - 'number of origins' :d['number of origins'].mean(), - 'RNA/protein' : d['RNA/protein'].mean(), - 'DNA content per cell (genome equivalents)' : d['DNA content per cell (genome equivalents)'].mean(), - 'type of perturbation' :c[4], - 'C+D period (minutes)' : d['C+D period (minutes)'].mean(), - 'C period (minutes)' : d['C period (minutes)' ].mean(), - 'growth_rate_hr' : d['growth rate (1/hours)'].mean()} - data_si_mean = data_si_mean.append(data_list, - ignore_index = True) - -# load in the Dai et al. 2016 data -dai_nut_df = pd.read_csv('../../data/dai2016_raw_data/dai2016_summary.csv') -dai_nut_df = dai_nut_df[dai_nut_df['Cm (μM)'] == 0] -lambda_dai = dai_nut_df.growth_rate_hr.values -R_P_dai = dai_nut_df.RNA_P_ratio.values - -# fit measurements of active fraction from Dai et al. data -dai_nut_df = dai_nut_df.sort_values(by='growth_rate_hr', ascending = True) - -popt_dai, pcov_dai = curve_fit(func, dai_nut_df.growth_rate_hr.values, dai_nut_df.f_a.values, p0=(1, 1e-6, 1)) - -# %% -###################### -# Plotting # -###################### - -# Add Dai et al, Scott, and historical -ax1.plot((R_P_dai/2.1)*func(lambda_dai, *popt_dai),lambda_dai, 'o', color= colors['light_yellow'], - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - ms=4, zorder=0, label = 'Dai et al. 2016') - -ax1.plot((R_P_scott/2.1)*func(lambda_scott, *popt_dai),lambda_scott, 'o', color= colors['light_purple'], - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - ms=4, zorder=0, label = 'Scott et al. 2010') - -ax1.plot((R_P_for/2.1)*func(lambda_for, *popt_dai),lambda_for, 'o', color= '#1F4B99', - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - ms=4, zorder=0, label = 'Forchhammer & Lindahl 1971') - -ax1.plot((R_P_brem/2.1)*func(lambda_brem, *popt_dai),lambda_brem, 'o', color= '#B7741A', - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - ms=4, zorder=0, label = 'Bremmer & Dennis 2006') - - -for g, d in df_ribo_frac.groupby(['dataset', 'condition', 'growth_rate_hr', 'dataset_name']): - ax1.plot(d['frac_ribo']*func( d.growth_rate_hr.unique(), *popt_dai), g[2], 'o', color=dataset_colors[g[0]], - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - label = g[3], ms=4, zorder=10) - -for c, d in data_si_mean.groupby(['type of perturbation', 'growth media', 'strain']): - if c[0] != 'nutrient conditions': - continue - if 'MG1655' in c[2]: - k = colors['pale_red'] - elif 'NCM3722' in c[2]: - k = colors['light_green'] - - ax1.plot((d['RNA/protein']/2.1)*func( d.growth_rate_hr.unique(), *popt_dai),d.growth_rate_hr.unique(), 'o', color= k, - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - ms=4, zorder=0, label = 'Si et al. 2017') - - -ax1.xaxis.set_tick_params(labelsize=5) -ax1.yaxis.set_tick_params(labelsize=5) - -ax1.set_xlim([0, 0.26]) -ax1.set_ylim([0, 2.2]) -ax1.set_xlabel('estimated active ribosomal\nfraction ($\Phi_R f_a$)', fontsize=6) -ax1.set_ylabel('growth rate [hr$^{-1}$]', fontsize=6) - -# Plot the prediction. -frac = np.linspace(0,0.3,100) -gr = (17.1 * frac/ L_R) * 3600 -ax1.plot(frac, gr, color='k', alpha=1.0, label='maximum growth rate', - linestyle='-', lw=0.75) - -handles, labels = ax1.get_legend_handles_labels() -by_label = dict(zip(labels, handles)) -ax1.legend(by_label.values(), by_label.keys(), loc = 'upper left', fontsize = 6) - -plt.tight_layout() -plt.savefig('../../figures/fig10-S1a_ribosome_as_limit.pdf') diff --git a/code/figures/fig10-S1b_ori.py b/code/figures/fig10-S1b_ori.py deleted file mode 100644 index 536b25ea..00000000 --- a/code/figures/fig10-S1b_ori.py +++ /dev/null @@ -1,116 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -from matplotlib.collections import LineCollection -from matplotlib.colors import ListedColormap, BoundaryNorm -from mpl_toolkits.axes_grid1 import make_axes_locatable -import matplotlib -import prot.viz -import prot.size as size -colors, palette = prot.viz.bokeh_theme() - -dataset_colors = {'li_2014':colors['purple'], 'schmidt_2016':colors['light_blue'], - 'peebo_2015':colors['green'], 'valgepea_2013':colors['red']} -prot.viz.plotting_style() - -from scipy.optimize import curve_fit -def func(x, a, c, d): - return a*np.exp(-c*x)+d - -# %% -###################### -# plot configuration # -###################### -fig = plt.figure(constrained_layout=True) -# widths = [6, 2.5, 2.5, 5] -widths = [6, 5, 5] -heights = [1.5, 1, 0.75, 1.25, 0.75, 2] -spec = fig.add_gridspec(ncols=3, nrows=6, width_ratios=widths, - height_ratios=heights) -ax2 = fig.add_subplot(spec[0, 2]) - -# Load the full Si 2017 SI -data_si = pd.read_csv('../../data/si_2017_raw/si2017_full.csv') - -# consider the mean values for each strain/condition they considered -data_si_mean = pd.DataFrame() -for c, d in data_si.groupby(['strain type (background)', 'growth media', 'inducer or drug added', 'concentration ', 'type of perturbation']): - data_list = {'strain' : c[0], - 'growth media' : c[1], - 'inducer or drug added' : c[2], - 'concentration': c[3], - 'number of origins' :d['number of origins'].mean(), - 'RNA/protein' : d['RNA/protein'].mean(), - 'DNA content per cell (genome equivalents)' : d['DNA content per cell (genome equivalents)'].mean(), - 'type of perturbation' :c[4], - 'C+D period (minutes)' : d['C+D period (minutes)'].mean(), - 'C period (minutes)' : d['C period (minutes)' ].mean(), - 'growth_rate_hr' : d['growth rate (1/hours)'].mean(), - 'doubling time (minutes)' : d['doubling time (minutes)'].mean() } - data_si_mean = data_si_mean.append(data_list, - ignore_index = True) - -# perform fit of growth rate vs. t_cyc so that we can estimate number of -# origins (2**(t_cyc/tau)) where tau is the doubling time. -data_si_mean = data_si_mean.sort_values(by='growth_rate_hr') -data_si_mean['tau'] = 60*(np.log(2)/data_si_mean['growth_rate_hr']) -data_si_mean = data_si_mean[data_si_mean.strain != 'tCRISPRi (MG1655)'] -data_si_mean = data_si_mean[data_si_mean['type of perturbation'] == 'nutrient conditions'] - - -def func_lin(l, a, b): - x = 60*(np.log(2)/l) - return a*x + b - -#### piecewise fit for t_cyc - piecewise fit works well with transition at 43 min -t_cyc_const = data_si_mean[data_si_mean.tau <=43]['C+D period (minutes)'].mean() -t_cyc_lin = data_si_mean[data_si_mean.tau > 43]['C+D period (minutes)'].values -l_lin = data_si_mean[data_si_mean.tau > 43]['growth_rate_hr'].values -popt_tcyc_lin, pcov_tcyc_lin = curve_fit(func_lin, l_lin, t_cyc_lin, p0=(1, 1)) - - -# Now plot! -for c, d in data_si_mean.groupby(['type of perturbation', 'growth media', 'strain']): - if c[0] != 'nutrient conditions': - continue - if 'MG1655' in c[2]: - k = colors['pale_red'] - elif 'NCM3722' in c[2]: - k = colors['light_green'] - - ax2.plot(d['growth_rate_hr'], d['C+D period (minutes)'], 'o', color= k, - alpha=1, markeredgecolor='k', markeredgewidth=0.25, - ms=4, zorder=10) - - - -# plot 2 ; t_cyc vs. tau and lambda -tau = np.linspace(0.1, 40, 100) -x = (np.log(2)/tau)*60 -tcyc_x = t_cyc_const.mean()*np.ones(100) -ax2.plot(x, tcyc_x, color = 'k', lw = 0.5, - alpha=0.75, - zorder=1, ls = '--') - -tau = np.linspace(40, (np.log(2)/0.1)*60, 100) -x = (np.log(2)/tau)*60 -tcyc_x = func_lin(x, *popt_tcyc_lin) -ax2.plot(x, tcyc_x, color = 'k', lw = 0.5, - alpha=0.75, - zorder=1, ls = '--') - - -for a in [ax2]: - a.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) - a.xaxis.set_tick_params(labelsize=5) - a.yaxis.set_tick_params(labelsize=5) - a.set_xlim([0, 2]) - a.set_ylim([0, 150]) - -ax2.set_ylabel('t$_{cyc}$ [min]', fontsize=6) - - - - -fig.savefig('../../figures/fig10-S1b_translation_limit.pdf') diff --git a/code/figures/fig10c_rRNA_scaling.py b/code/figures/fig10c_rRNA_scaling.py deleted file mode 100644 index 3e5a2500..00000000 --- a/code/figures/fig10c_rRNA_scaling.py +++ /dev/null @@ -1,49 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() -constants = prot.estimate.load_constants() - -# Load experimental data -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -data = data[data['shorthand']=='ribosome'] - -# Define constants -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -n_ori = constants['N_ori']['value'] - -# Compute the maximum number of rRNA produced per doubling time -k_rrna = 1 # functional rRNA units per second at steady state -n_operon = 7 # average number of functional ribosomal operons per chromosome -n_rRNA_full = n_operon * k_rrna * n_ori * t_double -n_rRNA_noparallel = n_operon * k_rrna * t_double - - -# Instantiate the figure canvas -fig, ax = plt.subplots(1, 1, figsize=(5, 4)) -ax.set_yscale('log') -ax.set_xlabel('growth rate [hr$^{-1}$]') -ax.set_ylabel(r'number of ribosomal units') -ax.set_ylim([5E3, 8E5]) - -# Plot the predicted maximal number of rRNA under different regimes -ax.plot(growth_rate, n_rRNA_full, '-', lw=1, color=colors['blue'], - label='maximum number of ribosomes\nwith parallelization (rRNA units)') -ax.plot(growth_rate, n_rRNA_noparallel, '--', lw=1, color=colors['blue'], - label='maximum number of ribosomes\nwithout parallelization (rRNA units)') - -# Plot the experimentally observed number of ribosomes -for g, d in data.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, markeredgecolor='k', - markeredgewidth=0.5, color=dataset_colors[g[0]], label='__nolegend__') - -ax.legend(fontsize=8) -# Save -plt.savefig('../../figures/fig9c_rRNA_scaling.svg') - -# %% diff --git a/code/figures/fig11b_polar_chromosome.py b/code/figures/fig11b_polar_chromosome.py deleted file mode 100644 index 14507971..00000000 --- a/code/figures/fig11b_polar_chromosome.py +++ /dev/null @@ -1,116 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import seaborn as sns -import tqdm -import prot.viz -import prot.size as size -import scipy.stats -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() - -# Load the datasets. -data = pd.read_csv('../../data/compiled_absolute_measurements.csv') -regulonDB = pd.read_csv('../../data/regulonDB_raw/GeneProductSet.txt', delimiter = ' ') - -# Map the transcription start stie to position from regulon DB. -tss_map = dict(zip(regulonDB.b_number.values, regulonDB['Gene left end position in the genome'].values)) -data['pos'] =data['b_number'].map(tss_map) - -data_schmidt = data[data.dataset == 'schmidt_2016'] -data_schmidt = data_schmidt.sort_values(by='growth_rate_hr', ascending = True) - -# Deal with double copies of EF-Tu -# Assume that they are equally distributed between gene copies. (right now, only tufA) -data_tufA = data_schmidt[data_schmidt.gene_name == 'tufA'] -data_tufA['tot_per_cell'] = data_tufA['tot_per_cell']/2 - -data_tufB = data_schmidt[data_schmidt.gene_name == 'tufA'] -data_tufB['gene_name'] = data_tufB['gene_name'].replace('tufA', 'tufB') -data_tufB['tot_per_cell'] = data_tufB['tot_per_cell']/2 -data_tufB['pos'] = 4175944 - -data_schmidt = data_schmidt[data_schmidt.gene_name != 'tufA'] -data_schmidt = data_schmidt.append(data_tufA) -data_schmidt = data_schmidt.append(data_tufB) - -# Shift the genomic positions to be centered at oriC -oriC_loc = 3925744 -data_schmidt['shifted_pos'] = data_schmidt['pos'].values - oriC_loc -max_pos_noshift = data_schmidt['pos'].max() + 1 -max_pos = data_schmidt['shifted_pos'].max() -data_schmidt.loc[data_schmidt['shifted_pos'] < 0, 'shifted_pos'] += max_pos_noshift -data_schmidt.dropna(inplace=True) - -# Create a mapping between shifted position and radians -# pos_to_rad = {p:v for p, v in -# zip(np.sort(data_schmidt['shifted_pos'].unique()), np.linspace(0, 2 * np.pi, -# len(data_schmidt['shifted_pos'].unique())))} -_positions = np.arange(0, 4.6E6, 1) -pos_to_rad = {p:v for p, v in zip(_positions, np.linspace(0, 2 * np.pi, len(_positions)))} - - -# Define the color palette to be used -palette = sns.color_palette('viridis', n_colors=len(data['growth_rate_hr'].unique())) -color_mapping = {k:v for k, v in zip(np.sort(data_schmidt['growth_rate_hr'].unique()), palette)} - -# -ribo_prots = ['rpsA', 'rpsB', 'rpsC', 'rpsD', 'rpsE', - 'rpsF', 'rpsG', 'rpsH', 'rpsI', 'rpsJ', 'rpsK', - 'rpsL', 'rpsM', 'rpsN', 'rpsO', 'rpsP', 'rpsQ', - 'rpsR', 'rpsS', 'rpsT', 'rpsU', 'sra', 'rplA', 'rplB', - 'rplC', 'rplD', 'rplE', 'rplF', 'rplJ', - 'rplL', 'rplI', 'rplK', 'rplM', 'rplN', 'rplO', 'rplP', 'rplQ', - 'rplR', 'rplS','rplT', 'rplU', 'rplV', 'rplW', 'rplX', 'rplY', - 'rpmA', 'rpmB', 'rpmC', 'rpmD', 'rpmE', 'rpmF', 'rpmG', 'rpmH', - 'rpmI', 'rpmJ', 'ykgM', 'ykgO'] - - -# Set up the figure canvas, -fig = plt.figure(figsize=(5,5)) -ax = fig.add_subplot(111, projection='polar') -ax.set_theta_zero_location('N') -ax.set_ylim([-60, 80]) -# ax.set_yticks([]) -ax.set_rlabel_position(180) -# ax.set_yscale('log') - -# Play with one condition -cond = data_schmidt[data_schmidt['condition']=='42C'] -cond.sort_values(by='shifted_pos', inplace=True) -window = 2E4 -position = np.sort(data_schmidt['shifted_pos'].unique()) -z = 100 -iter =0 -for g, d in tqdm.tqdm(data_schmidt.groupby(['growth_rate_hr']), desc='processing growth rates'): - cond = d - means = [] - pos = [] - for p in _positions[::500]: - weights = scipy.stats.norm(p, window).pdf(d['shifted_pos'].values) - means.append(np.sum(weights * d['tot_per_cell'].values)) - pos.append(pos_to_rad[p]) - - shifted = list(np.array(means) - np.median(means)) - shifted.append(shifted[0]) - pos.append(pos[0]) - ax.plot(pos, shifted, '-', lw=1, alpha=0.8, zorder=z, color=palette[iter]) - z -= 1 - iter += 1 - -ribosomes = data_schmidt[data_schmidt['gene_name'].isin(['rpsA', 'rpsB', 'rpsC', 'rpsD', 'rpsE', - 'rpsF', 'rpsG', 'rpsH', 'rpsI', 'rpsJ', 'rpsK', - 'rpsL', 'rpsM', 'rpsN', 'rpsO', 'rpsP', 'rpsQ', - 'rpsR', 'rpsS', 'rpsT', 'rpsU', 'sra', 'rplA', 'rplB', - 'rplC', 'rplD', 'rplE', 'rplF', 'rplJ', - 'rplL', 'rplI', 'rplK', 'rplM', 'rplN', 'rplO', 'rplP', 'rplQ', - 'rplR', 'rplS','rplT', 'rplU', 'rplV', 'rplW', 'rplX', 'rplY', - 'rpmA', 'rpmB', 'rpmC', 'rpmD', 'rpmE', 'rpmF', 'rpmG', 'rpmH', - 'rpmI', 'rpmJ', 'ykgM', 'ykgO'])] - -for g, d in ribosomes.groupby(['pos', 'shifted_pos']): - ax.plot([pos_to_rad[g[1]], pos_to_rad[g[1]]], [-15, -5], '-', lw=1, color=colors['red']) - -plt.savefig('../../figures/fig11b_polar_chromosome.svg') -#%% diff --git a/code/figures/fig2-S1a_phosphate_tporters.py b/code/figures/fig2-S1a_phosphate_tporters.py deleted file mode 100644 index f115b344..00000000 --- a/code/figures/fig2-S1a_phosphate_tporters.py +++ /dev/null @@ -1,55 +0,0 @@ -# %% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.size -import prot.estimate -constants = prot.estimate.load_constants() -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() - -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -data = data[data['shorthand']=='phosphate_tport'] - -# Define constants -theta_P = constants['dry_mass_frac']['value'] * constants['theta_P']['value'] -rho = constants['density']['value'] -vol = constants['volume']['value'] -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -mass = constants['cell_mass']['value'] -m_phos = 30/5E11 # in pg -r_phos = 300 # in C / s -N_tporters = (theta_P * mass)/ (m_phos * r_phos * t_double) - - -# Set up the figure canvas. -fig, ax = plt.subplots(1, 1, figsize=(3, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_xlim([0, 2]) -ax.set_ylim([1E1, 1E4]) -ax.set_yscale('log') -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('number of PitA + PitB phosphate\ntransporters per cell', fontsize=6) - -# Plot the scaling argument -ax.plot(0.5, 2E2, 'o', ms=6, color=colors['dark_brown'], alpha=0.4, label='point estimate', - zorder=1000) -ax.vlines(0.5, 1E1, 2E2, color='k', linestyle='--', lw=0.75, label='__nolegend__', - zorder=999) -ax.hlines(2E2, 0, 0.5, color='k', linestyle='--', lw=0.75, label='__nolegend__', - zorder=999) - -# Plot the data -for g, d in data.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.plot(growth_rate, N_tporters, '-', lw=3, color='grey', label='cell size dependence', -alpha=0.3) -ax.legend(ncol=2, fontsize=6) -plt.savefig('../../figures/fig2-S1a_phos_transporters.svg', bbox_inches='tight') - -# %% diff --git a/code/figures/fig2-S1b_sulfate_tporters.py b/code/figures/fig2-S1b_sulfate_tporters.py deleted file mode 100644 index 89317883..00000000 --- a/code/figures/fig2-S1b_sulfate_tporters.py +++ /dev/null @@ -1,50 +0,0 @@ -# %% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.size -import prot.estimate -constants = prot.estimate.load_constants() -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() - -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -data = data[data['shorthand']=='sulfur_tport'] - -# Define constants -theta_S = constants['dry_mass_frac']['value'] * constants['theta_S']['value'] -rho = constants['density']['value'] -vol = constants['volume']['value'] -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -mass = constants['cell_mass']['value'] -m_sulf = 32/6E11 # in pg -r_sulf = 10 # in C / s -N_tporters = (theta_S * mass)/ (m_sulf * r_sulf * t_double) - -# Set up the figure canvas. -fig, ax = plt.subplots(1, 1, figsize=(3, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_xlim([0, 2]) -ax.set_ylim([1E1, 5E4]) -ax.set_yscale('log') -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('number of CysUWA sulfate\ntransporters per cell', fontsize=6) - -# Plot the scaling argument -ax.plot(0.5, 1E3, 'o', ms=6, color=colors['dark_brown'], alpha=0.4, label='point estimate') -ax.vlines(0.5, 1E1, 1E3, color='k', linestyle='--', lw=0.75, label='__nolegend__') -ax.hlines(1E3, 0, 0.5, color='k', linestyle='--', lw=0.75, label='__nolegend__') - -# Plot the data -for g, d in data.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.plot(growth_rate, N_tporters, '-', lw=3, color='grey', label='cell size dependence', -alpha=0.3) -ax.legend(ncol=2, fontsize=6) -plt.savefig('../../figures/fig2-S1b_sulf_transporters.svg', bbox_inches='tight') -# %% diff --git a/code/figures/fig2a_carbon_tport.py b/code/figures/fig2a_carbon_tport.py deleted file mode 100644 index 7a6ac8d0..00000000 --- a/code/figures/fig2a_carbon_tport.py +++ /dev/null @@ -1,52 +0,0 @@ - -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() -constants = prot.estimate.load_constants() - -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -_carbon = data[data['shorthand']=='carbon_tport'] - -# Define constants -theta_C = constants['dry_mass_frac']['value'] * constants['theta_C']['value'] -rho = constants['density']['value'] -vol = constants['volume']['value'] -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -mass = constants['cell_mass']['value'] -m_carbon = 12/6E11 # in pg -r_carbon = 1000 # in C / s -N_tporters = (theta_C * mass)/ (m_carbon * r_carbon * t_double) - -# Set up the figure canvas. -fig, ax = plt.subplots(1, 1, figsize=(3, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_xlim([0, 2]) -ax.set_ylim([1E2, 5E5]) -ax.set_yscale('log') -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('total number of \n PTS transporters per cell', fontsize=6) - -# Plot the scaling argument -ax.plot(0.5, 2E3, 'o', ms=6, color=colors['dark_brown'], alpha=0.4, label='point estimate') -ax.vlines(0.5, 1E2, 2E3, color='k', linestyle='--', lw=0.75, label='__nolegend__') -ax.hlines(2E3, 0, 0.5, color='k', linestyle='--', lw=0.75, label='__nolegend__') - -# Plot the data -for g, d in _carbon.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.plot(growth_rate, N_tporters, '-', lw=3, color='grey', label='cell size dependence', -alpha=0.3) -ax.legend(ncol=2, fontsize=6) -plt.savefig('../../figures/fig2a_carbon_tporters.svg', bbox_inches='tight') - - -# %% diff --git a/code/figures/fig3ab_lipid_peptidoglycan.py b/code/figures/fig3ab_lipid_peptidoglycan.py deleted file mode 100644 index 183fc45c..00000000 --- a/code/figures/fig3ab_lipid_peptidoglycan.py +++ /dev/null @@ -1,93 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -data = pd.read_csv('../../data/compiled_estimate_categories.csv') - -# Load the data and restrict. -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -lipid = data[data['shorthand']=='fas'] -pg = data[data['shorthand']=='transpeptidases'] - -# Compute the scaling relations. -growth_rate = constants['growth_rate']['value'] -surface_area = constants['surface_area']['value'] -t_double = constants['t_double']['value'] - -rho_pg = 0.25 # in pg per fL -A_lipid = 0.5 / 1E6 # in square microns -N_leaflet = 4 -kcat_acp = 1 -kcat_tpd = 2 -xlink_frac = 0.2 -w_pg = 0.005 # thickness of pg in um -m_murein = 1000 / 6E11 # Mass of murein monomer in pg -theta_lipid = 0.4 -N_fabs = (theta_lipid * surface_area * N_leaflet) / (A_lipid * kcat_acp * t_double) -N_tpds = (xlink_frac * w_pg * surface_area * rho_pg) / (m_murein * kcat_tpd * t_double) - -# Generate the figures -fig, ax = plt.subplots(1, 1, figsize=(3.5, 2)) -ax.set_xlim([0, 2]) -ax.set_yscale('log') -ax.set_ylim([1E2, 1E5]) -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('ACP dehydratases per cell\n(FabZ + FabA)', fontsize=6) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) - -# Plot the scaling relationship -ax.plot(growth_rate, N_fabs, '-', lw=3, color='grey', label='surface area scaling', - alpha=0.4) - -# Plot the prediction -ax.plot(0.5, 4E3, 'o', ms=5, color=colors['dark_brown'], label='point estimate', - alpha=0.4) -ax.hlines(4E3, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') -ax.vlines(0.5, 0, 4E3, 'k', linestyle='--', lw=0.75, label='__nolegend__') - -# plot the data -for g, d in lipid.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, - color=dataset_colors[g[0]], alpha=0.75, markeredgecolor='k', - markeredgewidth=0.5, label=g[1]) -ax.legend(fontsize=6, loc='lower right') -plt.savefig('../../figures/fig3a_lipid_synthesis_plots.svg', bbox_inches='tight') -# %% -# Generate the figures -fig, ax = plt.subplots(1, 1, figsize=(3.5, 2)) -ax.set_xlim([0, 2]) -ax.set_yscale('log') -ax.set_ylim([5E0, 5E3]) -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('murein transpeptidases per cell', fontsize=6) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) - -# Plot the scaling relationship -ax.plot(growth_rate, N_tpds, '-', lw=3, color='grey', label='surface area scaling', - alpha=0.4) - -# Plot the prediction -ax.plot(0.5, 100, 'o', ms=5, color=colors['dark_brown'], label='point estimate', - alpha=0.4) -ax.hlines(100, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') -ax.vlines(0.5, 0, 100, 'k', linestyle='--', lw=0.75, label='__nolegend__') - -# plot the data -for g, d in pg.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, - color=dataset_colors[g[0]], alpha=0.75, markeredgecolor='k', - markeredgewidth=0.5, label=g[1]) -ax.legend(fontsize=6, loc='upper left', ncol=2) -plt.savefig('../../figures/fig3b_pg_biosynthesis.svg', bbox_inches='tight') - - - -# %% diff --git a/code/figures/fig4a_ATP_production.py b/code/figures/fig4a_ATP_production.py deleted file mode 100644 index 53df4fe8..00000000 --- a/code/figures/fig4a_ATP_production.py +++ /dev/null @@ -1,62 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -import prot.size -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() -constants = prot.estimate.load_constants() - -# Load the data set -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -data = data[data['shorthand']=='atp_synthase'] - - -# Load the complex subunit counts. -subunits = pd.read_csv('../../data/compiled_annotated_complexes.csv') - -# Compute the minimum number of complexes. -complex_count = subunits.groupby(['dataset', 'dataset_name', 'condition', 'growth_rate_hr', 'complex_annotation', 'complex'])['n_units'].mean().reset_index() - - -# Compute the scaling trend. -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -cell_mass = constants['cell_mass']['value'] -theta_dry = constants['dry_mass_frac']['value'] -theta_prot = constants['theta_prot']['value'] - -m_aa = 110 / 6E11 # in pg -r_atp = 300 # per second per synthase -atp_aa = 5 - -tot_prot = prot.size.lambda2P(growth_rate) / 1E3 -N_synthase = (tot_prot * atp_aa) / (m_aa * r_atp * t_double / np.log(2)) - -# Instantiate andf ormat the axis -fig, ax = plt.subplots(1, 1, figsize=(3.5, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_yscale('log') -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('ATP synthases per cell', fontsize=6) -ax.set_xlim([0, 2]) -ax.set_ylim([1E2, 5E4]) -# Plot the scaling relationship -ax.plot(growth_rate, N_synthase, '-', lw=3, color='grey', alpha=0.4, label='cell size dependence') - -# Plot the estimate value -ax.plot(0.5, 3000, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.5, label='estimated value') -ax.vlines(0.5, 0, 3000, 'k', lw=1, linestyle='--', label='__nolegend__') -ax.hlines(3000, 0, 0.5, 'k', lw=1, linestyle='--', label='__nolegend__') - -for g, d in complex_count[complex_count.complex == 'F-1-CPLX'].groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_units'], 'o', ms=4, color=dataset_colors[g[0]], - markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.legend(fontsize=6) -plt.savefig('../../figures/fig4a_atp_synthase.svg') - -# %% diff --git a/code/figures/fig4b_respiration.py b/code/figures/fig4b_respiration.py deleted file mode 100644 index 28558ae5..00000000 --- a/code/figures/fig4b_respiration.py +++ /dev/null @@ -1,59 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() -constants = prot.estimate.load_constants() - -# Load the data set -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -data = data[data['shorthand']=='proton_gradient'] - -# Compute the scaling trend. -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -cell_mass = constants['cell_mass']['value'] -theta_dry = constants['dry_mass_frac']['value'] -theta_prot = constants['theta_prot']['value'] -m_aa = 110 / 6E11 # in pg -r_atp = 300 # per second per synthase -atp_aa = 5 -prot_atp = 4 -r_etc = 1500 - -# N_synthase = (cell_mass * theta_dry * theta_prot * atp_aa) / (m_aa * r_atp * t_double) -tot_prot = prot.size.lambda2P(growth_rate) / 1E3 -N_synthase = (tot_prot * atp_aa) / (m_aa * r_atp * t_double / np.log(2)) -N_ETC = N_synthase * prot_atp * r_atp / r_etc - - -# Instantiate andf ormat the axis -fig, ax = plt.subplots(1, 1, figsize=(3.5, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_yscale('log') -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('electron transport complexes\nper cell', fontsize=6) -ax.set_xlim([0, 2]) -ax.set_ylim([1E2, 5E4]) -# Plot the scaling relationship -ax.plot(growth_rate, N_ETC, '-', lw=3, color='grey', alpha=0.4, label='cell size dependence') - -# Plot the estimate value -ax.plot(0.5, 2500, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.5, label='estimated value') -ax.vlines(0.5, 0, 2500, 'k', lw=1, linestyle='--', label='__nolegend__') -ax.hlines(2500, 0, 0.5, 'k', lw=1, linestyle='--', label='__nolegend__') - -for g, d in data.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.legend(fontsize=6) -plt.savefig('../../figures/fig4b_respiration.svg') - - - -# %% diff --git a/code/figures/fig6_COG_cytosol_barplot.py b/code/figures/fig6_COG_cytosol_barplot.py deleted file mode 100644 index 22338480..00000000 --- a/code/figures/fig6_COG_cytosol_barplot.py +++ /dev/null @@ -1,254 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib as mpl -import matplotlib.pyplot as plt -from matplotlib.lines import Line2D -from mpl_toolkits.axes_grid1.inset_locator import inset_axes -import prot.viz -import prot.size as size -colors, palette = prot.viz.bokeh_theme() -dataset_colors = {'li_2014':colors['purple'], 'schmidt_2016':colors['light_blue'], - 'peebo_2015':colors['green'], 'valgepea_2013':colors['red']} -prot.viz.plotting_style() - - -###################### -# plot configuration # -###################### -fig = plt.figure()#figsize = (6,5))#constrained_layout=True) -widths = [5, 6] -# heights = [2, 0.5, 0.5, 0.25] -# widths = [5, 5] -heights = [1.75, 1.25, 1.5, 1.5] -spec = fig.add_gridspec(ncols=2, nrows=4, width_ratios=widths) - # height_ratios=heights) - - -ax1 = fig.add_subplot(spec[:2,0]) -ax2 = fig.add_subplot(spec[2:,0]) - -ax3 = fig.add_subplot(spec[0,1]) -ax4 = fig.add_subplot(spec[1:,1]) - - -# Load the data set -data = pd.read_csv('../../data/compiled_absolute_measurements.csv') - -# total fg per cell cytosol GO:0005829 - cytosol -data_cytosol = data[data.go_terms.str.contains('GO:0005829')] - -data_cytosol = data_cytosol.replace('Not Assigned', 'poorly characterized or not assigned') -data_cytosol = data_cytosol.replace('poorly characterized', 'poorly characterized or not assigned') -# - -cog_class_order = ['metabolism', - 'cellular processes and signaling', - 'information storage and processing', - 'poorly characterized or not assigned'] -order_dict = dict(zip(cog_class_order, - np.arange(4))) - -color_dict = dict(zip(cog_class_order, - ['#679B48', '#BF703A', '#D3B15E', '#788FBD'])) - # ['', '#BF703A', '#D3B15E', '#788FBD'])) - -marker_dict = dict(zip(data.dataset.unique(), - ['o', 's', 'd', 'v'])) - -label_dict = dict(zip(data.dataset_name.unique(), - ['o', 's', 'd', 'v'])) -###################### -# Plot 1 -###################### -# relative dist of different COG categories - - -# Compute the mass fraction -mass_frac = [] -for g, d in data_cytosol.groupby(['dataset', 'condition', 'growth_rate_hr']): - tot_mass = d['fg_per_cell'].sum() - sector_mass = d.groupby(['dataset', 'dataset_name', 'condition', 'growth_rate_hr', 'cog_class'])['fg_per_cell'].sum().reset_index() - frac = sector_mass['fg_per_cell'].values / tot_mass - sector_mass['frac'] = frac - sector_mass['dataset_name'] = sector_mass['dataset_name'] - mass_frac.append(sector_mass) -mass_frac = pd.concat(mass_frac, sort=False) - -for g, d in mass_frac.groupby(['dataset', 'cog_class', 'dataset_name']): - ax1.plot(d.growth_rate_hr, d['frac'], marker = marker_dict[g[0]], color=color_dict[g[1]], - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - label = g[2], ms=4, zorder=10, linewidth = 0) - -ax1.set_ylim(0,1) -ax1.set_xlim(0,2) -ax1.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax1.set_ylabel('relative cytosolic protein\nfraction (GO term : 0005829)', fontsize=6) -ax1.xaxis.set_tick_params(labelsize=5) -ax1.yaxis.set_tick_params(labelsize=5) - -legend_elements = [Line2D([0], [0], - marker=label_dict[i], - color='w', linewidth = 0, - label=i, markeredgecolor='k', - markeredgewidth=0.25, - markerfacecolor='gray', - markersize=4) for i in data.dataset_name.unique()] - - - -ax1.legend(handles=legend_elements, loc='upper left', fontsize = 6) - - -###################### -# Plot 2 -###################### -# metabolism vs information processing - -cm = plt.cm.get_cmap('viridis') - -for g, d in mass_frac.groupby(['dataset', 'growth_rate_hr', 'dataset_name', 'condition']): - ax2.scatter(d[d.cog_class == 'information storage and processing']['frac'], - d[d.cog_class == 'metabolism']['frac'], marker = marker_dict[g[0]], - c = d.growth_rate_hr.unique(), cmap=cm,#'viridis', - vmin=0, vmax=2, alpha=0.75, edgecolors='k', linewidths=0.25) - -ax2.set_ylim(0.25,0.65) -ax2.set_xlim(0.25,0.55) -ax2.set_xlabel('relative mass fraction,\ninformation storage and processing', fontsize=6) -ax2.set_ylabel('relative mass fraction,\nmetabolism', fontsize=6) -ax2.xaxis.set_tick_params(labelsize=5) -ax2.yaxis.set_tick_params(labelsize=5) - -cbaxes = inset_axes(ax2, width="30%", height="5%", loc=3) -cb = plt.colorbar(plt.cm.ScalarMappable(norm=mpl.colors.Normalize(vmin=0, vmax=2), cmap=cm), - cax=cbaxes, ticks=[0.,2], orientation='horizontal') -# cbaxes.ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6)#, rotation=270) -cbaxes.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -cbaxes.xaxis.set_tick_params(labelsize=5) -cbaxes.yaxis.set_tick_params(labelsize=5) -cbaxes.xaxis.tick_top() -cbaxes.xaxis.set_label_position('top') -cb.outline.set_linewidth(0) - -###################### -# Plot 3 - protein concentration in cell -###################### - -data_cytosol_fg_summary = pd.DataFrame() -for c, d in data_cytosol.groupby(['dataset', 'condition', 'growth_rate_hr']): - d_ = d[d.gene_name != 'tufA'] - d_ = d_[d_.gene_name != 'tufB'] - - # V = 0.28 * np.exp(1.33 * c[2]) - # SA = 2 * np.pi * V**(2/3) - w = size.lambda2width(c[2]) - l = size.lambda2length(c[2]) - V = size.lambda2size(c[2]) - SA = size.rod_SA(l, w, V) - - fg_tot = d_.fg_per_cell.sum() - fg_SA = fg_tot / V - - data_list = {'fg per um2' : fg_SA, - 'growth_rate_hr' : c[2], - 'dataset' : c[0], - 'condition' : c[1]} - data_cytosol_fg_summary = \ - data_cytosol_fg_summary.append(data_list, - ignore_index = True) - -for g, d in data_cytosol_fg_summary.groupby(['dataset', 'condition', 'growth_rate_hr']): - ax3.plot(g[2], d['fg per um2'], 'o', color=dataset_colors[g[0]], - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - label = g[0], ms=4, zorder=10) -ax3.set_ylim(0,210) -ax3.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax3.set_ylabel('[fg per $\mu m^3$]', fontsize=6) -ax3.xaxis.set_tick_params(labelsize=5) -ax3.yaxis.set_tick_params(labelsize=5) - - - -###################### -# Plot 3 -###################### -# Plot distribution of inner membrane proteins, GO:0005886 -# Load the complex subunit counts. -subunits = pd.read_csv('../../data/compiled_annotated_complexes.csv') - -df_cyt_schmidt= data_cytosol[data_cytosol.dataset == 'schmidt_2016'] - -df_cyt_schmidt = df_cyt_schmidt.replace('Not Assigned', 'poorly characterized or not assigned') -df_cyt_schmidt = df_cyt_schmidt.replace('poorly characterized', 'poorly characterized or not assigned') - -df_cyt_schmidt_ = pd.DataFrame() -for c,d in df_cyt_schmidt.groupby(['dataset', 'condition', - 'growth_rate_hr', 'gene_name']): - data_list = {'gene_name' : d.gene_name.unique()[0] , - 'cog_class' : d.cog_class.unique()[0] , - 'condition' : d.condition.unique()[0] , - 'dataset' : d.dataset.unique()[0] , - 'dataset_name' : d.dataset_name.unique()[0] , - 'fg_per_cell' : d.fg_per_cell.sum(), - 'growth_rate_hr' : d.growth_rate_hr.unique()[0]} - df_cyt_schmidt_ = df_cyt_schmidt_.append(data_list, - ignore_index=True) - -df_cyt_schmidt_['rel_fg_per_cell'] = df_cyt_schmidt_.groupby('condition').transform(lambda x: (x / x.sum()))['fg_per_cell'] -df_cyt_schmidt_ = df_cyt_schmidt_.sort_values(by=['growth_rate_hr', 'gene_name'], ascending = False) - -y_order = dict(zip(df_cyt_schmidt_.condition.unique(), np.arange(len(df_cyt_schmidt_.condition.unique())))) - - - -for c, d in df_cyt_schmidt_.groupby('condition', sort=False): - for c_ in cog_class_order: - if c_ == 'metabolism': - resp = d[d.gene_name == 'respiration'] - ax4.barh(y_order[c], resp.rel_fg_per_cell, height=0.9, color='#679B48', alpha=0.3, #84A779 - linewidth=0.1) - - c_uptake = d[d.gene_name == 'carbon_uptake'] - lefts = resp.rel_fg_per_cell.sum() - ax4.barh(y_order[c], c_uptake.rel_fg_per_cell.sum(), height=0.9, color='#679B48', alpha=0.7, - left=lefts, linewidth=0.1) - - # lefts = d[d.gene_name == 'respiration'] - lefts += d[d.gene_name == 'carbon_uptake'].rel_fg_per_cell.sum() - meta = d[d.gene_name != 'respiration'].copy() - meta = meta[meta.gene_name !='carbon_uptake'].copy() - - ax4.barh(y_order[c], meta.rel_fg_per_cell.sum(), height=0.9, color='#679B48', - left=lefts, linewidth=0.1) - - lefts += meta[meta.cog_class == c_].rel_fg_per_cell.sum() - - else: - ax4.barh(y_order[c], d[d.cog_class == c_].rel_fg_per_cell.sum(), height=0.9, - color=color_dict[c_], left=lefts, linewidth=0.1) - lefts += d[d.cog_class == c_].rel_fg_per_cell.sum() - - - -ax4.set_xlim(0,1) -ax4.set_ylim(0,len(df_cyt_schmidt_.condition.unique())) -ax4.set_yticks(np.arange(len(df_cyt_schmidt_.condition.unique()))-0.5) -ax4.set_yticklabels(df_cyt_schmidt_.condition.unique()) -ax4.set_xlabel('relative cytosolic protein\nabundance (GO term : 0005829)', fontsize=6) -ax4.xaxis.set_tick_params(labelsize=5) -ax4.yaxis.set_tick_params(labelsize=5) - -growth_rates_list = [d.growth_rate_hr.unique()[0] for c, d in df_cyt_schmidt_.groupby('condition', sort=False)] -ax4_twin = ax4.twinx() -ax4_twin.set_yticks(np.arange(len(growth_rates_list))-0.5) -ax4_twin.set_yticklabels(growth_rates_list) -ax4_twin.set_ylabel('growth rate [hr$^{-1}$]', fontsize=6) -ax4_twin.set_ylim(0,len(df_cyt_schmidt_.condition.unique())) -ax4_twin.xaxis.set_tick_params(labelsize=5) -ax4_twin.yaxis.set_tick_params(labelsize=5) -# -plt.tight_layout() -fig.savefig('../../figures/fig6_COG_cytosol_barplot.svg') - -# %% diff --git a/code/figures/fig7_fig7-S1_DNA_synthesis.py b/code/figures/fig7_fig7-S1_DNA_synthesis.py deleted file mode 100644 index 9b1eaf5e..00000000 --- a/code/figures/fig7_fig7-S1_DNA_synthesis.py +++ /dev/null @@ -1,99 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() -constants = prot.estimate.load_constants() - -# Load the data and restrict -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -dnap = data[data['shorthand']=='dnap'] -rnr = data[data['shorthand']=='dntp'] - -# Compute the cell size dependence. -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -n_ori = constants['N_ori']['value'] -L_genome = 4.6E6 # in nt -r_rnr = 10 -r_dna = 600 # in nt per sec -n_pol = 2 # per replication fork -n_fork = 2 -N_rnr = 2 * n_ori * L_genome / (r_rnr * t_double) -N_dnap = n_fork * n_pol * n_ori -# %% -fig, ax = plt.subplots(1, 1, figsize=(3, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('ribonucleotide reductases per cell', fontsize=6) - -# Format the axes -ax.set_yscale('log') -ax.set_ylim([1E1, 1E4]) -ax.set_xlim([0, 2]) - -ax.plot(growth_rate, N_rnr,'-', color='grey', lw=3, alpha=0.5, label='replication fork dependence') - -# Plot the predictions -ax.plot(0.5, 200, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='estimated value') -ax.hlines(250, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') -ax.vlines(0.5, 10, 200, 'k', linestyle='--', lw=0.75, label='__nolegend__') - -for g, d in rnr.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.legend(fontsize=6, ncol=2) -plt.savefig('../../figures/fig7-S1_dNTP_plots.svg', bbox_inches='tight') - -# %% - - - -# %% -fig, ax = plt.subplots(2, 1, figsize=(3, 3)) -for a in ax: - a.xaxis.set_tick_params(labelsize=6) - a.yaxis.set_tick_params(labelsize=6) - a.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax[0].set_ylabel('DNA polymerase III\nper cell', fontsize=6) -ax[1].set_ylabel('DNA polymerase III\nconcentration [nM]', fontsize=6) - -# Format the axes -ax[0].set_yscale('log') -ax[1].set_yscale('log') -ax[0].set_ylim([1, 5E2]) -ax[0].set_xlim([0, 2]) -ax[1].set_ylim([1, 500]) -ax[1].set_xlim([0, 2]) - - -# Plot the predictions -ax[0].plot(growth_rate, N_dnap, '-', lw=3, color='grey', alpha=0.3, label='replication fork dependence') -ax[0].plot(0.5, 6.5, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='estimated value') -ax[0].hlines(6, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') -ax[0].vlines(0.5, 1, 6.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') - - - -# Plot the concentration range of 50 - 200 nM -ax[1].fill_between([0, 2], 50, 200, color='k', alpha=0.25, label='DNA Pol. III H.E. binding affinity\n (Ason et al. 2000)') - -for g, d in dnap.groupby(['dataset', 'dataset_name']): - ax[0].plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - ax[1].plot(d['growth_rate_hr'], d['concentration_uM'] * 1E3, 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label='__nolegend__') -ax[1].legend(fontsize=6) -ax[0].legend(fontsize=6, ncol=2) -plt.tight_layout() -plt.savefig('../../figures/fig7_DNA_polymerase_plots.svg', bbox_inches='tight') -# - - - -# %% diff --git a/code/figures/fig7_ribosome_as_limit.py b/code/figures/fig7_ribosome_as_limit.py deleted file mode 100644 index b8d0357f..00000000 --- a/code/figures/fig7_ribosome_as_limit.py +++ /dev/null @@ -1,397 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -from scipy.optimize import curve_fit -def func(x, a, c, d): - return a*np.exp(-c*x)+d - -# # Load the compiled data -data = pd.read_csv('../../data/compiled_absolute_measurements.csv') - -L_R = 7459.0 # length of all subunits in ribosomes, in amino acids - -ribosome_genes = ['rpsA', 'rpsB', 'rpsC', 'rpsD', 'rpsE', - 'rpsF', 'rpsG', 'rpsH', 'rpsI', 'rpsJ', 'rpsK', - 'rpsL', 'rpsM', 'rpsN', 'rpsO', 'rpsP', 'rpsQ', - 'rpsR', 'rpsS', 'rpsT', 'rpsU', 'sra', 'rplA', 'rplB', - 'rplC', 'rplD', 'rplE', 'rplF', 'rplJ', - 'rplL', 'rplI', 'rplK', 'rplM', 'rplN', 'rplO', 'rplP', 'rplQ', - 'rplR', 'rplS','rplT', 'rplU', 'rplV', 'rplW', 'rplX', 'rplY', - 'rpmA', 'rpmB', 'rpmC', 'rpmD', 'rpmE', 'rpmF', 'rpmG', 'rpmH', - 'rpmI', 'rpmJ', 'ykgM', 'ykgO'] - -# %% -###################### -# plot configuration # -###################### -fig = plt.figure(figsize = (6,5))#constrained_layout=True) -# widths = [6, 2.5, 2.5, 5] -widths = [5, 2, 2] -heights = [2, 4, 6] -spec = fig.add_gridspec(ncols=3, nrows=3, width_ratios=widths, - height_ratios=heights) - -# subplot [0,0] blank -# plot of growth rate vs. ribosomal fraction -ax2 = fig.add_subplot(spec[1, 1]) - -# plot of growth rate vs. active ribosomal fraction -ax3 = fig.add_subplot(spec[2, 0]) -# plot of number of ribosomes vs. growth rate - rRNA persepective -ax4 = fig.add_subplot(spec[2, 1:]) - -# % -############################ -# Plot 2 - growth rate vs. ribosomal fraction -############################ - -# Add in data from Dai et al. -[lambda_dai, R_P_dai] = np.array(\ - [[0.0, 0.08853279947047754], - [0.03324706890845652, 0.09742834356027935], - [0.12844176066233703, 0.12157153165470358], - [0.19652012565308674, 0.12917148174069676], - [0.23055930814846148, 0.13297145678369332], - [0.2849547247405284, 0.14694954887503597], - [0.33601892391911736, 0.15201256530868013], - [0.4074068045812377, 0.17107537557577435], - [0.417639175984852, 0.16979497279144085], - [0.4517000602223341, 0.17104716331103476], - [0.485674137491387, 0.18249049192423916], - [0.5503561798423366, 0.1888187199227418], - [0.6727865579409387, 0.21549233114688282], - [0.6864152519843529, 0.21548365045003987], - [0.7000547968988209, 0.21420107749149564], - [0.7170798135820351, 0.21546411888214323], - [0.744196140345166, 0.2320073568905744], - [0.9177883754618401, 0.25227895419304786], - [0.9448830004828637, 0.27136997672488156], - [0.9926268331190284, 0.2662440252391261], - [0.9753630972726335, 0.29300661360590724], - [1.0979236858238794, 0.3043935176896325], - [1.1624538159800777, 0.32855623735195344], - [1.2677832212980895, 0.36288405301735593], - [1.566952587118931, 0.4404005056505911], - [1.7949076862145108, 0.4784718718295111]]).T - -# add in data from Scott et al. -[lambda_scott, R_P_scott] = np.array(\ - [[0.4, 0.177], - [0.57, 0.230], - [0.71, 0.221], - [1.00, 0.287], - [1.31, 0.414], - [1.58, 0.466]]).T - -# Add in data from Forchhammer & Lindahl -[lambda_for, R_P_for] = np.array(\ - [[0.38, 0.189], - [0.60, 0.224], - [1.04, 0.295], - [1.46, 0.421], - [1.73, 0.469]]).T - -# Bremmer and Dennis -[lambda_brem, R_P_brem] = np.array(\ - [[0.42, 0.200], - [0.69, 0.225], - [1.04, 0.331], - [1.39, 0.391], - [1.73, 0.471]]).T - -df_ribo_frac = pd.DataFrame() -for c, d in data.groupby(['dataset', 'condition', 'growth_rate_hr']): - mass_ribo = d[d['gene_name'].isin(ribosome_genes)].fg_per_cell.sum() - frac_ribo = (mass_ribo )/ d.fg_per_cell.sum() - - data_list = {'frac_ribo' : frac_ribo, - 'dataset' : c[0], - 'condition' : c[1], - 'growth_rate_hr' : c[2]} - - df_ribo_frac = df_ribo_frac.append(data_list, - ignore_index = True) - -# inset axes.... -# axins = ax2.inset_axes([0.5, 0.5, 0.47, 0.47]) -# axins = ax2.inset_axes([0.5, 0.05, 0.5, 0.5]) - -# axins.imshow(Z2, extent=extent, interpolation="nearest", -# origin="lower") -# -# for ax_ in [ax2, axins]: -# -# for g, d in df_ribo_frac.groupby(['dataset', 'condition', 'growth_rate_hr']): -# # if g[0] == 'peebo_2015': -# # continue -# # if g[0] == 'valgepea_2013': -# # continue -# ax_.plot(d['frac_ribo'], g[2], 'o', color=dataset_colors[g[0]], -# alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, -# label = g[2], ms=4, zorder=10) -# -# -# ax_.plot(R_P_dai/2.1, lambda_dai, 'o', color= colors['pale_yellow'], -# alpha=1, markeredgecolor='k', markeredgewidth=0.25, -# ms=4, zorder=10) -# -# ax_.plot(R_P_scott/2.1, lambda_scott, 'o', color= colors['light_purple'], -# alpha=1, markeredgecolor='k', markeredgewidth=0.25, -# ms=4, zorder=10) -# -# -# ax_.plot(R_P_for/2.1, lambda_for, 'o', color= '#1F4B99', -# alpha=1, markeredgecolor='k', markeredgewidth=0.25, -# ms=4, zorder=10) -# -# -# ax_.plot(R_P_brem/2.1, lambda_brem, 'o', color= '#B7741A', -# alpha=1, markeredgecolor='k', markeredgewidth=0.25, -# ms=4, zorder=10) -# -# Plot the prediction. -frac = np.linspace(0,1.0,100) -gr = (17.1 * frac/ L_R) * 3600 -ax2.plot(frac, gr, color='k', alpha=1.0, label='maximum growth rate', - linestyle='-', lw=0.75) -ax2.hlines((17.1 / L_R) * 3600, 0, np.max(gr), color='k', linestyle='--', lw=0.75, label='__nolegend__') - - -ax2.xaxis.set_tick_params(labelsize=5) -ax2.yaxis.set_tick_params(labelsize=5) -ax2.set_xlim([0, 1.0]) -ax2.set_ylim([0, 9]) -ax2.set_xlabel('ribosomal fraction ($\Phi_R$)', fontsize=6) -ax2.set_ylabel('growth rate [hr$^{-1}$]', fontsize=6) - - - -# % -############################ -# Plot 3 - active ribosomal fraction -############################ - -# Load the full Si 2017 SI -data_si = pd.read_csv('../../data/si_2017_raw/si2017_full.csv') - -# consider the mean values for each strain/condition they considered -data_si_mean = pd.DataFrame() -for c, d in data_si.groupby(['strain type (background)', 'growth media', 'inducer or drug added', 'concentration ', 'type of perturbation']): - data_list = {'strain' : c[0], - 'growth media' : c[1], - 'inducer or drug added' : c[2], - 'concentration': c[3], - 'number of origins' :d['number of origins'].mean(), - 'RNA/protein' : d['RNA/protein'].mean(), - 'DNA content per cell (genome equivalents)' : d['DNA content per cell (genome equivalents)'].mean(), - 'type of perturbation' :c[4], - 'C+D period (minutes)' : d['C+D period (minutes)'].mean(), - 'C period (minutes)' : d['C period (minutes)' ].mean(), - 'growth_rate_hr' : d['growth rate (1/hours)'].mean()} - data_si_mean = data_si_mean.append(data_list, - ignore_index = True) - -## grab nutrient limitation data from Dai et al. 2016 -# nutrient limitation data from SI PDF: -conditions = ['RDM + 0.2% glucose+10 mM NH4Cl', - '0. 2 % glucose+cAA+10 mM NH4Cl', - ' 10 mM glucose-6-phosphate+10 mM gluconate +10 mM NH4Cl', - '0.2% glucose+10 mM NH4Cl', - '0.2% xylose+10 mM NH4Cl', - '0.2 % glycerol+10 mM NH4Cl', - '0.2% fructose+10 mM NH4Cl', - '0.2% sorbitol+10 mM NH4Cl', - '0.2% galactose+10 mM NH4Cl', - '60 mM acetate+10 mM NH4Cl', - '0.2% mannose+10 mM NH4Cl', - '0.1% mannose+10 mM NH4Cl', - '20 mM potassium aspartate', - '0.075% mannose+10 mM NH4Cl', - '20 mM aspartate+10 mM NH4Cl', - '0.2% glycerol +10 mM Arginine', - '20 mM glutamate+10 mM NH4Cl', - '0.2% glycerol+20 mM Threonine'] - -erate = [16.7, 16.3, 16.1, 15.9, 14.9, 15.0, 14.7, 13.7, 13.1, 12.6, 13.0, 12.4, - 12.0, 12.1, 12.3, 11.6, 10.7, 9.4] - -RNA_P = [0.476, 0.364, 0.306, 0.294, 0.233, 0.227, 0.217, 0.193, 0.184, 0.172, - 0.172, 0.152, 0.152, 0.147, 0.137, 0.130, 0.118, 0.097] - -r_prot_frac = [np.nan, np.nan, np.nan, 11.6, np.nan, np.nan, np.nan, np.nan, - np.nan, 7.2, np.nan, np.nan, np.nan, 5.1, np.nan, 6.1, 4.7, 4.4] - - -gr_dai, fa = np.array([[1.8, 0.958], - [1.28, 0.9], - [1.12, 0.927], - [0.98, 0.865], - [0.75, 0.902], - [0.69, 0.849], - [0.69, 0.888], - [0.55, 0.879], - [0.5, 0.860], - [0.46, 0.879], - [0.41, 0.756], - [0.34, 0.751], - [0.33, 0.756], - [0.29, 0.683], - [0.23, 0.590], - [0.201, 0.554], - [0.13, 0.441], - [0.035, 0.168]]).T - -dai_nut_df = pd.DataFrame({'condition' : conditions, - 'Cm (μM)' : np.zeros(len(gr_dai)), - 'RNA_P_ratio' : RNA_P, - 'growth_rate_hr' : gr_dai, - 'Translational elongation rate (aa/s)' : erate, - 'measured_prot_frac' : r_prot_frac, - 'f_a' : fa, - 'type' : ['nutrient limitation' for i in np.arange(len(gr_dai))]}, - columns = ['condition', 'Cm (μM)', 'RNA_P_ratio', 'growth_rate_hr', - 'Translational elongation rate (aa/s)', 'measured_prot_frac', - 'f_a', 'type']) - -# fit measurements of active fraction from Dai et al. data -dai_nut_df = dai_nut_df.sort_values(by='growth_rate_hr', ascending = True) - -popt_dai, pcov_dai = curve_fit(func, dai_nut_df.growth_rate_hr.values, dai_nut_df.f_a.values, p0=(1, 1e-6, 1)) - - -# Add Dai et al, Scott, and historical -ax3.plot((R_P_dai/2.1)*func(lambda_dai, *popt_dai),lambda_dai, 'o', color= 'k', #color=colors['light_yellow'], - alpha=0.2, markeredgecolor='k', markeredgewidth=0, - ms=4, zorder=0, label = 'non-proteomic data') - -ax3.plot((R_P_scott/2.1)*func(lambda_scott, *popt_dai),lambda_scott, 'o', color= 'k', #color=colors['light_purple'], - alpha=0.2, markeredgecolor='k', markeredgewidth=0, - ms=4, zorder=0, label = 'non-proteomic data') - -ax3.plot((R_P_for/2.1)*func(lambda_for, *popt_dai),lambda_for, 'o', color= 'k', #color= '#1F4B99', - alpha=0.2, markeredgecolor='k', markeredgewidth=0, - ms=4, zorder=0, label = 'non-proteomic data') - -ax3.plot((R_P_brem/2.1)*func(lambda_brem, *popt_dai),lambda_brem, 'o', color= 'k', #'#B7741A', - alpha=0.2, markeredgecolor='k', markeredgewidth=0, - ms=4, zorder=0, label = 'non-proteomic data') - - -for g, d in df_ribo_frac.groupby(['dataset', 'condition', 'growth_rate_hr']): - # if g[0] == 'peebo_2015': - # continue - # if g[0] == 'valgepea_2013': - # continue - ax3.plot(d['frac_ribo']*func( d.growth_rate_hr.unique(), *popt_dai), g[2], 'o', color=dataset_colors[g[0]], - alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, - label = g[2], ms=4, zorder=10) - -for c, d in data_si_mean.groupby(['type of perturbation', 'growth media', 'strain']): - if c[0] != 'nutrient conditions': - continue - if 'MG1655' in c[2]: - k = colors['pale_red'] - elif 'NCM3722' in c[2]: - k = colors['light_green'] - - ax3.plot((d['RNA/protein']/2.1)*func( d.growth_rate_hr.unique(), *popt_dai),d.growth_rate_hr.unique(), 'o', color= 'k', #color= k, - alpha=0.2, markeredgecolor='k', markeredgewidth=0, - ms=4, zorder=0, label = 'non-proteomic data') #label = g[2], ) - - -ax3.xaxis.set_tick_params(labelsize=5) -ax3.yaxis.set_tick_params(labelsize=5) - -ax3.set_xlim([0, 0.26]) -ax3.set_ylim([0, 2.2]) -ax3.set_xlabel('estimated active ribosomal\nfraction ($\Phi_R f_a$)', fontsize=6) -ax3.set_ylabel('growth rate [hr$^{-1}$]', fontsize=6) - - -# Plot the prediction. -frac = np.linspace(0,0.3,100) -gr = (17.1 * frac/ L_R) * 3600 -ax3.plot(frac, gr, color='k', alpha=1.0, label='maximum growth rate', - linestyle='-', lw=0.75) - -axins = ax3.inset_axes([0.12, 0.65, 0.32, 0.32]) -axins.plot(gr_dai, fa, 'o', color=colors['light_yellow'], - alpha=0.9, markeredgecolor='k', markeredgewidth=0.25, - ms=3, zorder=1) - -gr = np.linspace(0,2,100) -axins.plot(gr, func(gr, *popt_dai), color='k', - alpha=0.5, zorder=0, lw = 0.5, ls = '--') - -axins.xaxis.set_tick_params(labelsize=4) -axins.set_xticks([0,0.5,1.0,1.5,2.0]) -axins.yaxis.set_tick_params(labelsize=4) -axins.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -axins.set_ylabel('$f_a$', fontsize=6) - - -# sub region of the original image -# axins.set_xlim(x1, x2) -# axins.set_ylim(y1, y2) -# axins.set_xticklabels('') -# axins.set_yticklabels('') - -# ax3.indicate_inset_zoom(axins, alpha = 0.25, lw = 0.5) - -# % -############################ -# Plot 4 - rRNA limitations -############################ - -# Load experimental data -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -data = data[data['shorthand']=='ribosome'] - -# Define constants -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -n_ori = constants['N_ori']['value'] - -# Compute the maximum number of rRNA produced per doubling time -k_rrna = 1 # functional rRNA units per second at steady state -n_operon = 7 # average number of functional ribosomal operons per chromosome -n_rRNA_full = n_operon * k_rrna * n_ori * t_double -n_rRNA_noparallel = n_operon * k_rrna * t_double - -ax4.set_yscale('log') -ax4.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax4.set_ylabel(r'number of ribosomal units', fontsize=6) -ax4.set_ylim([5E3, 8E5]) -ax4.xaxis.set_tick_params(labelsize=5) -ax4.yaxis.set_tick_params(labelsize=5) - -# Plot the predicted maximal number of rRNA under different regimes -ax4.plot(growth_rate, n_rRNA_full, '-', lw=1, color=colors['blue'], - label='multiple DNA initiations\nper cell cycle (rRNA units)') -ax4.plot(growth_rate, n_rRNA_noparallel, '--', lw=1, color=colors['blue'], - label='single DNA initiations \nper cell cycle (rRNA units)') - - -# Plot the experimentally observed number of ribosomes -for g, d in data.groupby(['dataset', 'dataset_name']): - ax4.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, markeredgecolor='k', - markeredgewidth=0.25, color=dataset_colors[g[0]], label='__nolegend__') - -ax4.legend(fontsize=6, bbox_to_anchor=(1, 1)) - - - - - - - - -plt.tight_layout() -plt.savefig('../../figures/fig7_ribosome_as_limit.pdf') diff --git a/code/figures/fig7abc_DNA_synthesis.py b/code/figures/fig7abc_DNA_synthesis.py deleted file mode 100644 index ce09c35e..00000000 --- a/code/figures/fig7abc_DNA_synthesis.py +++ /dev/null @@ -1,98 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -dataset_colors = prot.viz.dataset_colors() - -# Load the data and restrict -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -dnap = data[data['shorthand']=='dnap'] -rnr = data[data['shorthand']=='dntp'] - -# Compute the cell size dependence. -growth_rate = constants['growth_rate']['value'] -t_double = constants['t_double']['value'] -n_ori = constants['N_ori']['value'] -L_genome = 4.6E6 # in nt -r_rnr = 10 -r_dna = 600 # in nt per sec -n_pol = 2 # per replication fork -n_fork = 2 -N_rnr = 2 * n_ori * L_genome / (r_rnr * t_double) -N_dnap = n_fork * n_pol * n_ori -# %% -fig, ax = plt.subplots(1, 1, figsize=(3, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('ribonucleotide reductases per cell', fontsize=6) - -# Format the axes -ax.set_yscale('log') -ax.set_ylim([1E1, 1E4]) -ax.set_xlim([0, 2]) - -ax.plot(growth_rate, N_rnr,'-', color='grey', lw=3, alpha=0.5, label='replication fork dependence') - -# Plot the predictions -ax.plot(0.5, 200, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='estimated value') -ax.hlines(250, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') -ax.vlines(0.5, 10, 200, 'k', linestyle='--', lw=0.75, label='__nolegend__') - -for g, d in rnr.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.legend(fontsize=6, ncol=2) -plt.savefig('../../figures/fig6a_dNTP_plots.svg', bbox_inches='tight') - -# %% - - - -# %% -fig, ax = plt.subplots(2, 1, figsize=(3, 3)) -for a in ax: - a.xaxis.set_tick_params(labelsize=6) - a.yaxis.set_tick_params(labelsize=6) - a.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax[0].set_ylabel('DNA polymerase III\nper cell', fontsize=6) -ax[1].set_ylabel('DNA polymerase III\nconcentration [nM]', fontsize=6) - -# Format the axes -ax[0].set_yscale('log') -ax[1].set_yscale('log') -ax[0].set_ylim([1, 5E2]) -ax[0].set_xlim([0, 2]) -ax[1].set_ylim([1, 500]) -ax[1].set_xlim([0, 2]) - - -# Plot the predictions -ax[0].plot(growth_rate, N_dnap, '-', lw=3, color='grey', alpha=0.3, label='replication fork dependence') -ax[0].plot(0.5, 6.5, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='estimated value') -ax[0].hlines(6, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') -ax[0].vlines(0.5, 1, 6.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') - - - -# Plot the concentration range of 50 - 200 nM -ax[1].fill_between([0, 2], 50, 200, color='k', alpha=0.25, label='DNA Pol. III H.E. binding affinity\n (Ason et al. 2000)') - -for g, d in dnap.groupby(['dataset', 'dataset_name']): - ax[0].plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - ax[1].plot(d['growth_rate_hr'], d['concentration_uM'] * 1E3, 'o', ms=4, color=dataset_colors[g[0]], - alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label='__nolegend__') -ax[1].legend(fontsize=6) -ax[0].legend(fontsize=6, ncol=2) -plt.tight_layout() -plt.savefig('../../figures/fig6bc_DNA_polymerase_plots.svg', bbox_inches='tight') -# - - - -# %% diff --git a/code/figures/fig8a_tRNA_synthesis.py b/code/figures/fig8a_tRNA_synthesis.py deleted file mode 100644 index a0ec4cec..00000000 --- a/code/figures/fig8a_tRNA_synthesis.py +++ /dev/null @@ -1,56 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -# Load the data -data = pd.read_csv('../../data/compiled_estimate_categories.csv', comment='#') -data = data[data['shorthand']=='trna'] - -# Compute the trend -growth_rate = constants['growth_rate']['value'] -cell_mass = constants['cell_mass']['value'] -theta_dry = constants['dry_mass_frac']['value'] -theta_prot = constants['theta_prot']['value'] -t_double = constants['t_double']['value'] -m_aa = 110 / 6E11 # in pg -k_trna = 20 # per sec - -N_synthase = cell_mass * theta_dry * theta_prot / (m_aa * k_trna * t_double) - - -# Instantiate the figure canvas -fig, ax = plt.subplots(1, 1, figsize=(3.5, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_yscale('log') -ax.set_xlim([0, 2]) -ax.set_ylim([1E3, 3E5]) -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('number of tRNA synthetases', fontsize=6) - -# Plot the cell size dependence -ax.plot(growth_rate, N_synthase, lw=3, color='grey', alpha=0.4, label='cell size dependence') - -# Plot the point estimate. -estimate = 1E4 -ax.plot(0.5, estimate, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='point estimate') -ax.vlines(0.5, 0, estimate, 'k', linestyle='--', lw=1, label='__nolegend__') -ax.hlines(estimate, 0, 0.5, 'k', linestyle='--', lw=1, label='__nolegend__') - -# Plot the experimetnal data -for g, d in data.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.legend(fontsize=6) -plt.savefig('../../figures/fig8a_tRNA_synthases.svg', bbox_inches='tight') -# %% - - -# %% diff --git a/code/figures/fig8b_fig8-S1_RNA_synthesis.py b/code/figures/fig8b_fig8-S1_RNA_synthesis.py deleted file mode 100644 index 8e650790..00000000 --- a/code/figures/fig8b_fig8-S1_RNA_synthesis.py +++ /dev/null @@ -1,75 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -# Load the data and restrict -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -rnap = data[data['shorthand']=='rnap'] -sig70 = data[data['shorthand']=='sigma70'] - - -# Compute the predicted trends.. -growth_rate = constants['growth_rate']['value'] -N_ori = constants['N_ori']['value'] -cell_mass = constants['cell_mass']['value'] -theta_dry = constants['dry_mass_frac']['value'] -theta_prot = constants['theta_prot']['value'] -t_double = constants['t_double']['value'] - -m_aa = 110 / 6E11 # in pg -m_prot = (300 * 110) / 6E11 # in pg -n_prot = (theta_prot * theta_dry * cell_mass) /m_prot -gamma_mRNA = 1 / 300 -n_mRNA = (n_prot / 1E3) * gamma_mRNA -L_mRNA = 1000 -L_rRNA = 4500 -r_txn = 40 # in nt/s -n_operon = 7 -footprint = 80 # in nt -n_tRNA = theta_prot * theta_dry * cell_mass / (m_aa * t_double) -L_tRNA = 80 - -N_polymerase = (L_rRNA * n_operon * N_ori/ footprint) + (n_mRNA * L_mRNA / r_txn) + (n_tRNA * L_tRNA) / (r_txn * t_double) - - -#%% -fig, ax = plt.subplots(1, 2, figsize=(6.5, 2.5)) -for a in ax: - a.plot(growth_rate, N_polymerase, '-', lw=3, color='grey', alpha=0.4, label='replication fork scaling') - a.set_xlabel('growth rate [hr$^{-1}$]', fontsize=8) - a.set_yscale('log') - a.set_xlim([0, 2]) -ax[0].set_ylabel('RNA Polymerases per cell', fontsize=8) -ax[1].set_ylabel('$\sigma^{70}$ (RpoD) per cell', fontsize=8) -ax[0].set_yticks([1E2, 1E3, 1E4, 1E5]) -ax[0].set_ylim([1E2, 1E5]) -ax[1].set_yticks([1E2, 1E3, 1E4]) -ax[1].set_ylim([1E2, 1E4]) - -# Plot the predictions -for a in ax: - a.plot(0.5, 1E3, 'o', ms=6, alpha=0.4, color=colors['dark_brown'], label='estimated value') - a.vlines(0.5, 1, 1E3, color='k', linestyle='--', label='__nolegend__', lw=0.75) - a.hlines(1E3, 0, 0.5, color='k', linestyle='--', label='__nolegend__', lw=0.75) - -# plot the data -for p, a in zip([rnap, sig70], ax.ravel()): - for g, d in p.groupby(['dataset', 'dataset_name']): - a.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -# Add legends. -for a in ax: - a.legend(fontsize=6, loc='lower right') - a.xaxis.set_tick_params(labelsize=6) - a.yaxis.set_tick_params(labelsize=6) - -plt.tight_layout() -plt.savefig('../../figures/fig8_RNA_synthesis_plots.svg', bbox_inches='tight') -# %% diff --git a/code/figures/fig8bc_RNA_synthesis.py b/code/figures/fig8bc_RNA_synthesis.py deleted file mode 100644 index 42f524ad..00000000 --- a/code/figures/fig8bc_RNA_synthesis.py +++ /dev/null @@ -1,75 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -# Load the data and restrict -data = pd.read_csv('../../data/compiled_estimate_categories.csv') -rnap = data[data['shorthand']=='rnap'] -sig70 = data[data['shorthand']=='sigma70'] - - -# Compute the predicted trends.. -growth_rate = constants['growth_rate']['value'] -N_ori = constants['N_ori']['value'] -cell_mass = constants['cell_mass']['value'] -theta_dry = constants['dry_mass_frac']['value'] -theta_prot = constants['theta_prot']['value'] -t_double = constants['t_double']['value'] - -m_aa = 110 / 6E11 # in pg -m_prot = (300 * 110) / 6E11 # in pg -n_prot = (theta_prot * theta_dry * cell_mass) /m_prot -gamma_mRNA = 1 / 300 -n_mRNA = (n_prot / 1E3) * gamma_mRNA -L_mRNA = 1000 -L_rRNA = 4500 -r_txn = 40 # in nt/s -n_operon = 7 -footprint = 40 # in nt -n_tRNA = theta_prot * theta_dry * cell_mass / (m_aa * t_double) -L_tRNA = 80 - -N_polymerase = (L_rRNA * n_operon * N_ori/ footprint) + (n_mRNA * L_mRNA / r_txn) + (n_tRNA * L_tRNA) / (r_txn * t_double) - - -#%% -fig, ax = plt.subplots(1, 2, figsize=(6.5, 2.5)) -for a in ax: - a.plot(growth_rate, N_polymerase, '-', lw=3, color='grey', alpha=0.4, label='scaling with DNA content') - a.set_xlabel('growth rate [hr$^{-1}$]', fontsize=8) - a.set_yscale('log') - a.set_xlim([0, 2]) -ax[0].set_ylabel('RNA Polymerases per cell', fontsize=8) -ax[1].set_ylabel('$\sigma^{70}$ (RpoD) per cell', fontsize=8) -ax[0].set_yticks([1E2, 1E3, 1E4, 1E5]) -ax[0].set_ylim([1E2, 1E5]) -ax[1].set_yticks([1E2, 1E3, 1E4]) -ax[1].set_ylim([1E2, 1E4]) - -# Plot the predictions -for a in ax: - a.plot(0.5, 1.5E3, 'o', ms=6, alpha=0.4, color=colors['dark_brown'], label='estimated value') - a.vlines(0.5, 1, 1.5E3, color='k', linestyle='--', label='__nolegend__', lw=0.75) - a.hlines(1.5E3, 0, 0.5, color='k', linestyle='--', label='__nolegend__', lw=0.75) - -# plot the data -for p, a in zip([rnap, sig70], ax.ravel()): - for g, d in p.groupby(['dataset', 'dataset_name']): - a.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -# Add legends. -for a in ax: - a.legend(fontsize=6, loc='lower right') - a.xaxis.set_tick_params(labelsize=6) - a.yaxis.set_tick_params(labelsize=6) - -plt.tight_layout() -plt.savefig('../../figures/RNA_synthesis_plots.svg', bbox_inches='tight') -# %% diff --git a/code/figures/fig9-S1_tRNA_synthesis.py b/code/figures/fig9-S1_tRNA_synthesis.py deleted file mode 100644 index 37e181e0..00000000 --- a/code/figures/fig9-S1_tRNA_synthesis.py +++ /dev/null @@ -1,56 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -# Load the data -data = pd.read_csv('../../data/compiled_estimate_categories.csv', comment='#') -data = data[data['shorthand']=='trna'] - -# Compute the trend -growth_rate = constants['growth_rate']['value'] -cell_mass = constants['cell_mass']['value'] -theta_dry = constants['dry_mass_frac']['value'] -theta_prot = constants['theta_prot']['value'] -t_double = constants['t_double']['value'] -m_aa = 110 / 6E11 # in pg -k_trna = 20 # per sec - -N_synthase = cell_mass * theta_dry * theta_prot / (m_aa * k_trna * t_double) - - -# Instantiate the figure canvas -fig, ax = plt.subplots(1, 1, figsize=(3.5, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_yscale('log') -ax.set_xlim([0, 2]) -ax.set_ylim([1E3, 3E5]) -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('number of tRNA synthetases', fontsize=6) - -# Plot the cell size dependence -ax.plot(growth_rate, N_synthase, lw=3, color='grey', alpha=0.4, label='cell size dependence') - -# Plot the point estimate. -estimate = 1E4 -ax.plot(0.5, estimate, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='point estimate') -ax.vlines(0.5, 0, estimate, 'k', linestyle='--', lw=1, label='__nolegend__') -ax.hlines(estimate, 0, 0.5, 'k', linestyle='--', lw=1, label='__nolegend__') - -# Plot the experimetnal data -for g, d in data.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.legend(fontsize=6) -plt.savefig('../../figures/fig9-S1_tRNA_synthases.svg', bbox_inches='tight') -# %% - - -# %% diff --git a/code/figures/fig9a_ribosomes.py b/code/figures/fig9a_ribosomes.py deleted file mode 100644 index 955a207b..00000000 --- a/code/figures/fig9a_ribosomes.py +++ /dev/null @@ -1,56 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -import prot.viz -import prot.estimate -colors = prot.viz.plotting_style() -constants = prot.estimate.load_constants() -dataset_colors = prot.viz.dataset_colors() - -# Load the data -data = pd.read_csv('../../data/compiled_estimate_categories.csv', comment='#') -data = data[data['shorthand']=='ribosome'] - -# Compute the trend -growth_rate = constants['growth_rate']['value'] -cell_mass = constants['cell_mass']['value'] -theta_dry = constants['dry_mass_frac']['value'] -theta_prot = constants['theta_prot']['value'] -t_double = constants['t_double']['value'] -m_aa = 110 / 6E11 # in pg -k_tsl = 15 # per sec - -N_ribosomes = cell_mass * theta_dry * theta_prot / (m_aa * k_tsl * t_double) - - -# Instantiate the figure canvas -fig, ax = plt.subplots(1, 1, figsize=(3.5, 2)) -ax.xaxis.set_tick_params(labelsize=6) -ax.yaxis.set_tick_params(labelsize=6) -ax.set_yscale('log') -ax.set_xlim([0, 2]) -ax.set_ylim([1E3, 3E5]) -ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) -ax.set_ylabel('number of ribosomes', fontsize=6) - -# Plot the cell size dependence -ax.plot(growth_rate, N_ribosomes, lw=3, color='grey', alpha=0.4, label='cell size dependence') - -# Plot the point estimate. -estimate = 1E4 -ax.plot(0.5, estimate, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='point estimate') -ax.vlines(0.5, 0, estimate, 'k', linestyle='--', lw=1, label='__nolegend__') -ax.hlines(estimate, 0, 0.5, 'k', linestyle='--', lw=1, label='__nolegend__') - -# Plot the experimetnal data -for g, d in data.groupby(['dataset', 'dataset_name']): - ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], - markeredgewidth=0.5, markeredgecolor='k', label=g[1]) - -ax.legend(fontsize=6) -plt.savefig('../../figures/fig9a_ribosomes.svg', bbox_inches='tight') -# %% - - -# %% diff --git a/code/figures/fig9d_boxcar.py b/code/figures/fig9d_boxcar.py deleted file mode 100644 index c6a20449..00000000 --- a/code/figures/fig9d_boxcar.py +++ /dev/null @@ -1,174 +0,0 @@ -#%% -import numpy as np -import pandas as pd -import matplotlib.pyplot as plt -from matplotlib.collections import LineCollection -from matplotlib.colors import ListedColormap, BoundaryNorm -from mpl_toolkits.axes_grid1 import make_axes_locatable -import matplotlib -import prot.viz -import prot.size as size -colors, palette = prot.viz.bokeh_theme() - -dataset_colors = {'li_2014':colors['purple'], 'schmidt_2016':colors['light_blue'], - 'peebo_2015':colors['green'], 'valgepea_2013':colors['red']} -prot.viz.plotting_style() - -# %% -###################### -# plot configuration # -###################### -fig = plt.figure(constrained_layout=True) -# widths = [6, 2.5, 2.5, 5] -widths = [6, 5, 5] -heights = [1.5, 1, 0.75, 1.25, 0.75, 2] -spec = fig.add_gridspec(ncols=3, nrows=6, width_ratios=widths, - height_ratios=heights) - -# plot of t_cyc vs. tau -ax1 = fig.add_subplot(spec[0, 1]) -# plot of t_cyc vs. tau -ax2 = fig.add_subplot(spec[0, 2]) -# plot of RNA/protein vs. num ori -ax3 = fig.add_subplot(spec[1:4, 1]) -# plot of # ribosomes vs. num ori -ax4 = fig.add_subplot(spec[1:4, 2]) -# plot of avg copy num vs loc -ax5 = fig.add_subplot(spec[3, 0]) - - -# plot of elongation rate vs. active fraction -ax6 = fig.add_subplot(spec[4:, 1]) -ax6_ = fig.add_subplot(spec[4:, 0]) -ax6_.axis('off') - -# plot of ribosomal fraction vs lambda -ax7 = fig.add_subplot(spec[4:, 2]) - -###################### -# plot of avg copy num vs loc -# # Load the compiled data -data = pd.read_csv('../../data/compiled_absolute_measurements.csv') - -# load in position information -regulonDB = pd.read_csv('../../data/regulonDB_raw/GeneProductSet.txt', delimiter = ' ') - -tss_map = dict(zip(regulonDB.b_number.values, regulonDB['Gene left end position in the genome'].values)) -data['pos'] =data['b_number'].map(tss_map) - -data_schmidt = data[data.dataset == 'schmidt_2016'] -data_schmidt = data_schmidt.sort_values(by='growth_rate_hr', ascending = True) - -################### -# Deal with double copies of EF-Tu -# Assume that they are equally distributed between -# gene copies. (right now, only tufA) -data_tufA = data_schmidt[data_schmidt.gene_name == 'tufA'] -data_tufA['tot_per_cell'] = data_tufA['tot_per_cell']/2 - -data_tufB = data_schmidt[data_schmidt.gene_name == 'tufA'] -data_tufB['gene_name'] = data_tufB['gene_name'].replace('tufA', 'tufB') -data_tufB['tot_per_cell'] = data_tufB['tot_per_cell']/2 -data_tufB['pos'] = 4175944 - -data_schmidt = data_schmidt[data_schmidt.gene_name != 'tufA'] -data_schmidt = data_schmidt.append(data_tufA) -data_schmidt = data_schmidt.append(data_tufB) - -# Deal with edge positions -# re-copy values with positions near -# 0 and 4.6E6 so that we can treat as circular chromosome. -# 0 bp side -data_schmidt_ = data_schmidt[data_schmidt.pos >= (4.6E6-0.5E6)] -data_schmidt_['pos'] = data_schmidt_['pos'] - 4.6E6 -data_schmidt = data_schmidt.append(data_schmidt_) -# 4.6E6 bp side -data_schmidt_ = data_schmidt[data_schmidt.pos <= (0.5E6)] -data_schmidt_['pos'] = data_schmidt_['pos'] + 4.6E6 -data_schmidt = data_schmidt.append(data_schmidt_) - -# colormap stuff -colors_viridis = plt.cm.cividis(np.linspace(0,1,len(data_schmidt.condition.unique()))) -colordic = dict(zip(data_schmidt.condition.unique(), colors_viridis)) -parameters = data_schmidt.growth_rate_hr.unique() - -# normalize data for colormap range from 0 to 2 hr-1 -norm = matplotlib.colors.Normalize( - vmin=np.min(parameters), - vmax=np.max(parameters)) - -c_m = matplotlib.cm.cividis_r -s_m = matplotlib.cm.ScalarMappable(cmap=c_m, norm=norm) - -################### -# Now calculate average values for plotting! -for c, d in data_schmidt.groupby('condition', sort= False): - pos = np.linspace(0,(4.6E6), 500) - avg_num = [] - for p in pos: - # if p == 0: - # continue - d_ = d[d.pos <= p + 250000] - d_ = d_[d_.pos >= p - 250000] - avg_num = np.append(avg_num,d_.tot_per_cell.mean()) - - avg_num = avg_num - np.mean(avg_num) - - ax5.plot((pos)/1E6, avg_num, - color = s_m.to_rgba(d.growth_rate_hr.unique())[0], - lw = 0.5) - - -divider = make_axes_locatable(ax5) -cax = divider.append_axes('right', size='5%', pad=0.05) -cb = fig.colorbar(s_m, cax=cax, orientation='vertical'); - -cb.ax.set_ylabel('growth rate [hr$^{-1}$]', fontsize=6) -cb.ax.tick_params(labelsize=5) -ax5.set_xlabel('genomic position (Mb)', fontsize=6) -ax5.set_ylabel('average protein copy\nnumber relative to mean', fontsize=6) -ax5.xaxis.set_tick_params(labelsize=5) -ax5.yaxis.set_tick_params(labelsize=5) -# ax5.set_xlim(0,4.6E6) -ax5.set_xlim(0,4.6) - -# add in position info for rRNA, r-protein, oriC, ter -ax_genes = divider.append_axes('bottom', size='5%', pad=0.05) -ax_genes.set_xticklabels([]) -ax_genes.set_yticklabels([]) - -ax_genes.set_xlim(0,4.6) -ax_genes.grid(False) -ax_genes.spines['bottom'].set_visible(False) -ax_genes.spines['right'].set_visible(False) -ax_genes.spines['top'].set_visible(False) -ax_genes.spines['left'].set_visible(False) -ax_genes.set_facecolor('white') -ax_genes.patch.set_alpha(0.0) - -ax_genes.plot(np.array([1339769,1339769])/1E6, [-2,2], lw=2, color="#C24E9D", zorder = 10) -ax_genes.plot(np.array([1607181,1607181])/1E6, [-2,2], lw=2, color="#C24E9D", zorder = 10) -ax_genes.plot(np.array([3926090, 3926090])/1E6, [-2,2], lw=2, color="#19733A", zorder = 10) - -rrna_operons = np.array([4035239, 4166367, 3941516, 3429047, 4207863, 2731448, 223593]) -for p in rrna_operons: - ax_genes.plot(np.array([p,p])/1E6, [-2,2], lw=1, color="#E55E68") - -pos_schmidt = data[data.dataset == 'schmidt_2016'] -data['pos'] =data['b_number'].map(tss_map) -ribosome_genes = ['rpsA', 'rpsB', 'rpsC', 'rpsD', 'rpsE', - 'rpsF', 'rpsG', 'rpsH', 'rpsI', 'rpsJ', 'rpsK', - 'rpsL', 'rpsM', 'rpsN', 'rpsO', 'rpsP', 'rpsQ', - 'rpsR', 'rpsS', 'rpsT', 'rpsU', 'sra', 'rplA', 'rplB', - 'rplC', 'rplD', 'rplE', 'rplF', 'rplJ', - 'rplL', 'rplI', 'rplK', 'rplM', 'rplN', 'rplO', 'rplP', 'rplQ', - 'rplR', 'rplS','rplT', 'rplU', 'rplV', 'rplW', 'rplX', 'rplY', - 'rpmA', 'rpmB', 'rpmC', 'rpmD', 'rpmE', 'rpmF', 'rpmG', 'rpmH', - 'rpmI', 'rpmJ', 'ykgM', 'ykgO'] -# ribosome_genes = ['tufA'] - -pos_schmidt = pos_schmidt[pos_schmidt.gene_name.isin(ribosome_genes)].pos.unique() -for p in pos_schmidt: - ax_genes.plot(np.array([p,p])/1E6, [-2,2], lw=0.5, color="#F47530") - -fig.savefig('../../figures/boxcar.pdf', bbox_inches = 'tight') diff --git a/code/figures/main_text/fig3_nutrient_cellwall_energy.py b/code/figures/main_text/fig3_nutrient_cellwall_energy.py new file mode 100644 index 00000000..4643dd7b --- /dev/null +++ b/code/figures/main_text/fig3_nutrient_cellwall_energy.py @@ -0,0 +1,351 @@ + +#%% +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +import prot.viz +import prot.estimate +colors = prot.viz.plotting_style() +dataset_colors = prot.viz.dataset_colors() +constants = prot.estimate.load_constants() + +data = pd.read_csv('../../data/compiled_estimate_categories.csv') +carbon = data[data['shorthand']=='carbon_tport'] +phos = data[data['shorthand']=='phosphate_tport'] +sulf = data[data['shorthand']=='sulfur_tport'] +lipid = data[data['shorthand']=='fas'] +pg = data[data['shorthand']=='transpeptidases'] +proton = data[data['shorthand']=='proton_gradient'] +atp = data[data['shorthand']=='atp_synthase'] + +################################### +# CARBON TRANSPORT (Fig 3A) +################################### + +# Set up the figure canvas. +fig = plt.figure(figsize = (12,6)) +widths = [2, 2, 2, 2] +heights = [2, 2] +spec = fig.add_gridspec(ncols=4, nrows=2, width_ratios=widths, + height_ratios=heights) +ax = fig.add_subplot(spec[0, 0]) +ax2 = fig.add_subplot(spec[0, 1]) +ax3 = fig.add_subplot(spec[0, 2]) + +ax8 = fig.add_subplot(spec[1, 0]) +ax9 = fig.add_subplot(spec[1, 1]) + +ax10 = fig.add_subplot(spec[1, 2]) +ax11 = fig.add_subplot(spec[1, 3]) + + +# Define constants +theta_C = constants['dry_mass_frac']['value'] * constants['theta_C']['value'] +rho = constants['density']['value'] +vol = constants['volume']['value'] +growth_rate = constants['growth_rate']['value'] +t_double = constants['t_double']['value'] +mass = constants['cell_mass']['value'] +m_carbon = 12/6E11 # in pg +r_carbon = 1000 # in C / s +N_tporters = (theta_C * mass)/ (m_carbon * r_carbon * t_double) + +ax.xaxis.set_tick_params(labelsize=10) +ax.yaxis.set_tick_params(labelsize=10) +ax.set_xlim([0, 2]) +ax.set_ylim([1E2, 5E5]) +ax.set_yscale('log') +ax.set_xlabel('growth rate [hr$^{-1}$]', fontsize=10) +ax.set_ylabel('carbon transporters\nper cell (PTS)', fontsize=10) + +# Plot the scaling argument +ax.plot(0.5, 2E3, 'o', ms=6, color=colors['dark_brown'], alpha=0.4, label='point estimate') +ax.vlines(0.5, 1E2, 2E3, color='k', linestyle='--', lw=0.75, label='__nolegend__') +ax.hlines(2E3, 0, 0.5, color='k', linestyle='--', lw=0.75, label='__nolegend__') + +# Plot the data +for g, d in carbon.groupby(['dataset', 'dataset_name']): + ax.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + +ax.plot(growth_rate[growth_rate > 0.23], N_tporters[growth_rate > 0.23], '-', lw=3, color='grey', label='cell size dependence', +alpha=0.3) +ax.plot(growth_rate[growth_rate <= 0.23], N_tporters[growth_rate <= 0.23], ':', lw=3, color='grey', label='__nolegend__', +alpha=0.3) + + +# data = pd.read_csv('../../data/compiled_estimate_categories.csv') +# data = data[data['shorthand']=='phosphate_tport'] + +# Define constants +theta_P = constants['dry_mass_frac']['value'] * constants['theta_P']['value'] +rho = constants['density']['value'] +vol = constants['volume']['value'] +growth_rate = constants['growth_rate']['value'] +t_double = constants['t_double']['value'] +mass = constants['cell_mass']['value'] +m_phos = 30/5E11 # in pg +r_phos = 300 # in P / s +N_tporters = (theta_P * mass)/ (m_phos * r_phos * t_double) + +# data = pd.read_csv('../../data/compiled_estimate_categories.csv') + +# # Define constants. +# RHO = constants['density']['value'] +# DRY_FRAC = constants['dry_mass_frac']['value'] +# PROT_FRAC = DRY_FRAC * constants['theta_prot']['value'] +# CARB_FRAC = DRY_FRAC * constants['theta_C']['value'] +# VOL = constants['volume']['value'] +# T_DOUBLE = constants['t_double']['value'] +# MASS_CARB = 12/6E11 # in pg +# GROWTH_RATE = constants['growth_rate']['value'] + +# Define transport constants. +# R_GLUC = 200 # in sugar per sec +# R_XYL = 50 # in xylose per sec +# R_FRUC = 200 +# R_GLYC = 2000 +# N_GLUC = 6 # Carbons per sugar +# N_XYL = 5 +# N_FRUC = 6 +# N_GLYC = 3 +# # GLUCOSE_TPORTERS +# N_gluc_tport = (RHO * VOL * DRY_FRAC * CARB_FRAC)\ +# / (R_GLUC * N_GLUC * MASS_CARB * T_DOUBLE) +# N_glyc_tport = (RHO * VOL * DRY_FRAC * CARB_FRAC)\ +# / (R_GLYC * N_GLYC * MASS_CARB * T_DOUBLE) +# N_xyl_tport = (RHO * VOL * DRY_FRAC * CARB_FRAC)\ +# / (R_XYL * N_XYL * MASS_CARB * T_DOUBLE) +# N_fruc_tport = (RHO * VOL * DRY_FRAC * CARB_FRAC)\ +# / (R_FRUC * N_FRUC * MASS_CARB * T_DOUBLE) + +################################## +# PHOSPHATE TRANSPORT (Fig 3B) +################################### +# data = pd.read_csv('../../data/compiled_estimate_categories.csv') +ax2.xaxis.set_tick_params(labelsize=10) +ax2.yaxis.set_tick_params(labelsize=10) +ax2.set_xlim([0, 2]) +ax2.set_ylim([1E1, 1E4]) +ax2.set_yscale('log') +ax2.set_xlabel('growth rate [hr$^{-1}$]', fontsize=10) +ax2.set_ylabel('phosphate transporters\nper cell (PitA + PitB)', fontsize=10) + +# Plot the scaling argument +ax2.plot(0.5, 2E2, 'o', ms=6, color=colors['dark_brown'], alpha=0.4, label='point estimate', + zorder=1000) +ax2.vlines(0.5, 1E1, 2E2, color='k', linestyle='--', lw=0.75, label='__nolegend__', + zorder=999) +ax2.hlines(2E2, 0, 0.5, color='k', linestyle='--', lw=0.75, label='__nolegend__', + zorder=999) + +# Plot the data +for g, d in phos.groupby(['dataset', 'dataset_name']): + ax2.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + +ax2.plot(growth_rate[growth_rate > 0.23], N_tporters[growth_rate > 0.23], '-', lw=3, color='grey', label='cell size dependence', +alpha=0.3) +ax2.plot(growth_rate[growth_rate <= 0.23], N_tporters[growth_rate <= 0.23], ':', lw=3, color='grey', label='__nolegend__', +alpha=0.3) + +# data = pd.read_csv('../../data/compiled_estimate_categories.csv') +################################### +# SULFUR TRANPSORT (Fig 3 C) +################################### + + +# Define constants +theta_S = constants['dry_mass_frac']['value'] * constants['theta_S']['value'] +rho = constants['density']['value'] +vol = constants['volume']['value'] +growth_rate = constants['growth_rate']['value'] +t_double = constants['t_double']['value'] +mass = constants['cell_mass']['value'] +m_sulf = 32/6E11 # in pg +r_sulf = 10 # in C / s +N_tporters = (theta_S * mass)/ (m_sulf * r_sulf * t_double) + +ax3.xaxis.set_tick_params(labelsize=10) +ax3.yaxis.set_tick_params(labelsize=10) +ax3.set_xlim([0, 2]) +ax3.set_ylim([1E1, 5E4]) +ax3.set_yscale('log') +ax3.set_xlabel('growth rate [hr$^{-1}$]', fontsize=10) +ax3.set_ylabel('sulfate transporters\nper cell (CysUWA)', fontsize=10) + +# Plot the scaling argument +ax3.plot(0.5, 1E3, 'o', ms=6, color=colors['dark_brown'], alpha=0.4, label='point estimate') +ax3.vlines(0.5, 1E1, 1E3, color='k', linestyle='--', lw=0.75, label='__nolegend__') +ax3.hlines(1E3, 0, 0.5, color='k', linestyle='--', lw=0.75, label='__nolegend__') + +# Plot the data +for g, d in sulf.groupby(['dataset', 'dataset_name']): + ax3.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + +ax3.plot(growth_rate[growth_rate > 0.23], N_tporters[growth_rate > 0.23], '-', lw=3, color='grey', label='cell size dependence', +alpha=0.3) +ax3.plot(growth_rate[growth_rate <= 0.23], N_tporters[growth_rate <= 0.23], ':', lw=3, color='grey', label='__nolegend__', +alpha=0.3) + +########################################## +# CELL ENVELOPEE BIOSYNTHESIS (Fig. 3 D-E) +########################################## +# data = pd.read_csv('../../data/compiled_estimate_categories.csv') + +# Compute the scaling relations. +growth_rate = constants['growth_rate']['value'] +surface_area = constants['surface_area']['value'] +t_double = constants['t_double']['value'] + +rho_pg = 0.25 # in pg per fL +A_lipid = 0.5 / 1E6 # in square microns +N_leaflet = 4 +kcat_acp = 1 +kcat_tpd = 2 +xlink_frac = 0.2 +w_pg = 0.005 # thickness of pg in um +m_murein = 1000 / 6E11 # Mass of murein monomer in pg +theta_lipid = 0.4 +N_fabs = (theta_lipid * surface_area * N_leaflet) / (A_lipid * kcat_acp * t_double) +N_tpds = (xlink_frac * w_pg * surface_area * rho_pg) / (m_murein * kcat_tpd * t_double) + +# Generate the figures +ax8.set_xlim([0, 2]) +ax8.set_yscale('log') +ax8.set_ylim([1E2, 1E5]) +ax8.set_xlabel('growth rate [hr$^{-1}$]', fontsize=10) +ax8.set_ylabel('ACP dehydratases per cell\n(FabZ + FabA)', fontsize=10) +ax8.xaxis.set_tick_params(labelsize=10) +ax8.yaxis.set_tick_params(labelsize=10) + +# Plot the scaling relationship +ax8.plot(growth_rate[growth_rate > 0.23], N_fabs[growth_rate > 0.23], '-', lw=3, color='grey', label='surface area scaling', + alpha=0.4) +ax8.plot(growth_rate[growth_rate <= 0.23], N_fabs[growth_rate <= 0.23], ':', lw=3, color='grey', label='surface area scaling', + alpha=0.4) + +# Plot the prediction +ax8.plot(0.5, 4E3, 'o', ms=5, color=colors['dark_brown'], label='point estimate', + alpha=0.4) +ax8.hlines(4E3, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') +ax8.vlines(0.5, 0, 4E3, 'k', linestyle='--', lw=0.75, label='__nolegend__') + +# plot the data +for g, d in lipid.groupby(['dataset', 'dataset_name']): + ax8.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, + color=dataset_colors[g[0]], alpha=0.75, markeredgecolor='k', + markeredgewidth=0.5, label=g[1]) +################################### +# lipid +################################### + +ax9.set_xlim([0, 2]) +ax9.set_yscale('log') +ax9.set_ylim([5E0, 5E3]) +ax9.set_xlabel('growth rate [hr$^{-1}$]', fontsize=10) +ax9.set_ylabel('murein transpeptidases per cell', fontsize=10) +ax9.xaxis.set_tick_params(labelsize=10) +ax9.yaxis.set_tick_params(labelsize=10) + +# Plot the scaling relationship +ax9.plot(growth_rate[growth_rate > 0.23], N_tpds[growth_rate > 0.23], '-', lw=3, color='grey', label='surface area scaling', + alpha=0.4) +ax9.plot(growth_rate[growth_rate <= 0.23], N_tpds[growth_rate <= 0.23], ':', lw=3, color='grey', label='__nolegend__', + alpha=0.4) + +# Plot the prediction +ax9.plot(0.5, 100, 'o', ms=5, color=colors['dark_brown'], label='point estimate', + alpha=0.4) +ax9.hlines(100, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') +ax9.vlines(0.5, 0, 100, 'k', linestyle='--', lw=0.75, label='__nolegend__') + +# plot the data +for g, d in pg.groupby(['dataset', 'dataset_name']): + ax9.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, + color=dataset_colors[g[0]], alpha=0.75, markeredgecolor='k', + markeredgewidth=0.5, label=g[1]) + + +################################### +# ATP SYNTHESIS (Fig. 3 F) +################################### +# Compute the scaling trend. +growth_rate = constants['growth_rate']['value'] +t_double = constants['t_double']['value'] +cell_mass = constants['cell_mass']['value'] +theta_dry = constants['dry_mass_frac']['value'] +theta_prot = constants['theta_prot']['value'] + +m_aa = 110 / 6E11 # in pg +r_atp = 300 # per second per synthase +atp_aa = 5 + +tot_prot = prot.size.lambda2P(growth_rate) / 1E3 +N_synthase = (tot_prot * atp_aa) / (m_aa * r_atp * t_double / np.log(2)) + +ax10.xaxis.set_tick_params(labelsize=10) +ax10.yaxis.set_tick_params(labelsize=10) +ax10.set_yscale('log') +ax10.set_xlabel('growth rate [hr$^{-1}$]', fontsize=10) +ax10.set_ylabel('ATP synthases per cell', fontsize=10) +ax10.set_xlim([0, 2]) +ax10.set_ylim([1E2, 5E4]) + +# Plot the scaling relationship +ax10.plot(growth_rate[growth_rate > 0.23], N_synthase[growth_rate >= 0.23], '-', lw=3, color='grey', alpha=0.4, label='cell size dependence') +ax10.plot(growth_rate[growth_rate <= 0.23], N_synthase[growth_rate <= 0.23], ':', lw=3, color='grey', alpha=0.4, label='__nolegend_-') + +# Plot the estimate value +ax10.plot(0.5, 3000, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.5, label='estimated value') +ax10.vlines(0.5, 0, 3000, 'k', lw=1, linestyle='--', label='__nolegend__') +ax10.hlines(3000, 0, 0.5, 'k', lw=1, linestyle='--', label='__nolegend__') + +for g, d in atp.groupby(['dataset', 'dataset_name', 'condition']): + ax10.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + +################################### +# PROTON GRADIENT (Fig. 3 G) +################################### +# data = pd.read_csv('../../data/compiled_estimate_categories.csv') + +# Compute the scaling trend. +growth_rate = constants['growth_rate']['value'] +t_double = constants['t_double']['value'] +cell_mass = constants['cell_mass']['value'] +theta_dry = constants['dry_mass_frac']['value'] +theta_prot = constants['theta_prot']['value'] +m_aa = 110 / 6E11 # in pg +r_atp = 300 # per second per synthase +atp_aa = 5 +prot_atp = 4 +r_etc = 1500 + +tot_prot = prot.size.lambda2P(growth_rate) / 1E3 +N_synthase = (tot_prot * atp_aa) / (m_aa * r_atp * t_double / np.log(2)) +N_ETC = N_synthase * prot_atp * r_atp / r_etc + +ax11.xaxis.set_tick_params(labelsize=10) +ax11.yaxis.set_tick_params(labelsize=10) +ax11.set_yscale('log') +ax11.set_xlabel('growth rate [hr$^{-1}$]', fontsize=10) +ax11.set_ylabel('electron transport complexes\nper cell', fontsize=10) +ax11.set_xlim([0, 2]) +ax11.set_ylim([1E2, 5E4]) +# Plot the scaling relationship +ax11.plot(growth_rate[growth_rate > 0.23], N_ETC[growth_rate > 0.23], '-', lw=3, color='grey', alpha=0.4, label='cell size dependence') +ax11.plot(growth_rate[growth_rate <= 0.23], N_ETC[growth_rate <= 0.23], ':', lw=3, color='grey', alpha=0.4, label='__nolegend__') + +# Plot the estimate value +ax11.plot(0.5, 2500, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.5, label='estimated value') +ax11.vlines(0.5, 0, 2500, 'k', lw=1, linestyle='--', label='__nolegend__') +ax11.hlines(2500, 0, 0.5, 'k', lw=1, linestyle='--', label='__nolegend__') + +for g, d in proton.groupby(['dataset', 'dataset_name']): + ax11.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + +plt.tight_layout() +plt.savefig('../../figures/fig3_nutrient_cellwall_energy.pdf') \ No newline at end of file diff --git a/code/figures/fig5abc_SV_scaling_COG_characterization.py b/code/figures/main_text/fig4abc_SV_scaling_COG_characterization.py similarity index 80% rename from code/figures/fig5abc_SV_scaling_COG_characterization.py rename to code/figures/main_text/fig4abc_SV_scaling_COG_characterization.py index edf210ea..652e1273 100644 --- a/code/figures/fig5abc_SV_scaling_COG_characterization.py +++ b/code/figures/main_text/fig4abc_SV_scaling_COG_characterization.py @@ -16,14 +16,14 @@ ###################### fig = plt.figure(constrained_layout=True) widths = [6, 7] -heights = [2, 0.5, 0.5, 0.25] +heights = [2, 0.5, 0.1, 0.65] spec = fig.add_gridspec(ncols=2, nrows=4, width_ratios=widths, height_ratios=heights) ax1 = fig.add_subplot(spec[0, 0]) # ax2 = fig.add_subplot(spec[0, 1]) ax3 = fig.add_subplot(spec[2:, 0]) -ax4 = fig.add_subplot(spec[:2, 1]) +ax4 = fig.add_subplot(spec[:3, 1]) # Parameters and calculations # @@ -124,7 +124,7 @@ ax1.set_xlim([np.min(Pv), np.max(Ps_resp_)]) ax1.set_xlabel('ATP equivalents per s', fontsize=6) -ax1.set_ylabel('S/V ratio [$\mu$m]', fontsize=6) +ax1.set_ylabel('S/V ratio [$\mu$m$^{-1}$]', fontsize=6) @@ -191,8 +191,10 @@ subunits = pd.read_csv('../../data/compiled_annotated_complexes.csv') complex_energy = ['NADH-DHI-CPLX', 'CPLX0-8160', 'CYT-O-UBIOX-CPLX', 'CYT-D-UBIOX-CPLX', 'ATPSYN-CPLX'] -df_mem = data_membrane[data_membrane.dataset == 'schmidt_2016'] +# df_mem = data_membrane[data_membrane.dataset == 'schmidt_2016'] +df_mem = data_membrane df_mem = df_mem[df_mem.gene_name != 'tufA'] +df_mem = df_mem[df_mem.gene_name != 'tufB'] genes_respiration = [] for c, d in subunits.groupby('complex'): @@ -221,32 +223,40 @@ df_mem_ = df_mem_.append(data_list, ignore_index=True) -df_mem_['rel_fg_per_cell'] = df_mem_.groupby('condition').transform(lambda x: (x / x.sum()))['fg_per_cell'] +df_mem_['rel_fg_per_cell'] = df_mem_.groupby(['dataset', 'growth_rate_hr', 'condition']).transform(lambda x: (x / x.sum()))['fg_per_cell'] df_mem_ = df_mem_.sort_values(by=['growth_rate_hr', 'gene_name'], ascending = False) -y_order = dict(zip(df_mem_.condition.unique(), np.arange(len(df_mem_.condition.unique())))) +# y_order = dict(zip(df_mem_.growth_rate_hr, np.arange(len(df_mem_.growth_rate_hr)))) +# cog_class_order = ['metabolism', +# 'cellular processes and signaling', +# 'information storage and processing', +# 'poorly characterized or not assigned'] cog_class_order = ['metabolism', - 'cellular processes and signaling', 'information storage and processing', + 'cellular processes and signaling', 'poorly characterized or not assigned'] order_dict = dict(zip(cog_class_order, np.arange(4))) # color_dict = dict(zip(cog_class_order, # ['', '#C8715B', '#A587AA', '#788FBD'])) color_dict = dict(zip(cog_class_order, - ['', '#BF703A', '#D3B15E', '#788FBD'])) - - -for c, d in df_mem_.groupby('condition', sort=False): + ['', '#D3B15E', '#BF703A', '#788FBD'])) + # ['', '#BF703A', '#D3B15E', '#788FBD'])) + +gr_yaxis = [] +count = -1 +for c, d in df_mem_.groupby(['dataset', 'growth_rate_hr', 'condition'], sort=False): + gr_yaxis = np.append(gr_yaxis,c[1]) + count += 1 for c_ in cog_class_order: if c_ == 'metabolism': resp = d[d.gene_name == 'respiration'] - ax4.barh(y_order[c], resp.rel_fg_per_cell, height=0.9, color='#679B48', alpha=0.3, #84A779 + ax4.barh(count, resp.rel_fg_per_cell, height=0.9, color='#679B48', alpha=0.3, #84A779 linewidth=0.1) c_uptake = d[d.gene_name == 'carbon_uptake'] lefts = resp.rel_fg_per_cell.sum() - ax4.barh(y_order[c], c_uptake.rel_fg_per_cell.sum(), height=0.9, color='#679B48', alpha=0.7, + ax4.barh(count, c_uptake.rel_fg_per_cell.sum(), height=0.9, color='#679B48', alpha=0.7, left=lefts, linewidth=0.1) # lefts = d[d.gene_name == 'respiration'] @@ -254,37 +264,45 @@ meta = d[d.gene_name != 'respiration'].copy() meta = meta[meta.gene_name !='carbon_uptake'].copy() - ax4.barh(y_order[c], meta.rel_fg_per_cell.sum(), height=0.9, color='#679B48', + ax4.barh(count, meta.rel_fg_per_cell.sum(), height=0.9, color='#679B48', left=lefts, linewidth=0.1) lefts += meta[meta.cog_class == c_].rel_fg_per_cell.sum() else: - ax4.barh(y_order[c], d[d.cog_class == c_].rel_fg_per_cell.sum(), height=0.9, + if c[0] == 'li_2014': + print(c, d[d.cog_class == c_].sort_values(by='rel_fg_per_cell')[['gene_name', 'rel_fg_per_cell']]) + ax4.barh(count, d[d.cog_class == c_].rel_fg_per_cell.sum(), height=0.9, color=color_dict[c_], left=lefts, linewidth=0.1) lefts += d[d.cog_class == c_].rel_fg_per_cell.sum() ax4.set_xlim(0,1) -ax4.set_ylim(0,len(df_mem_.condition.unique())) -ax4.set_yticks(np.arange(len(df_mem_.condition.unique()))-0.5) -ax4.set_yticklabels(df_mem_.condition.unique()) +# ax4.set_ylim(0,count) +ax4.set_ylim(-0.5,count+0.5) +# ax4.set_ylim(0,len(df_mem_.condition.unique())) +# ax4.set_yticks(np.arange(len(df_mem_.condition.unique()))-0.5) +# ax4.set_yticklabels(df_mem_.condition.unique()) ax4.set_xlabel('relative plasma membrane abundance (GO term : 0005886)', fontsize=6) ax4.xaxis.set_tick_params(labelsize=5) ax4.yaxis.set_tick_params(labelsize=5) -growth_rates_list = [d.growth_rate_hr.unique()[0] for c, d in df_mem_.groupby('condition', sort=False)] +# growth_rates_list = [d.growth_rate_hr.unique()[0] for c, d in df_cyt_schmidt_.groupby('condition', sort=False)] ax4_twin = ax4.twinx() -ax4_twin.set_yticks(np.arange(len(growth_rates_list))-0.5) -ax4_twin.set_yticklabels(growth_rates_list) +# ax4_twin.set_yticks(np.arange(len(growth_rates_list))-0.5) +# ax4_twin.set_yticklabels(growth_rates_list) +ax4_twin.set_yticks(np.arange(len(gr_yaxis))-0.5) +ax4_twin.set_yticklabels(gr_yaxis) +print(gr_yaxis) ax4_twin.set_ylabel('growth rate [hr$^{-1}$]', fontsize=6) -ax4_twin.set_ylim(0,len(df_mem_.condition.unique())) -ax4_twin.xaxis.set_tick_params(labelsize=5) -ax4_twin.yaxis.set_tick_params(labelsize=5) +# ax4_twin.set_ylim(0,len(df_mem_.condition.unique())) +ax4_twin.set_ylim(-0.5,count+0.5) +ax4_twin.xaxis.set_tick_params(labelsize=4.5) +ax4_twin.yaxis.set_tick_params(labelsize=4.5) plt.tight_layout() -fig.savefig('../../figures/fig5abc_SV_scaling_COG_characterization.pdf') +# fig.savefig('../../figures/fig5abc_SV_scaling_COG_characterization_all.pdf') # %% diff --git a/code/figures/main_text/fig4de_cytosol.py b/code/figures/main_text/fig4de_cytosol.py new file mode 100644 index 00000000..1819927a --- /dev/null +++ b/code/figures/main_text/fig4de_cytosol.py @@ -0,0 +1,131 @@ +#%% +import numpy as np +import pandas as pd +import matplotlib as mpl +import matplotlib.pyplot as plt +from matplotlib.lines import Line2D +from mpl_toolkits.axes_grid1.inset_locator import inset_axes +import prot.viz +import prot.size as size +colors, palette = prot.viz.bokeh_theme() +dataset_colors = {'li_2014':colors['purple'], 'schmidt_2016':colors['light_blue'], + 'peebo_2015':colors['green'], 'valgepea_2013':colors['red']} +prot.viz.plotting_style() + + +###################### +# plot configuration # +###################### +fig = plt.figure() +widths = [5, 6] +# heights = [2, 0.5, 0.5, 0.25] +# widths = [5, 5] +heights = [1.75, 1.25, 1.5, 1.5] +spec = fig.add_gridspec(ncols=2, nrows=4, width_ratios=widths) + + +ax1 = fig.add_subplot(spec[:2,0]) +ax2 = fig.add_subplot(spec[2:,0]) + + +# Load the data set +data = pd.read_csv('../../data/compiled_absolute_measurements.csv') + +# total fg per cell cytosol GO:0005829 - cytosol +data_cytosol = data[data.go_terms.str.contains('GO:0005829')] + +data_cytosol = data_cytosol.replace('Not Assigned', 'poorly characterized or not assigned') +data_cytosol = data_cytosol.replace('poorly characterized', 'poorly characterized or not assigned') + +cog_class_order = ['metabolism', + 'information storage and processing', + 'cellular processes and signaling', + 'poorly characterized or not assigned'] +order_dict = dict(zip(cog_class_order, + np.arange(4))) + +color_dict = dict(zip(cog_class_order, + ['#679B48', '#D3B15E', '#BF703A', '#788FBD'])) + +marker_dict = dict(zip(data.dataset.unique(), + ['o', 's', 'd', 'v'])) + +label_dict = dict(zip(data.dataset_name.unique(), + ['o', 's', 'd', 'v'])) +###################### +# relative dist of different COG categories: Plot (D) +###################### + + +# Compute the mass fraction +mass_frac = [] +for g, d in data_cytosol.groupby(['dataset', 'condition', 'growth_rate_hr']): + tot_mass = d['fg_per_cell'].sum() + sector_mass = d.groupby(['dataset', 'dataset_name', 'condition', 'growth_rate_hr', 'cog_class'])['fg_per_cell'].sum().reset_index() + frac = sector_mass['fg_per_cell'].values / tot_mass + sector_mass['frac'] = frac + sector_mass['dataset_name'] = sector_mass['dataset_name'] + mass_frac.append(sector_mass) +mass_frac = pd.concat(mass_frac, sort=False) + +for g, d in mass_frac.groupby(['dataset', 'cog_class', 'dataset_name']): + ax1.plot(d.growth_rate_hr, d['frac'], marker = marker_dict[g[0]], color=color_dict[g[1]], + alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, + label = g[2], ms=4, zorder=10, linewidth = 0) + +ax1.set_ylim(0,1) +ax1.set_xlim(0,2) +ax1.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) +ax1.set_ylabel('cytosolic protein mass\n fraction (GO term : 0005829)', fontsize=6) +ax1.xaxis.set_tick_params(labelsize=5) +ax1.yaxis.set_tick_params(labelsize=5) + +legend_elements = [Line2D([0], [0], + marker=label_dict[i], + color='w', linewidth = 0, + label=i, markeredgecolor='k', + markeredgewidth=0.25, + markerfacecolor='gray', + markersize=4) for i in data.dataset_name.unique()] + +ax1.legend(handles=legend_elements, loc='upper left', fontsize = 6) + + +###################### +# metabolism vs information processing; Plot (E) +###################### + +cm = plt.cm.viridis + +for g, d in mass_frac.groupby(['dataset', 'growth_rate_hr', 'dataset_name', 'condition']): + ax2.scatter(d[d.cog_class == 'information storage and processing']['frac'], + d[d.cog_class == 'metabolism']['frac'], marker = marker_dict[g[0]], + c = [float(i) for i in d.growth_rate_hr.unique()], cmap = cm, + # c = float(d.growth_rate_hr.unique()), cmap=cm,#'viridis', + vmin=0, vmax=2, alpha=0.75, edgecolors='k', linewidths=0.25) + +ax2.set_ylim(0.25,0.65) +ax2.set_xlim(0.25,0.55) +ax2.set_xlabel('proteomic mass fraction,\ninformation storage and processing', fontsize=6) +ax2.set_ylabel('proteomic mass fraction,\nmetabolism', fontsize=6) +ax2.xaxis.set_tick_params(labelsize=5) +ax2.yaxis.set_tick_params(labelsize=5) + +# add in colorbar for growth rate, 0-2 hr-1 +cbaxes = inset_axes(ax2, width="30%", height="3%", loc=3) +norm = mpl.colors.Normalize(vmin=0,vmax=2) +sm = plt.cm.ScalarMappable(cmap=cm, norm=norm) +sm.set_array([]) +cb = plt.colorbar(sm, cax=cbaxes, ticks=[0.,2], orientation='horizontal') +cbaxes.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) +cbaxes.xaxis.set_tick_params(labelsize=5) +cbaxes.yaxis.set_tick_params(labelsize=5) +cbaxes.xaxis.tick_top() +cbaxes.xaxis.set_label_position('top') +cb.outline.set_linewidth(0) + + +plt.tight_layout() +fig.savefig('../../figures/fig5de_cytosol.pdf') + +# %% diff --git a/code/figures/main_text/fig5_central_dogma.py b/code/figures/main_text/fig5_central_dogma.py new file mode 100644 index 00000000..70e2252e --- /dev/null +++ b/code/figures/main_text/fig5_central_dogma.py @@ -0,0 +1,276 @@ + +#%% +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +import prot.viz +import prot.estimate +colors = prot.viz.plotting_style() +dataset_colors = prot.viz.dataset_colors() +constants = prot.estimate.load_constants() + +data = pd.read_csv('../../data/compiled_estimate_categories.csv') + +# Set up the figure canvas. +# DNA replication, dNTP, +# RNA synthesis legend +# protein synthesis (2), +# additional column: +# DNA pol conc. , rna pol RpoD, ribo synthesis time + +# ribosomal synthesis time schematic + +fig = plt.figure(figsize = (8,6)) +widths = [2, 2, 2] +heights = [2, 2, 2] +spec = fig.add_gridspec(ncols=3, nrows=3, width_ratios=widths, + height_ratios=heights) + +ax1 = fig.add_subplot(spec[0, 0]) # DNA pol III +ax2 = fig.add_subplot(spec[0, 1]) # dNTP +ax3 = fig.add_subplot(spec[1, 0]) # RNA pol +ax4 = fig.add_subplot(spec[2, 0]) # ribosomes +ax5 = fig.add_subplot(spec[2, 1]) # tRNA + +ax6 = fig.add_subplot(spec[0, 2]) # DNA pol conc. +ax7 = fig.add_subplot(spec[1, 2]) # RpoD + +################################### +# dNTP +################################### +dnap = data[data['shorthand']=='dnap'] +rnr = data[data['shorthand']=='dntp'] + +# Compute the cell size dependence. +growth_rate = constants['growth_rate']['value'] +t_double = constants['t_double']['value'] +n_ori = constants['N_ori']['value'] +L_genome = 4.6E6 # in nt +r_rnr = 10 +r_dna = 600 # in nt per sec +n_pol = 2 # per replication fork +n_fork = 2 +N_rnr = 2 * n_ori * L_genome / (r_rnr * t_double) +N_dnap = n_fork * n_pol * n_ori + +ax2.xaxis.set_tick_params(labelsize=8) +ax2.yaxis.set_tick_params(labelsize=8) +ax2.set_xlabel('growth rate [hr$^{-1}$]', fontsize=8) +ax2.set_ylabel('ribonucleotide reductases\nper cell', fontsize=8) + +# Format the axes +ax2.set_yscale('log') +ax2.set_ylim([1E1, 1E4]) +ax2.set_xlim([0, 2]) + +ax2.plot(growth_rate[growth_rate > 0.23], N_rnr[growth_rate > 0.23],'-', color='grey', lw=3, alpha=0.5, label='replication fork dependence') +ax2.plot(growth_rate[growth_rate <= 0.23], N_rnr[growth_rate <= 0.23], ':', color='grey', lw=3, alpha=0.5, label='__nolegend__') + + +# Plot the predictions +ax2.plot(0.5, 200, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='estimated value') +ax2.hlines(250, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') +ax2.vlines(0.5, 10, 200, 'k', linestyle='--', lw=0.75, label='__nolegend__') + +for g, d in rnr.groupby(['dataset', 'dataset_name']): + ax2.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + + +################################### +# DNA replication +################################### + +for a in [ax1,ax6]: + a.xaxis.set_tick_params(labelsize=8) + a.yaxis.set_tick_params(labelsize=8) + a.set_xlabel('growth rate [hr$^{-1}$]', fontsize=8) +ax1.set_ylabel('DNA polymerase III\nper cell', fontsize=8) +ax6.set_ylabel('DNA polymerase III\nconcentration [nM]', fontsize=8) + +# Format the axes +ax1.set_yscale('log') +ax6.set_yscale('log') +ax1.set_ylim([1, 5E2]) +ax1.set_xlim([0, 2]) +ax6.set_ylim([1, 500]) +ax6.set_xlim([0, 2]) + + +# Plot the predictions +ax1.plot(growth_rate, N_dnap, '-', lw=3, color='grey', alpha=0.3, label='replication fork dependence') +ax1.plot(growth_rate[growth_rate > 0.23], N_dnap[growth_rate > 0.23], '-', lw=3, color='grey', alpha=0.3, label='replication fork dependence') +ax1.plot(growth_rate[growth_rate <= 0.23], N_dnap[growth_rate <= 0.23], ':', lw=3, color='grey', alpha=0.3, label='__nolegend__') +ax1.plot(0.5, 6.5, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='estimated value') +ax1.hlines(6, 0, 0.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') +ax1.vlines(0.5, 1, 6.5, 'k', linestyle='--', lw=0.75, label='__nolegend__') + + + +# Plot the concentration range of 50 - 200 nM +ax6.fill_between([0, 2], 50, 200, color='k', alpha=0.25, label='DNA Pol. III H.E. binding affinity\n (Ason et al. 2000)') + +for g, d in dnap.groupby(['dataset', 'dataset_name']): + ax1.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + ax6.plot(d['growth_rate_hr'], d['concentration_uM'] * 1E3, 'o', ms=4, color=dataset_colors[g[0]], + alpha=0.75, markeredgewidth=0.5, markeredgecolor='k', label='__nolegend__') +# ax6.legend(fontsize=8) +# ax1.legend(fontsize=8, ncol=2) + + +################################### +# RNA synthesis +################################### + +rnap = data[data['shorthand']=='rnap'] +sig70 = data[data['shorthand']=='sigma70'] + + +# Compute the predicted trends.. +growth_rate = constants['growth_rate']['value'] +N_ori = constants['N_ori']['value'] +cell_mass = constants['cell_mass']['value'] +theta_dry = constants['dry_mass_frac']['value'] +theta_prot = constants['theta_prot']['value'] +t_double = constants['t_double']['value'] + +m_aa = 110 / 6E11 # in pg +m_prot = (300 * 110) / 6E11 # in pg +n_prot = (theta_prot * theta_dry * cell_mass) /m_prot +gamma_mRNA = 1 / 300 +n_mRNA = (n_prot / 1E3) * gamma_mRNA +L_mRNA = 1000 +L_rRNA = 4500 +r_txn = 40 # in nt/s +n_operon = 7 +footprint = 80 # in nt +n_tRNA = theta_prot * theta_dry * cell_mass / (m_aa * t_double) +L_tRNA = 80 + +N_polymerase = (L_rRNA * n_operon * N_ori/ footprint) + (n_mRNA * L_mRNA / r_txn) + (n_tRNA * L_tRNA) / (r_txn * t_double) + + +for a in [ax3, ax7]: + a.plot(growth_rate[growth_rate > 0.23], N_polymerase[growth_rate > 0.23], '-', lw=3, color='grey', alpha=0.4, label='replication fork scaling') + a.plot(growth_rate[growth_rate <= 0.23], N_polymerase[growth_rate <= 0.23], ':', lw=3, color='grey', alpha=0.4, label='__nolegend__') + a.set_xlabel('growth rate [hr$^{-1}$]', fontsize=8) + a.set_yscale('log') + a.set_xlim([0, 2]) +ax3.set_ylabel('RNA Polymerases\nper cell', fontsize=8) +ax7.set_ylabel('$\sigma^{70}$ (RpoD)\nper cell', fontsize=8) +ax3.set_yticks([1E2, 1E3, 1E4, 1E5]) +ax3.set_ylim([1E2, 1E5]) +ax7.set_yticks([1E2, 1E3, 1E4]) +ax7.set_ylim([1E2, 1E4]) + +# Plot the predictions +for a in [ax3, ax7]: + a.plot(0.5, 1E3, 'o', ms=6, alpha=0.4, color=colors['dark_brown'], label='estimated value') + a.vlines(0.5, 1, 1E3, color='k', linestyle='--', label='__nolegend__', lw=0.75) + a.hlines(1E3, 0, 0.5, color='k', linestyle='--', label='__nolegend__', lw=0.75) + +# plot the data +for p, a in zip([rnap, sig70], [ax3, ax7]): + for g, d in p.groupby(['dataset', 'dataset_name']): + a.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + +# Add legends. +for a in [ax3, ax7]: + # a.legend(fontsize=8, loc='lower right') + a.xaxis.set_tick_params(labelsize=8) + a.yaxis.set_tick_params(labelsize=8) + +################################### +# protein synthesis +################################### +data = pd.read_csv('../../data/compiled_estimate_categories.csv', comment='#') +data = data[data['shorthand']=='ribosome'] + +# Compute the trend +growth_rate = constants['growth_rate']['value'] +cell_mass = constants['cell_mass']['value'] +theta_dry = constants['dry_mass_frac']['value'] +theta_prot = constants['theta_prot']['value'] +t_double = constants['t_double']['value'] +m_aa = 110 / 6E11 # in pg +k_tsl = 15 # per sec + +N_ribosomes = cell_mass * theta_dry * theta_prot / (m_aa * k_tsl * t_double) + +ax4.xaxis.set_tick_params(labelsize=8) +ax4.yaxis.set_tick_params(labelsize=8) +ax4.set_yscale('log') +ax4.set_xlim([0, 2]) +ax4.set_ylim([1E3, 3E5]) +ax4.set_xlabel('growth rate [hr$^{-1}$]', fontsize=8) +ax4.set_ylabel('ribosomes\nper cell', fontsize=8) + +# Plot the cell size dependence +ax4.plot(growth_rate[growth_rate > 0.23], N_ribosomes[growth_rate > 0.23], lw=3, color='grey', alpha=0.4, label='cell size dependence') +ax4.plot(growth_rate[growth_rate <= 0.23], N_ribosomes[growth_rate <= 0.23], ':', lw=3, color='grey', alpha=0.4, label='__nolegend__') + +# Plot the point estimate. +estimate = 1E4 +ax4.plot(0.5, estimate, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='point estimate') +ax4.vlines(0.5, 0, estimate, 'k', linestyle='--', lw=1, label='__nolegend__') +ax4.hlines(estimate, 0, 0.5, 'k', linestyle='--', lw=1, label='__nolegend__') + +# Plot the experimetnal data +for g, d in data.groupby(['dataset', 'dataset_name']): + ax4.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + + +################################### +# tRNA synthesis +################################### +data = pd.read_csv('../../data/compiled_estimate_categories.csv', comment='#') +data = data[data['shorthand']=='trna'] + +# Compute the trend +growth_rate = constants['growth_rate']['value'] +cell_mass = constants['cell_mass']['value'] +theta_dry = constants['dry_mass_frac']['value'] +theta_prot = constants['theta_prot']['value'] +t_double = constants['t_double']['value'] +m_aa = 110 / 6E11 # in pg +k_trna = 20 # per sec + +N_synthase = cell_mass * theta_dry * theta_prot / (m_aa * k_trna * t_double) + +ax5.xaxis.set_tick_params(labelsize=8) +ax5.yaxis.set_tick_params(labelsize=8) +ax5.set_yscale('log') +ax5.set_xlim([0, 2]) +ax5.set_ylim([1E3, 3E5]) +ax5.set_xlabel('growth rate [hr$^{-1}$]', fontsize=8) +ax5.set_ylabel('tRNA synthetases\nper cell', fontsize=8) + +# Plot the cell size dependence +ax5.plot(growth_rate[growth_rate > 0.23], N_synthase[growth_rate > 0.23], lw=3, color='grey', alpha=0.4, label='cell size dependence') +ax5.plot(growth_rate[growth_rate <= 0.23], N_synthase[growth_rate <= 0.23], ':', lw=3, color='grey', alpha=0.4, label='__nolegend__') + +# Plot the point estimate. +estimate = 1E4 +ax5.plot(0.5, estimate, 'o', ms=4.5, color=colors['dark_brown'], alpha=0.4, label='point estimate') +ax5.vlines(0.5, 0, estimate, 'k', linestyle='--', lw=1, label='__nolegend__') +ax5.hlines(estimate, 0, 0.5, 'k', linestyle='--', lw=1, label='__nolegend__') + +# Plot the experimetnal data +for g, d in data.groupby(['dataset', 'dataset_name']): + ax5.plot(d['growth_rate_hr'], d['n_complex'], 'o', ms=4, color=dataset_colors[g[0]], + markeredgewidth=0.5, markeredgecolor='k', label=g[1]) + + + +# ax2.legend(ncol=2, fontsize=8) +plt.tight_layout() +plt.savefig('../../figures/fig4_central_dogma.pdf')#, bbox_inches='tight') + + + + + +# %% diff --git a/code/figures/fig10ab_ribosome_as_limit.py b/code/figures/main_text/fig6ab_ribosome_as_limit.py similarity index 100% rename from code/figures/fig10ab_ribosome_as_limit.py rename to code/figures/main_text/fig6ab_ribosome_as_limit.py diff --git a/code/figures/fig11a_R_ori.py b/code/figures/main_text/fig7a_ribosomes_vs_volume.py similarity index 84% rename from code/figures/fig11a_R_ori.py rename to code/figures/main_text/fig7a_ribosomes_vs_volume.py index 8c1592b9..b7c0f337 100644 --- a/code/figures/fig11a_R_ori.py +++ b/code/figures/main_text/fig7a_ribosomes_vs_volume.py @@ -88,27 +88,17 @@ def func_lin(l, a, b): complex_ribo = complex_count[complex_count.complex_annotation == 'ribosome'] -complex_ribo['tau'] = 60*(np.log(2)/(complex_ribo['growth_rate_hr'])) -t_cyc_arr = [] -for i, val in enumerate(complex_ribo['tau'].values): - if val <= 40: - t_cyc_ = t_cyc_const - else: - t_cyc_ = func_lin(complex_ribo['growth_rate_hr'].values[i], *popt_tcyc_lin) - t_cyc_arr = np.append(t_cyc_arr, t_cyc_) - -complex_ribo['t_cyc'] = t_cyc_arr #func_lin(complex_ribo['growth_rate_hr'], *popt_tcyc_lin) -complex_ribo['# ori'] = 2**(complex_ribo['t_cyc'] / complex_ribo['tau'] ) - -# for g, d in complex_ribo.groupby(['dataset', 'condition', 'growth_rate_hr']): + for g, d in complex_ribo.groupby(['dataset', 'dataset_name']): - ax.plot(d['# ori'], d['n_units'], 'o', color=dataset_colors[g[0]], + ax.plot(size.lambda2size(d['growth_rate_hr']), d['n_units'], 'o', color=dataset_colors[g[0]], alpha=0.75, markeredgecolor='k', markeredgewidth=0.25, label = g[1], ms=4, zorder=10) -ax.set_xlabel('estimated # ori', fontsize=6) +ax.set_xlabel('estimated cell volume [fL]', fontsize=6) ax.set_ylabel('ribosomes per cell', fontsize=6) ax.xaxis.set_tick_params(labelsize=5) ax.yaxis.set_tick_params(labelsize=5) ax.legend(fontsize=6, loc = 'upper left') -plt.savefig('../../figures/fig11a_ribosome_vs_ori.pdf', bbox_inches='tight') + +plt.tight_layout() +plt.savefig('../../figures/fig7a_R_V.pdf', bbox_inches='tight') diff --git a/code/figures/fig12bc_elongation_rate_model.py b/code/figures/main_text/fig7de_elongation_rate_model.py similarity index 100% rename from code/figures/fig12bc_elongation_rate_model.py rename to code/figures/main_text/fig7de_elongation_rate_model.py diff --git a/code/figures/figA9_complex_counting.py b/code/figures/supplement/figS10_complex_counting.py similarity index 96% rename from code/figures/figA9_complex_counting.py rename to code/figures/supplement/figS10_complex_counting.py index a25d9d63..9ce7b4a0 100644 --- a/code/figures/figA9_complex_counting.py +++ b/code/figures/supplement/figS10_complex_counting.py @@ -46,4 +46,4 @@ ax[i].xaxis.set_tick_params(labelsize=3) ax[i].set_xticklabels(labels, rotation=90) ax[0].legend(loc='lower right', fontsize=6) -plt.savefig('../../figures/figA9_subunit_counting.pdf', bbox_inches='tight') +plt.savefig('../../figures/figS10_subunit_counting.pdf', bbox_inches='tight') diff --git a/code/figures/figA10_si_ori_ter_supplemental.py b/code/figures/supplement/figS11_si_ori_ter_supplemental.py similarity index 99% rename from code/figures/figA10_si_ori_ter_supplemental.py rename to code/figures/supplement/figS11_si_ori_ter_supplemental.py index b3f54b59..86a66f71 100644 --- a/code/figures/figA10_si_ori_ter_supplemental.py +++ b/code/figures/supplement/figS11_si_ori_ter_supplemental.py @@ -162,4 +162,4 @@ def func_lin(l, a, b): ax2.set_ylabel('t$_{cyc}$ [min]', fontsize=6) ax4.set_ylabel('t$_{cyc}$ [min]', fontsize=6) -fig.savefig('../../figures/figA10_supplemental_ori_ter.pdf', bbox_inches = 'tight') +fig.savefig('../../figures/figS11_supplemental_ori_ter.pdf', bbox_inches = 'tight') diff --git a/code/figures/supplement/figS12_RV_heatmaps.py b/code/figures/supplement/figS12_RV_heatmaps.py new file mode 100644 index 00000000..b727a21b --- /dev/null +++ b/code/figures/supplement/figS12_RV_heatmaps.py @@ -0,0 +1,100 @@ +#%% +import numpy as np +import pandas as pd +import prot.viz +import matplotlib.pyplot as plt +colors = prot.viz.plotting_style() + +def elongation_rate(R, r_AA, V=1E-15, K_D=5E-3, t=1, f_a = 1, rt_max=17.1): + + """ + Computes the average elongation rate of actively translating ribosomes + given the model parameters. + + Parameters + ---------- + R : array_like, float or int + The number of ribosomes in the desired cell volume. Must be greater than 0 + r_AA: array_like, float or int + The amino acid supply rate to the volume in units of AA per ribosome + V : array_like, float or int, optional + The unit volume to consider in units of L. Default value is 1 fL. + K_D: array_like, float, optional + The effective dissociation constant of aa-tRNAs to the ribosome in units + of M. Default value is 5 mM + t : float, optional + The timescale in units of seconds. Default value is 1 second. + f_a: float, optional + The fraction of the ribosome pool that is actively translating. Default value + is 1, implying all ribosomes are translating. + rt_max: float, optional + The maximal elongation rate in units of AA per second per ribosome. Default + value is 17.1 AA / sec / ribosome, which is the maximal elongation rate + in E. coli + + Returns + ------- + r_t: array_like + The average elongation rate of all actively elongating ribosomes. + """ + + N_A = 6.022E23 # Avogadro's number + prefix = K_D * N_A * V + R * f_a * rt_max * t + r_AA * t + sqrt_a = (K_D * N_A * V)**2 + (r_AA * t)**2 + (R * f_a * rt_max * t)**2 + sqrt_b = 2 * (K_D * N_A * R * V * f_a * rt_max* t + K_D * N_A * V * r_AA * t -\ + R * f_a * rt_max * r_AA * t**2) + denom = 2 * R * f_a * t + r_t = (prefix - np.sqrt(sqrt_a + sqrt_b)) / denom + return r_t + +def growth_rate_indep(phi_R, V, r_aa, f_a=1): + L_R = 7459 + N_pep = (V * 1.1E-12 * 0.3 * 0.5 * 6.022E23 / 110) + R = phi_R * N_pep / L_R + R_conc = R/V + r_aa_conc = r_aa/V + r_t = elongation_rate(R_conc, r_aa_conc) + return 3600 * r_t * R * f_a / N_pep + + +phi_R_range = np.linspace(0.05, 0.5, 200) +V_range = np.linspace(0.3, 2, 200) +rAA_range = [1E4, 5E5, 5E6, 1E8] +phi_R, V = np.meshgrid(phi_R_range, V_range) +heat_maps = [] + +for i, r in enumerate(rAA_range): + out = growth_rate_indep(phi_R, V, r) + heat_maps.append(out) + +fig, ax = plt.subplots(2, 2, figsize=(6, 6)) +for i, a in enumerate(ax.ravel()): + pcm = a.imshow(heat_maps[i], origin='lower', vmin=0, vmax=3, cmap='viridis') + conts = a.contour(np.arange(0, 200), np.arange(0, 200), + heat_maps[i], zorder=1000, colors='white') + # clabel = a.clabel(conts) + a.xaxis.set_tick_params(labelsize=6) + a.yaxis.set_tick_params(labelsize=6) + a.set_xlabel('$\Phi_R$', fontsize=8) + a.set_ylabel('volume [µm$^3$]', fontsize=8) + a.set_title('$r_{AA}$ = 10$^{' + f'{int(np.log10(rAA_range[i]))}' + '}$ AA / sec / cell', + fontsize=8, backgroundcolor=colors['pale_yellow'], y=1.08) + a.set_yticks([0, 50, 100, 150, 200]) + a.set_xticks([0, 50, 100, 150, 200]) + a.set_yticklabels([str(np.round(V_range[i], decimals=1)) for i in [0, 49, 99, 149, 199]]) + a.set_xticklabels([str(np.round(phi_R_range[i], decimals=1)) for i in [0, 49, 99, 149, 199]]) +fig.subplots_adjust(hspace=0.5, wspace=0.01) +bar = fig.colorbar(pcm, ax=ax, orientation='horizontal', + fraction=0.1, shrink=0.8, pad=0.08) +fig.text(0.12, 0.915, '(A)', fontsize=8) +fig.text(0.5, 0.915, '(B)', fontsize=8) +fig.text(0.12, 0.545, '(C)', fontsize=8) +fig.text(0.5, 0.545, '(D)', fontsize=8) +bar.ax.tick_params(labelsize=6) +bar.set_label('growth rate [hr$^{-1}$]', fontsize=8) +plt.savefig('../../figures/figS12_RV_heatmaps.pdf', bbox_inches='tight') +# bar.set_tickparams(labelsize=6) +# bar.set_title('growth rate [hr$^{-1}$]', fontsize=8) +# plt.tight_layout() + +# %% diff --git a/code/figures/supplement/figS13_chlor.py b/code/figures/supplement/figS13_chlor.py new file mode 100644 index 00000000..6713b859 --- /dev/null +++ b/code/figures/supplement/figS13_chlor.py @@ -0,0 +1,153 @@ +#%% +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt +import prot.viz +import prot.size as size +prot.viz.plotting_style() +colors, palette = prot.viz.bokeh_theme() +from mpl_toolkits.axes_grid1.inset_locator import inset_axes + +def elongation_rate(R, r_AA, V, K_D, t, f_a, rt_max): + + """ + Computes the average elongation rate of actively translating ribosomes + given the model parameters. + + Parameters + ---------- + R : array_like, float or int + The number of ribosomes in the desired cell volume. Must be greater than 0 + r_AA: array_like, float or int + The amino acid supply rate to the volume in units of AA per ribosome + V : array_like, float or int, optional + The unit volume to consider in units of L. + K_D: array_like, float, optional + The effective dissociation constant of aa-tRNAs to the ribosome in units + of M. + t : float, optional + The timescale in units of seconds. + f_a: float, optional + The fraction of the ribosome pool that is actively translating. Default value + is 1, implying all ribosomes are translating. + rt_max: float, optional + The maximal elongation rate in units of AA per second per ribosome. + + Returns + ------- + r_t: array_like + The average elongation rate of all actively elongating ribosomes. + """ + + N_A = 6.022E23 # Avogadro's number + prefix = K_D * N_A * V + R * f_a * rt_max * t + r_AA * t + sqrt_a = (K_D * N_A * V)**2 + (r_AA * t)**2 + (R * f_a * rt_max * t)**2 + sqrt_b = 2 * (K_D * N_A * R * V * f_a * rt_max* t + K_D * N_A * V * r_AA * t -\ + R * f_a * rt_max * r_AA * t**2) + denom = 2 * R * f_a * t + r_t = (prefix - np.sqrt(sqrt_a + sqrt_b)) / denom + return r_t + + +def compute_growth_rate(r_t, Naa, R, fa=1): + """ + Given an elongation rate, compute the growth rate. + """ + return 3600 * r_t * R * fa * Naa**-1 + + +# load in the data from Dai et al. 2016: +dai_Cm_df = pd.read_csv('../../data/dai2016_raw_data/dai2016_chlor_data_summary.csv') +dai_nut_df = pd.read_csv('../../data/dai2016_raw_data/dai2016_nutrient_data_summary.csv') + +color_dict = dict(zip(np.append(dai_Cm_df.condition.unique(), dai_nut_df.condition.unique()), palette)) + + +# color map for varying fraction of active ribosomes: +cm = plt.cm.get_cmap('viridis') + +# initialize plot +fig, ax = plt.subplots(1, 2, figsize = (8,4)) + +# we need to 'infer' best values for r_aa for each condition without +# antibiotic; we'll assume this doesn't change with the addition of chlor. +# place values in df_raa_est +df_raa_est = pd.DataFrame() + +for gr, d in dai_nut_df.groupby(['growth_rate_hr', 'condition']): + r_aa = np.logspace(-1,10, 1000) + # rt = compute_elongation_rate(r_aa, d['R'].values[0], Kd=1E-1, V=d['V'].values[0]*1E-15, #Kd=1E-5 + # t=60*60*(np.log(2)/d['growth_rate_hr'].values[0]), #t=d['growth_rate_hr'].values[0], + # Na=6.022E23, fa=d['f_a'].values[0], rt_max=18) + + rt = elongation_rate( d['R'].values[0], r_aa, V=d['V'].values[0]*1E-15, K_D=1E-1, + t=60*60*(np.log(2)/d['growth_rate_hr'].values[0]), f_a = d['f_a'].values[0], rt_max=18) + + + rt_compare = list(np.abs(rt - d['Translational elongation rate (aa/s)'].values[0])) + + minpos = rt_compare.index(min(rt_compare)) + + + df_raa_est_list = {'condition' : gr[1], + 'growth_rate_hr' : gr[0], + 'raa_bestfit' : r_aa[minpos], + 'rt' : d['Translational elongation rate (aa/s)'].values[0], + 'f_a' : d['f_a'].values[0], + 'rt_fit' : rt[minpos], + 'V' : d['V'].values[0], + 'R' : d['R'].values[0], + 'Naa' : d['Naa'].values[0], + 'Phi_R' : d['Phi_R'].values[0]} + df_raa_est = df_raa_est.append(df_raa_est_list, + ignore_index = True) + + ax[0].scatter(gr[0], rt[minpos], zorder=10, + color = 'k', alpha = 0.5) + + # also plot effect as fcn of f_a + f_a = np.linspace(0,d['f_a'].values[0],100) + # rt_fa = compute_elongation_rate(r_aa[minpos], d['R'].values[0], Kd=1E-1, V=d['V'].values[0]*1E-15, #Kd=1E-5 + # t=60*60*(np.log(2)/d['growth_rate_hr'].values[0]), #t=d['growth_rate_hr'].values[0], + # Na=6.022E23, fa=f_a, rt_max=18) + + rt_fa = elongation_rate( d['R'].values[0], r_aa[minpos], V=d['V'].values[0]*1E-15, K_D=1E-1, + t=60*60*(np.log(2)/d['growth_rate_hr'].values[0]), f_a = f_a, rt_max=18) + + + gr_fa = compute_growth_rate(rt_fa, d['Naa'].values[0], d['R'].values[0], f_a) + + sc = ax[0].scatter(gr_fa, rt_fa, c=f_a, cmap=cm, vmin = 0, vmax = 1, s = 4, alpha = 0.5) + +ax[0].set_ylim(8,17.5) +ax[0].set_xlim(0,2) +ax[0].set_xlabel('growth rate [hr$^{-1}$]', fontsize = 14) +ax[0].set_ylabel('elongation rate [aa/s]', fontsize = 14) +cbaxes = inset_axes(ax[0], width="30%", height="4%", loc=4) +plt.colorbar(sc, cax=cbaxes, ticks=[0.,1], orientation='horizontal') + +cbaxes.set_xlabel('active ribosomal fraction $f_a$') + + + +for cond, d in dai_Cm_df.groupby('condition'): + df_raa_est_ = df_raa_est[df_raa_est.condition == cond] + + rt = 1/((1/20) + 1/(6.4*31*d['RNA_P_ratio'])) + gr = compute_growth_rate(rt, df_raa_est_.Naa.values[0], df_raa_est_.R.values[0], fa=d['f_a'].values) + + ax[1].plot(gr, rt, zorder=10, ls = '--', + color = color_dict[cond]) + + ax[1].scatter(gr, d['Translational elongation rate (aa/s)'], zorder = 10, + color = color_dict[cond]) + + +ax[1].set_ylim(8,17.5) +ax[1].set_xlim(0,2) +ax[1].set_xlabel('growth rate', fontsize = 14) +ax[1].set_ylabel('elongation rate [aa/s]', fontsize = 14) + +plt.tight_layout() + +plt.savefig('../../figures/figS13_Cm_data.pdf') diff --git a/code/figures/fig2b_induced_expression_plots.py b/code/figures/supplement/figS1_induced_expression_plots.py similarity index 100% rename from code/figures/fig2b_induced_expression_plots.py rename to code/figures/supplement/figS1_induced_expression_plots.py diff --git a/code/figures/figA1_data_corrections_summary.py b/code/figures/supplement/figS2_data_corrections_summary.py similarity index 97% rename from code/figures/figA1_data_corrections_summary.py rename to code/figures/supplement/figS2_data_corrections_summary.py index d716b246..4fcb9f6c 100644 --- a/code/figures/figA1_data_corrections_summary.py +++ b/code/figures/supplement/figS2_data_corrections_summary.py @@ -78,4 +78,4 @@ ax_.set_xlabel('growth rate [hr$^{-1}$]', fontsize=6) plt.tight_layout() -fig.savefig('../../figures/figA1_dataset_corrections.pdf', bbox_inches='tight') +fig.savefig('../../figures/figS2_dataset_corrections.pdf', bbox_inches='tight') diff --git a/code/figures/figA2_dataset_intersections_venn.py b/code/figures/supplement/figS3_dataset_intersections_venn.py similarity index 96% rename from code/figures/figA2_dataset_intersections_venn.py rename to code/figures/supplement/figS3_dataset_intersections_venn.py index 2e48b800..573319e4 100644 --- a/code/figures/figA2_dataset_intersections_venn.py +++ b/code/figures/supplement/figS3_dataset_intersections_venn.py @@ -52,7 +52,7 @@ } venn(datasets, cmap = [colors['light_blue'], colors['green'], colors['purple'], colors['red']]) -plt.savefig('../../figures/figA2_intersections_venn.pdf', bbox_inches='tight') +plt.savefig('../../figures/figS3_intersections_venn.pdf', bbox_inches='tight') # %% diff --git a/code/figures/figA3_Si_et_al_size_data_fit.py b/code/figures/supplement/figS4_Si_et_al_size_data_fit.py similarity index 99% rename from code/figures/figA3_Si_et_al_size_data_fit.py rename to code/figures/supplement/figS4_Si_et_al_size_data_fit.py index e0636b01..9fd568b3 100644 --- a/code/figures/figA3_Si_et_al_size_data_fit.py +++ b/code/figures/supplement/figS4_Si_et_al_size_data_fit.py @@ -202,4 +202,4 @@ def func2(x, a, c): plt.tight_layout() -fig.savefig('../../figures/figA3_Si_size_data_fit.pdf', bbox_inches='tight') +fig.savefig('../../figures/figS4_Si_size_data_fit.pdf', bbox_inches='tight') diff --git a/code/figures/figA4_estimate_protein_per_cell.py b/code/figures/supplement/figS5_estimate_protein_per_cell.py similarity index 98% rename from code/figures/figA4_estimate_protein_per_cell.py rename to code/figures/supplement/figS5_estimate_protein_per_cell.py index 8285ed80..c1d82447 100644 --- a/code/figures/figA4_estimate_protein_per_cell.py +++ b/code/figures/supplement/figS5_estimate_protein_per_cell.py @@ -187,7 +187,7 @@ def func(x, a, c, d): ax[2].set_ylabel('concentration [fg/fL]', fontsize=6) ax[2].set_ylim(0,270) -ax[3].set_ylabel('protein mass per cell [fg]', fontsize=6) +ax[3].set_ylabel('mass per cell [fg]', fontsize=6) ax[3].legend(loc = 'upper left', fontsize=6) ax[3].set_ylim(0,850) @@ -222,4 +222,4 @@ def func(x, a, c, d): # plt.tight_layout() -fig.savefig('../../figures/figA4_predict_protein_per_cell.pdf', bbox_inches='tight') +fig.savefig('../../figures/figS5_predict_protein_per_cell.pdf', bbox_inches='tight') diff --git a/code/figures/figA5_naa_v_ribosome_inference.py b/code/figures/supplement/figS6_naa_v_ribosome_inference.py similarity index 97% rename from code/figures/figA5_naa_v_ribosome_inference.py rename to code/figures/supplement/figS6_naa_v_ribosome_inference.py index 4d9bf18c..984b2aed 100644 --- a/code/figures/figA5_naa_v_ribosome_inference.py +++ b/code/figures/supplement/figS6_naa_v_ribosome_inference.py @@ -68,6 +68,6 @@ ax[0].legend(fontsize=6, loc='lower right') ax[1].legend(fontsize=6, loc='lower right') plt.tight_layout() -plt.savefig('../../figures/figA5_linear_regression_naa_volume_ribosomes.pdf') +plt.savefig('../../figures/figS6_linear_regression_naa_volume_ribosomes.pdf') # %% diff --git a/code/figures/figA6_cell_size_literature.py b/code/figures/supplement/figS7_cell_size_literature.py similarity index 97% rename from code/figures/figA6_cell_size_literature.py rename to code/figures/supplement/figS7_cell_size_literature.py index 52e25ad4..7b60ae6f 100644 --- a/code/figures/figA6_cell_size_literature.py +++ b/code/figures/supplement/figS7_cell_size_literature.py @@ -82,4 +82,4 @@ def func(x, a, c, d): plt.tight_layout() -fig.savefig('../../figures/figA6_size_data_lit.pdf', bbox_inches='tight') +fig.savefig('../../figures/figS7_size_data_lit.pdf', bbox_inches='tight') diff --git a/code/figures/figA7_schmidt_correction_approaches.py b/code/figures/supplement/figS8_schmidt_correction_approaches.py similarity index 99% rename from code/figures/figA7_schmidt_correction_approaches.py rename to code/figures/supplement/figS8_schmidt_correction_approaches.py index 819d1543..73e5b7ad 100644 --- a/code/figures/figA7_schmidt_correction_approaches.py +++ b/code/figures/supplement/figS8_schmidt_correction_approaches.py @@ -188,4 +188,4 @@ def func(x, a, c, d): plt.tight_layout() -fig.savefig('../../figures/figA7_schmidt_corrections_approaches.pdf', bbox_inches='tight') +fig.savefig('../../figures/figS8_schmidt_corrections_approaches.pdf', bbox_inches='tight') diff --git a/code/figures/figA8_basan_protein.py b/code/figures/supplement/figS9_basan_protein.py similarity index 96% rename from code/figures/figA8_basan_protein.py rename to code/figures/supplement/figS9_basan_protein.py index e3cc3de4..d1a9aa27 100644 --- a/code/figures/figA8_basan_protein.py +++ b/code/figures/supplement/figS9_basan_protein.py @@ -49,4 +49,4 @@ def func(x, a, c, d): plt.tight_layout() -fig.savefig('../../figures/figA8_protein_basan.pdf', bbox_inches='tight') +fig.savefig('../../figures/figS9_protein_basan.pdf', bbox_inches='tight')