diff --git a/INIT/getINITModel.m b/INIT/getINITModel.m index 9626d9e6..3d21174d 100644 --- a/INIT/getINITModel.m +++ b/INIT/getINITModel.m @@ -391,6 +391,9 @@ if isfield(model,'geneShortNames') model.geneShortNames(I)=[]; end +if isfield(model,'proteinNames') + model.proteinNames(I)=[]; +end if isfield(model,'geneMiriams') model.geneMiriams(I)=[]; end diff --git a/INIT/mergeLinear.m b/INIT/mergeLinear.m index 4ce4c3af..ae4618ba 100644 --- a/INIT/mergeLinear.m +++ b/INIT/mergeLinear.m @@ -29,6 +29,9 @@ if isfield(reducedModel,'geneShortNames') reducedModel.geneShortNames={}; end +if isfield(reducedModel,'proteinNames') + reducedModel.proteinNames={}; +end if isfield(reducedModel,'geneMiriams') reducedModel.geneMiriams={}; end diff --git a/INIT/removeLowScoreGenes.m b/INIT/removeLowScoreGenes.m index 589a54b9..d49fbd7d 100644 --- a/INIT/removeLowScoreGenes.m +++ b/INIT/removeLowScoreGenes.m @@ -119,6 +119,9 @@ if isfield(newModel,'geneShortNames') newModel.geneShortNames(remInd) = []; end +if isfield(newModel,'proteinNames') + newModel.proteinNames(remInd) = []; +end if isfield(newModel,'geneMiriams') newModel.geneMiriams(remInd) = []; end diff --git a/core/addGenesRaven.m b/core/addGenesRaven.m index 9be3abf4..30e73b83 100755 --- a/core/addGenesRaven.m +++ b/core/addGenesRaven.m @@ -14,6 +14,8 @@ % default '') % geneMiriams cell array with MIRIAM structures (optional, % default []) +% proteinNames cell array of protein names associated to +% each gene (optional, default '') % % newModel an updated model structure % @@ -56,6 +58,9 @@ if isfield(genesToAdd,'geneShortNames') genesToAdd.geneShortNames(I)=[]; end + if isfield(genesToAdd,'proteinNames') + genesToAdd.proteinNames(I)=[]; + end if isfield(genesToAdd,'geneMiriams') genesToAdd.geneMiriams(I)=[]; end @@ -81,6 +86,24 @@ 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'; + dispEM(EM); + end + %Add empty field if it doesn't exist + if ~isfield(newModel,'proteinNames') + newModel.proteinNames=largeFiller; + end + newModel.proteinNames=[newModel.proteinNames;genesToAdd.proteinNames(:)]; +else + %Add empty strings if structure is in model + if isfield(newModel,'proteinNames') + newModel.proteinNames=[newModel.proteinNames;filler]; + end +end + %Don't check the type of geneMiriams if isfield(genesToAdd,'geneMiriams') diff --git a/core/deleteUnusedGenes.m b/core/deleteUnusedGenes.m index 49cff71f..0fb2e2e1 100755 --- a/core/deleteUnusedGenes.m +++ b/core/deleteUnusedGenes.m @@ -37,6 +37,10 @@ reducedModel.geneShortNames=reducedModel.geneShortNames(toKeep); end +if isfield(reducedModel,'proteinNames') + reducedModel.proteinNames=reducedModel.proteinNames(toKeep); +end + if isfield(reducedModel,'geneMiriams') reducedModel.geneMiriams=reducedModel.geneMiriams(toKeep); end diff --git a/core/getModelFromHomology.m b/core/getModelFromHomology.m index 242e6f36..42ef3f82 100755 --- a/core/getModelFromHomology.m +++ b/core/getModelFromHomology.m @@ -107,14 +107,17 @@ modelNames=cell(numel(models),1); for i=1:numel(models) modelNames{i}=models{i}.id; - %Gene short names and geneMiriams are often different between species, - %safer not to include them + %Gene short names, geneMiriams and proteins are often different + %between species, safer not to include them if isfield(models{i},'geneShortNames') models{i}=rmfield(models{i},'geneShortNames'); end if isfield(models{i},'geneMiriams') models{i}=rmfield(models{i},'geneMiriams'); end + if isfield(models{i},'proteinNames') + models{i}=rmfield(models{i},'proteinNames'); + end %The geneFrom field also loses meaning if the genes are replaced by %orthologs if isfield(models{i},'geneFrom') diff --git a/core/mergeModels.m b/core/mergeModels.m index 19de25c1..c7b7fb15 100755 --- a/core/mergeModels.m +++ b/core/mergeModels.m @@ -492,7 +492,11 @@ if isfield(models{i},'geneShortNames') model.geneShortNames=models{i}.geneShortNames; end - + + if isfield(models{i},'proteinNames') + model.proteinNames=models{i}.proteinNames; + end + if isfield(models{i},'geneMiriams') model.geneMiriams=models{i}.geneMiriams; end @@ -530,7 +534,23 @@ model.geneShortNames=[model.geneShortNames;emptyGeneSN]; end end - + + if isfield(models{i},'proteinNames') + if isfield(model,'proteinNames') + model.proteinNames=[model.proteinNames;models{i}.proteinNames(genesToAdd)]; + else + emptyGeneSN=cell(numel(model.genes)-numel(genesToAdd),1); + emptyGeneSN(:)={''}; + model.proteinNames=[emptyGeneSN;models{i}.proteinNames(genesToAdd)]; + end + else + if isfield(model,'proteinNames') + emptyGeneSN=cell(numel(genesToAdd),1); + emptyGeneSN(:)={''}; + model.proteinNames=[model.proteinNames;emptyGeneSN]; + end + end + if isfield(models{i},'geneMiriams') if isfield(model,'geneMiriams') model.geneMiriams=[model.geneMiriams;models{i}.geneMiriams(genesToAdd)]; diff --git a/core/permuteModel.m b/core/permuteModel.m index 200bf283..1a7fca61 100755 --- a/core/permuteModel.m +++ b/core/permuteModel.m @@ -132,6 +132,9 @@ if isfield(newModel,'geneShortNames') newModel.geneShortNames=newModel.geneShortNames(indexes); end + if isfield(newModel,'proteinNames') + newModel.proteinNames=newModel.proteinNames(indexes); + end if isfield(newModel,'rxnGeneMat') newModel.rxnGeneMat=newModel.rxnGeneMat(:,indexes); end diff --git a/core/predictLocalization.m b/core/predictLocalization.m index bab49bb0..d05fe0ef 100755 --- a/core/predictLocalization.m +++ b/core/predictLocalization.m @@ -199,6 +199,9 @@ if isfield(model,'geneMiriams') model.geneMiriams=[model.geneMiriams;{[]}]; end + if isfield(model,'proteinNames') + model.proteinNames=[model.proteinNames;{[]}]; + end if isfield(model,'geneFrom') model.geneFrom=[model.geneFrom;{{'FAKE'}}]; end @@ -258,6 +261,9 @@ if isfield(model,'geneShortNames') model.geneShortNames=[model.geneShortNames;{''}]; end + if isfield(model,'proteinNames') + model.proteinNames=[model.proteinNames;{''}]; + end if isfield(model,'geneFrom') model.geneFrom=[model.geneFrom;{'COMPLEX'}]; end @@ -759,6 +765,9 @@ if isfield(outModel,'geneShortNames') outModel.geneShortNames(I)=[]; end +if isfield(outModel,'proteinNames') + outModel.proteinNames(I)=[]; +end outModel.rxnGeneMat(:,I)=[]; %Fix grRules and reconstruct rxnGeneMat diff --git a/core/removeReactions.m b/core/removeReactions.m index d2af5a4a..d296c566 100755 --- a/core/removeReactions.m +++ b/core/removeReactions.m @@ -129,6 +129,10 @@ if isfield(reducedModel,'geneShortNames') reducedModel.geneShortNames=reducedModel.geneShortNames(toKeep); end + + if isfield(reducedModel,'proteinNames') + reducedModel.proteinNames=reducedModel.proteinNames(toKeep); + end if isfield(reducedModel,'geneMiriams') reducedModel.geneMiriams=reducedModel.geneMiriams(toKeep); diff --git a/core/simplifyModel.m b/core/simplifyModel.m index 2dbc72ec..ecf8a6af 100755 --- a/core/simplifyModel.m +++ b/core/simplifyModel.m @@ -221,6 +221,9 @@ if isfield(reducedModel,'geneShortNames') reducedModel.geneShortNames={}; end + if isfield(reducedModel,'proteinNames') + reducedModel.proteinNames={}; + end if isfield(reducedModel,'geneMiriams') reducedModel.geneMiriams={}; end diff --git a/doc/INIT/getINITModel.html b/doc/INIT/getINITModel.html index 66b87a44..bd3c7d0e 100644 --- a/doc/INIT/getINITModel.html +++ b/doc/INIT/getINITModel.html @@ -544,77 +544,80 @@