FbaResults¶
Analyze optimization solutions derived from FBA and TFA models.
- class f2xba.FbaResults(optim, results)[source]¶
Process optimization solution for FBA and TFA models.
Using the FbaOptimization class, one or several model optimization solutions can be determined, e.g. across different media conditions. Solutions can be collected in a dictionary.
Example: Prepare the processing of optimization solutions for two different conditions.
fr = FbaResults(fo, {'glucose': solution_glc, 'acetate': solution_ac})
- collect_fluxes(net=False)¶
Extract predicted reaction fluxes (mmol/gDWh) from optimization results.
In extended models, reactions may be divided into forward and reverse directions, as well as into reactions catalyzed by isoenzymes. When the “net” parameter is set to True, fluxes of split reactions are combined.
For RBA models, production (PROD) and degradation (DEGR) fluxes for macromolecule synthesis and degradation will be included in the returned table.
Information columns are incorporated to provide context and facilitate data filtration.
Example: Retrieve predicted reaction fluxes and net reaction fluxes from model optimization.
df_fluxes = er.collect_fluxes() df_net_fluxes = er.collect_fluxes(net=True)
- Parameters:
net (bool) – (optional) summarize fluxes on reaction level, if True (default: False)
- Returns:
table with predicted reaction fluxes
- Return type:
pandas.DataFrame
- collect_species_conc()¶
Extract predicted species concentrations (mmol/l) from optimization results.
Available for thermodynamics constraint models like TFA, TGECKO and TRBA.
Information columns are incorporated to provide context and facilitate data filtration.
Example: Retrieve predicted species concentrations from TD constraint model optimization.
df_species_conc = fr.collect_species_conc()
- Returns:
table with predicted species concentrations in mmol/l
- Return type:
pandas.DataFrame
- property objective_values¶
Query objective values related to results.
- Returns:
conditions with values for optimization objective
- Return type:
dict
- plot_grs(exp_grs, gr_max=None, highlight=None, plot_fname=None)¶
Plot predicted vs. measured growth rates.
Plot predicted vs. measured growth rates (exp_grs). A ‘reference’ condition can be highlighted using the optional parameter highlight. The maximum value can be fixed with optional parameter gr_max. The plot can be exported to file using the optional parameter plot_fname. The plot is created using matplotlib.pyplot.
Example: Plot predicted vs. measured growth rates and export plot to pdf.
exp_grs = {'acetate': 0.29, 'glycerol': 0.47, 'glucose': 0.66} er.plot_grs(exp_grs, highlight='glucose', plot_fname='growth_rates.pdf')
- Parameters:
exp_grs (dict(str, float)) – (media) conditions with measured growth rates (h-1)
gr_max (float) – (optional) max growth rate on axis
highlight (str) – (optional) reference condition to be highlighted
plot_fname (str) – (optional) filename to export plot with extension ‘.pdf’
- report_gr_correlation(exp_grs)¶
Report on predicted vs. measured growth rates.
Example: Print a report how well predicted growth rates correlate with measured growth rates.
exp_grs = {'acetate': 0.29, 'glycerol': 0.47, 'glucose': 0.66} er.report_gr_correlation(exp_grs)
- Parameters:
exp_grs (dict(str, float)) – (media) conditions with measured growth rates (h-1)
- save_to_escher(results_table, base_fname)¶
Export optimization solutions for upload into Escher maps.
Escher maps (https://escher.github.io) provide a visual representation of optimization results. Either use already existing Escher maps or generate maps compliant to your SBML model.
Ref: King, Z. A., Dräger, A., Ebrahim, A., Sonnenschein, N., Lewis, N. E., & Palsson, B. O. (2015). Escher: A Web Application for Building, Sharing, and Embedding Data-Rich Visualizations of Biological Pathways. PLOS Computational Biology, 11(8), e1004321. https://doi.org/10.1371/journal.pcbi.1004321
Predicted reaction fluxes, protein levels and metabolite concentrations can be exported in JSON format, which is compatible for upload into Escher maps. File names are generated automatically by extending the base_fname. Values with absolute value (<1e-8) are not exported.
Example 1: Export predicted net fluxes for one specified condition.
er.save_to_escher(df_net_fluxes['glucose'], 'iML1515_GECKO')
Example 2: Export predicted protein levels for all conditions.
er.save_to_escher(df_proteins, 'iML1515_GECKO')
Example 3: Export predicted metabolite concentrations for a TD constraint model.
fr.save_to_escher(df_species_conc['glucose'], 'iML1515_TFA')
- Parameters:
results_table (pandas.DataFrame or pandas.Series) – table with optimization solutions
base_fname (str) – base name used to construct filenames for export