Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 30 22:25
    jafemm opened #291
  • Nov 25 10:06
    carrascomj opened #290
  • Nov 25 08:10
    codecov[bot] commented #289
  • Nov 25 08:07
    codecov[bot] commented #289
  • Nov 25 07:57
    carrascomj review_requested #289
  • Nov 24 22:52
    djinnome opened #289
  • Nov 24 22:48
    djinnome opened #288
  • Nov 15 09:54
    phantomas1234 commented #215
  • Nov 15 09:54

    phantomas1234 on devel

    GrowthCouplingPotential (#215) … (compare)

  • Nov 15 09:53
    phantomas1234 closed #215
  • Nov 12 12:12
    carrascomj closed #266
  • Nov 12 12:12
    carrascomj commented #266
  • Nov 12 12:11
    carrascomj closed #188
  • Nov 12 12:11
    carrascomj commented #188
  • Nov 12 12:08
    carrascomj edited #268
  • Nov 12 12:08
    carrascomj edited #268
  • Nov 10 08:21
  • Nov 09 12:22
    codecov[bot] commented #215
  • Nov 09 12:21
    codecov[bot] commented #215
  • Nov 09 12:19
    codecov[bot] commented #215
Nikolaus Sonnenschein
@phantomas1234
Daniel Machado
@cdanielmachado
Hi everyone, I have a couple of questions from a visiting student in our lab who is using cameo, I hope you can help.
First, how does one define the optimization objective in OptGene? In OptFlux one can choose between product yield or BPCY. In cameo I don't see that option.
Does cameo allow visualization of fluxes in customized escher maps ?
Can one add reactions to cameo models in a single line? Like in model.add("a + b -> c") ?
Daniel Machado
@cdanielmachado
Can one export models in JSON format ? (The escher build tool requires to load the modified model to draw the heterologous reactions in a map).
@joaocardoso Niko says you're the expert :)
Moritz E. Beber
@Midnighter

Can one add reactions to cameo models in a single line? Like in model.add("a + b -> c") ?

You can build a reaction from a string and then add that to your model. https://cobrapy.readthedocs.io/en/latest/cobra.core.html#cobra.core.reaction.Reaction.build_reaction_from_string

Daniel Machado
@cdanielmachado
@Midnighter thanks! The first question is still the most pressing though... :)
by the way, you guys could add model.add_reaction_from_str like we have in framed, i find it super convenient
Moritz E. Beber
@Midnighter
Yeah, it'd be a convenient method to have. Until we put it in you could just monkey patch the class.
João Gonçalo Rocha Cardoso
@joaocardoso
Daniel: you can use cobra.io.json to export the model
Objective functions in cameo can be found at cameo.strain_design.heuristic.evolutionary.objective_functions
João Gonçalo Rocha Cardoso
@joaocardoso
Looks like you cannot change the objective function in OptGene. If you need to use yield instead of BPCY, we can update the run signature.
Nikolaus Sonnenschein
@phantomas1234
One could also use the lower level classes
Daniel Machado
@cdanielmachado
ok, thanks !
Astrid-42
@Astrid-42

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

Daniel Machado
@cdanielmachado
@joaocardoso @Midnighter Astrid is currently working at our lab. Can you help her? It seems something might be wrong with the jupyter integration.
Svetlana Kutuzova (Galkina)
@sgalkina
hi Astrid! this error can happen if bokeh package is of version >=0.12.2 (you can check it by running pip freeze)
you could try installing the correct version of bokeh by running pip install --upgrade bokeh==0.12.1
please tell if it helped
Astrid-42
@Astrid-42
Many thanks for the advice, unfortunately I still get the same error (show() got an unexpected keyword argument 'notebook_handle') after updating bokeh and restarting the Jupiter Notebook.
Astrid-42
@Astrid-42
And python within only the terminal also still produces an empty result. Any other ideas on what could be the issue? Many thanks!
Astrid-42
@Astrid-42
And another question: Also Optknock is not working here. It seems to fail already when it tries to identify essential reactions and such, so before the actual optimisation. FBA works fine, but upon ...
optknock = OptKnock(model, fraction_of_optimum=0.00001,
use_nullspace_simplification=False)
I get the following error ...

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'

