EcmResults

Analyze optimization solutions derived from enzyme constraint models, e.g. GECKO or TGECKO.

class f2xba.EcmResults(optim, results, df_mpmf=None)[source]

Optimization results processing for enzyme constraint models generated by f2xba.

Using the EcmOptimization class, one or several model optimization solutions can be determined, e.g. across different media conditions. Solutions can be collected in a dictionary.

Example: optimization solutions has been determined for growth on glucose and acetate. Proteomics data df_mpmf has been measured in mg protein per g total protein for one or several media conditions.

er = EcmResults(eo, {'glucose': solution_glc, 'acetate': solution_ac}, df_mpmf)
collect_protein_results(units='mg_per_gP')[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()
Parameters:

units (str) – (optional) concentration units: ‘mg_per_gP’ (default: ‘mg_per_gP’)

Returns:

table with predicted proteins concentrations

Return type:

pandas.DataFrame

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’

plot_proteins(condition, lin_max=None, plot_fname=None)

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’

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)

report_protein_levels(condition)

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

report_proteomics_correlation(scale='lin')

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’)

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