phantomas1234 on devel
GrowthCouplingPotential (#215) … (compare)
cameo.strain_design.heuristic.evolutionary.objective_functions
Hi everyone,
I have a problem with cameo, specifically OptGene, and would be very delighted about your help.
After importing OptGene, my model, and fba as simulation method, I tried to run OptGene:
result = optgene.run(target='r_4054',
biomass='s_0450',
substrate='s_0565',
max_knockouts=10,
variable_size=True,
simulation_method= fba,
growth_coupled=False,
max_evaluations=500,
population_size=200,
max_results=50,
use_nullspace_simplification=True,
seed=None)
Upon this, Jupiter stops and throws me the error "show() got an unexpected keyword argument 'notebook_handle'". Do you know how to fix that?
If I try the same in the terminal to avoid the Jupiter Notebook the process finishes without error, but the result seems to be empty?
(result.data_frame
# Empty DataFrame
# Columns: [reactions, genes, size, fva_min, fva_max, target_flux, biomass_flux, yield, fitness]
# Index: []
I would be very happy about your ideas where the problem is.
Many thanks and kind regards,
Astrid
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.