Closed PkiwiBird closed 4 years ago
This is certainly possible in cobrapy, but there isn't a "convenience" function for performing gap filling given a list of tasks. If you can share the types of tasks you're trying to gapfill for, we can point you in the right direction; the constraints associated with common tasks are easily set it cobrapy.
There is some functionality for running MATLAB functions from python, but I would recommend a pure python or pure MATLAB approach if possible.
Thank you for replying. I basically created new reactions with existing metabolites and then added bounds to those reactions. For example, a task of the type: ATP[c] + H2O[c] <=> ADP[c] + Pi[c]. But I don't know how to proceed from there. I guess we start by adding one of those reactions to the model, but how do we "inform" the gapfilling function that we want that reaction to have flux while gapfilling?
In that case, constraining the lower bound of the reaction of interest to be > 0 (if forward flux is desired) would be sufficient. So this would do it:
reaction_of_interest = model.reactions.get_by_id("your_reaction_id_here")
x = 0.05 # desired minimum flux for the task
reaction_of_interest.bounds = (x, reaction_of_interest.upper_bound)
After constraining this reaction, the constraint will be maintained when you create a gapfilling object in cobrapy (or run the gapfill function). You can add as many constraints as you'd like.
Makes sense. What is odd is the file with metabolic tasks has some reactions as you said with lb 1 or 0.0001 and ub 1000, but others have lb 0 and ub 1000 or even lb -1000 to 1000. So, required metabolic tasks can have flux 0 ? For metabolic task to happen doesn't have to have flux value different than 0?
I agree that some of those bounds look odd--I can't imagine a scenario where a task with the bounds (-1000,1000) would be useful alone (e.g., unless maximizing or minimizing flux through that reaction is also set as the objective function, and there is some other step checking for a particular objective value). (0,1000) could be used to indicate that anything except reverse flux is allowed for a reaction that the creators wanted to keep reversible in the reconstruction, but the use case is unclear to me.
This looks stale. Feel free to reopen if the issue persists.
Cobrapy user guide explains how to do gapfilling when we want to guarantee that the organism objective is to grow or guarantee a certain metabolite is produced. Is there a cobrapy function equivalent to the 'fitTasks' function on RAVEN toolbox in matlab https://github.com/SysBioChalmers/RAVEN/blob/master/core/fitTasks.m that performs gapfilling by providing a list of essential metabolic tasks? And is it possible to use the function from matlab on python?