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 >= 0

which 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 >= 0

which 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) – The COBRA model.
  • objective_sense (str) – The objective sense of the starting problem, either ‘maximize’ or ‘minimize’. A minimization problems will be converted to a maximization before taking the dual. This function always returns a minimization problem.
  • iteger_vars_to_maintain ([str]) – A list of IDs for Boolean integer variables to be maintained in the dual problem. See ‘Maintaining integer variables’ below for more details.
  • already_irreversible (bool) – If True, then do not convert the model to irreversible.
  • copy (bool) – If True, then make a copy of the model before modifying it. This is not necessary if already_irreversible is True.
  • dual_maximum (float or int) – The upper bound for dual variables.

Maintaining integer 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. https://doi.org/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

(1) Maximize sum(objective_coefficient_j * reaction_j for all j)
        s.t.
(2)     sum(coeff_i_j * reaction_j for all j) +
        sum(decision_coeff_i_j * decision_var_j for all j)
        <= metabolite_bound_i
(3)     reaction_j <= upper_bound_j
(4)     reaction_j >= 0

to the problem:

Minimize (b - (A_y)y)^T w subject to (A_x^T)w >= c, w >= 0

which 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

 (5) 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.
 (6)   - sum( coefficient_i_j * dual_i for all i ) - dual_m+j
       <= - objective_coefficient_j
 (7)     auxiliary_var_i_j - dual_maximum * decision_var_j          <= 0
 (8)     auxiliary_var_i_j - dual_i                                 <= 0
 (9)   - auxiliary_var_i_j + dual_i + dual_maximum * decision_var_j
       <= dual_maximum
(10)     dual_maximum >= dual_i            >= 0
(11)     dual_maximum >= dual_m+j          >= 0
(12)     dual_maximum >= auxiliary_var_i_j >= 0
(13)                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.

Parameters:
  • optknock_problem (Model) – 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. https://doi.org/10.1002/bit.10803.

Parameters:
  • model (Model) – A COBRA model.
  • 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

14.1.2.3. Module contents