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

Error: ftINIT - failed to find good enough solution within time frame #483

Closed
1 task done
jasonsherfey opened this issue Apr 11, 2023 · 14 comments
Closed
1 task done
Labels
fixed in develop This issue is fixed and pushed to develop branch. Will be closed when fix appears in master branch.

Comments

@jasonsherfey
Copy link

Description of the issue:

Hello everyone.
I use RAVEN 2.8.0 on MATLAB 2020b, Ubuntu 20.04

I am trying to extract a GEM model from GTEx liver transcriptomics data using ftINIT following the GEM Extraction guide here:
https://sysbiochalmers.github.io/Human-GEM-guide/gem_extraction/

I got an error when executing:
model1 = ftINIT(prepData, arrayData.tissues{1}, [], [], arrayData, {}, getHumanGEMINITSteps('1+0'), false, true);

test.mat.zip contains a MAT file with the prepData (based on the guide) and arrayData (containing TPM counts for two GTEx liver samples).

Reproducing this issue:

model1 = ftINIT(prepData, arrayData.tissues{1}, [], [], arrayData, {}, getHumanGEMINITSteps('1+0'), false, true);

ftINIT: Running step 1
MILP detected.
MipGap too high, trying with a different run. MipGap = Inf New MipGap Limit = 0.003
MILP detected.
Error using dispEM (line 49)
Failed to find good enough solution within the
time frame. MIPGap: Inf

Error in ftINIT (line 281)
        dispEM(['Failed to find good enough
        solution within the time frame. MIPGap:
        ' num2str(mipGap)]);

System information

Installing from location /RAVEN
Checking RAVEN release 2.8.0
You are running the latest RAVEN release
Checking MATLAB release 2020b
Checking system architecture glnxa64
Set RAVEN in MATLAB path
Pass
Save MATLAB path Pass

=== Model solvers ===

Checking for LP solvers
glpk Pass
gurobi Fail
soplex Fail
cobra Pass
Set RAVEN solver glpk

=== Essential binary executables ===

Checking BLAST+
Pass
Checking DIAMOND
Pass
Checking HMMER
Pass

A similar issue has been reported on Stackoverflow:
https://stackoverflow.com/questions/75822973/error-using-gurobi-solver-to-create-model-in-matlab-milp-detected-failed-to-find

Any advice on how to approach troubleshooting this would be greatly appreciated!

Best wishes

I hereby confirm that I have:

@jasonsherfey
Copy link
Author

The same error occurs when I use the gtexSampForTutorialTPM.txt file from the Zenodo repository.

@FaribaRoshanzamir
Copy link

Hi Jason,
Can you please set the RAVEN solver to Gurobi to see if you still get the same error?

@jasonsherfey
Copy link
Author

Thanks for the reply @FaribaRoshanzamir! I just requested a Gurobi license and will try it when it arrives in a 1-2 business days. Previously I have used GLPK and Mosek for LP. Hopefully Gurobi works in this case; however, the Stackoverflow post says they received the same error using Gurobi following the same guide. Is there anything else I could try while waiting for the license?

@FaribaRoshanzamir
Copy link

FaribaRoshanzamir commented Apr 14, 2023

I checked it today, and I'm not getting any error when RAVEN 2.8.0 and setting the solver to Gurobi. So, it should work smoothly if you have a functional Gurobi. I am currently not sure how you can solve this issue with GLPK.

@pranasag
Copy link

Hi guys, I'd like to jump in with a similar issue. I'm using the latest RAVEN release, and Gurobi as the preferred solver, but ftINIT works only on some of the models I use. I could run the Human-GEM guide successfully, but running ftINIT on other models seems to be a challenge - algorithm fails at the same step as described here.
Any ideas what could be the issue?

@FaribaRoshanzamir
Copy link

@pranasag Can you please give us more details so we can help you out? Are you using Human-GEM as your reference model?

@pranasag
Copy link

Hi @FaribaRoshanzamir, my set-up is as follows: MATLAB 2019a on Mac OS X, with Gurobi 9.5.2 (downgraded from Gurobi 10 after reading this issue thread). I'm currently using the development branch of RAVEN (because of #479).
In the initial post I mentioned that I can successfully run ftINIT algorithm on Human-GEM (v. 1.14): that is both true for the Human-GEM guide, and I've used other expression datasets on Human-GEM as well. I am working with an unpublished GEM of another organism, and for this model, I can generate the prepData structure, all seems fine (all tasks pass the check), but the initial ftINIT MILP fails with any omics dataset I've tried so far.

@edkerk
Copy link
Member

edkerk commented Apr 17, 2023

@johan-gson, any idea?

@johan-gson
Copy link
Contributor

I would have to debug this, I have only tested ftInit with Human-GEM and Mouse-GEM. Any chance you could send me the model and omics + your code? Johan.gson@gmail.com

@jasonsherfey
Copy link
Author

Hi @FaribaRoshanzamir, switching to Gurobi fixed the issue for me. Thank you! I tested Gurobi v9.5.2 and v10.0.1. Both ran successfully, but they returned slightly different results - v10.0.1 produced a model with fewer rxns and mets. Is one version of Gurobi recommended over the other?

@johan-gson
Copy link
Contributor

Hi @jasonsherfey, I used 9.5.0 throughout the development, so it is much more tested. The problem formulation is the same, which solver that does best is difficult to say. In general, I think they reduced the accuracy a little bit and gained a bit of speed in 10.0, but I could be wrong - but I had to change one of the precision parameters to a larger value to make it work with 10.0. Also, you get different results depending on random seed and so forth, so some differences are expected - the solver normally doesn't find the optimal solution, but a good enough solution. Are the differences between the solvers large?

@jasonsherfey
Copy link
Author

Hi @johan-gson, thanks for your reply. The difference I saw between versions of Gurobi was small: eg, moving from Gurobi 9.5.2 to 10.0.1 reduced # elements in rxns from 9032 to 9026 and mets from 5882 to 5880.

@johan-gson
Copy link
Contributor

Ok, thanks for the info, I think you could get the same differences from changing the random seed in the solver for example, so I think that is fine.

@johan-gson
Copy link
Contributor

@pranasag I have finally found time to debug this, and figured out what is happening, sorry for the delay. The problem lies in the scaling step, which is a risky thing. In short, ftINIT has problems dealing with reactions that have large differences in the stoichiometric coefficients, you have a few of those in your model. They typically take like 1000 ATP and 1 of some amino acid, or 0.001 ROS or something like that. I have tried to solve the problem by scaling, where I did something really rough that messes up the stoichiometry, mass balance etc., is that the tolerances in the solver are not small enough to handle such large differences. In short, ftINIT says that the flux should be lower than B*1000, where B is 0 or 1 and represents if the reaction should be included or not. The problem is that 0 is not really zero, so if we increase the number 1000, small but large enough fluxes can slip through. We have problems when some fluxes need to be > 1000 for other fluxes to reach >0.1. Note that the scaling is used in the MILP only, it is not there in the final model. Human-GEM is pretty tolerant to messing up the stoichiometry a bit, so there this works.

To solve this for you and others, I added the possibility to turn off scaling in prepINITData - I can run ftINIT on your model with this flag - it is currently in the fix/ftINITScaling branch. If you use that branch and use the line
prepData = prepINITModel(model, ...
parseTaskList('metabolicTasks.xlsx'),...
sponTable.rxns(sponTable.spontaneous == 1), ...
false, ...
{}, ...
'e', ...
false);
it should work reasonably well. You may get problems with these few reactions, but it could also just work without any problems. I did find some other problems in your model, will send them in a separate mail.

@edkerk edkerk mentioned this issue May 17, 2023
4 tasks
@edkerk edkerk added the fixed in develop This issue is fixed and pushed to develop branch. Will be closed when fix appears in master branch. label May 17, 2023
@edkerk edkerk closed this as completed May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed in develop This issue is fixed and pushed to develop branch. Will be closed when fix appears in master branch.
Projects
None yet
Development

No branches or pull requests

5 participants