corneto.methods.MultiSampleIMAT#

class corneto.methods.MultiSampleIMAT(lambda_reg=0.0, beta_reg=0.0, eps=0.01, scale=False, use_bigm_constraints=True, gpr_field='GPR', default_flux_lower_bound=None, default_flux_upper_bound=None, high_expression_threshold=None, low_expression_threshold=None, use_mean_for_missing_reactions=False, backend=None)#

Bases: MultiSampleFBA

Integrative Metabolic Analysis Tool (iMAT) implementation for multiple samples.

This implementation extends the original iMAT method for multi-sample analysis.

iMAT integrates gene expression data with metabolic network analysis by selecting flux distributions that maximize the number of highly expressed reactions carrying flux while minimizing the number of lowly expressed reactions carrying flux.

Parameters:
  • lambda_reg (float, optional) – Network size regularization parameter. Higher values encourage fewer active reactions. Defaults to 1e-3.

  • beta_reg (float, optional) – Secondary regularization parameter for sparsity. Used when both types of regularization are needed. Defaults to 0.0.

  • eps (float, optional) – Tolerance for considering a flux as non-zero. Defaults to 1e-2.

  • scale (bool, optional) – If True, normalize the nonzero iMAT score weights independently for each condition so their absolute values sum to 100. Defaults to False.

  • gpr_field (str, optional) – Name of the attribute field containing GPR rules. Defaults to “GPR”.

  • high_expression_threshold (Optional[float], optional) – Threshold above which genes are highly expressed. Defaults to 1.0.

  • low_expression_threshold (Optional[float], optional) – Threshold below which genes are lowly expressed. Defaults to -1.0.

  • use_mean_for_missing_reactions (bool, optional) – When True, use the mean score for reactions with no gene mappings. Defaults to False.

  • use_bigm_constraints (bool, optional) – Use binary indicators and big-M constraints to force zero flux for lowly expressed reactions instead of only constraining it below epsilon. Defaults to True.

  • backend (Backend, optional) – The optimization backend to use.

  • default_flux_lower_bound (float | None)

  • default_flux_upper_bound (float | None)

__init__(lambda_reg=0.0, beta_reg=0.0, eps=0.01, scale=False, use_bigm_constraints=True, gpr_field='GPR', default_flux_lower_bound=None, default_flux_upper_bound=None, high_expression_threshold=None, low_expression_threshold=None, use_mean_for_missing_reactions=False, backend=None)#

Initialize a MultiSampleFBA instance.

Parameters:
  • lambda_reg (float, optional) – Primary sparsity regularization. Higher values encourage fewer active reactions. Defaults to 0.0.

  • beta_reg (float, optional) – Secondary regularization parameter for sparsity. Used when both types of regularization are needed. Defaults to 0.0.

  • flux_indicator_name (str, optional) – Name for the flux indicator variables. These track whether a reaction is active. Defaults to “edge_has_flux”.

  • disable_structured_sparsity (bool, optional) – Disable structured sparsity optimization. Defaults to False.

  • default_flow_lower_bound (float, optional) – Default reaction lower bound when the graph does not provide one.

  • default_flow_upper_bound (float, optional) – Default reaction upper bound when the graph does not provide one.

  • backend (Optional[Backend], optional) – The optimization backend to use. If None, the default backend is used. Defaults to None.

  • eps (float)

  • scale (bool)

  • use_bigm_constraints (bool)

  • gpr_field (str)

  • default_flux_lower_bound (float | None)

  • default_flux_upper_bound (float | None)

  • high_expression_threshold (float | None)

  • low_expression_threshold (float | None)

  • use_mean_for_missing_reactions (bool)

Methods

__init__([lambda_reg, beta_reg, eps, scale, ...])

Initialize a MultiSampleFBA instance.

build(model[, data, gene_expression, ...])

Build a single-condition iMAT problem from explicit inputs.

build_from_data(graph[, data])

Build the complete optimization problem.

build_many(model, *[, gene_expression, ...])

Build a multi-condition iMAT problem from named condition mappings.

create_flow_based_problem(flow_problem, ...)

Create the iMAT optimization problem.

create_problem(graph, data)

Create the optimization problem using a flow-based formulation.

description()

Returns a description of the method.

get_flow_bounds(graph, data)

Return sample-specific flux bounds for the flow formulation.

name()

Returns the name of the method.

preprocess(graph, data)

Preprocess the graph and data before solving.

references()

Return citation keys for the method.

show_bibtex()

Display raw BibTeX entries in a formatted block for easy copying.

show_references()

Display formatted citations in a Jupyter notebook.

Attributes

backend

Return the optimization backend being used.

build(model, data=None, *, gene_expression=None, reaction_scores=None, objectives=None, reaction_bounds=None)#

Build a single-condition iMAT problem from explicit inputs.

Parameters:
build_many(model, *, gene_expression=None, reaction_scores=None, objectives=None, reaction_bounds=None)#

Build a multi-condition iMAT problem from named condition mappings.

Parameters:

model (BaseGraph)

preprocess(graph, data)#

Preprocess the graph and data before solving.

This method checks whether reaction features use mapping="edge". If none are present, it applies GPR rules to derive reaction features from gene features using mapping="none".

Parameters:
  • graph (BaseGraph) – The metabolic network graph to be analyzed.

  • data (Data) – The experimental data containing gene/reaction scores.

Returns:

The preprocessed graph and data.

Return type:

Tuple[BaseGraph, Data]

create_flow_based_problem(flow_problem, graph, data)#

Create the iMAT optimization problem.

The parent class first creates the FBA constraints and objectives. This method then adds iMAT-specific flux-activity indicators and weight-based optimization for highly and lowly expressed reactions.

Parameters:
  • flow_problem – The optimization problem object from parent class.

  • graph (BaseGraph) – The metabolic network graph.

  • data (Data) – The experimental data containing sample information.

Returns:

The configured optimization problem ready to be solved.

static references()#

Return citation keys for the method.