From e6f283760b1fafd0a201fe14bb1488c3d053cfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Domenzain?= Date: Sat, 12 Oct 2024 22:26:32 +0200 Subject: [PATCH] fix: change model field proteinNames to proteins (#564) * fix: change model field proteinNames to proteins * fix: enforce column form for model.proteins * doc: importModel more informative warning * chore: update documentation --------- Co-authored-by: Eduard Kerkhoven --- INIT/getINITModel.m | 4 +- INIT/mergeLinear.m | 4 +- INIT/removeLowScoreGenes.m | 4 +- core/addGenesRaven.m | 24 +- core/deleteUnusedGenes.m | 4 +- core/getModelFromHomology.m | 4 +- core/mergeModels.m | 16 +- core/permuteModel.m | 4 +- core/predictLocalization.m | 12 +- core/removeReactions.m | 4 +- core/simplifyModel.m | 4 +- doc/INIT/getINITModel.html | 4 +- doc/INIT/mergeLinear.html | 4 +- doc/INIT/removeLowScoreGenes.html | 4 +- doc/core/addGenesRaven.html | 26 +- doc/core/deleteUnusedGenes.html | 4 +- doc/core/getModelFromHomology.html | 4 +- doc/core/mergeModels.html | 16 +- doc/core/permuteModel.html | 4 +- doc/core/predictLocalization.html | 12 +- doc/core/removeReactions.html | 4 +- doc/core/simplifyModel.html | 4 +- doc/io/exportModel.html | 10 +- doc/io/importModel.html | 519 ++++++++++--------- doc/io/readYAMLmodel.html | 6 +- doc/io/writeYAMLmodel.html | 2 +- doc/struct_conversion/ravenCobraWrapper.html | 2 +- io/exportModel.m | 10 +- io/importModel.m | 31 +- io/readYAMLmodel.m | 6 +- io/writeYAMLmodel.m | 2 +- struct_conversion/ravenCobraWrapper.m | 2 +- 32 files changed, 393 insertions(+), 367 deletions(-) diff --git a/INIT/getINITModel.m b/INIT/getINITModel.m index 3d21174d..e48bf1a2 100644 --- a/INIT/getINITModel.m +++ b/INIT/getINITModel.m @@ -391,8 +391,8 @@ if isfield(model,'geneShortNames') model.geneShortNames(I)=[]; end -if isfield(model,'proteinNames') - model.proteinNames(I)=[]; +if isfield(model,'proteins') + model.proteins(I)=[]; end if isfield(model,'geneMiriams') model.geneMiriams(I)=[]; diff --git a/INIT/mergeLinear.m b/INIT/mergeLinear.m index ae4618ba..1378353b 100644 --- a/INIT/mergeLinear.m +++ b/INIT/mergeLinear.m @@ -29,8 +29,8 @@ if isfield(reducedModel,'geneShortNames') reducedModel.geneShortNames={}; end -if isfield(reducedModel,'proteinNames') - reducedModel.proteinNames={}; +if isfield(reducedModel,'proteins') + reducedModel.proteins={}; end if isfield(reducedModel,'geneMiriams') reducedModel.geneMiriams={}; diff --git a/INIT/removeLowScoreGenes.m b/INIT/removeLowScoreGenes.m index d49fbd7d..76a5bdeb 100644 --- a/INIT/removeLowScoreGenes.m +++ b/INIT/removeLowScoreGenes.m @@ -119,8 +119,8 @@ if isfield(newModel,'geneShortNames') newModel.geneShortNames(remInd) = []; end -if isfield(newModel,'proteinNames') - newModel.proteinNames(remInd) = []; +if isfield(newModel,'proteins') + newModel.proteins(remInd) = []; end if isfield(newModel,'geneMiriams') newModel.geneMiriams(remInd) = []; diff --git a/core/addGenesRaven.m b/core/addGenesRaven.m index 30e73b83..cc44f153 100755 --- a/core/addGenesRaven.m +++ b/core/addGenesRaven.m @@ -14,7 +14,7 @@ % default '') % geneMiriams cell array with MIRIAM structures (optional, % default []) -% proteinNames cell array of protein names associated to +% proteins cell array of protein names associated to % each gene (optional, default '') % % newModel an updated model structure @@ -58,8 +58,8 @@ if isfield(genesToAdd,'geneShortNames') genesToAdd.geneShortNames(I)=[]; end - if isfield(genesToAdd,'proteinNames') - genesToAdd.proteinNames(I)=[]; + if isfield(genesToAdd,'proteins') + genesToAdd.proteins(I)=[]; end if isfield(genesToAdd,'geneMiriams') genesToAdd.geneMiriams(I)=[]; @@ -86,21 +86,21 @@ newModel.geneShortNames=[newModel.geneShortNames;filler]; end end -if isfield(genesToAdd,'proteinNames') - genesToAdd.proteinNames=convertCharArray(genesToAdd.proteinNames); - if numel(genesToAdd.proteinNames)~=nGenes - EM='genesToAdd.proteinNames must have the same number of elements as genesToAdd.genes'; +if isfield(genesToAdd,'proteins') + genesToAdd.proteins=convertCharArray(genesToAdd.proteins); + if numel(genesToAdd.proteins)~=nGenes + EM='genesToAdd.proteins must have the same number of elements as genesToAdd.genes'; dispEM(EM); end %Add empty field if it doesn't exist - if ~isfield(newModel,'proteinNames') - newModel.proteinNames=largeFiller; + if ~isfield(newModel,'proteins') + newModel.proteins=largeFiller; end - newModel.proteinNames=[newModel.proteinNames;genesToAdd.proteinNames(:)]; + newModel.proteins=[newModel.proteins;genesToAdd.proteins(:)]; else %Add empty strings if structure is in model - if isfield(newModel,'proteinNames') - newModel.proteinNames=[newModel.proteinNames;filler]; + if isfield(newModel,'proteins') + newModel.proteins=[newModel.proteins;filler]; end end diff --git a/core/deleteUnusedGenes.m b/core/deleteUnusedGenes.m index 0fb2e2e1..7d0427f9 100755 --- a/core/deleteUnusedGenes.m +++ b/core/deleteUnusedGenes.m @@ -37,8 +37,8 @@ reducedModel.geneShortNames=reducedModel.geneShortNames(toKeep); end -if isfield(reducedModel,'proteinNames') - reducedModel.proteinNames=reducedModel.proteinNames(toKeep); +if isfield(reducedModel,'proteins') + reducedModel.proteins=reducedModel.proteins(toKeep); end if isfield(reducedModel,'geneMiriams') diff --git a/core/getModelFromHomology.m b/core/getModelFromHomology.m index 42ef3f82..aa356b03 100755 --- a/core/getModelFromHomology.m +++ b/core/getModelFromHomology.m @@ -115,8 +115,8 @@ if isfield(models{i},'geneMiriams') models{i}=rmfield(models{i},'geneMiriams'); end - if isfield(models{i},'proteinNames') - models{i}=rmfield(models{i},'proteinNames'); + if isfield(models{i},'proteins') + models{i}=rmfield(models{i},'proteins'); end %The geneFrom field also loses meaning if the genes are replaced by %orthologs diff --git a/core/mergeModels.m b/core/mergeModels.m index c7b7fb15..29faff96 100755 --- a/core/mergeModels.m +++ b/core/mergeModels.m @@ -493,8 +493,8 @@ model.geneShortNames=models{i}.geneShortNames; end - if isfield(models{i},'proteinNames') - model.proteinNames=models{i}.proteinNames; + if isfield(models{i},'proteins') + model.proteins=models{i}.proteins; end if isfield(models{i},'geneMiriams') @@ -535,19 +535,19 @@ end end - if isfield(models{i},'proteinNames') - if isfield(model,'proteinNames') - model.proteinNames=[model.proteinNames;models{i}.proteinNames(genesToAdd)]; + if isfield(models{i},'proteins') + if isfield(model,'proteins') + model.proteins=[model.proteins;models{i}.proteins(genesToAdd)]; else emptyGeneSN=cell(numel(model.genes)-numel(genesToAdd),1); emptyGeneSN(:)={''}; - model.proteinNames=[emptyGeneSN;models{i}.proteinNames(genesToAdd)]; + model.proteins=[emptyGeneSN;models{i}.proteins(genesToAdd)]; end else - if isfield(model,'proteinNames') + if isfield(model,'proteins') emptyGeneSN=cell(numel(genesToAdd),1); emptyGeneSN(:)={''}; - model.proteinNames=[model.proteinNames;emptyGeneSN]; + model.proteins=[model.proteins;emptyGeneSN]; end end diff --git a/core/permuteModel.m b/core/permuteModel.m index 1a7fca61..4fad67c2 100755 --- a/core/permuteModel.m +++ b/core/permuteModel.m @@ -132,8 +132,8 @@ if isfield(newModel,'geneShortNames') newModel.geneShortNames=newModel.geneShortNames(indexes); end - if isfield(newModel,'proteinNames') - newModel.proteinNames=newModel.proteinNames(indexes); + if isfield(newModel,'proteins') + newModel.proteins=newModel.proteins(indexes); end if isfield(newModel,'rxnGeneMat') newModel.rxnGeneMat=newModel.rxnGeneMat(:,indexes); diff --git a/core/predictLocalization.m b/core/predictLocalization.m index d05fe0ef..2bfff833 100755 --- a/core/predictLocalization.m +++ b/core/predictLocalization.m @@ -199,8 +199,8 @@ if isfield(model,'geneMiriams') model.geneMiriams=[model.geneMiriams;{[]}]; end - if isfield(model,'proteinNames') - model.proteinNames=[model.proteinNames;{[]}]; + if isfield(model,'proteins') + model.proteins=[model.proteins;{[]}]; end if isfield(model,'geneFrom') model.geneFrom=[model.geneFrom;{{'FAKE'}}]; @@ -261,8 +261,8 @@ if isfield(model,'geneShortNames') model.geneShortNames=[model.geneShortNames;{''}]; end - if isfield(model,'proteinNames') - model.proteinNames=[model.proteinNames;{''}]; + if isfield(model,'proteins') + model.proteins=[model.proteins;{''}]; end if isfield(model,'geneFrom') model.geneFrom=[model.geneFrom;{'COMPLEX'}]; @@ -765,8 +765,8 @@ if isfield(outModel,'geneShortNames') outModel.geneShortNames(I)=[]; end -if isfield(outModel,'proteinNames') - outModel.proteinNames(I)=[]; +if isfield(outModel,'proteins') + outModel.proteins(I)=[]; end outModel.rxnGeneMat(:,I)=[]; diff --git a/core/removeReactions.m b/core/removeReactions.m index d296c566..4255c6e2 100755 --- a/core/removeReactions.m +++ b/core/removeReactions.m @@ -130,8 +130,8 @@ reducedModel.geneShortNames=reducedModel.geneShortNames(toKeep); end - if isfield(reducedModel,'proteinNames') - reducedModel.proteinNames=reducedModel.proteinNames(toKeep); + if isfield(reducedModel,'proteins') + reducedModel.proteins=reducedModel.proteins(toKeep); end if isfield(reducedModel,'geneMiriams') diff --git a/core/simplifyModel.m b/core/simplifyModel.m index ecf8a6af..d99f7ae6 100755 --- a/core/simplifyModel.m +++ b/core/simplifyModel.m @@ -221,8 +221,8 @@ if isfield(reducedModel,'geneShortNames') reducedModel.geneShortNames={}; end - if isfield(reducedModel,'proteinNames') - reducedModel.proteinNames={}; + if isfield(reducedModel,'proteins') + reducedModel.proteins={}; end if isfield(reducedModel,'geneMiriams') reducedModel.geneMiriams={}; diff --git a/doc/INIT/getINITModel.html b/doc/INIT/getINITModel.html index bd3c7d0e..a1079434 100644 --- a/doc/INIT/getINITModel.html +++ b/doc/INIT/getINITModel.html @@ -544,8 +544,8 @@

SOURCE CODE ^if isfield(model,'geneShortNames') 0392 model.geneShortNames(I)=[]; 0393 end -0394 if isfield(model,'proteinNames') -0395 model.proteinNames(I)=[]; +0394 if isfield(model,'proteins') +0395 model.proteins(I)=[]; 0396 end 0397 if isfield(model,'geneMiriams') 0398 model.geneMiriams(I)=[]; diff --git a/doc/INIT/mergeLinear.html b/doc/INIT/mergeLinear.html index 6643af31..16467e80 100644 --- a/doc/INIT/mergeLinear.html +++ b/doc/INIT/mergeLinear.html @@ -92,8 +92,8 @@

SOURCE CODE ^if isfield(reducedModel,'geneShortNames') 0030 reducedModel.geneShortNames={}; 0031 end -0032 if isfield(reducedModel,'proteinNames') -0033 reducedModel.proteinNames={}; +0032 if isfield(reducedModel,'proteins') +0033 reducedModel.proteins={}; 0034 end 0035 if isfield(reducedModel,'geneMiriams') 0036 reducedModel.geneMiriams={}; diff --git a/doc/INIT/removeLowScoreGenes.html b/doc/INIT/removeLowScoreGenes.html index 9994b421..34524a1e 100644 --- a/doc/INIT/removeLowScoreGenes.html +++ b/doc/INIT/removeLowScoreGenes.html @@ -223,8 +223,8 @@

SOURCE CODE ^if isfield(newModel,'geneShortNames') 0120 newModel.geneShortNames(remInd) = []; 0121 end -0122 if isfield(newModel,'proteinNames') -0123 newModel.proteinNames(remInd) = []; +0122 if isfield(newModel,'proteins') +0123 newModel.proteins(remInd) = []; 0124 end 0125 if isfield(newModel,'geneMiriams') 0126 newModel.geneMiriams(remInd) = []; diff --git a/doc/core/addGenesRaven.html b/doc/core/addGenesRaven.html index 99bba050..39d26818 100644 --- a/doc/core/addGenesRaven.html +++ b/doc/core/addGenesRaven.html @@ -42,7 +42,7 @@

DESCRIPTION ^SOURCE CODE ^% default '') 0015 % geneMiriams cell array with MIRIAM structures (optional, 0016 % default []) -0017 % proteinNames cell array of protein names associated to +0017 % proteins cell array of protein names associated to 0018 % each gene (optional, default '') 0019 % 0020 % newModel an updated model structure @@ -125,8 +125,8 @@

