BioSystemsUM / cobamp

Constraint-based modeling framework for the enumeration of pathway analysis concepts
http://cobamp.readthedocs.io
GNU General Public License v3.0
14 stars 2 forks source link

Sign changes when performing EFM analysis on network with fixed-direction reactions #13

Closed danolson1 closed 4 years ago

danolson1 commented 4 years ago

Describe the bug When I run a model where all of the fluxes are constrained to be either positive or negative (i.e. bounds from -1000 to 0, or 0 to 1000, but not -1000 to 1000), the fluxes constrained to be negative show up as positive values.

To Reproduce Create a model and set some bounds to -1000 to 0, and some to 0 to 1000.

Expected behavior I would expect fluxes that are constrained to -1000 to 0 to have negative fluxes in the elementary mode solution. Note, if I set my flux bounds as -1000 to 1000, the fluxes have the correct signs.

Screenshots n/a

Additional context I'm using cobamp version 0.1.5. I'd be happy to share my Jupyter Notebook if you want to see how to reproduce it.

vvvieira commented 4 years ago

Hello @danolson1. Thanks for pointing this out.

I think this is a problem concerning the behaviour of the IrreversibleLinearSystem class. When the bounds are preprocessed, reactions with upper bound below 0 have their stoichiometric coefficients inversed. This results in the behaviour you have just specified (reactions carrying flux strictly in the backwards sense appear with positive flux).

You're right in saying this is indeed misleading. I will address this in the next release but I am 99.99% sure the results themselves can be trusted, as long as you either make all reactions reversible or with bounds such as 0-1000. Alternatively, you can also identify backwards irreversible reactions and flip the resulting fluxes.

Nevertheless, this will be changed in the future!

Please let me know if you have any further questions!

danolson1 commented 4 years ago

Thanks. Yeah, it's not a huge problem (since we know the correct flux direction, which was used as an input to change the reaction bounds), but simplifies the subsequent analysis.

I'm using this for the Metabolic Engineering course I'm teaching. I recently switched from Matlab to Python, so I also switched from using EFMtool to cobamp. So far it works great. Thanks for making the library.

-Dan