This notebook uses the OMG library to create times series of synthetic "experimental" data (transcriptomics, proteomics, metabolomics, fluxomics, cell density, external metabolites), that will be used to demonstrate the use of ICE and EDD. These data will also be the base for creating similar data for bioengineereed strains.
Tested using biodesign_3.7 kernel on jprime.lbl.gov (see github repository for kernel details)
iJO1366_MVA.json
file in the ../data/models
directory)EDD_experiment_description_file_WT.csv
EDD_OD_WT.csv
EDD_external_metabolites_WT.csv
EDD_transcriptomics_WT.csv
EDD_proteomics_WTSM.csv
EDD_metabolomics_WTSM.csv
EDD_fluxomics_WT.csv
The files are stored in the user defined directory.
Clone the git repository with the OMG
library:
git clone https://github.com/JBEI/OMG.git
or pull the latest version.
Importing needed libraries:
import sys
sys.path.insert(1, '../../OMG')
sys.path.append('../')
import omg
from plot_multiomics import *
import cobra
user_params = {
'host': 'ecoli', # ecoli or ropacus supported
'modelfile': '../data/models/iJO1366_MVA.json', # GSM host model file location
'cerevisiae_modelfile': '../data/models/iMM904.json', # GSM pathway donor model file location
'timestart': 0.0, # Start and end for time in time series
'timestop': 8.0,
'numtimepoints': 9, # Number of time points
'mapping_file': '../mapping/inchikey_to_cid.txt', # Maps of metabolite inchikey to pubchem compound id (cid)
'output_file_path': '../data/omg_output/', # Folder for output files
'edd_omics_file_path': '../data/omg_output/edd/', # Folder for EDD output files
'numreactions': 8, # Number of total reactions to be bioengineered
'ext_metabolites': { # Initial concentrations (in mMol) of external metabolites
'glc__D_e': 22.203,
'nh4_e': 18.695,
'pi_e': 69.454,
'so4_e': 2.0,
'mg2_e': 2.0,
'k_e': 21.883,
'na1_e': 103.7,
'cl_e': 27.25,
'isoprenol_e': 0.0,
'ac_e': 0.0,
'for_e': 0.0,
'lac__D_e': 0.0,
'etoh_e': 0.0
},
'initial_OD': 0.01,
'BIOMASS_REACTION_ID': 'BIOMASS_Ec_iJO1366_core_53p95M' # Biomass reaction in host GSM
}
First we obtain the metabolic model:
file_name = user_params['modelfile']
model = cobra.io.load_json_model(file_name)
We now add minimum flux constraints for production of isoprenol and formate, and we limit oxygen intake:
iso = 'EX_isoprenol_e'
iso_cons = model.problem.Constraint(model.reactions.EX_isoprenol_e.flux_expression,lb = 0.20)
model.add_cons_vars(iso_cons)
for_cons = model.problem.Constraint(model.reactions.EX_for_e.flux_expression,lb = 0.10)
model.add_cons_vars(for_cons)
o2_cons = model.problem.Constraint(model.reactions.EX_o2_e.flux_expression,lb = -8.0)
model.add_cons_vars(o2_cons)
And then we constrain several central carbon metabolism fluxes to more realistic upper and lower bounds:
CC_rxn_names = ['ACCOAC','MDH','PTAr','CS','ACACT1r','PPC','PPCK','PFL']
for reaction in CC_rxn_names:
reaction_constraint = model.problem.Constraint(model.reactions.get_by_id(reaction).flux_expression,lb = -1.0,ub = 1.0)
model.add_cons_vars(reaction_constraint)
First create time grid for simulation:
t0 = user_params['timestart']
tf = user_params['timestop']
points = user_params['numtimepoints']
tspan, delt = np.linspace(t0, tf, points, dtype='float64', retstep=True)
grid = (tspan, delt)
We then use this model to obtain the times series for fluxes, OD and external metabolites, by solving the model for each time point:
solution_TS, model_TS, cell, Emets, Erxn2Emet = \
omg.get_flux_time_series(model, user_params['ext_metabolites'], grid, user_params)
These are the external metabolites concentrations as a function of time:
Emets
plot_DO_extmets(cell, Emets[['glc__D_e','isoprenol_e','ac_e','for_e','lac__D_e','etoh_e']])
We now obtain the multiomics data for each time point:
proteomics_timeseries = {}
transcriptomics_timeseries = {}
metabolomics_timeseries = {}
metabolomics_oldids_timeseries = {}
fluxomics_timeseries = {}
# By setting the old_ids flag to True, we get two time series for metabolomics data: one with Pubchem CIDs and one with BIGG ids.
# Setting the old_ids flag to False and returns only three dictionaries:proteomics, transcriptomics, metabolomics
for t in tspan:
fluxomics_timeseries[t] = solution_TS[t].fluxes.to_dict()
(proteomics_timeseries[t], transcriptomics_timeseries[t],
metabolomics_timeseries[t], metabolomics_oldids_timeseries[t]) = omg.get_multiomics(model,
solution_TS[t],
user_params['mapping_file'],
old_ids=True)
First write the experiment description files needed for input (label indicates a label at the end of the file name):
omg.write_experiment_description_file(user_params['edd_omics_file_path'], line_name='WT', label='_WT')
Write OD data:
omg.write_OD_data(cell, user_params['edd_omics_file_path'], line_name='WT', label='_WT')
Write external metabolites:
omg.write_external_metabolite(Emets, user_params['edd_omics_file_path'], line_name='WT', label='_WT')
Write multiomics data:
omg.write_omics_files(fluxomics_timeseries, 'fluxomics', user_params, line_name='WT', label='_WT')
omg.write_omics_files(proteomics_timeseries, 'proteomics', user_params, line_name='WT', label='_WT')
omg.write_omics_files(transcriptomics_timeseries, 'transcriptomics', user_params, line_name='WT', label='_WT')
omg.write_omics_files(metabolomics_timeseries, 'metabolomics', user_params, line_name='WT', label='_WT')
We will also write a small version of the multiomics data with a subset of proteins, transcripts and metabolites:
genesSM = ['b0180','b2708','b3197','b1094','b2224','b3256','b2316','b3255','b0185','b1101']
proteinsSM = ['P17115','P76461','P0ABD5','P00893','P15639','P0AC44','P0A6I6','P0A9M8']
metabolitesSM = ['CID:1549101','CID:175','CID:164533','CID:15938965','CID:21604863','CID:15939608','CID:27284','CID:1038','CID:16741146','CID:1778309']
transcriptomics_timeseriesSM ={}
proteomics_timeseriesSM ={}
metabolomics_timeseriesSM ={}
for t in tspan:
transcriptomics_timeseriesSM[t] = {gene: transcriptomics_timeseries[t][gene] for gene in genesSM}
proteomics_timeseriesSM[t] = {protein: proteomics_timeseries[t][protein] for protein in proteinsSM}
metabolomics_timeseriesSM[t] = {metab: metabolomics_timeseries[t][metab] for metab in metabolitesSM}
omg.write_omics_files(proteomics_timeseriesSM, 'proteomics' , user_params, line_name='WT', label='_WTSM')
omg.write_omics_files(transcriptomics_timeseriesSM,'transcriptomics', user_params, line_name='WT', label='_WTSM')
omg.write_omics_files(metabolomics_timeseriesSM, 'metabolomics' , user_params, line_name='WT', label='_WTSM')