From 0f531342d59e8efcbad6b3ec4842e42dd7a14d0d Mon Sep 17 00:00:00 2001 From: Eduard Kerkhoven Date: Mon, 27 May 2024 09:44:02 +0200 Subject: [PATCH] fix: setParam and removeMets bugs (#544) * fix: setParam correct error message * fix: removeMets metNotes field * doc: updateDocumentation --- core/removeMets.m | 3 ++ core/setParam.m | 2 +- doc/core/removeMets.html | 59 +++++++++++++++++++++------------------- doc/core/setParam.html | 2 +- 4 files changed, 36 insertions(+), 30 deletions(-) diff --git a/core/removeMets.m b/core/removeMets.m index 3398b9ed..0f4a5f26 100755 --- a/core/removeMets.m +++ b/core/removeMets.m @@ -95,6 +95,9 @@ if isfield(reducedModel,'metDeltaG') reducedModel.metDeltaG(indexesToDelete)=[]; end + if isfield(reducedModel,'metNotes') + reducedModel.metNotes(indexesToDelete)=[]; + end end %Remove unused reactions diff --git a/core/setParam.m b/core/setParam.m index 5440e056..c341b914 100755 --- a/core/setParam.m +++ b/core/setParam.m @@ -31,7 +31,7 @@ paramType=convertCharArray(paramType); if ~any(strcmpi(paramType,{'lb','ub','eq','obj','rev','var','unc'})) - EM=['Incorrect parameter type: "' paramType '"']; + EM=['Incorrect parameter type: "' paramType{1} '"']; dispEM(EM); end if isnumeric(rxnList) || islogical(rxnList) diff --git a/doc/core/removeMets.html b/doc/core/removeMets.html index 5c7d5254..4a3d2d26 100644 --- a/doc/core/removeMets.html +++ b/doc/core/removeMets.html @@ -161,35 +161,38 @@

SOURCE CODE ^if isfield(reducedModel,'metDeltaG') 0096 reducedModel.metDeltaG(indexesToDelete)=[]; 0097 end -0098 end -0099 -0100 %Remove unused reactions -0101 if removeUnusedRxns==true -0102 %Get unused reactions -0103 [~, a]=find(reducedModel.S); -0104 rxnsToRemove=1:numel(reducedModel.rxns); -0105 rxnsToRemove(a)=[]; -0106 reducedModel=removeReactions(reducedModel,rxnsToRemove,false,removeUnusedGenes); -0107 end -0108 -0109 %Remove unused compartments -0110 if removeUnusedComps==true -0111 oldComps=reducedModel.comps; -0112 I=ismember(1:numel(oldComps),reducedModel.metComps); -0113 if ~all(I) -0114 reducedModel.comps(~I)=[]; -0115 reducedModel.compNames(~I)=[]; -0116 if isfield(reducedModel,'compOutside') -0117 reducedModel.compOutside(~I)=[]; -0118 end -0119 if isfield(reducedModel,'compMiriams') -0120 reducedModel.compMiriams(~I)=[]; +0098 if isfield(reducedModel,'metNotes') +0099 reducedModel.metNotes(indexesToDelete)=[]; +0100 end +0101 end +0102 +0103 %Remove unused reactions +0104 if removeUnusedRxns==true +0105 %Get unused reactions +0106 [~, a]=find(reducedModel.S); +0107 rxnsToRemove=1:numel(reducedModel.rxns); +0108 rxnsToRemove(a)=[]; +0109 reducedModel=removeReactions(reducedModel,rxnsToRemove,false,removeUnusedGenes); +0110 end +0111 +0112 %Remove unused compartments +0113 if removeUnusedComps==true +0114 oldComps=reducedModel.comps; +0115 I=ismember(1:numel(oldComps),reducedModel.metComps); +0116 if ~all(I) +0117 reducedModel.comps(~I)=[]; +0118 reducedModel.compNames(~I)=[]; +0119 if isfield(reducedModel,'compOutside') +0120 reducedModel.compOutside(~I)=[]; 0121 end -0122 [~, J]=ismember(oldComps(reducedModel.metComps),reducedModel.comps); -0123 reducedModel.metComps=J; -0124 end -0125 end -0126 end +0122 if isfield(reducedModel,'compMiriams') +0123 reducedModel.compMiriams(~I)=[]; +0124 end +0125 [~, J]=ismember(oldComps(reducedModel.metComps),reducedModel.comps); +0126 reducedModel.metComps=J; +0127 end +0128 end +0129 end
Generated by m2html © 2005
\ No newline at end of file diff --git a/doc/core/setParam.html b/doc/core/setParam.html index 284fbe8c..2aee63e2 100644 --- a/doc/core/setParam.html +++ b/doc/core/setParam.html @@ -103,7 +103,7 @@

SOURCE CODE ^convertCharArray(paramType); 0033 if ~any(strcmpi(paramType,{'lb','ub','eq','obj','rev','var','unc'})) -0034 EM=['Incorrect parameter type: "' paramType '"']; +0034 EM=['Incorrect parameter type: "' paramType{1} '"']; 0035 dispEM(EM); 0036 end 0037 if isnumeric(rxnList) || islogical(rxnList)