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 to minimize for relaxation. |
Functions¶
|
Relax the problem by relaxing the protein concentration constraints. |
|
Relax the problem by relaxing the protein concentration constraints. |
|
Get one IIS of upper bounds of the candidates. |
|
Convert constrains to elastic constraints until the problem is feashible. |
|
Remove proteomics measurements with a set that enables the model to grow. |
- class geckopy.experimental.relaxation.Objective_rule[source]¶
Bases:
enum.EnumObjective 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).
- 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
original_model (geckopy.Model) – Geckopy model. It won’t be modified but copied.
objective_rule (Objective_rule) – The IIS is selected by minimizing an objective as defined in
Objective_rule.
- 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
original_model (geckopy.Model) – Geckopy model. It won’t be modified but copied.
objective_rule (Objective_rule) – The IIS is selected by minimizing an objective as defined in
Objective_rule.
- 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
relax(\(e_i\)) for each \(e_i\) in \(E\)
min \(Z\), s.t. \(E, Q, v \ge 0 \forall V\)
Get \(R = v \in V \lt 0\)
- If infeashible:
STOP
- Else:
5.1. \(E = E - R\)
5.2. \(IIS = IIS \cup R\)
Go to 1
return IIS
- Parameters
original_model (cobra.Model) –
elastic_candidates (list[str]) –
objective_rule (Objective_rule) – The IIS is selected by minimizing an objective as defined in
Objective_rule.
- 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.