SOURCE CODE ^if isfield(genesToAdd,'geneShortNames') 0059 genesToAdd.geneShortNames(I)=[]; 0060 end -0061 if isfield(genesToAdd,'proteinNames') -0062 genesToAdd.proteinNames(I)=[]; +0061 if isfield(genesToAdd,'proteins') +0062 genesToAdd.proteins(I)=[]; 0063 end 0064 if isfield(genesToAdd,'geneMiriams') 0065 genesToAdd.geneMiriams(I)=[]; @@ -153,21 +153,21 @@

SOURCE CODE ^end 0088 end -0089 if isfield(genesToAdd,'proteinNames') -0090 genesToAdd.proteinNames=convertCharArray(genesToAdd.proteinNames); -0091 if numel(genesToAdd.proteinNames)~=nGenes -0092 EM='genesToAdd.proteinNames must have the same number of elements as genesToAdd.genes'; +0089 if isfield(genesToAdd,'proteins') +0090 genesToAdd.proteins=convertCharArray(genesToAdd.proteins); +0091 if numel(genesToAdd.proteins)~=nGenes +0092 EM='genesToAdd.proteins must have the same number of elements as genesToAdd.genes'; 0093 dispEM(EM); 0094 end 0095 %Add empty field if it doesn't exist -0096 if ~isfield(newModel,'proteinNames') -0097 newModel.proteinNames=largeFiller; +0096 if ~isfield(newModel,'proteins') +0097 newModel.proteins=largeFiller; 0098 end -0099 newModel.proteinNames=[newModel.proteinNames;genesToAdd.proteinNames(:)]; +0099 newModel.proteins=[newModel.proteins;genesToAdd.proteins(:)]; 0100 else 0101 %Add empty strings if structure is in model -0102 if isfield(newModel,'proteinNames') -0103 newModel.proteinNames=[newModel.proteinNames;filler]; +0102 if isfield(newModel,'proteins') +0103 newModel.proteins=[newModel.proteins;filler]; 0104 end 0105 end 0106 diff --git a/doc/core/deleteUnusedGenes.html b/doc/core/deleteUnusedGenes.html index bd8131d5..6a9bd7b1 100644 --- a/doc/core/deleteUnusedGenes.html +++ b/doc/core/deleteUnusedGenes.html @@ -90,8 +90,8 @@

