geckopy.experimental.relaxation

Relax experimental constraints.

Usually, the experimental constraints produce an infeashible model. The relaxation methods aim to remove the smallest subset of experimental measurements to allow growth.

Module Contents

Classes

Objective_rule

Objective to minimize for relaxation.

Functions

apply_proteomics_relaxation(original_model: geckopy.model.Model, objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE) → Tuple[(Model, Set)]

Relax the problem by relaxing the protein concentration constraints.

apply_proteomics_elastic_relaxation(original_model: geckopy.model.Model, objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE) → Tuple[(Model, Set)]

Relax the problem by relaxing the protein concentration constraints.

get_upper_relaxation(model: cobra.Model, candidates: List[str], objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE) → Tuple[(Set, str)]

Get one IIS of upper bounds of the candidates.

elastic_upper_relaxation(original_model: cobra.Model, elastic_candidates: List[str], objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE) → Set

Convert constrains to elastic constraints until the problem is feashible.

relax_proteomics_greedy(model: geckopy.model.Model, minimal_growth: float, protein_set: Optional[List[str]] = None) → Tuple[(Dict, List[Dict])]

Remove proteomics measurements with a set that enables the model to grow.

class geckopy.experimental.relaxation.Objective_rule[source]

Bases: enum.Enum

Objective to minimize for relaxation.

  • Objective_rule.MIN_ELASTIC_SUM:

\(\sum_{v \in \text{elastic vars}} v_{flux}\) (LP).

  • Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE:

\(\sum_{e \in \text{elastic vars}} + \text{prev objective}\) (LP).

  • Objective_rule.MIN_MILP_COUNT:

\(\sum_i^{N} e_i\) where e is a binary variable (MILP).

MIN_ELASTIC_SUM = 1[source]
MIN_MILP_COUNT = 2[source]
MIN_ELASTIC_SUM_OBJECTIVE = 3[source]
geckopy.experimental.relaxation.apply_proteomics_relaxation(original_model: geckopy.model.Model, objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE)Tuple[Model, Set][source]

Relax the problem by relaxing the protein concentration constraints.

The relaxed problems will contain elastic variables, returning the model a non-unique infeashible contraint set.

Parameters
Returns

tuple – copy of the model with the relaxed variables applied and the sets

Return type

(geckopy.Model, set)

geckopy.experimental.relaxation.apply_proteomics_elastic_relaxation(original_model: geckopy.model.Model, objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE)Tuple[Model, Set][source]

Relax the problem by relaxing the protein concentration constraints.

The relaxed problems will be determined via Elastic filtering, returning the model and a irreducibly inconsistent set of functional constraints ( [Chinnek and Dravnieks, 1990] (https://pubsonline.informs.org/doi/abs/10.1287/ijoc.3.2.157)).

Parameters
Returns

tuple – copy of the model with the relaxed variables applied and the sets

Return type

(geckopy.Model, set)

geckopy.experimental.relaxation.get_upper_relaxation(model: cobra.Model, candidates: List[str], objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE)Tuple[Set, str][source]

Get one IIS of upper bounds of the candidates.

geckopy.experimental.relaxation.elastic_upper_relaxation(original_model: cobra.Model, elastic_candidates: List[str], objective_rule: geckopy.experimental.relaxation.Objective_rule = Objective_rule.MIN_ELASTIC_SUM_OBJECTIVE)Set[source]

Convert constrains to elastic constraints until the problem is feashible.

It assumes that the elastic candidates are all subject to a <= constraint.

Based on Brown and Graves, 1975:

  • Q <- original problem

  • E <- set of variables, candidates to be relaxed

  • V <- set of variables that relax the problem

  • relax(\(e_i\)) <- Add constraint \(e - v\)

  • Z <- \(\sum_{v \in V} v\)

IIS <- irreducibly infeashible set of variables

  1. relax(\(e_i\)) for each \(e_i\) in \(E\)

  2. min \(Z\), s.t. \(E, Q, v \ge 0 \forall V\)

  3. Get \(R = v \in V \lt 0\)

  4. If infeashible:

    STOP

  5. Else:

    5.1. \(E = E - R\)

    5.2. \(IIS = IIS \cup R\)

    Go to 1

  6. return IIS

Parameters
geckopy.experimental.relaxation.relax_proteomics_greedy(model: geckopy.model.Model, minimal_growth: float, protein_set: Optional[List[str]] = None)Tuple[Dict, List[Dict]][source]

Remove proteomics measurements with a set that enables the model to grow.

Proteins are removed from the set iteratively based on sensitivity analysis (shadow prices).

Adapted from https://github.com/DD-DeCaF/simulations/blob/devel/src/simulations/modeling/driven.py

Parameters
  • model (cobra.Model) – The enzyme-constrained model.

  • minimal_growth_rate (float) – Minimal growth rate to enforce.

  • protein_set (Optional[List[str]]) – If a list of ids is provided, the search will be applied to only these proteins.

Returns

  • growth_rate (dict) – New growth rate (will change if the model couldn’t grow at the inputted value).

  • proteomics (list(dict)) – Filtered list of proteomics.