Results analysis¶
FBA model optimization determines values for only one type of optimization variables, namely reaction fluxes. Optimization of extended models determines values for different types of optimization variables. Variables include reaction fluxes, which may be split per catalyzing isoenzyme and direction, but also include variables for protein, enzyme and metabolite concentration. Meaningful presentation of optimization results become more challenging. Further, predicted values may be compared to measured values, results may be enriched with information, and data may be converted for downstream processing.
- FbaResults
- EcmResults
- RbaResults
RbaResultsRbaResults.collect_protein_results()RbaResults.collect_enzyme_results()RbaResults.collect_rna_results()RbaResults.collect_density_results()RbaResults.collect_fluxes()RbaResults.collect_species_conc()RbaResults.plot_grs()RbaResults.plot_proteins()RbaResults.report_gr_correlation()RbaResults.report_protein_levels()RbaResults.report_proteomics_correlation()RbaResults.save_to_escher()
Results¶
Base class for optimization results analysis. Analysis is independent of the interface used to retrieve the optimization solutions.
- class f2xba.optimization.results.Results(optim, results, df_mpmf=None)[source]¶
Process solutions obtained by optimizing extended models (base class).
Results is parent to FbaResults, EcmResults and RbaResults classes. Results is independent of the interface used during optimization (COBRApy, gurobipy) and provides common functionality for processing of optimization solutions across one or several conditions.
Example: Prepare the processing of optimization solutions for two different conditions.
er = EcmResults(eo, {'glucose': solution_glc, 'acetate': solution_ac}, df_mpmf)
- collect_fluxes(net=False)[source]¶
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
- abstract collect_protein_results()[source]¶
Extract predicted protein concentrations from optimization results.
Information columns are incorporated to provide context and facilitate data filtration.
df_proteins = er.collect_protein_results()
This method is not available for FBA and TFA models.
- Returns:
table with predicted protein concentrations
- Return type:
pandas.DataFrame
- collect_species_conc()[source]¶
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
- report_gr_correlation(exp_grs)[source]¶
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)
- report_proteomics_correlation(scale='lin')[source]¶
Report on predicted vs. measured protein mass fractions.
Example: Report on protein correlation for linear scaled protein mass fractions.
er.report_proteomics_correlation(scale='lin')
This method is not available for FBA and TFA models.
- Parameters:
scale (str) – (optional) numerical value scale: ‘lin’ or ‘log’ (default: ‘lin’)
- report_protein_levels(condition)[source]¶
Report on predicted vs. measured protein levels split per reaction type for given condition.
Example: Detailed report on protein correlation split per type of reactions for one condition.
er.report_protein_levels('glucose')
This method is not available for FBA and TFA models.
- Parameters:
condition (str) – (media) condition in optimization results
- save_to_escher(results_table, base_fname)[source]¶
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
- plot_grs(exp_grs, gr_max=None, highlight=None, plot_fname=None)[source]¶
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’
- plot_proteins(condition, lin_max=None, plot_fname=None)[source]¶
Plot predicted vs. measured protein levels for given condition.
Plots predicted vs. measured protein levels for given condition in linear and log scale. The maximum protein mass fraction on linear scaled plot can be limited by the optional parameter lin_max. The plots can be exported to file using the optional parameter plot_fname. The plot is created using matplotlib.pyplot.
Example: Plot protein correlation for one condition and export to pdf file.
er.plot_proteins('glucose', plot_fname='proteins_glucose.pdf')
This method is not available for FBA and TFA models.
- Parameters:
condition (str) – selected (media) condition in optimization results
lin_max – (optional) max value in linear scaled plot
plot_fname (str) – (optional) filename to export plot with extension ‘.pdf’