SOURCE CODE ^end 0039 -0040 if isfield(reducedModel,'proteinNames') -0041 reducedModel.proteinNames=reducedModel.proteinNames(toKeep); +0040 if isfield(reducedModel,'proteins') +0041 reducedModel.proteins=reducedModel.proteins(toKeep); 0042 end 0043 0044 if isfield(reducedModel,'geneMiriams') diff --git a/doc/core/getModelFromHomology.html b/doc/core/getModelFromHomology.html index 650f0647..e8f6d374 100644 --- a/doc/core/getModelFromHomology.html +++ b/doc/core/getModelFromHomology.html @@ -222,8 +222,8 @@

SOURCE CODE ^if isfield(models{i},'geneMiriams') 0116 models{i}=rmfield(models{i},'geneMiriams'); 0117 end -0118 if isfield(models{i},'proteinNames') -0119 models{i}=rmfield(models{i},'proteinNames'); +0118 if isfield(models{i},'proteins') +0119 models{i}=rmfield(models{i},'proteins'); 0120 end 0121 %The geneFrom field also loses meaning if the genes are replaced by 0122 %orthologs diff --git a/doc/core/mergeModels.html b/doc/core/mergeModels.html index 2144f402..8264db25 100644 --- a/doc/core/mergeModels.html +++ b/doc/core/mergeModels.html @@ -554,8 +554,8 @@

SOURCE CODE ^end 0495 -0496 if isfield(models{i},'proteinNames') -0497 model.proteinNames=models{i}.proteinNames; +0496 if isfield(models{i},'proteins') +0497 model.proteins=models{i}.proteins; 0498 end 0499 0500 if isfield(models{i},'geneMiriams') @@ -596,19 +596,19 @@

SOURCE CODE ^end 0536 end 0537 -0538 if isfield(models{i},'proteinNames') -0539 if isfield(model,'proteinNames') -0540 model.proteinNames=[model.proteinNames;models{i}.proteinNames(genesToAdd)]; +0538 if isfield(models{i},'proteins') +0539 if isfield(model,'proteins') +0540 model.proteins=[model.proteins;models{i}.proteins(genesToAdd)]; 0541 else 0542 emptyGeneSN=cell(numel(model.genes)-numel(genesToAdd),1); 0543 emptyGeneSN(:)={''}; -0544 model.proteinNames=[emptyGeneSN;models{i}.proteinNames(genesToAdd)]; +0544 model.proteins=[emptyGeneSN;models{i}.proteins(genesToAdd)]; 0545 end 0546 else -0547 if isfield(model,'proteinNames') +0547 if isfield(model,'proteins') 0548 emptyGeneSN=cell(numel(genesToAdd),1); 0549 emptyGeneSN(:)={''}; -0550 model.proteinNames=[model.proteinNames;emptyGeneSN]; +0550 model.proteins=[model.proteins;emptyGeneSN]; 0551 end 0552 end 0553 diff --git a/doc/core/permuteModel.html b/doc/core/permuteModel.html index 64d94afe..f86f25f5 100644 --- a/doc/core/permuteModel.html +++ b/doc/core/permuteModel.html @@ -189,8 +189,8 @@

SOURCE CODE ^if isfield(newModel,'geneShortNames') 0133 newModel.geneShortNames=newModel.geneShortNames(indexes); 0134 end -0135 if isfield(newModel,'proteinNames') -0136 newModel.proteinNames=newModel.proteinNames(indexes); +0135 if isfield(newModel,'proteins') +0136 newModel.proteins=newModel.proteins(indexes); 0137 end 0138 if isfield(newModel,'rxnGeneMat') 0139 newModel.rxnGeneMat=newModel.rxnGeneMat(:,indexes); diff --git a/doc/core/predictLocalization.html b/doc/core/predictLocalization.html index 3c8b4a08..2622161e 100644 --- a/doc/core/predictLocalization.html +++ b/doc/core/predictLocalization.html @@ -304,8 +304,8 @@

SOURCE CODE ^if isfield(model,'geneMiriams') 0200 model.geneMiriams=[model.geneMiriams;{[]}]; 0201 end -0202 if isfield(model,'proteinNames') -0203 model.proteinNames=[model.proteinNames;{[]}]; +0202 if isfield(model,'proteins') +0203 model.proteins=[model.proteins;{[]}]; 0204 end 0205 if isfield(model,'geneFrom') 0206 model.geneFrom=[model.geneFrom;{{'FAKE'}}]; @@ -366,8 +366,8 @@

SOURCE CODE ^if isfield(model,'geneShortNames') 0262 model.geneShortNames=[model.geneShortNames;{''}]; 0263 end -0264 if isfield(model,'proteinNames') -0265 model.proteinNames=[model.proteinNames;{''}]; +0264 if isfield(model,'proteins') +0265 model.proteins=[model.proteins;{''}]; 0266 end 0267 if isfield(model,'geneFrom') 0268 model.geneFrom=[model.geneFrom;{'COMPLEX'}]; @@ -870,8 +870,8 @@

SOURCE CODE ^if isfield(outModel,'geneShortNames') 0766 outModel.geneShortNames(I)=[]; 0767 end -0768 if isfield(outModel,'proteinNames') -0769 outModel.proteinNames(I)=[]; +0768 if isfield(outModel,'proteins') +0769 outModel.proteins(I)=[]; 0770 end 0771 outModel.rxnGeneMat(:,I)=[]; 0772 diff --git a/doc/core/removeReactions.html b/doc/core/removeReactions.html index e9cc84ac..efc52428 100644 --- a/doc/core/removeReactions.html +++ b/doc/core/removeReactions.html @@ -193,8 +193,8 @@

