1. Preprocessing Flux Data for Plots

[1]:
import os
import pandas as pd
from scarcc.preparation.metabolic_model import BasicModel
from scarcc.preparation.find_directory import find_directory
from scarcc.data_analysis import (get_biomass_df, get_end_BM, get_carbon_allocation_E_wide)
model_directory = find_directory('models', os.path.abspath(''))
data_directory = find_directory('Data', os.path.abspath(''))

# initialize model
E0, S0, all_components = BasicModel(model_directory=model_directory, flux_weighting=True).load_ES_models()
flux_path = os.path.join(data_directory, 'checkerboard_flux_snapshot.csv')
gr_path = os.path.join(data_directory, 'gr_DG_checkerboard_normalized.csv')
gr_df = pd.read_csv(gr_path, index_col=0)
alpha_table = pd.read_csv(os.path.join(data_directory, 'checkerboard_alpha_table.csv'), index_col=0)
biomass_df = get_biomass_df([os.path.join(data_directory, 'checkerboard_run4.csv')])
end_BM = get_end_BM(biomass_df)

carbon_allocation_E_wide = get_carbon_allocation_E_wide(E0, all_components, additive_threshold=0.05, flux_analysis_file=flux_path, gr_file=gr_path, end_BM=end_BM)
# carbon_allocation_E_wide.to_csv(os.path.join(data_directory, 'carbon_allocation_E_wide_checkerboard.csv'))

[1]:
# Gene combinations run
[2]:
flux_path = os.path.join(data_directory, 'flux_analysis_m1.csv')
gr_path = os.path.join(data_directory, 'gr_DG_m1_normalized.csv')
gr_df = pd.read_csv(gr_path, index_col=0)
alpha_table = pd.read_csv(os.path.join(data_directory, 'alpha_table_m1.csv'), index_col=0)
biomass_df_file_list = ['BM_SG_m1.csv', 'BM_DG_m1.csv']
biomass_df = get_biomass_df([os.path.join(data_directory, file) for file in biomass_df_file_list])
end_BM = get_end_BM(biomass_df)

carbon_allocation_E_wide = get_carbon_allocation_E_wide(E0, all_components, additive_threshold=0.05, flux_analysis_file=flux_path, gr_file=gr_path, end_BM=end_BM)
carbon_allocation_E_wide.to_csv(os.path.join(data_directory, 'carbon_allocation_E_wide_m1.csv'))
[2]:
# add flux full and pathway info
[ ]: