SysBioChalmers / RAVEN

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

How to apply ftINIT to yeast-GEM #570

Open broke-why opened 1 month ago

broke-why commented 1 month ago

Description of the issue:

I followed the tutorial at https://sysbiochalmers.github.io/Human-GEM-guide/gem_extraction/#retrieve-the-data and successfully ran the human-GEM example.However, when using yeast-GEM, I can't obtain the correct prepData from prepINITModel(), which results in an unsolvable model when I try to do FBA to optmize the growth. Specifically, during prepINITModel(model, taskData), I encounter a failure in Step 3: "FAIL: [GR] Growth on SCmedia (biomass production)." Interestingly, when I run checkTasks(), the same metabolic task passes. I wonder if this error could be due to structural differences between yeast-GEM and human-GEM, such as metabolites naming rules or constraints?

Reproducing this issue:

model: yeast-GEM 8.0
taskData: grown in minimal medium supplemented with 20 amino acids

>> [taskReport, essentialRxnMat, ~, essentialFluxes] = checkTasks(model,[],true,false,true,taskData);
PASS: [GR] Growth on SCmedia (biomass production)

>> prepData = prepINITModel(model, taskData);
Step 1: Gene rules
Step 2: First simplification
test
Step 3: Check tasks (~10 min)
FAIL: [GR] Growth on SCmedia (biomass production)
Step 4: Second simplification (~1 hour)
Cannot find MATLAB Parallel Computing Toolbox, process is not parallelized.
Running getAllowedBounds |███████████████ 2 min, 4 sec ███████████████|100%
Step 5: Final work

System information

I hereby confirm that I have:

edkerk commented 1 month ago

To my understanding, this should not depend on metabolite naming rules, and as long as your task file is appropriately defined (and it appears as it is, based on checkTasks), then prepINITmodel should also work.

@johan-gson, you're more aware of ftINIT functions, shouldn't tasks succeed both in checkTasks and prepINITmodel?

johan-gson commented 1 month ago

I recommend debugging this - it should be possible to figure this out. Set a breakpoint where checktasks is called and see if the parameters to checktasks are different from what you send in when running it on the outside. If the parameters are not the same, test to run it outside the function with those parameters. If they are the same or if it works with those, test to modify the code: remove any step that modifies the model, like simplifyModel, and see if it helps. If you find the step where this happens, it should be possible to find the problem. You may also want to set skipScaling to true.

YeastGEM could probably also be run in "full" mode since it is much smaller

Let us know how it went!

broke-why commented 4 weeks ago

Thanks for your suggestion! By setting a breakpoint in the prepINITModel function, I made two modifications to pass the growth task:

  1. I changed simplifyModel parameters in step 2, as:
    % [~,deletedDeadEndRxns] = simplifyModel(origRefModel,true,false,true,true,true);  % original for human-GEM
    [~,deletedDeadEndRxns] = simplifyModel(origRefModel,true,false,true,true,false);   % for yeast-GEM
  2. I ignore the closeModel process before checktasks in step3, as:
    
    bModel = closeModel(cModel);  
    % [taskReport, essentialRxnMat, ~, essentialFluxes] = checkTasks(bModel,[],true,false,true,taskStruct); % original for human-GEM  
    [taskReport, essentialRxnMat, ~, essentialFluxes] = checkTasks(cModel,[],true,false,true,taskStruct); % for yeast-GEM  

After these changes, I got a seemingly normal prepData for running the ftINIT process.However, I'm unsure if these modifications are correct because I encountered an error when running the ftINIT function:

model1 = ftINIT(prepData, data_struct.tissues{1}, [], [], data_struct, {}, getINITSteps([],'1+0'), false, true);
ftINIT: Running step 1
WARNING: Exchange metabolites are still present in the model. Use simplifyModel if this is not intended
MipGap too high, trying with a different run. MipGap = Inf New MipGap Limit = 0.003
WARNING: Exchange metabolites are still present in the model. Use simplifyModel if this is not intended
错误使用 dispEM
Failed to find good enough solution within the time frame. MIPGap: Inf
出错 ftINIT (第 282 行)
dispEM(['Failed to find good enough solution within the time frame. MIPGap: ' num2str(mipGap)]);

And I find the preoblem is the MILP problem is infeasible in line 267 

[deletedRxnsInINIT1, metProduction,fullMipRes,rxnsTurnedOn1,fluxes1] = ftINITInternalAlg(mm,rxnScores,metData,essentialRxns,5,stp.AllowMetSecr,stp.PosRevOff,params, startVals, fluxes, verbose);

johan-gson commented 4 weeks ago

Hi again,

You need to run closeModel on the model, otherwise if I remember correctly the model will be able to take up all metabolites, and hence the tasks will probably work even though they are not functional. A good test would be to run closeModel followed by checkTasks outside of ftINIT and see if the tasks still work. If not, investigate the ones that fail. Or does this work differently for the Yeast-GEM @edkerk ?