SOURCE CODE ^end 0132 -0133 if isfield(reducedModel,'proteinNames') -0134 reducedModel.proteinNames=reducedModel.proteinNames(toKeep); +0133 if isfield(reducedModel,'proteins') +0134 reducedModel.proteins=reducedModel.proteins(toKeep); 0135 end 0136 0137 if isfield(reducedModel,'geneMiriams') diff --git a/doc/core/simplifyModel.html b/doc/core/simplifyModel.html index f7ae25a4..f6f4baf6 100644 --- a/doc/core/simplifyModel.html +++ b/doc/core/simplifyModel.html @@ -299,8 +299,8 @@

SOURCE CODE ^if isfield(reducedModel,'geneShortNames') 0222 reducedModel.geneShortNames={}; 0223 end -0224 if isfield(reducedModel,'proteinNames') -0225 reducedModel.proteinNames={}; +0224 if isfield(reducedModel,'proteins') +0225 reducedModel.proteins={}; 0226 end 0227 if isfield(reducedModel,'geneMiriams') 0228 reducedModel.geneMiriams={}; diff --git a/doc/io/exportModel.html b/doc/io/exportModel.html index aa5fbcb4..cc628177 100644 --- a/doc/io/exportModel.html +++ b/doc/io/exportModel.html @@ -198,8 +198,8 @@

SOURCE CODE ^if ~isfield(model,'geneShortNames') && isfield(model,'genes') 0133 model.geneShortNames=cell(numel(model.genes),1); 0134 end -0135 if ~isfield(model,'proteinNames') && isfield(model,'genes') -0136 model.proteinNames=cell(numel(model.genes),1); +0135 if ~isfield(model,'proteins') && isfield(model,'genes') +0136 model.proteins=cell(numel(model.genes),1); 0137 end 0138 if ~isfield(model,'subSystems') 0139 model.subSystems=cell(numel(model.rxns),1); @@ -491,9 +491,9 @@

SOURCE CODE ^end 0427 end -0428 if isfield(modelSBML.fbc_geneProduct, 'fbc_name') && isfield(model,'proteinNames') -0429 if ~isempty(model.proteinNames{i}) -0430 modelSBML.fbc_geneProduct(i).fbc_name=model.proteinNames{i}; +0428 if isfield(modelSBML.fbc_geneProduct, 'fbc_name') && isfield(model,'proteins') +0429 if ~isempty(model.proteins{i}) +0430 modelSBML.fbc_geneProduct(i).fbc_name=model.proteins{i}; 0431 end 0432 end 0433 end diff --git a/doc/io/importModel.html b/doc/io/importModel.html index 17d65974..dd993e5c 100644 --- a/doc/io/importModel.html +++ b/doc/io/importModel.html @@ -77,7 +77,7 @@

DESCRIPTION ^SOURCE CODE ^% geneComps compartments for genes 0050 % geneMiriams structure with MIRIAM information about the genes 0051 % geneShortNames gene alternative names (e.g. ERG10) -0052 % proteinNames protein associated to each gene +0052 % proteins protein associated to each gene 0053 % metNames metabolite description 0054 % metComps compartments for metabolites 0055 % inchis InChI-codes for metabolites @@ -237,7 +237,7 @@

SOURCE CODE ^SOURCE CODE ^SOURCE CODE ^end 0865 end 0866 end -0867 proteinNames={modelSBML.fbc_geneProduct.fbc_name}; +0867 proteins={modelSBML.fbc_geneProduct.fbc_name}; 0868 else 0869 genes=getGeneList(grRules); 0870 end @@ -1060,259 +1060,272 @@

