SysBioChalmers / RAVEN

The RAVEN Toolbox for genome scale model reconstruction, curation and analysis.
http://sysbiochalmers.github.io/RAVEN/
Other
100 stars 52 forks source link

bug: simplifyModel with irreversible backwards-only reactions #529

Closed edkerk closed 5 months ago

edkerk commented 7 months ago

Description of the issue:

Reactions that are defined backwards-only (so lb<0 and ub=0) could arguably have their rev field as 0. But this raises a problem when simplifyModel is run with deleteInaccessible is set as true. In this line:

https://github.com/SysBioChalmers/RAVEN/blob/e296b5dc7b66f11d8a494303629256ec69679868/core/simplifyModel.m#L129

The S-matrix is expanded with inverted versions of reversible reactions (the reducedModel.rev~=0 part), to consider that reactions can have a negative flux. But for the above case (backwards-only & irreversible), these reactions are not included. Arguably, it is not interesting anyway what the value of the rev field is, what is important is whether the reaction can carry a negative flux.

This should therefore be changed to:

revS=[reducedModel.S,reducedModel.S(:,reducedModel.lb<0)*-1 I(:,in) I(:,out)*-1];

I hereby confirm that I have: