brianjamesschmidt / gim3e

Gene Inactivation Moderated by Metabolism, Metabolomics, and Expression (COBRApy)
9 stars 7 forks source link

selection of exchange reactions #6

Open sshameer opened 8 years ago

sshameer commented 8 years ago

Hi

In line 172 excahnge reactions are selected by looking for the "EX" tag, this might lead to incorrect exchange selections if one does not use the EX prefix for exchange reactions. exchange_reactions = new_cobra_model.reactions.query("EX_")

instead shouldn't we able to select exchange reactions using the following block ?

exchange_reactions = cobra.core.DictList()
for reaction in model.reactions:
  if (len(reaction.products)==0 or len(reaction.reactants)==0):
    exchange_reactions.append(reaction)

since cobra doesnt represent metabolites whose boundaryCondition attribute is set to true

brianjamesschmidt commented 8 years ago

Hi, It's been a while since I've worked with COBRApy, we were on 0.2.x when I was last actively working with the software. I can see one potential issue with the suggested approach. Wouldn't other reaction types that don't both create and consume metabolites, such as demand reactions, also be counted?

sshameer commented 8 years ago

It is indeed evolving at a fast pace, thanks to the hard work put in by the cobra guys :+1:

I agree these reactions would be included and I dont understand why they shouldnt be. From what I understand, demand reactions are exchange reactions with constraints. And the constraints on the exchange reactions and their reverse copies are replaced in the block lines 178-191 which would make sure only the reaction in the desired direction is allowed. Hence the reactions such as source and demand reactions remain unscathed and would just have a copy with flux bounds max and min = 0.

what do you think?

brianjamesschmidt commented 8 years ago

Again, it has been a while since I've worked with the software, but I believe there are some general reasons for keeping the exchange and demand reactions readily separately identified to facilitate subsequent analysis. For example, if you wanted to check for which reactions, or pairs, etc.., are required for supplying adequate nutrients at the boundary, or what could be purified from the media. The DM and EX tags are just one way to do this, and I probably carried some conventions forward based on the models that were available. If you were to switch and just use only the reaction constraints to separate them, it seems likely you would run into situations where an exchange reaction would look just like a demand reaction. Perhaps that wouldn't complicate your particular analyses. There also may be some unofficial conventions in the MATLAB COBRA packages, so you may want to check what was done there, too, in case someone wanted to move the model into another platform. Of course, it's also possible the COBRApy team decided to move in a particular direction on this issue, Ali has been nice enough so far to provide updates here as I haven't been actively developing/working in this area lately.

sshameer commented 8 years ago

Fair enough. I guess every team has its own (We use pipe to seperate pathways in notes because there is no convention on notes) I'll keep and eye out for them. :-)