SOURCE CODE ^end 0952 0953 %If any protein strings have been loaded -0954 if any(~cellfun(@isempty,proteinNames)) -0955 model.proteinNames=proteinNames; -0956 end -0957 -0958 model.unconstrained=metaboliteUnconstrained; -0959 -0960 %Convert SBML IDs back into their original strings. Here we are using part -0961 %from convertSBMLID, originating from the COBRA Toolbox -0962 model.rxns=regexprep(model.rxns,'__([0-9]+)__','${char(str2num($1))}'); -0963 model.mets=regexprep(model.mets,'__([0-9]+)__','${char(str2num($1))}'); -0964 model.comps=regexprep(model.comps,'__([0-9]+)__','${char(str2num($1))}'); -0965 model.grRules=regexprep(model.grRules,'__([0-9]+)__','${char(str2num($1))}'); -0966 model.genes=regexprep(model.genes,'__([0-9]+)__','${char(str2num($1))}'); -0967 model.id=regexprep(model.id,'__([0-9]+)__','${char(str2num($1))}'); -0968 +0954 if any(~cellfun(@isempty,proteins)) +0955 proteins = reshape(proteins,[],1); +0956 model.proteins=proteins; +0957 end +0958 +0959 model.unconstrained=metaboliteUnconstrained; +0960 +0961 %Convert SBML IDs back into their original strings. Here we are using part +0962 %from convertSBMLID, originating from the COBRA Toolbox +0963 model.rxns=regexprep(model.rxns,'__([0-9]+)__','${char(str2num($1))}'); +0964 model.mets=regexprep(model.mets,'__([0-9]+)__','${char(str2num($1))}'); +0965 model.comps=regexprep(model.comps,'__([0-9]+)__','${char(str2num($1))}'); +0966 model.grRules=regexprep(model.grRules,'__([0-9]+)__','${char(str2num($1))}'); +0967 model.genes=regexprep(model.genes,'__([0-9]+)__','${char(str2num($1))}'); +0968 model.id=regexprep(model.id,'__([0-9]+)__','${char(str2num($1))}'); 0969 -0970 hasCOBRAids(1) = all(startsWith(model.rxns,'R_')); -0971 hasCOBRAids(2) = all(startsWith(model.mets,'M_')); -0972 hasCOBRAids(3) = all(startsWith(model.comps,'C_')); -0973 hasCOBRAids(4) = all(startsWith(model.genes,'G_')); -0974 hasCOBRAids(5) = all(startsWith(model.metNames,'M_')); -0975 hasCOBRAids(6) = all(startsWith(model.rxnNames,'R_')); -0976 hasCOBRAids(7) = all(startsWith(model.id,'M_')); -0977 -0978 if COBRAstyle -0979 if hasCOBRAids(1) -0980 model.rxns = cellfun(@(x) x(3:end), model.rxns,'un',0); -0981 end -0982 if hasCOBRAids(2) -0983 model.mets = cellfun(@(x) x(3:end), model.mets,'un',0); -0984 end -0985 if hasCOBRAids(3) -0986 model.comps = cellfun(@(x) x(3:end), model.comps,'un',0); -0987 end -0988 if hasCOBRAids(4) -0989 model.genes = cellfun(@(x) x(3:end), model.genes,'un',0); -0990 model.grRules=regexprep(model.grRules,'^G_',''); -0991 model.grRules=regexprep(model.grRules,'\(G_','('); -0992 model.grRules=regexprep(model.grRules,' G_',' '); -0993 end -0994 % Not strictly identifier, but also remove from metNames and rxnNames if present -0995 if hasCOBRAids(5) -0996 model.metNames = cellfun(@(x) x(3:end), model.metNames,'un',0); -0997 end -0998 if hasCOBRAids(6) -0999 model.rxnNames = cellfun(@(x) x(3:end), model.rxnNames,'un',0); -1000 end -1001 if hasCOBRAids(6) -1002 model.id = model.id(3:end); -1003 end -1004 elseif any(hasCOBRAids) -1005 printOrange('COBRA style identifier prefixes (like R_ for reactions) found in the model. To remove those, run importModel with COBRAstyle as true: importModel(''filename.xml'', [], true);\n'); -1006 end -1007 -1008 %Remove unused fields -1009 if isempty(model.annotation) -1010 model=rmfield(model,'annotation'); -1011 end -1012 if isempty(model.compOutside) -1013 model=rmfield(model,'compOutside'); -1014 end -1015 if isempty(model.compMiriams) -1016 model=rmfield(model,'compMiriams'); -1017 end -1018 if isempty(model.rxnComps) -1019 model=rmfield(model,'rxnComps'); -1020 end -1021 if isempty(model.grRules) -1022 model=rmfield(model,'grRules'); -1023 end -1024 if isempty(model.rxnGeneMat) -1025 model=rmfield(model,'rxnGeneMat'); -1026 end -1027 if isempty(model.subSystems) -1028 model=rmfield(model,'subSystems'); -1029 else -1030 model.subSystems(cellfun(@isempty,subsystems))={{''}}; -1031 end -1032 if isempty(model.eccodes) -1033 model=rmfield(model,'eccodes'); -1034 end -1035 if isempty(model.rxnMiriams) -1036 model=rmfield(model,'rxnMiriams'); -1037 end -1038 if cellfun(@isempty,model.rxnNotes) -1039 model=rmfield(model,'rxnNotes'); -1040 end -1041 if cellfun(@isempty,model.rxnReferences) -1042 model=rmfield(model,'rxnReferences'); -1043 end -1044 if isempty(model.rxnConfidenceScores) || all(isnan(model.rxnConfidenceScores)) -1045 model=rmfield(model,'rxnConfidenceScores'); -1046 end -1047 if isempty(model.genes) -1048 model=rmfield(model,'genes'); -1049 elseif isrow(model.genes) -1050 model.genes=transpose(model.genes); -1051 end -1052 if isempty(model.geneComps) -1053 model=rmfield(model,'geneComps'); -1054 end -1055 if isempty(model.geneMiriams) -1056 model=rmfield(model,'geneMiriams'); -1057 end -1058 if isempty(model.geneShortNames) -1059 model=rmfield(model,'geneShortNames'); -1060 end -1061 if isempty(model.proteinNames) -1062 model=rmfield(model,'proteinNames'); -1063 end -1064 if isempty(model.inchis) -1065 model=rmfield(model,'inchis'); -1066 end -1067 if isempty(model.metFormulas) -1068 model=rmfield(model,'metFormulas'); -1069 end -1070 if isempty(model.metMiriams) -1071 model=rmfield(model,'metMiriams'); -1072 end -1073 if ~any(model.metCharges) -1074 model=rmfield(model,'metCharges'); -1075 end -1076 -1077 %This just removes the grRules if no genes have been loaded -1078 if ~isfield(model,'genes') && isfield(model,'grRules') -1079 model=rmfield(model,'grRules'); -1080 end -1081 -1082 %Print warnings about bad structure -1083 if supressWarnings==false -1084 checkModelStruct(model,false); +0970 +0971 hasCOBRAids(1) = all(startsWith(model.rxns,'R_')); +0972 hasCOBRAids(2) = all(startsWith(model.mets,'M_')); +0973 hasCOBRAids(3) = all(startsWith(model.comps,'C_')); +0974 hasCOBRAids(4) = all(startsWith(model.genes,'G_')); +0975 hasCOBRAids(5) = all(startsWith(model.metNames,'M_')); +0976 hasCOBRAids(6) = all(startsWith(model.rxnNames,'R_')); +0977 hasCOBRAids(7) = all(startsWith(model.id,'M_')); +0978 +0979 if COBRAstyle +0980 if hasCOBRAids(1) +0981 model.rxns = cellfun(@(x) x(3:end), model.rxns,'un',0); +0982 end +0983 if hasCOBRAids(2) +0984 model.mets = cellfun(@(x) x(3:end), model.mets,'un',0); +0985 end +0986 if hasCOBRAids(3) +0987 model.comps = cellfun(@(x) x(3:end), model.comps,'un',0); +0988 end +0989 if hasCOBRAids(4) +0990 model.genes = cellfun(@(x) x(3:end), model.genes,'un',0); +0991 model.grRules=regexprep(model.grRules,'^G_',''); +0992 model.grRules=regexprep(model.grRules,'\(G_','('); +0993 model.grRules=regexprep(model.grRules,' G_',' '); +0994 end +0995 % Not strictly identifier, but also remove from metNames and rxnNames if present +0996 if hasCOBRAids(5) +0997 model.metNames = cellfun(@(x) x(3:end), model.metNames,'un',0); +0998 end +0999 if hasCOBRAids(6) +1000 model.rxnNames = cellfun(@(x) x(3:end), model.rxnNames,'un',0); +1001 end +1002 if hasCOBRAids(6) +1003 model.id = model.id(3:end); +1004 end +1005 elseif any(hasCOBRAids) +1006 hasCOBRAidsMsg = {'model.rxns (R_ prefix)',... +1007 'model.mets (M_ prefix)',... +1008 'model.comps (C_ prefix)',... +1009 'model.genes (G_ prefix)',... +1010 'model.metNames (M_ prefix)',... +1011 'model.rxnNames (R_ prefix)',... +1012 'model.id (M_ prefix)'}; +1013 hasCOBRAidsMsg(~hasCOBRAids) = []; +1014 printOrange(['COBRA style identifier prefixes are found in: "' ... +1015 strjoin(hasCOBRAidsMsg,'"; "') '". Since RAVEN 2.10.0, identifiers ' ... +1016 'are by default imported "as-is". If you do prefer to remove these ' ... +1017 'identifier prefixes, run importModel with COBRAstyle as true. ' ... +1018 'Example: importModel(''filename.xml'', [], true);\n']); +1019 end +1020 +1021 %Remove unused fields +1022 if isempty(model.annotation) +1023 model=rmfield(model,'annotation'); +1024 end +1025 if isempty(model.compOutside) +1026 model=rmfield(model,'compOutside'); +1027 end +1028 if isempty(model.compMiriams) +1029 model=rmfield(model,'compMiriams'); +1030 end +1031 if isempty(model.rxnComps) +1032 model=rmfield(model,'rxnComps'); +1033 end +1034 if isempty(model.grRules) +1035 model=rmfield(model,'grRules'); +1036 end +1037 if isempty(model.rxnGeneMat) +1038 model=rmfield(model,'rxnGeneMat'); +1039 end +1040 if isempty(model.subSystems) +1041 model=rmfield(model,'subSystems'); +1042 else +1043 model.subSystems(cellfun(@isempty,subsystems))={{''}}; +1044 end +1045 if isempty(model.eccodes) +1046 model=rmfield(model,'eccodes'); +1047 end +1048 if isempty(model.rxnMiriams) +1049 model=rmfield(model,'rxnMiriams'); +1050 end +1051 if cellfun(@isempty,model.rxnNotes) +1052 model=rmfield(model,'rxnNotes'); +1053 end +1054 if cellfun(@isempty,model.rxnReferences) +1055 model=rmfield(model,'rxnReferences'); +1056 end +1057 if isempty(model.rxnConfidenceScores) || all(isnan(model.rxnConfidenceScores)) +1058 model=rmfield(model,'rxnConfidenceScores'); +1059 end +1060 if isempty(model.genes) +1061 model=rmfield(model,'genes'); +1062 elseif isrow(model.genes) +1063 model.genes=transpose(model.genes); +1064 end +1065 if isempty(model.geneComps) +1066 model=rmfield(model,'geneComps'); +1067 end +1068 if isempty(model.geneMiriams) +1069 model=rmfield(model,'geneMiriams'); +1070 end +1071 if isempty(model.geneShortNames) +1072 model=rmfield(model,'geneShortNames'); +1073 end +1074 if isempty(model.proteins) +1075 model=rmfield(model,'proteins'); +1076 end +1077 if isempty(model.inchis) +1078 model=rmfield(model,'inchis'); +1079 end +1080 if isempty(model.metFormulas) +1081 model=rmfield(model,'metFormulas'); +1082 end +1083 if isempty(model.metMiriams) +1084 model=rmfield(model,'metMiriams'); 1085 end -1086 -1087 if removeExcMets==true -1088 model=simplifyModel(model); -1089 end -1090 end -1091 -1092 function matchGenes=getGeneList(grRules) -1093 %Constructs the list of unique genes from grRules +1086 if ~any(model.metCharges) +1087 model=rmfield(model,'metCharges'); +1088 end +1089 +1090 %This just removes the grRules if no genes have been loaded +1091 if ~isfield(model,'genes') && isfield(model,'grRules') +1092 model=rmfield(model,'grRules'); +1093 end 1094 -1095 %Assumes that everything that isn't a paranthesis, " AND " or " or " is a -1096 %gene name -1097 genes=strrep(grRules,'(',''); -1098 genes=strrep(genes,')',''); -1099 genes=strrep(genes,' or ',' '); -1100 genes=strrep(genes,' and ',' '); -1101 genes=strrep(genes,' OR ',' '); -1102 genes=strrep(genes,' AND ',' '); -1103 genes=regexp(genes,' ','split'); +1095 %Print warnings about bad structure +1096 if supressWarnings==false +1097 checkModelStruct(model,false); +1098 end +1099 +1100 if removeExcMets==true +1101 model=simplifyModel(model); +1102 end +1103 end 1104 -1105 allNames={}; -1106 for i=1:numel(genes) -1107 allNames=[allNames genes{i}]; -1108 end -1109 matchGenes=unique(allNames)'; -1110 -1111 %Remove the empty element if present -1112 if isempty(matchGenes{1}) -1113 matchGenes(1)=[]; -1114 end -1115 end -1116 -1117 function fieldContent=parseNote(searchString,fieldName) -1118 %The function obtains the particular information from 'notes' field, using -1119 %fieldName as the dummy string -1120 -1121 fieldContent=''; -1122 -1123 if strfind(searchString,fieldName) -1124 [~,targetString] = regexp(searchString,['<p>' fieldName '.*?</p>'],'tokens','match'); -1125 targetString=regexprep(targetString,'<p>|</p>',''); -1126 targetString=regexprep(targetString,[fieldName, ':'],''); -1127 for i=1:numel(targetString) -1128 fieldContent=[fieldContent ';' strtrim(targetString{1,i})]; -1129 end -1130 fieldContent=regexprep(fieldContent,'^;|;$',''); -1131 else -1132 fieldContent=''; -1133 end -1134 end +1105 function matchGenes=getGeneList(grRules) +1106 %Constructs the list of unique genes from grRules +1107 +1108 %Assumes that everything that isn't a paranthesis, " AND " or " or " is a +1109 %gene name +1110 genes=strrep(grRules,'(',''); +1111 genes=strrep(genes,')',''); +1112 genes=strrep(genes,' or ',' '); +1113 genes=strrep(genes,' and ',' '); +1114 genes=strrep(genes,' OR ',' '); +1115 genes=strrep(genes,' AND ',' '); +1116 genes=regexp(genes,' ','split'); +1117 +1118 allNames={}; +1119 for i=1:numel(genes) +1120 allNames=[allNames genes{i}]; +1121 end +1122 matchGenes=unique(allNames)'; +1123 +1124 %Remove the empty element if present +1125 if isempty(matchGenes{1}) +1126 matchGenes(1)=[]; +1127 end +1128 end +1129 +1130 function fieldContent=parseNote(searchString,fieldName) +1131 %The function obtains the particular information from 'notes' field, using +1132 %fieldName as the dummy string +1133 +1134 fieldContent=''; 1135 -1136 function fieldContent=parseAnnotation(searchString,startString,midString,fieldName) -1137 -1138 fieldContent=''; -1139 -1140 %Removing whitespace characters from the ending strings, which may occur in -1141 %several cases -1142 searchString=regexprep(searchString,'" />','"/>'); -1143 [~,targetString] = regexp(searchString,['<rdf:li rdf:resource="' startString fieldName midString '.*?"/>'],'tokens','match'); -1144 targetString=regexprep(targetString,'<rdf:li rdf:resource="|"/>',''); -1145 targetString=regexprep(targetString,startString,''); -1146 targetString=regexprep(targetString,[fieldName midString],''); -1147 -1148 for i=1:numel(targetString) -1149 fieldContent=[fieldContent ';' strtrim(targetString{1,i})]; -1150 end -1151 -1152 fieldContent=regexprep(fieldContent,'^;|;$',''); -1153 end -1154 -1155 function miriamStruct=parseMiriam(searchString) -1156 %Generates miriam structure from annotation field -1157 -1158 %Finding whether miriams are written in the old or the new way -1159 if strfind(searchString,'urn:miriam:') -1160 startString='urn:miriam:'; -1161 midString=':'; -1162 elseif strfind(searchString,'http://identifiers.org/') -1163 startString='http://identifiers.org/'; -1164 midString='/'; -1165 elseif strfind(searchString,'https://identifiers.org/') -1166 startString='https://identifiers.org/'; -1167 midString='/'; -1168 else -1169 miriamStruct=[]; -1170 return; -1171 end -1172 -1173 miriamStruct=[]; -1174 -1175 searchString=regexprep(searchString,'" />','"/>'); -1176 [~,targetString] = regexp(searchString,'<rdf:li rdf:resource=".*?"/>','tokens','match'); -1177 targetString=regexprep(targetString,'<rdf:li rdf:resource="|"/>',''); -1178 targetString=regexprep(targetString,startString,''); -1179 targetString=regexprep(targetString,midString,'/','once'); -1180 -1181 counter=0; -1182 for i=1:numel(targetString) -1183 if isempty(regexp(targetString{1,i},'inchi|ec-code', 'once')) -1184 counter=counter+1; -1185 miriamStruct.name{counter,1} = regexprep(targetString{1,i},'/.+','','once'); -1186 miriamStruct.value{counter,1} = regexprep(targetString{1,i},[miriamStruct.name{counter,1} '/'],'','once'); -1187 miriamStruct.name{counter,1} = regexprep(miriamStruct.name{counter,1},'^obo\.',''); -1188 end -1189 end -1190 end -1191 -1192 function miriam = addSBOtoMiriam(miriam,sboTerm) -1193 %Appends SBO term to miriam structure -1194 -1195 sboTerm = {['SBO:' sprintf('%07u',sboTerm)]}; % convert to proper format -1196 if isempty(miriam) -1197 miriam.name = {'sbo'}; -1198 miriam.value = sboTerm; -1199 elseif any(strcmp('sbo',miriam.name)) -1200 currSbo = strcmp('sbo',miriam.name); -1201 miriam.value(currSbo) = sboTerm; -1202 else -1203 miriam.name(end+1) = {'sbo'}; -1204 miriam.value(end+1) = sboTerm; -1205 end -1206 end +1136 if strfind(searchString,fieldName) +1137 [~,targetString] = regexp(searchString,['<p>' fieldName '.*?</p>'],'tokens','match'); +1138 targetString=regexprep(targetString,'<p>|</p>',''); +1139 targetString=regexprep(targetString,[fieldName, ':'],''); +1140 for i=1:numel(targetString) +1141 fieldContent=[fieldContent ';' strtrim(targetString{1,i})]; +1142 end +1143 fieldContent=regexprep(fieldContent,'^;|;$',''); +1144 else +1145 fieldContent=''; +1146 end +1147 end +1148 +1149 function fieldContent=parseAnnotation(searchString,startString,midString,fieldName) +1150 +1151 fieldContent=''; +1152 +1153 %Removing whitespace characters from the ending strings, which may occur in +1154 %several cases +1155 searchString=regexprep(searchString,'" />','"/>'); +1156 [~,targetString] = regexp(searchString,['<rdf:li rdf:resource="' startString fieldName midString '.*?"/>'],'tokens','match'); +1157 targetString=regexprep(targetString,'<rdf:li rdf:resource="|"/>',''); +1158 targetString=regexprep(targetString,startString,''); +1159 targetString=regexprep(targetString,[fieldName midString],''); +1160 +1161 for i=1:numel(targetString) +1162 fieldContent=[fieldContent ';' strtrim(targetString{1,i})]; +1163 end +1164 +1165 fieldContent=regexprep(fieldContent,'^;|;$',''); +1166 end +1167 +1168 function miriamStruct=parseMiriam(searchString) +1169 %Generates miriam structure from annotation field +1170 +1171 %Finding whether miriams are written in the old or the new way +1172 if strfind(searchString,'urn:miriam:') +1173 startString='urn:miriam:'; +1174 midString=':'; +1175 elseif strfind(searchString,'http://identifiers.org/') +1176 startString='http://identifiers.org/'; +1177 midString='/'; +1178 elseif strfind(searchString,'https://identifiers.org/') +1179 startString='https://identifiers.org/'; +1180 midString='/'; +1181 else +1182 miriamStruct=[]; +1183 return; +1184 end +1185 +1186 miriamStruct=[]; +1187 +1188 searchString=regexprep(searchString,'" />','"/>'); +1189 [~,targetString] = regexp(searchString,'<rdf:li rdf:resource=".*?"/>','tokens','match'); +1190 targetString=regexprep(targetString,'<rdf:li rdf:resource="|"/>',''); +1191 targetString=regexprep(targetString,startString,''); +1192 targetString=regexprep(targetString,midString,'/','once'); +1193 +1194 counter=0; +1195 for i=1:numel(targetString) +1196 if isempty(regexp(targetString{1,i},'inchi|ec-code', 'once')) +1197 counter=counter+1; +1198 miriamStruct.name{counter,1} = regexprep(targetString{1,i},'/.+','','once'); +1199 miriamStruct.value{counter,1} = regexprep(targetString{1,i},[miriamStruct.name{counter,1} '/'],'','once'); +1200 miriamStruct.name{counter,1} = regexprep(miriamStruct.name{counter,1},'^obo\.',''); +1201 end +1202 end +1203 end +1204 +1205 function miriam = addSBOtoMiriam(miriam,sboTerm) +1206 %Appends SBO term to miriam structure +1207 +1208 sboTerm = {['SBO:' sprintf('%07u',sboTerm)]}; % convert to proper format +1209 if isempty(miriam) +1210 miriam.name = {'sbo'}; +1211 miriam.value = sboTerm; +1212 elseif any(strcmp('sbo',miriam.name)) +1213 currSbo = strcmp('sbo',miriam.name); +1214 miriam.value(currSbo) = sboTerm; +1215 else +1216 miriam.name(end+1) = {'sbo'}; +1217 miriam.value(end+1) = sboTerm; +1218 end +1219 end
Generated by m2html © 2005
\ No newline at end of file diff --git a/doc/io/readYAMLmodel.html b/doc/io/readYAMLmodel.html index 2d7a38c0..a76b6b12 100644 --- a/doc/io/readYAMLmodel.html +++ b/doc/io/readYAMLmodel.html @@ -157,7 +157,7 @@

