Analysis module
Documentation for the mimeco.analysis module. This module contains the main functions of mimeco, designed for users.
Created on Mon Jan 20 09:46:31 2025
@author: e158401a
- mimeco.analysis.crossfed_metabolites(model1, model2, solver, model1_biomass_id, model2_biomass_id, medium=None, undescribed_metabolites_constraint=None, undescribed_met_lb=-0.1, sample_size=1000, exchange_correlation=0.5, biomass_correlation=0.8, lower_exchange_proportion=0.3, plot=False, retrieve_data='no')
A function that, given 2 models in the same namespace and a defined medium, predicts metabolic exchanges that are correlated with one model’s objective value. Correlation options can be customized. Spearman correlation is used. plot and retrieve_data options enable further analysis (see documentation)
- Parameters:
model1 (cobra.Model)
model2 (cobra.Model)
solver (string) – solver supported by the cobra toolbox. “cplex” or “gurobi” are recommended but require prior installation.
model1_biomass_id (string) – id of the reaction used as objective in model1 (if the objective coefficient is not null for several reactions, then a new reaction must be built to constrain the model to a given objective value through its flux)
model2_biomass_id (string) – id of the reaction used as objective in model2 (if the objective coefficient is not null for several reactions, then a new reaction must be built to constrain the model to a given objective value through its flux)
medium (pandas series) – Index : metabolites names values : Availability of corresponding metabolite in the medium as a positive flux value.
undescribed_metabolites_constraint (string (“blocked”, “partially_constrained” or “as_is”).) – How strictly constrained are the medium metabolites for which the flux is not described in the medium dataframe. “blocked” : They are not available in the medium at all (can result in model unable to grow) “partially_constrained” : They are made available with an influx in the medium of 1 mmol.gDW^-1.h^-1 “as_is” : Their availability is the same as in the original inputted model.
undescribed_met_lb (negative float, optional) – Lower bound assigned to metabolites exchanges reactions that are not described in the given medium, when the “undescribed_metabolic_constraint” argument is set to “partially_constrained”. Default is -0.1
sample_size (int, optional) – Number of samples sampled from the Pareto front to infer correlation between exchange reactions and biomass. The default is 1000.
exchange_correlation (float between 0 and -1, optional) – defines the threshold for the correlation between secretion and uptake of a same metabolite by paired models for this metabolite to be considered exchanged default is 0.5
biomass_correlation (float between 0 and 1, optional) – correlation threshold between the exchange of the metabolite and the biomass production of model2 for its selection as crossfed. default is 0.8
lower_exchange_proportion (float between 0 and 1, optional) – proportion of the sampling solutions in which the metabolite of interest is secreted by one organism and uptaken by the other.
plot (Boolean, optional) – Rudimentary integrated plot function to visualize Pareto front. default is False
retrieve_data (str, optionnal) – Returns data that can be used for custom analysis. “all”: returns the sampling dataframe containing the fluxes of each reaction of the ecosystem in all samples. “selection”: returns a subset of the sampling dataframe, containing the predicted crossfed metabolites exchange fluxes in all samples of the Pareto front, as well as the objective value of each model in these samples. If retrieve_data is set on “all” or “selection”, the function returns a second variable with the corresponding dataframe. default is “no”
- Returns:
potential_crossfeeding (pandas.dataframe) – columns : metabolite_id model_benefiting, proportion_exchange (proportion of samples featuring inverse secretion/uptake for a same metabolite), proportion_model1_to_model2 (proportion of samples with metabolite exchange from model1 to model2), proportion_model2_to_model1 (proportion of samples with metabolite exchange from model2 to model1), correlation_obj_model1, correlation_obj_model2
sampling_data (pandas dataframe) – Dataframe based on the sampling, resulting in each row being a sample. if retrieve_data == “selection” The first two columns records the objective value, in the given sample, of both models. Other columns are, by pairs, the flux values of the exchange reactions of a crossfed metabolite for both models. if retrieve_data == “all” Columns are all reaction of the ecosystem model in the order of ecosys.reactions.
- mimeco.analysis.enterocyte_crossfed_metabolites(model, solver, model_biomass_id, medium=None, undescribed_metabolites_constraint=None, undescribed_met_lb=-0.1, plot=False, sample_size=1000, exchange_correlation=0.5, biomass_correlation=0.8, retrieve_data='no')
A function that, given 2 models in the same namespace and a defined medium, predicts metabolic exchanges that are correlated with the evolution of a model’s objective value.
- Parameters:
model (cobra.Model)
solver (string) – solver supported by the cobra toolbox. “cplex” or “gurobi” are recommended but require prior installation.
model_biomass_id (string) – id of the reaction used as objective in model (if the objective coefficient is not null for several reactions, then a new reaction must be built to constrain the model to a given objective value through its flux)
medium (pandas series) – Index : metabolites names values : Availability of corresponding metabolite in the medium as a positive flux value.
undescribed_metabolites_constraint (string (“blocked”, “partially_constrained” or “as_is”).) – How strictly constrained are the medium metabolites for which the flux is not described in the medium dataframe. “blocked” : They are not available in the medium at all (can result in model unable to grow) “partially_constrained” : They are made available with an influx in the medium of 1 mmol.gDW^-1.h^-1 “as_is” : Their availability is the same as in the original inputted model.
undescribed_met_lb (negative float, optional) – Lower bound assigned to metabolites exchanges reactions that are not described in the given medium, when the “undescribed_metabolic_constraint” argument is set to “partially_constrained”. Default is -0.1
plot (Boolean, optional) – Rudimentary integrated plot function to visualize Pareto front.
sample_size (int, optional) – Number of samples sampled from the Pareto front to infer correlation between exchange reactions and biomass. Default is 1000.
exchange_correlation (float between 0 and -1, optional) – defines the threshold for the correlation between secretion and uptake of a same metabolite by paired models for this metabolite to be considered exchanged default is 0.5
biomass_correlation (float between 0 and 1, optional) – correlation threshold between the exchange of the metabolite and the biomass production of model2 for its selection as crossfed. default is 0.8
retrieve_data (str, optional) – Returns data that can be used for custom analysis. “all”: returns the sampling dataframe containing the fluxes of each reaction of the ecosystem in all samples. “selection”: returns a subset of the sampling dataframe, containing the predicted crossfed metabolites exchange fluxes in all samples of the Pareto front, as well as the objective value of each model in these samples. If retrieve_data is set on “all” or “selection”, the function returns a second variable with the corresponding dataframe. default is “no”
- Returns:
potential_crossfeeding (pandas.dataframe) – columns : metabolite_id model_benefiting, proportion_exchange (proportion of samples featuring inverse secretion/uptake for a same metabolite), proportion_model1_to_model2 (proportion of samples with metabolite exchange from model1 to model2), proportion_model2_to_model1 (proportion of samples with metabolite exchange from model2 to model1), correlation_obj_model1, correlation_obj_model2
sampling_data (pandas dataframe) – Dataframe based on the sampling, resulting in each row being a sample. if retrieve_data == “selection” The first two columns records the objective value, in the given sample, of both models. Other columns are, by pairs, the flux values of the exchange reactions of a crossfed metabolite for both models. if retrieve_data == “all” Columns are all reaction of the ecosystem model in the order of ecosys.reactions.
- mimeco.analysis.enterocyte_interaction_score_and_type(model, solver, medium=None, undescribed_metabolites_constraint=None, undescribed_met_lb=-0.1, namespace='bigg', plot=False)
A function infering the interaction between a given model and a small intestinal epithelial cell (sIEC) adapted from https://doi.org/10.1093/hmg/ddt119. Returns qualitative (interaction_type) and quantitative (interaction_score) information on their metabolic interaction.
- Parameters:
model (cobra.Model)
medium (pandas series) – Index : metabolites names values : Availability of corresponding metabolite in the medium as a positive flux value.
undescribed_metabolites_constraint (string (“blocked”, “partially_constrained” or “as_is”).) – How strictly constrained are the medium metabolites for which the flux is not described in the medium dataframe. “blocked” : They are not available in the medium at all (can result in model unable to grow) “partially_constrained” : They are made available with an influx in the medium of 1 mmol.gDW^-1.h^-1 “as_is” : Their availability is the same as in the original inputted model.
solver (string) – solver supported by the cobra toolbox. “cplex” or “gurobi” are recommended but require prior installation.
undescribed_met_lb (negative float, optional) – Lower bound assigned to metabolites exchanges reactions that are not described in the given medium, when the “undescribed_metabolic_constraint” argument is set to “partially_constrained”. Default is -0.1
namespace (string, optionnal) – “bigg” : enterocyte and medium in the BiGG namespace. Compatible with CarveMe. “agora” : enterocyte and medium in the Agora namespace: Compatible with Agora and VMH models. (Built with Model SEED / Kbase) default is “bigg”
plot (Boolean, optional) – Rudimentary integrated plot function to visualize Pareto front. default is False
- Returns:
interaction_score (float) – Predicts the nature of the interaction between host and model 2. Score < 0 predicts a competitive interaction, Score = 0 predicts a neutral interaction Score > 0 predicts a positive interaction
interaction_type (string) – Qualitative description of the interaction.
- mimeco.analysis.interaction_score_and_type(model1, model2, medium=None, undescribed_metabolites_constraint=None, undescribed_met_lb=-0.1, plot=False, verbose=False)
A function that, given 2 models in the same namespace and a defined medium, analyses the interaction between the two models, infering qualitative (interaction_type) and quantitative (interaction_score) information on their metabolic interaction.
- Parameters:
model1 (cobra.Model)
model2 (cobra.Model)
medium (pandas series) – Index : metabolites names values : Availability of corresponding metabolite in the medium as a positive flux value.
undescribed_metabolites_constraint (string (“blocked”, “partially_constrained” or “as_is”).) – How strictly constrained are the medium metabolites for which the flux is not described in the medium dataframe. “blocked” : They are not available in the medium at all (can result in model unable to grow) “partially_constrained” : They are made available with an influx in the medium of 1 mmol.gDW^-1.h^-1 “as_is” : Their availability is the same as in the original inputted model.
undescribed_met_lb (negative float, optional) – Lower bound assigned to metabolites exchanges reactions that are not described in the given medium, when the “undescribed_metabolic_constraint” argument is set to “partially_constrained”. Default is -0.1
plot (Boolean, optional) – Rudimentary integrated plot function to visualize the exchange fluxes of predicted crossfed metabolite along the Pareto sampling. default is False
verbose (Boolean, optional) – If True, will print models maximal growth in monoculture and co-culture.
- Returns:
interaction_score (float) – Predicts the nature of the interaction between model1 and model2. Score < 0 predicts a competitive interaction, Score = 0 predicts a neutral interaction Score > 0 predicts a positive interaction
interaction_type (string) – Qualitative description of the interaction.