Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect size(model.rhs) error when running loopless FVA with LLC-NS method #2377

Open
2 of 3 tasks
assaron opened this issue Nov 10, 2024 · 5 comments
Open
2 of 3 tasks

Comments

@assaron
Copy link

assaron commented Nov 10, 2024

I'm trying to use LLC-NS constraints for loopless FVA and it fails with an error, while fastSNP method works well.

Here is the code I'm running:

model = readCbModel('e_coli_core.mat');

res = fluxVariability(model, 100, 'max', model.rxns, 1, true);
res = fluxVariability(model, 100, 'max', model.rxns, 1, 'LLC-NS');
res = fluxVariability(model, 100, 'max', model.rxns, 1, 'fastSNP');

The first and third fluxVariability calls work without error, but for the second I get:

Reduce complexity by nullspace preprocessing and implementing localized loopless constraints (LLCs)
Reactions in internal nullspace can be divided into 1 connected components.
Error using gurobi
Incorrect size(model.rhs)

Error in solveCobraLP (line 839)
        resultgurobi = gurobi(gurobiLP,gurobiParam);
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in optimizeCbModel (line 652)
            solution = solveCobraLP(optProblem2, param);
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in processingLLCs>preprocessLLCs (line 151)
sFeas = optimizeCbModel(model2, 'max', 'one');
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in processingLLCs (line 36)
        loopInfo = preprocessLLCs(varargin{1:5});
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in fluxVariability (line 232)
        [solveLP, MILPproblem, loopInfo] = processingLLCs('preprocess', loopInfo, LPproblem, model, nRxns, osenseStr, MILPproblem);
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I've added a breakpoint at solveCobraLP and for some reason the problem has matrix A of size 263x285 while vector b is of size 262, which causes the gurobi error.

Also, when I ran testFVA I also have the same error.

I hereby confirm that I have:

  • Tried to solve the issue on my own
  • Retried to run my code with the latest version of The COBRA Toolbox
  • Checked that a similar issue has not already been opened

(Note: You may replace [ ] with [X] to check the box)

@rmtfleming
Copy link
Member

rmtfleming commented Nov 10, 2024 via email

@assaron
Copy link
Author

assaron commented Nov 11, 2024

Sorry, I'm not that familiar for cobra code base, neither with matlab in general, so not sure what you suggest exactly.

That said, I agree with your "evidently". As I understand at this line

optProblem2.b = [optProblem.b;zeros(2*nRxns,1);objectiveLP];
objectiveLP is empty and doesn't increase b size, while the constraint rows is added to A (although it's a zero row in my case).

I've also checked version 9d88036. There everything appears to work fine.

@assaron
Copy link
Author

assaron commented Nov 11, 2024

I've also found the commit that introduced this problem: 27d920b#diff-0401bfa37ea7edab5d85374c70147dfc317f57bcc6c1fbe031f112898b3ce8e2L438

I would suggest to revert to setting objectiveLP = 0;, but not sure why it was changed in the first place.

@rmtfleming
Copy link
Member

rmtfleming commented Nov 11, 2024 via email

@assaron
Copy link
Author

assaron commented Nov 11, 2024

Actually, the problem seems to be fixed in the develop branch by this check: https://github.com/opencobra/cobratoolbox/blob/develop/src/analysis/FBA/optimizeCbModel.m#L636

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants