14.1.2. cobra.design package¶
14.1.2.1. Submodules¶
14.1.2.2. cobra.design.design_algorithms module¶
-
cobra.design.design_algorithms.
dual_problem
(model, objective_sense='maximize', integer_vars_to_maintain=[], already_irreversible=False, copy=True, dual_maximum=1000)[source]¶ Return a new model representing the dual of the model.
Make the problem irreversible, then take the dual. Convert the problem:
Maximize (c^T)x subject to Ax <= b, x >= 0which is something like this in COBRApy:
- Maximize sum(objective_coefficient_j * reaction_j for all j)
- s.t. sum(coefficient_i_j * reaction_j for all j) <= metabolite_bound_i reaction_j <= upper_bound_j reaction_j >= 0
to the problem:
Minimize (b^T)w subject to (A^T)w >= c, w >= 0which is something like this in COBRApy (S matrix is m x n):
- Minimize sum( metabolite_bound_i * dual_i for all i ) +
- sum( upper_bound_j * dual_m+j for all j ) +
- s.t.
- sum( coefficient_i_j * dual_i for all i ) + sum( dual_2m+j’ for all j’ ) >= objective_coefficient_j
dual_k >= 0
Parameters: - model (
Model
object.) – - objective_sense (str. The objective sense of the starting problem, either) –
- or 'minimize'. A minimization problems will be converted to a ('maximize') –
- before taking the dual. This function always returns a (maximization) –
- problem. (minimization) –
- iteger_vars_to_maintain ([str]. A list of IDs for Boolean integer variables) –
- be maintained in the dual problem. See 'Maintaining integer variables' (to) –
- for more details (below) –
- already_irreversible (Boolean. If True, then do not convert the model to) –
- irreversible. –
- copy (bool. If True, then make a copy of the model before modifying) –
- This is not necessary if already_irreversible is True. (it.) –
- dual_maximum (float or int. The upper bound for dual variables.) –
The argument integer_vars_to_maintain can be used to specify certin Boolean integer variables that will be maintained in the dual problem. This makes it possible to join outer and inner problems in a bi-level MILP. The method for maintaining integer variables is described by Tepper and Shlomi, 2010:
Tepper N, Shlomi T. Predicting metabolic engineering knockout strategies for chemical production: accounting for competing pathways. Bioinformatics. 2010;26(4):536-43. doi:10.1093/bioinformatics/btp704.In COBRApy, this roughly translates to transforming (decision variables p, integer constraints o):
Maximize (c^T)x subject to (A_x)x + (A_y)y <= b, x >= 0
- Maximize sum(objective_coefficient_j * reaction_j for all j)
s.t.
sum(coeff_i_j * reaction_j for all j) + sum(decision_coeff_i_j * decision_var_j for all j) <= metabolite_bound_i
reaction_j <= upper_bound_j
reaction_j >= 0
to the problem:
Minimize (b - (A_y)y)^T w subject to (A_x^T)w >= c, w >= 0which linearizes to (with auxiliary variables z):
Minimize (b^T)w - { ((A_y)y)^T w with yw –> z } subject to (A_x^T)w >= c, linearization constraints, w >= 0
- Linearization constraints: z <= w_max * y, z <= w,
- z >= w - w_max * (1 - y), z >= 0
- Minimize sum( metabolite_bound_i * dual_i for all i ) +
sum( upper_bound_j * dual_m+j for all j ) +
- sum( decision_coeff_i_j * auxiliary_var_i_j
for all combinations i, j )
s.t.
- sum( coefficient_i_j * dual_i for all i ) - dual_m+j
<= - objective_coefficient_j
auxiliary_var_i_j - dual_maximum * decision_var_j <= 0
auxiliary_var_i_j - dual_i <= 0
- auxiliary_var_i_j + dual_i + dual_maximum * decision_var_j
<= dual_maximum
- dual_maximum >= dual_i >= 0
- dual_maximum >= dual_m+j >= 0
- dual_maximum >= auxiliary_var_i_j >= 0
- 1 >= decision_var_j >= 0
Zachary King 2015
-
cobra.design.design_algorithms.
run_optknock
(optknock_problem, solver=None, tolerance_integer=1e-09, **kwargs)[source]¶ Run the OptKnock problem created with set_up_optknock.
optknock_problem:
Model
object. The problem generated by set_up_optknock.solver: str. The name of the preferred solver.
tolerance_integer: float. The integer tolerance for the MILP.
**kwargs: Keyword arguments are passed to Model.optimize().
Zachary King 2015
-
cobra.design.design_algorithms.
set_up_optknock
(model, chemical_objective, knockable_reactions, biomass_objective=None, n_knockouts=5, n_knockouts_required=True, dual_maximum=1000, copy=True)[source]¶ Set up the OptKnock problem described by Burgard et al., 2003:
Burgard AP, Pharkya P, Maranas CD. Optknock: a bilevel programming framework for identifying gene knockout strategies for microbial strain optimization. Biotechnol Bioeng. 2003;84(6):647-57. http://dx.doi.org/10.1002/bit.10803.model :
Model
object.chemical_objective: str. The ID of the reaction to maximize in the outer problem.
knockable_reactions: [str]. A list of reaction IDs that can be knocked out.
biomass_objective: str. The ID of the reaction to maximize in the inner problem. By default, this is the existing objective function in the passed model.
n_knockouts: int. The number of knockouts allowable.
n_knockouts_required: bool. Require exactly the number of knockouts specified by n_knockouts.
dual_maximum: float or int. The upper bound for dual variables.
copy: bool. Copy the model before making any modifications.
Zachary King 2015