From a0b4bbec3ab6c52babb752198f568c2399c2a34a Mon Sep 17 00:00:00 2001 From: Ivan Domenzain Date: Tue, 23 Mar 2021 17:11:16 +0100 Subject: [PATCH] fix: ignore conflicting grRules and display additional warning --- ecHumanGEM/scripts/preprocessModel.m | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/ecHumanGEM/scripts/preprocessModel.m b/ecHumanGEM/scripts/preprocessModel.m index 2560cab6..b800ccf9 100644 --- a/ecHumanGEM/scripts/preprocessModel.m +++ b/ecHumanGEM/scripts/preprocessModel.m @@ -23,17 +23,21 @@ name = []; end end -model = removeFields(model); -[grRules, rxnGeneMat] = standardizeGrRules(model); -model.grRules = grRules; -model.rxnGeneMat = rxnGeneMat; +model = removeFields(model); +%find conflicting grRules in model +[~,~,conflicts] = standardizeGrRules(model); +if ~isempty(conflicts) + warning(sprintf('\nConflicting grRules where found for several reactions (check the above lines). GECKO will ignore these grRules to avoid introduction of potentially wrong enzyme constrains for such cases. It is recommended to check your original GEM and fix these grRules manually with the guidance provided by the function "standardizeGrRules.m" in the RAVEN toolbox.\n')) +end +%delete conflicting grRules to avoid weird enzyme constraints +model.grRules(conflicts) = {''}; %Remove gene rules from pseudoreactions (if any): -for i = 1:length(model.rxns) - if endsWith(model.rxnNames{i},' pseudoreaction') - model.grRules{i} = ''; - model.rxnGeneMat(i,:) = zeros(1,length(model.genes)); - end -end +pseudoRxns = endsWith(model.rxnNames,' pseudoreaction'); +model.grRules(pseudoRxns) = {''}; +%standardize grRules +[grRules,rxnGeneMat] = standardizeGrRules(model); +model.grRules = grRules; +model.rxnGeneMat = rxnGeneMat; % Standardizes the metabolites names model = modifyMetNames(model);