João Gonçalo Rocha Cardoso
@joaocardoso
Hi Astrid. I’ll have a look at that on Monday. What model are you using?
Astrid-42
@Astrid-42
Many thanks, that's very kind of you. I use the newest consensus model for yeast: yeast7.6.
João Gonçalo Rocha Cardoso
@joaocardoso
Hi @Astrid-42! What is "r_4054"? When I load the yeast model I cannot find it in the reactions or metabolites
Astrid-42
@Astrid-42
Hi @joaocardoso, thanks for looking at it! I added a linear heterologous reactions (as well as metabolites). FBAs worked fine so far, so I expected them to not interfere in an unexpected way with the model.
Unfortunately I have to leave work right now, but please feel free to send any further questions, I will answer them tmr morning and would be delighted to find out why OptKnock and OptGene fail here!
Astrid-42
@Astrid-42
Did you come up with any idea why OptKnock and OptGene can't run?
Nikolaus Sonnenschein
@phantomas1234
Astrid, did you add sink reactions for the metabolites in the heterologous reaction?
Astrid-42
@Astrid-42
Yes. The linearly produced substance has a sink reaction "r_4054: product --> ". No other substances are produced without being consumed by another reaction, only FAD/FADH2 and NADP(+)/NADPH (already existing in the model) are produced/used without a source/sink reaction for them.
Astrid-42
@Astrid-42
Hi @phantomas1234 @joaocardoso ,
I would be really glad about some ideas on why the OptKnock algorithm doesn't work!
My input:
‘optknock = OptKnock(model, fraction_of_optimum=0.00001, use_nullspace_simplification=False)’
The output is a long error message ending with
‘ 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' '

João Gonçalo Rocha Cardoso
@joaocardoso
What solver are you using?
Astrid-42
@Astrid-42
Thanks for the reply! I use CPLEX.
Nikolaus Sonnenschein
@phantomas1234
@sgalkina can you help Astrid with this? @Astrid-42 can you please create an issue on the cameo issue tracker and upload model and code so that we can try to reproduce the problem? https://github.com/biosustain/cameo/issues
Astrid-42
@Astrid-42
@phantomas1234 Many thanks! @sgalkina I created an issue with the name 'OptKnock error' and attached both model and code. Thanks a lot for your help!
João Gonçalo Rocha Cardoso
@joaocardoso
@Astrid-42: regarding your problem with OptGene. One thing you did was to set the biomass as a metabolite. In COBRA models (like iJO1366 or iMM904) there is no biomass metabolite. The variables of the model are reactions. You can set the 'r_2111' as biomass given the constitution of the model, it will serve it's purpose.
Regarding OptKnock, I am still trying to reproduce your error
A few notes on that model
it has 3493 reactions, of which 1513 are coupled.
if you run OptKnock without the null space simplification it will take a very long time, it it works at all
João Gonçalo Rocha Cardoso
@joaocardoso
the null space simplification will reduce those 1513 reactions to ~500 variables
I left OptKnock building the problem on my computer, I'll update you when I have news
Astrid-42
@Astrid-42
@joaocardoso Many many thanks for having a look!
-for OptGene: I tried with the biomass reaction first, then tried with the metabolite (I understood that both is possible). But it didn't solve the problem.
-for OptKnock: I tried with the simplification at first of course, but it seemed to abort with an error in the middle of doing some simplifications of the model. Therefore we tried to switch that off, but both didn't work sadly.
Many thanks, please keep me in the loop! It would be great if you could understand the problem.
João Gonçalo Rocha Cardoso
@joaocardoso
@Astrid-42 I managed to reproduce your error. I’ll explore a solution soon. I am attending a conference today and tomorrow and I’ll try a few different things on Monday when I am back in the office
Astrid-42
@Astrid-42
@joaocardoso Thanks a lot, good to know you get the same error and I would be very happy to hear back from you next week. Much fun at the conference!