diff --git a/doc/src/geckomat/utilities/getSubsetEcModel.html b/doc/src/geckomat/utilities/getSubsetEcModel.html index dd8e6d7c..49359f00 100644 --- a/doc/src/geckomat/utilities/getSubsetEcModel.html +++ b/doc/src/geckomat/utilities/getSubsetEcModel.html @@ -31,6 +31,12 @@

DESCRIPTION ^SOURCE CODE ^% mapping reactions and genes from a conventional context-specific GEM to 0005 % a general ecModel (bigEcModel), to yield a context-specific ecModel. 0006 % -0007 % Input: -0008 % bigEcModel enzyme-constrained version of conventional model of -0009 % metabolism for a given species -0010 % smallGEM Reduced model (subset of the general model) for a -0011 % specific strain (microbes) or cell-line/tissues (mammals) +0007 % Both models (bigEcModel and the smallGEM) should have derived from the +0008 % same starting model. If an ecModel with human-GEM 1.15.0 is made +0009 % (yielding the bigEcModel), then human-GEM 1.15.0 should also be the +0010 % basis from which the context-specific GEM (smallGEM) was generated by +0011 % for instance tINIT. 0012 % -0013 % Output: -0014 % smallEcModel Enzyme-constrained version of the context-specific model -0015 % -0016 % Usage: smallEcModel = getSubsetEcModel(smallGEM,bigEcModel) -0017 -0018 % Check if original bigEcModel contains context-dependent protein constraints -0019 if any(bigEcModel.lb(startsWith(bigEcModel.rxns,'usage_prot_')) ~= -1000) -0020 printOrange(['WARNING: The bigEcModel is constraint by protein concentrations that are\n' ... -0021 'likely not relevant in the constructed smallEcModel.\n']) -0022 end +0013 % Input: +0014 % bigEcModel enzyme-constrained version of conventional model of +0015 % metabolism for a given species +0016 % smallGEM Reduced model (subset of the general model) for a +0017 % specific strain (microbes) or cell-line/tissues (mammals) +0018 % +0019 % Output: +0020 % smallEcModel Enzyme-constrained version of the context-specific model +0021 % +0022 % Usage: smallEcModel = getSubsetEcModel(smallGEM,bigEcModel) 0023 -0024 % Remove genes (and associated reactions) that are absent in smallGEM -0025 genesToRemove = setdiff(bigEcModel.genes,smallGEM.genes); -0026 smallEcModel = removeGenes(bigEcModel,genesToRemove,true,true,false); -0027 -0028 % Remove genes from ec-structure -0029 enzToRemove = ismember(smallEcModel.ec.genes,genesToRemove); -0030 smallEcModel.ec.genes(enzToRemove) = []; -0031 smallEcModel.ec.enzymes(enzToRemove) = []; -0032 smallEcModel.ec.concs(enzToRemove) = []; -0033 smallEcModel.ec.mw(enzToRemove) = []; -0034 smallEcModel.ec.sequence(enzToRemove) = []; -0035 smallEcModel.ec.rxnEnzMat(:,enzToRemove) = []; -0036 -0037 % Remove any reaction (except prot_ associated) that is absent from smallGEM -0038 trimRxns = regexprep(smallEcModel.rxns,'_REV|_EXP_\d+',''); -0039 protRxns = startsWith(smallEcModel.rxns,{'usage_prot_','prot_pool_exchange'}); -0040 keepRxns = ismember(trimRxns,smallGEM.rxns) | protRxns; -0041 smallEcModel = removeReactions(smallEcModel,~keepRxns, true, true, true); -0042 -0043 % Remove reactions from ec-structure -0044 ecRxnsToRemove = ~ismember(smallEcModel.ec.rxns,smallEcModel.rxns); -0045 -0046 smallEcModel.ec.rxns(ecRxnsToRemove) = []; -0047 smallEcModel.ec.kcat(ecRxnsToRemove) = []; -0048 smallEcModel.ec.source(ecRxnsToRemove) = []; -0049 smallEcModel.ec.notes(ecRxnsToRemove) = []; -0050 smallEcModel.ec.eccodes(ecRxnsToRemove) = []; -0051 smallEcModel.ec.rxnEnzMat(ecRxnsToRemove,:) = []; -0052 end -0053 +0024 % Check if models were derived from the same starting GEM +0025 rxnsDiff = find(~ismember(smallGEM.rxns,bigEcModel.rxns)); +0026 if numel(rxnsDiff) > 0 +0027 dispEM(['While both models should have derived from the same starting ',... +0028 'GEM, the following reactions from smallGEM could not be found ',... +0029 'in bigEcModel:'],true,smallGEM.rxns(rxnsDiff),false); +0030 end +0031 +0032 % Check if original bigEcModel contains context-dependent protein constraints +0033 if any(bigEcModel.lb(startsWith(bigEcModel.rxns,'usage_prot_')) ~= -1000) +0034 printOrange(['WARNING: The bigEcModel is constraint by protein concentrations that are\n' ... +0035 'likely not relevant in the constructed smallEcModel.\n']) +0036 end +0037 +0038 % Remove genes (and associated reactions) that are absent in smallGEM +0039 genesToRemove = setdiff(bigEcModel.genes,smallGEM.genes); +0040 smallEcModel = removeGenes(bigEcModel,genesToRemove,true,true,false); +0041 +0042 % Remove genes from ec-structure +0043 enzToRemove = ismember(smallEcModel.ec.genes,genesToRemove); +0044 smallEcModel.ec.genes(enzToRemove) = []; +0045 smallEcModel.ec.enzymes(enzToRemove) = []; +0046 smallEcModel.ec.concs(enzToRemove) = []; +0047 smallEcModel.ec.mw(enzToRemove) = []; +0048 smallEcModel.ec.sequence(enzToRemove) = []; +0049 smallEcModel.ec.rxnEnzMat(:,enzToRemove) = []; +0050 +0051 % Remove any reaction (except prot_ associated) that is absent from smallGEM +0052 trimRxns = regexprep(smallEcModel.rxns,'_REV|_EXP_\d+',''); +0053 protRxns = startsWith(smallEcModel.rxns,{'usage_prot_','prot_pool_exchange'}); +0054 keepRxns = ismember(trimRxns,smallGEM.rxns) | protRxns; +0055 smallEcModel = removeReactions(smallEcModel,~keepRxns, true, true, true); +0056 +0057 % Remove reactions from ec-structure +0058 ecRxnsToRemove = ~ismember(smallEcModel.ec.rxns,smallEcModel.rxns); +0059 +0060 smallEcModel.ec.rxns(ecRxnsToRemove) = []; +0061 smallEcModel.ec.kcat(ecRxnsToRemove) = []; +0062 smallEcModel.ec.source(ecRxnsToRemove) = []; +0063 smallEcModel.ec.notes(ecRxnsToRemove) = []; +0064 smallEcModel.ec.eccodes(ecRxnsToRemove) = []; +0065 smallEcModel.ec.rxnEnzMat(ecRxnsToRemove,:) = []; +0066 end +0067
Generated by m2html © 2005
\ No newline at end of file diff --git a/src/geckomat/utilities/getSubsetEcModel.m b/src/geckomat/utilities/getSubsetEcModel.m index f94883a0..f7c8f5cb 100644 --- a/src/geckomat/utilities/getSubsetEcModel.m +++ b/src/geckomat/utilities/getSubsetEcModel.m @@ -3,6 +3,12 @@ % Generate a context-specific ecModel (strain/cell-line/tissue) by % mapping reactions and genes from a conventional context-specific GEM to % a general ecModel (bigEcModel), to yield a context-specific ecModel. +% +% Both models (bigEcModel and the smallGEM) should have derived from the +% same starting model. If an ecModel with human-GEM 1.15.0 is made +% (yielding the bigEcModel), then human-GEM 1.15.0 should also be the +% basis from which the context-specific GEM (smallGEM) was generated by +% for instance tINIT. % % Input: % bigEcModel enzyme-constrained version of conventional model of @@ -15,6 +21,14 @@ % % Usage: smallEcModel = getSubsetEcModel(smallGEM,bigEcModel) +% Check if models were derived from the same starting GEM +rxnsDiff = find(~ismember(smallGEM.rxns,bigEcModel.rxns)); +if numel(rxnsDiff) > 0 + dispEM(['While both models should have derived from the same starting ',... + 'GEM, the following reactions from smallGEM could not be found ',... + 'in bigEcModel:'],true,smallGEM.rxns(rxnsDiff),false); +end + % Check if original bigEcModel contains context-dependent protein constraints if any(bigEcModel.lb(startsWith(bigEcModel.rxns,'usage_prot_')) ~= -1000) printOrange(['WARNING: The bigEcModel is constraint by protein concentrations that are\n' ...