diff --git a/core/checkModelStruct.m b/core/checkModelStruct.m
index 6cadafcf..3fb1e15f 100755
--- a/core/checkModelStruct.m
+++ b/core/checkModelStruct.m
@@ -124,6 +124,10 @@ function checkModelStruct(model,throwErrors,trimWarnings)
EM='If "grRules" field exists, the model should also contain a "genes" field';
dispEM(EM,throwErrors);
else
+ %Erroneous grRules that start/end with OR/AND
+ EM='The following reaction(s) have grRules that start or end with ''OR'' or ''AND'':';
+ dispEM(EM,throwErrors,model.rxns(startsWith(model.grRules,{'or ','and '}) | endsWith(model.grRules,{' or',' and'})),trimWarnings);
+ %grRules that are not in genes field
geneList = getGenesFromGrRules(model.grRules);
geneList = setdiff(unique(geneList),model.genes);
if ~isempty(geneList)
diff --git a/core/getExchangeRxns.m b/core/getExchangeRxns.m
index fa197b21..d058f689 100755
--- a/core/getExchangeRxns.m
+++ b/core/getExchangeRxns.m
@@ -26,8 +26,8 @@
% positive flux value would imply uptake,
% but reaction bounds are not considered
% 'out' reactions where the boundary metabolite
-% is the substrate of the reaction, a
-% positive flux value would imply uptake,
+% is the product of the reaction, a
+% negative flux value would imply uptake,
% but reaction bounds are not considered.
%
% Output:
diff --git a/core/setParam.m b/core/setParam.m
index e24ad2ca..734853b7 100755
--- a/core/setParam.m
+++ b/core/setParam.m
@@ -39,6 +39,9 @@
else
rxnList=convertCharArray(rxnList);
end
+if isempty(rxnList)
+ return;
+end
%Allow to set several parameters to the same value
if numel(rxnList)~=numel(params) && numel(params)~=1
@@ -59,23 +62,16 @@
%as we do not want to throw errors if matches fail
indexes=zeros(numel(rxnList),1);
-for i=1:numel(rxnList)
- index=find(strcmp(rxnList{i},model.rxns),1);
- if ~isempty(index)
- indexes(i)=index;
- else
- indexes(i)=-1;
- EM=['Reaction ' rxnList{i} ' is not present in the reaction list'];
- dispEM(EM,false);
- end
+[Lia,Locb] = ismember(rxnList,model.rxns);
+indexes(Lia) = Locb;
+if any(~Lia)
+ params(~Lia)=[];
+ indexes(~Lia)=[];
+ paramType(~Lia)=[];
+ dispEM('Reactions not present in model, will be ignored:',false,rxnLise(~Lia));
end
-%Remove the reactions that were not found
-params(indexes==-1)=[];
-indexes(indexes==-1)=[];
-paramType(indexes==-1)=[];
%Change the parameters
-
if ~isempty(indexes)
if contains(paramType,'obj')
model.c=zeros(numel(model.c),1); % parameter is changed, not added
diff --git a/doc/core/checkModelStruct.html b/doc/core/checkModelStruct.html
index 2f029e1f..920a7c8b 100644
--- a/doc/core/checkModelStruct.html
+++ b/doc/core/checkModelStruct.html
@@ -183,331 +183,335 @@
SOURCE CODE
'If "grRules" field exists, the model should also contain a "genes" field';
0125 dispEM(EM,throwErrors);
0126 else
-0127 geneList = getGenesFromGrRules(model.grRules);
-0128 geneList = setdiff(unique(geneList),model.genes);
-0129 if ~isempty(geneList)
-0130 problemGrRules = model.rxns(contains(model.grRules,geneList));
-0131 problemGrRules = strjoin(problemGrRules(:),'; ');
-0132 EM=['The reaction(s) "' problemGrRules '" contain the following genes in its "grRules" field, but these are not in the "genes" field:'];
-0133 dispEM(EM,throwErrors,geneList);
-0134 end
-0135 end
-0136 end
-0137 if isfield(model,'rxnComps')
-0138 if ~isnumeric(model.rxnComps)
-0139 EM='The "rxnComps" field must be of type "double"';
-0140 dispEM(EM,throwErrors);
-0141 end
-0142 end
-0143 if isfield(model,'inchis')
-0144 if ~iscellstr(model.inchis)
-0145 EM='The "inchis" field must be a cell array of strings';
-0146 dispEM(EM,throwErrors);
-0147 end
-0148 end
-0149 if isfield(model,'metSmiles')
-0150 if ~iscellstr(model.metSmiles)
-0151 EM='The "metSmiles" field must be a cell array of strings';
-0152 dispEM(EM,throwErrors);
-0153 end
-0154 end
-0155 if isfield(model,'metFormulas')
-0156 if ~iscellstr(model.metFormulas)
-0157 EM='The "metFormulas" field must be a cell array of strings';
-0158 dispEM(EM,throwErrors);
-0159 end
-0160 end
-0161 if isfield(model,'metCharges')
-0162 if ~isnumeric(model.metCharges)
-0163 EM='The "metCharges" field must be a double';
-0164 dispEM(EM,throwErrors);
-0165 end
-0166 end
-0167 if isfield(model,'metDeltaG')
-0168 if ~isnumeric(model.metDeltaG)
-0169 EM='The "metDeltaG" field must be a double';
-0170 dispEM(EM,throwErrors);
-0171 end
-0172 end
-0173 if isfield(model,'subSystems')
-0174 for i=1:numel(model.subSystems)
-0175 if ~iscell(model.subSystems{i,1})
-0176 EM='The "subSystems" field must be a cell array';
-0177 dispEM(EM,throwErrors);
-0178 end
-0179 end
-0180 end
-0181 if isfield(model,'eccodes')
-0182 if ~iscellstr(model.eccodes)
-0183 EM='The "eccodes" field must be a cell array of strings';
-0184 dispEM(EM,throwErrors);
-0185 end
-0186 end
-0187 if isfield(model,'unconstrained')
-0188 if ~isnumeric(model.unconstrained)
-0189 EM='The "unconstrained" field must be of type "double"';
-0190 dispEM(EM,throwErrors);
-0191 end
-0192 end
-0193 if isfield(model,'rxnNotes')
-0194 if ~iscellstr(model.rxnNotes)
-0195 EM='The "rxnNotes" field must be a cell array of strings';
-0196 dispEM(EM,throwErrors);
-0197 end
-0198 end
-0199 if isfield(model,'rxnReferences')
-0200 if ~iscellstr(model.rxnReferences)
-0201 EM='The "rxnReferences" field must be a cell array of strings';
-0202 dispEM(EM,throwErrors);
-0203 end
-0204 end
-0205 if isfield(model,'rxnConfidenceScores')
-0206 if ~isnumeric(model.rxnConfidenceScores)
-0207 EM='The "rxnConfidenceScores" field must be a double';
-0208 dispEM(EM,throwErrors);
-0209 end
-0210 end
-0211 if isfield(model,'rxnDeltaG')
-0212 if ~isnumeric(model.rxnDeltaG)
-0213 EM='The "rxnDeltaG" field must be a double';
-0214 dispEM(EM,throwErrors);
-0215 end
-0216 end
-0217
-0218
-0219 if isempty(model.id)
-0220 EM='The "id" field cannot be empty';
-0221 dispEM(EM,throwErrors);
-0222 end
-0223 if any(cellfun(@isempty,model.rxns))
-0224 EM='The model contains empty reaction IDs';
+0127
+0128 EM='The following reaction(s) have grRules that start or end with ''OR'' or ''AND'':';
+0129 dispEM(EM,throwErrors,model.rxns(startsWith(model.grRules,{'or ','and '}) | endsWith(model.grRules,{' or',' and'})),trimWarnings);
+0130
+0131 geneList = getGenesFromGrRules(model.grRules);
+0132 geneList = setdiff(unique(geneList),model.genes);
+0133 if ~isempty(geneList)
+0134 problemGrRules = model.rxns(contains(model.grRules,geneList));
+0135 problemGrRules = strjoin(problemGrRules(:),'; ');
+0136 EM=['The reaction(s) "' problemGrRules '" contain the following genes in its "grRules" field, but these are not in the "genes" field:'];
+0137 dispEM(EM,throwErrors,geneList);
+0138 end
+0139 end
+0140 end
+0141 if isfield(model,'rxnComps')
+0142 if ~isnumeric(model.rxnComps)
+0143 EM='The "rxnComps" field must be of type "double"';
+0144 dispEM(EM,throwErrors);
+0145 end
+0146 end
+0147 if isfield(model,'inchis')
+0148 if ~iscellstr(model.inchis)
+0149 EM='The "inchis" field must be a cell array of strings';
+0150 dispEM(EM,throwErrors);
+0151 end
+0152 end
+0153 if isfield(model,'metSmiles')
+0154 if ~iscellstr(model.metSmiles)
+0155 EM='The "metSmiles" field must be a cell array of strings';
+0156 dispEM(EM,throwErrors);
+0157 end
+0158 end
+0159 if isfield(model,'metFormulas')
+0160 if ~iscellstr(model.metFormulas)
+0161 EM='The "metFormulas" field must be a cell array of strings';
+0162 dispEM(EM,throwErrors);
+0163 end
+0164 end
+0165 if isfield(model,'metCharges')
+0166 if ~isnumeric(model.metCharges)
+0167 EM='The "metCharges" field must be a double';
+0168 dispEM(EM,throwErrors);
+0169 end
+0170 end
+0171 if isfield(model,'metDeltaG')
+0172 if ~isnumeric(model.metDeltaG)
+0173 EM='The "metDeltaG" field must be a double';
+0174 dispEM(EM,throwErrors);
+0175 end
+0176 end
+0177 if isfield(model,'subSystems')
+0178 for i=1:numel(model.subSystems)
+0179 if ~iscell(model.subSystems{i,1})
+0180 EM='The "subSystems" field must be a cell array';
+0181 dispEM(EM,throwErrors);
+0182 end
+0183 end
+0184 end
+0185 if isfield(model,'eccodes')
+0186 if ~iscellstr(model.eccodes)
+0187 EM='The "eccodes" field must be a cell array of strings';
+0188 dispEM(EM,throwErrors);
+0189 end
+0190 end
+0191 if isfield(model,'unconstrained')
+0192 if ~isnumeric(model.unconstrained)
+0193 EM='The "unconstrained" field must be of type "double"';
+0194 dispEM(EM,throwErrors);
+0195 end
+0196 end
+0197 if isfield(model,'rxnNotes')
+0198 if ~iscellstr(model.rxnNotes)
+0199 EM='The "rxnNotes" field must be a cell array of strings';
+0200 dispEM(EM,throwErrors);
+0201 end
+0202 end
+0203 if isfield(model,'rxnReferences')
+0204 if ~iscellstr(model.rxnReferences)
+0205 EM='The "rxnReferences" field must be a cell array of strings';
+0206 dispEM(EM,throwErrors);
+0207 end
+0208 end
+0209 if isfield(model,'rxnConfidenceScores')
+0210 if ~isnumeric(model.rxnConfidenceScores)
+0211 EM='The "rxnConfidenceScores" field must be a double';
+0212 dispEM(EM,throwErrors);
+0213 end
+0214 end
+0215 if isfield(model,'rxnDeltaG')
+0216 if ~isnumeric(model.rxnDeltaG)
+0217 EM='The "rxnDeltaG" field must be a double';
+0218 dispEM(EM,throwErrors);
+0219 end
+0220 end
+0221
+0222
+0223 if isempty(model.id)
+0224 EM='The "id" field cannot be empty';
0225 dispEM(EM,throwErrors);
0226 end
-0227 if any(cellfun(@isempty,model.mets))
-0228 EM='The model contains empty metabolite IDs';
+0227 if any(cellfun(@isempty,model.rxns))
+0228 EM='The model contains empty reaction IDs';
0229 dispEM(EM,throwErrors);
0230 end
-0231 if any(cellfun(@isempty,model.comps))
-0232 EM='The model contains empty compartment IDs';
+0231 if any(cellfun(@isempty,model.mets))
+0232 EM='The model contains empty metabolite IDs';
0233 dispEM(EM,throwErrors);
0234 end
-0235 EM='The following metabolites have empty names:';
-0236 dispEM(EM,throwErrors,model.mets(cellfun(@isempty,model.metNames)),trimWarnings);
-0237
-0238 if isfield(model,'genes')
-0239 if any(cellfun(@isempty,model.genes))
-0240 EM='The model contains empty gene IDs';
-0241 dispEM(EM,throwErrors);
-0242 end
-0243 end
-0244
-0245
-0246 fields = {'rxns';'mets';'comps';'genes'};
-0247 fieldNames = {'reaction';'metabolite';'compartment';'gene'};
-0248 fieldPrefix = {'R_';'M_';'C_';'G_'};
-0249 for i=1:numel(fields)
-0250 try
-0251 numIDs = ~startsWith(model.(fields{i}),regexpPattern('^[a-zA-Z_]'));
-0252 catch
-0253 numIDs = [];
-0254 end
-0255 if any(numIDs)
-0256 EM = ['The following ' fieldNames{i} ' identifiers do not start '...
-0257 'with a letter or _ (conflicting with SBML specifications). '...
-0258 'This does not impact RAVEN functionality, but be aware that '...
-0259 'exportModel will automatically add ' fieldPrefix{i} ...
-0260 ' prefixes to all ' fieldNames{i} ' identifiers:'];
-0261 dispEM(EM,false,{model.(fields{i}){numIDs}},trimWarnings);
-0262 end
-0263 end
-0264
-0265
-0266 EM='The following reaction IDs are duplicates:';
-0267 dispEM(EM,throwErrors,model.rxns(duplicates(model.rxns)),trimWarnings);
-0268 EM='The following metabolite IDs are duplicates:';
-0269 dispEM(EM,throwErrors,model.mets(duplicates(model.mets)),trimWarnings);
-0270 EM='The following compartment IDs are duplicates:';
-0271 dispEM(EM,throwErrors,model.comps(duplicates(model.comps)),trimWarnings);
-0272 if isfield(model,'genes')
-0273 EM='The following genes are duplicates:';
-0274 dispEM(EM,throwErrors,model.genes(duplicates(model.genes)),trimWarnings);
-0275 end
-0276 metInComp=strcat(model.metNames,'[',model.comps(model.metComps),']');
-0277 EM='The following metabolites already exist in the same compartment:';
-0278 dispEM(EM,throwErrors,metInComp(duplicates(metInComp)),trimWarnings);
-0279
-0280
-0281 EM='The following reactions are empty (no involved metabolites):';
-0282 dispEM(EM,false,model.rxns(~any(model.S,1)),trimWarnings);
-0283 EM='The following metabolites are never used in a reaction:';
-0284 dispEM(EM,false,model.mets(~any(model.S,2)),trimWarnings);
-0285 if isfield(model,'genes')
-0286 EM='The following genes are not associated to a reaction:';
-0287 dispEM(EM,false,model.genes(~any(model.rxnGeneMat,1)),trimWarnings);
-0288 end
-0289 I=true(numel(model.comps),1);
-0290 I(model.metComps)=false;
-0291 EM='The following compartments contain no metabolites:';
-0292 dispEM(EM,false,model.comps(I),trimWarnings);
-0293
-0294
-0295 EM='The following reactions have contradicting bounds (lower bound is higher than upper bound):';
-0296 dispEM(EM,throwErrors,model.rxns(model.lb>model.ub),trimWarnings);
-0297 EM='The following reactions have lower and upper bounds that indicate reversibility, but are indicated as irreversible in model.rev:';
-0298 dispEM(EM,false,model.rxns(model.lb < 0 & model.ub > 0 & model.rev==0),trimWarnings);
-0299
-0300
-0301 if numel(find(model.c))>1
-0302 EM='Multiple objective functions found. This might be intended, but results in FBCv2 non-compliant SBML file when exported';
-0303 dispEM(EM,false,model.rxns(find(model.c)),trimWarnings);
-0304 elseif ~any(model.c)
-0305 EM='No objective function found. This might be intended, but results in FBCv2 non-compliant SBML file when exported';
-0306 dispEM(EM,false);
-0307 end
-0308
-0309
-0310 if isfield(model,'compOutside')
-0311 EM='The following compartments are in "compOutside" but not in "comps":';
-0312 dispEM(EM,throwErrors,setdiff(model.compOutside,[{''};model.comps]),trimWarnings);
-0313 end
-0314
-0315
-0316 I=false(numel(model.metNames),1);
-0317 for i=1:numel(model.metNames)
-0318 index=strfind(model.metNames{i},' ');
-0319 if any(index)
-0320 if any(str2double(model.metNames{i}(1:index(1)-1)))
-0321 I(i)=true;
-0322 end
-0323 end
-0324 end
-0325 EM='The following metabolite names begin with a number directly followed by space, which could potentially cause problems:';
-0326 dispEM(EM,false,model.metNames(I),trimWarnings);
-0327
-0328
-0329 if isfield(model,'metFormulas')
-0330 [~, ~, exitFlag]=parseFormulas(model.metFormulas,true,false);
-0331 EM='The composition for the following metabolites could not be parsed:';
-0332 dispEM(EM,false,model.mets(exitFlag==-1),trimWarnings);
-0333 end
-0334
-0335
-0336
-0337 if isfield(model,'metMiriams')
-0338 miriams=containers.Map();
-0339 for i=1:numel(model.mets)
-0340 if ~isempty(model.metMiriams{i})
-0341
-0342 for j=1:numel(model.metMiriams{i}.name)
-0343
-0344 current=strcat(model.metMiriams{i}.name{j},'/',model.metMiriams{i}.value{j});
-0345 if isKey(miriams,current)
-0346 existing=miriams(current);
-0347 else
-0348 existing=[];
-0349 end
-0350 miriams(current)=[existing;i];
-0351 end
-0352 end
-0353 end
-0354
-0355
-0356 allMiriams=keys(miriams);
-0357
-0358 hasMultiple=false(numel(allMiriams),1);
-0359 for i=1:numel(allMiriams)
-0360 if numel(miriams(allMiriams{i}))>1
-0361
-0362 if numel(unique(model.metNames(miriams(allMiriams{i}))))>1
-0363 if ~regexp(allMiriams{i},'^sbo\/SBO:')
-0364 hasMultiple(i)=true;
-0365 end
-0366 end
-0367 end
-0368 end
-0369
-0370
-0371 EM='The following MIRIAM strings are associated to more than one unique metabolite name:';
-0372 dispEM(EM,false,allMiriams(hasMultiple),trimWarnings);
-0373 end
-0374
-0375
-0376
-0377 if isfield(model,'inchis')
-0378 inchis=containers.Map();
-0379 for i=1:numel(model.mets)
-0380 if ~isempty(model.inchis{i})
-0381
-0382 if isKey(inchis,model.inchis{i})
-0383 existing=inchis(model.inchis{i});
-0384 else
-0385 existing=[];
-0386 end
-0387 inchis(model.inchis{i})=[existing;i];
-0388 end
-0389 end
-0390
-0391
-0392 allInchis=keys(inchis);
-0393
-0394 hasMultiple=false(numel(allInchis),1);
-0395 for i=1:numel(allInchis)
-0396 if numel(inchis(allInchis{i}))>1
-0397
-0398 if numel(unique(model.metNames(inchis(allInchis{i}))))>1
-0399 hasMultiple(i)=true;
-0400 end
-0401 end
-0402 end
-0403
-0404
-0405 EM='The following InChI strings are associated to more than one unique metabolite name:';
-0406 dispEM(EM,false,allInchis(hasMultiple),trimWarnings);
-0407 end
-0408
-0409
-0410
-0411
-0412
-0413
-0414
-0415
-0416
-0417
-0418
-0419
-0420
-0421
-0422
-0423
-0424
-0425
-0426
-0427
-0428
-0429
-0430
-0431
-0432
-0433
-0434
-0435
-0436
-0437
-0438
-0439
-0440
-0441 end
-0442
-0443 function I=duplicates(strings)
-0444 I=false(numel(strings),1);
-0445 [J, K]=unique(strings);
-0446 if numel(J)~=numel(strings)
-0447 L=1:numel(strings);
-0448 L(K)=[];
-0449 I(L)=true;
-0450 end
-0451 end
+0235 if any(cellfun(@isempty,model.comps))
+0236 EM='The model contains empty compartment IDs';
+0237 dispEM(EM,throwErrors);
+0238 end
+0239 EM='The following metabolites have empty names:';
+0240 dispEM(EM,throwErrors,model.mets(cellfun(@isempty,model.metNames)),trimWarnings);
+0241
+0242 if isfield(model,'genes')
+0243 if any(cellfun(@isempty,model.genes))
+0244 EM='The model contains empty gene IDs';
+0245 dispEM(EM,throwErrors);
+0246 end
+0247 end
+0248
+0249
+0250 fields = {'rxns';'mets';'comps';'genes'};
+0251 fieldNames = {'reaction';'metabolite';'compartment';'gene'};
+0252 fieldPrefix = {'R_';'M_';'C_';'G_'};
+0253 for i=1:numel(fields)
+0254 try
+0255 numIDs = ~startsWith(model.(fields{i}),regexpPattern('^[a-zA-Z_]'));
+0256 catch
+0257 numIDs = [];
+0258 end
+0259 if any(numIDs)
+0260 EM = ['The following ' fieldNames{i} ' identifiers do not start '...
+0261 'with a letter or _ (conflicting with SBML specifications). '...
+0262 'This does not impact RAVEN functionality, but be aware that '...
+0263 'exportModel will automatically add ' fieldPrefix{i} ...
+0264 ' prefixes to all ' fieldNames{i} ' identifiers:'];
+0265 dispEM(EM,false,{model.(fields{i}){numIDs}},trimWarnings);
+0266 end
+0267 end
+0268
+0269
+0270 EM='The following reaction IDs are duplicates:';
+0271 dispEM(EM,throwErrors,model.rxns(duplicates(model.rxns)),trimWarnings);
+0272 EM='The following metabolite IDs are duplicates:';
+0273 dispEM(EM,throwErrors,model.mets(duplicates(model.mets)),trimWarnings);
+0274 EM='The following compartment IDs are duplicates:';
+0275 dispEM(EM,throwErrors,model.comps(duplicates(model.comps)),trimWarnings);
+0276 if isfield(model,'genes')
+0277 EM='The following genes are duplicates:';
+0278 dispEM(EM,throwErrors,model.genes(duplicates(model.genes)),trimWarnings);
+0279 end
+0280 metInComp=strcat(model.metNames,'[',model.comps(model.metComps),']');
+0281 EM='The following metabolites already exist in the same compartment:';
+0282 dispEM(EM,throwErrors,metInComp(duplicates(metInComp)),trimWarnings);
+0283
+0284
+0285 EM='The following reactions are empty (no involved metabolites):';
+0286 dispEM(EM,false,model.rxns(~any(model.S,1)),trimWarnings);
+0287 EM='The following metabolites are never used in a reaction:';
+0288 dispEM(EM,false,model.mets(~any(model.S,2)),trimWarnings);
+0289 if isfield(model,'genes')
+0290 EM='The following genes are not associated to a reaction:';
+0291 dispEM(EM,false,model.genes(~any(model.rxnGeneMat,1)),trimWarnings);
+0292 end
+0293 I=true(numel(model.comps),1);
+0294 I(model.metComps)=false;
+0295 EM='The following compartments contain no metabolites:';
+0296 dispEM(EM,false,model.comps(I),trimWarnings);
+0297
+0298
+0299 EM='The following reactions have contradicting bounds (lower bound is higher than upper bound):';
+0300 dispEM(EM,throwErrors,model.rxns(model.lb>model.ub),trimWarnings);
+0301 EM='The following reactions have lower and upper bounds that indicate reversibility, but are indicated as irreversible in model.rev:';
+0302 dispEM(EM,false,model.rxns(model.lb < 0 & model.ub > 0 & model.rev==0),trimWarnings);
+0303
+0304
+0305 if numel(find(model.c))>1
+0306 EM='Multiple objective functions found. This might be intended, but results in FBCv2 non-compliant SBML file when exported';
+0307 dispEM(EM,false,model.rxns(find(model.c)),trimWarnings);
+0308 elseif ~any(model.c)
+0309 EM='No objective function found. This might be intended, but results in FBCv2 non-compliant SBML file when exported';
+0310 dispEM(EM,false);
+0311 end
+0312
+0313
+0314 if isfield(model,'compOutside')
+0315 EM='The following compartments are in "compOutside" but not in "comps":';
+0316 dispEM(EM,throwErrors,setdiff(model.compOutside,[{''};model.comps]),trimWarnings);
+0317 end
+0318
+0319
+0320 I=false(numel(model.metNames),1);
+0321 for i=1:numel(model.metNames)
+0322 index=strfind(model.metNames{i},' ');
+0323 if any(index)
+0324 if any(str2double(model.metNames{i}(1:index(1)-1)))
+0325 I(i)=true;
+0326 end
+0327 end
+0328 end
+0329 EM='The following metabolite names begin with a number directly followed by space, which could potentially cause problems:';
+0330 dispEM(EM,false,model.metNames(I),trimWarnings);
+0331
+0332
+0333 if isfield(model,'metFormulas')
+0334 [~, ~, exitFlag]=parseFormulas(model.metFormulas,true,false);
+0335 EM='The composition for the following metabolites could not be parsed:';
+0336 dispEM(EM,false,model.mets(exitFlag==-1),trimWarnings);
+0337 end
+0338
+0339
+0340
+0341 if isfield(model,'metMiriams')
+0342 miriams=containers.Map();
+0343 for i=1:numel(model.mets)
+0344 if ~isempty(model.metMiriams{i})
+0345
+0346 for j=1:numel(model.metMiriams{i}.name)
+0347
+0348 current=strcat(model.metMiriams{i}.name{j},'/',model.metMiriams{i}.value{j});
+0349 if isKey(miriams,current)
+0350 existing=miriams(current);
+0351 else
+0352 existing=[];
+0353 end
+0354 miriams(current)=[existing;i];
+0355 end
+0356 end
+0357 end
+0358
+0359
+0360 allMiriams=keys(miriams);
+0361
+0362 hasMultiple=false(numel(allMiriams),1);
+0363 for i=1:numel(allMiriams)
+0364 if numel(miriams(allMiriams{i}))>1
+0365
+0366 if numel(unique(model.metNames(miriams(allMiriams{i}))))>1
+0367 if ~regexp(allMiriams{i},'^sbo\/SBO:')
+0368 hasMultiple(i)=true;
+0369 end
+0370 end
+0371 end
+0372 end
+0373
+0374
+0375 EM='The following MIRIAM strings are associated to more than one unique metabolite name:';
+0376 dispEM(EM,false,allMiriams(hasMultiple),trimWarnings);
+0377 end
+0378
+0379
+0380
+0381 if isfield(model,'inchis')
+0382 inchis=containers.Map();
+0383 for i=1:numel(model.mets)
+0384 if ~isempty(model.inchis{i})
+0385
+0386 if isKey(inchis,model.inchis{i})
+0387 existing=inchis(model.inchis{i});
+0388 else
+0389 existing=[];
+0390 end
+0391 inchis(model.inchis{i})=[existing;i];
+0392 end
+0393 end
+0394
+0395
+0396 allInchis=keys(inchis);
+0397
+0398 hasMultiple=false(numel(allInchis),1);
+0399 for i=1:numel(allInchis)
+0400 if numel(inchis(allInchis{i}))>1
+0401
+0402 if numel(unique(model.metNames(inchis(allInchis{i}))))>1
+0403 hasMultiple(i)=true;
+0404 end
+0405 end
+0406 end
+0407
+0408
+0409 EM='The following InChI strings are associated to more than one unique metabolite name:';
+0410 dispEM(EM,false,allInchis(hasMultiple),trimWarnings);
+0411 end
+0412
+0413
+0414
+0415
+0416
+0417
+0418
+0419
+0420
+0421
+0422
+0423
+0424
+0425
+0426
+0427
+0428
+0429
+0430
+0431
+0432
+0433
+0434
+0435
+0436
+0437
+0438
+0439
+0440
+0441
+0442
+0443
+0444
+0445 end
+0446
+0447 function I=duplicates(strings)
+0448 I=false(numel(strings),1);
+0449 [J, K]=unique(strings);
+0450 if numel(J)~=numel(strings)
+0451 L=1:numel(strings);
+0452 L(K)=[];
+0453 I(L)=true;
+0454 end
+0455 end
Generated by m2html © 2005