phantomas1234 on devel
GrowthCouplingPotential (#215) … (compare)
OptimizationError Traceback (most recent call last)
<ipython-input-15-46433b0e54bd> in <module>()
1 optknock = OptKnock(model, fraction_of_optimum=0.00001,
----> 2 use_nullspace_simplification=False) ## ???
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cameo/strain_design/deterministic/linear_programming.pyc in init(self, model, exclude_reactions, remove_blocked, fraction_of_optimum, exclude_non_gene_reactions, use_nullspace_simplification, args, *kwargs)
113 exclude_reactions += [r for r in self._model.reactions if not r.genes]
114
--> 115 self._build_problem(exclude_reactions, use_nullspace_simplification)
116
117 def _remove_blocked_reactions(self):
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cameo/strain_design/deterministic/linear_programming.pyc in _build_problem(self, essential_reactions, use_nullspace_simplification)
132 logger.debug("Starting to formulate OptKnock problem")
133
--> 134 self.essential_reactions = find_essential_reactions(self._model).union(self._model.exchanges)
135 if essential_reactions:
136 self.essential_reactions.update(set(get_reaction_for(self._model, r) for r in essential_reactions))
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/flux_analysis/variability.pyc in find_essential_reactions(model, threshold)
345 Set of essential reactions
346 """
--> 347 solution = model.optimize(raise_error=True)
348 tolerance = model.solver.configuration.tolerances.feasibility
349 non_zero_flux_reactions = list(
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/core/model.pyc in optimize(self, objective_sense, raise_error, **kwargs)
890 objective_sense, original_direction)
891 self.slim_optimize()
--> 892 solution = get_solution(self, raise_error=raise_error)
893 self.objective.direction = original_direction
894 return solution
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/core/solution.pyc in get_solution(model, reactions, metabolites, raise_error)
286 legacy solvers.
287 """
--> 288 check_solver_status(model.solver.status, raise_error=raise_error)
289 if reactions is None:
290 reactions = model.reactions
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/util/solver.pyc in check_solver_status(status, raise_error)
422 "model was not optimized yet or solver context switched")
423 else:
--> 424 raise OptimizationError("solver status is '{}'".format(status))
425
426
OptimizationError: solver status is 'infeasible'
The full error message is as follows:
'---------------------------------------------------------------------------
OptimizationError Traceback (most recent call last)
<ipython-input-5-443fb185c4d9> in <module>()
----> 1 optknock = OptKnock(model, fraction_of_optimum=0.00001, use_nullspace_simplification=False) ## ???
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cameo/strain_design/deterministic/linear_programming.pyc in init(self, model, exclude_reactions, remove_blocked, fraction_of_optimum, exclude_non_gene_reactions, use_nullspace_simplification, args, *kwargs)
113 exclude_reactions += [r for r in self._model.reactions if not r.genes]
114
--> 115 self._build_problem(exclude_reactions, use_nullspace_simplification)
116
117 def _remove_blocked_reactions(self):
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cameo/strain_design/deterministic/linear_programming.pyc in _build_problem(self, essential_reactions, use_nullspace_simplification)
132 logger.debug("Starting to formulate OptKnock problem")
133
--> 134 self.essential_reactions = find_essential_reactions(self._model).union(self._model.exchanges)
135 if essential_reactions:
136 self.essential_reactions.update(set(get_reaction_for(self._model, r) for r in essential_reactions))
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/flux_analysis/variability.pyc in find_essential_reactions(model, threshold)
345 Set of essential reactions
346 """
--> 347 solution = model.optimize(raise_error=True)
348 tolerance = model.solver.configuration.tolerances.feasibility
349 non_zero_flux_reactions = list(
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/core/model.pyc in optimize(self, objective_sense, raise_error, **kwargs)
890 objective_sense, original_direction)
891 self.slim_optimize()
--> 892 solution = get_solution(self, raise_error=raise_error)
893 self.objective.direction = original_direction
894 return solution
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/core/solution.pyc in get_solution(model, reactions, metabolites, raise_error)
286 legacy solvers.
287 """
--> 288 check_solver_status(model.solver.status, raise_error=raise_error)
289 if reactions is None:
290 reactions = model.reactions
/Users/astridstubbusch/anaconda/envs/py2/lib/python2.7/site-packages/cobra/util/solver.pyc in check_solver_status(status, raise_error)
422 "model was not optimized yet or solver context switched")
423 else:
--> 424 raise OptimizationError("solver status is '{}'".format(status))
425
426
OptimizationError: solver status is 'infeasible' '
fraction_of_optimum
can be the problem. I’ll test it myself, but you are setting the model objective to be a number below the solver precision and that’s usually recipe for disaster. I’ll be back in the office tomorrow and I will try to assess that myself.