SOURCE CODE ^'geneComps',cell(0,0);... %Changed to double in the end. 0101 'geneMiriams',cell(0,0);... 0102 'geneShortNames',cell(0,0);... -0103 'proteinNames',cell(0,0);... +0103 'proteins',cell(0,0);... 0104 'unconstrained',cell(0,0);... %Changed to double in the end. 0105 'metFrom',cell(0,0);... 0106 'rxnFrom',cell(0,0)}; @@ -432,7 +432,7 @@

SOURCE CODE ^case 'name' 0376 model = readFieldValue(model, 'geneShortNames', tline_value, pos); 0377 case 'protein' -0378 model = readFieldValue(model, 'proteinNames', tline_value, pos); +0378 model = readFieldValue(model, 'proteins', tline_value, pos); 0379 case 'annotation' 0380 readList = 'annotation'; 0381 otherwise @@ -628,7 +628,7 @@

SOURCE CODE ^emptyOrFill(model,i{1},1,'mets'); 0572 end 0573 % Genes -0574 for i={'geneMiriams','geneShortNames','proteinNames'} % Empty strings +0574 for i={'geneMiriams','geneShortNames','proteins'} % Empty strings 0575 model = emptyOrFill(model,i{1},{''},'genes'); 0576 end 0577 for i={'geneComps'} % Ones, assume first compartment diff --git a/doc/io/writeYAMLmodel.html b/doc/io/writeYAMLmodel.html index 72030bbd..77164d47 100644 --- a/doc/io/writeYAMLmodel.html +++ b/doc/io/writeYAMLmodel.html @@ -172,7 +172,7 @@

SOURCE CODE ^' - !!omap\n'); 0114 writeField(model, fid, 'genes', 'txt', i, ' - id', preserveQuotes) 0115 writeField(model, fid, 'geneShortNames', 'txt', i, ' - name', preserveQuotes) -0116 writeField(model, fid, 'proteinNames', 'txt', i, ' - protein', preserveQuotes) +0116 writeField(model, fid, 'proteins', 'txt', i, ' - protein', preserveQuotes) 0117 writeField(model, fid, 'geneMiriams', 'txt', i, ' - annotation', preserveQuotes) 0118 end 0119 diff --git a/doc/struct_conversion/ravenCobraWrapper.html b/doc/struct_conversion/ravenCobraWrapper.html index f8aaad4d..6bb7c386 100644 --- a/doc/struct_conversion/ravenCobraWrapper.html +++ b/doc/struct_conversion/ravenCobraWrapper.html @@ -151,7 +151,7 @@

SOURCE CODE ^'rxnNames','rxnNotes','rxnConfidenceScores','rxnDeltaG',... 0079 'rxnGeneMat','rev','subSystems','comps','compNames','metCharges',... -0080 'metDeltaG','metFormulas','metNotes','metSmiles','genes','proteinNames'}; +0080 'metDeltaG','metFormulas','metNotes','metSmiles','genes','proteins'}; 0081 for i=1:length(optFields) 0082 if isfield(model,optFields{i}) 0083 newModel.(optFields{i})=model.(optFields{i}); diff --git a/io/exportModel.m b/io/exportModel.m index 7ee8bf06..13c96e4e 100755 --- a/io/exportModel.m +++ b/io/exportModel.m @@ -132,8 +132,8 @@ function exportModel(model,fileName,COBRAstyle,supressWarnings,sortIds) if ~isfield(model,'geneShortNames') && isfield(model,'genes') model.geneShortNames=cell(numel(model.genes),1); end -if ~isfield(model,'proteinNames') && isfield(model,'genes') - model.proteinNames=cell(numel(model.genes),1); +if ~isfield(model,'proteins') && isfield(model,'genes') + model.proteins=cell(numel(model.genes),1); end if ~isfield(model,'subSystems') model.subSystems=cell(numel(model.rxns),1); @@ -425,9 +425,9 @@ function exportModel(model,fileName,COBRAstyle,supressWarnings,sortIds) modelSBML.fbc_geneProduct(i).fbc_label=model.geneShortNames{i}; end end - if isfield(modelSBML.fbc_geneProduct, 'fbc_name') && isfield(model,'proteinNames') - if ~isempty(model.proteinNames{i}) - modelSBML.fbc_geneProduct(i).fbc_name=model.proteinNames{i}; + if isfield(modelSBML.fbc_geneProduct, 'fbc_name') && isfield(model,'proteins') + if ~isempty(model.proteins{i}) + modelSBML.fbc_geneProduct(i).fbc_name=model.proteins{i}; end end end diff --git a/io/importModel.m b/io/importModel.m index d6190a51..3a1803b0 100755 --- a/io/importModel.m +++ b/io/importModel.m @@ -49,7 +49,7 @@ % geneComps compartments for genes % geneMiriams structure with MIRIAM information about the genes % geneShortNames gene alternative names (e.g. ERG10) -% proteinNames protein associated to each gene +% proteins protein associated to each gene % metNames metabolite description % metComps compartments for metabolites % inchis InChI-codes for metabolites @@ -128,7 +128,7 @@ model.geneComps=[]; model.geneMiriams={}; model.geneShortNames={}; -model.proteinNames={}; +model.proteins={}; model.metNames={}; model.metComps=[]; model.inchis={}; @@ -202,7 +202,7 @@ geneIDs={}; geneMiriams={}; geneShortNames={}; -proteinNames={}; +proteins={}; geneCompartments={}; complexIDs={}; complexNames={}; @@ -864,7 +864,7 @@ end end end - proteinNames={modelSBML.fbc_geneProduct.fbc_name}; + proteins={modelSBML.fbc_geneProduct.fbc_name}; else genes=getGeneList(grRules); end @@ -951,8 +951,9 @@ end %If any protein strings have been loaded -if any(~cellfun(@isempty,proteinNames)) - model.proteinNames=proteinNames; +if any(~cellfun(@isempty,proteins)) + proteins = reshape(proteins,[],1); + model.proteins=proteins; end model.unconstrained=metaboliteUnconstrained; @@ -1002,7 +1003,19 @@ model.id = model.id(3:end); end elseif any(hasCOBRAids) - printOrange('COBRA style identifier prefixes (like R_ for reactions) found in the model. To remove those, run importModel with COBRAstyle as true: importModel(''filename.xml'', [], true);\n'); + hasCOBRAidsMsg = {'model.rxns (R_ prefix)',... + 'model.mets (M_ prefix)',... + 'model.comps (C_ prefix)',... + 'model.genes (G_ prefix)',... + 'model.metNames (M_ prefix)',... + 'model.rxnNames (R_ prefix)',... + 'model.id (M_ prefix)'}; + hasCOBRAidsMsg(~hasCOBRAids) = []; + printOrange(['COBRA style identifier prefixes are found in: "' ... + strjoin(hasCOBRAidsMsg,'"; "') '". Since RAVEN 2.10.0, identifiers ' ... + 'are by default imported "as-is". If you do prefer to remove these ' ... + 'identifier prefixes, run importModel with COBRAstyle as true. ' ... + 'Example: importModel(''filename.xml'', [], true);\n']); end %Remove unused fields @@ -1058,8 +1071,8 @@ if isempty(model.geneShortNames) model=rmfield(model,'geneShortNames'); end -if isempty(model.proteinNames) - model=rmfield(model,'proteinNames'); +if isempty(model.proteins) + model=rmfield(model,'proteins'); end if isempty(model.inchis) model=rmfield(model,'inchis'); diff --git a/io/readYAMLmodel.m b/io/readYAMLmodel.m index 3f31bbf5..19095d6c 100755 --- a/io/readYAMLmodel.m +++ b/io/readYAMLmodel.m @@ -100,7 +100,7 @@ 'geneComps',cell(0,0);... %Changed to double in the end. 'geneMiriams',cell(0,0);... 'geneShortNames',cell(0,0);... - 'proteinNames',cell(0,0);... + 'proteins',cell(0,0);... 'unconstrained',cell(0,0);... %Changed to double in the end. 'metFrom',cell(0,0);... 'rxnFrom',cell(0,0)}; @@ -375,7 +375,7 @@ case 'name' model = readFieldValue(model, 'geneShortNames', tline_value, pos); case 'protein' - model = readFieldValue(model, 'proteinNames', tline_value, pos); + model = readFieldValue(model, 'proteins', tline_value, pos); case 'annotation' readList = 'annotation'; otherwise @@ -571,7 +571,7 @@ model = emptyOrFill(model,i{1},1,'mets'); end % Genes -for i={'geneMiriams','geneShortNames','proteinNames'} % Empty strings +for i={'geneMiriams','geneShortNames','proteins'} % Empty strings model = emptyOrFill(model,i{1},{''},'genes'); end for i={'geneComps'} % Ones, assume first compartment diff --git a/io/writeYAMLmodel.m b/io/writeYAMLmodel.m index dc804665..b40bf18e 100755 --- a/io/writeYAMLmodel.m +++ b/io/writeYAMLmodel.m @@ -113,7 +113,7 @@ function writeYAMLmodel(model,fileName,preserveQuotes,sortIds) fprintf(fid,' - !!omap\n'); writeField(model, fid, 'genes', 'txt', i, ' - id', preserveQuotes) writeField(model, fid, 'geneShortNames', 'txt', i, ' - name', preserveQuotes) - writeField(model, fid, 'proteinNames', 'txt', i, ' - protein', preserveQuotes) + writeField(model, fid, 'proteins', 'txt', i, ' - protein', preserveQuotes) writeField(model, fid, 'geneMiriams', 'txt', i, ' - annotation', preserveQuotes) end diff --git a/struct_conversion/ravenCobraWrapper.m b/struct_conversion/ravenCobraWrapper.m index 27a7fe32..6bb14d7c 100755 --- a/struct_conversion/ravenCobraWrapper.m +++ b/struct_conversion/ravenCobraWrapper.m @@ -77,7 +77,7 @@ newModel.rxns=model.rxns; optFields = {'rxnNames','rxnNotes','rxnConfidenceScores','rxnDeltaG',... 'rxnGeneMat','rev','subSystems','comps','compNames','metCharges',... - 'metDeltaG','metFormulas','metNotes','metSmiles','genes','proteinNames'}; + 'metDeltaG','metFormulas','metNotes','metSmiles','genes','proteins'}; for i=1:length(optFields) if isfield(model,optFields{i}) newModel.(optFields{i})=model.(optFields{i});