Skip to content

Commit

Permalink
Merge pull request #132 from SysBioChalmers/feat/SBOterms
Browse files Browse the repository at this point in the history
Feat/SBOterms
  • Loading branch information
BenjaSanchez authored Jul 12, 2018
2 parents b851173 + 0677a57 commit e2d594c
Show file tree
Hide file tree
Showing 4 changed files with 45,711 additions and 6,917 deletions.
61 changes: 61 additions & 0 deletions ComplementaryScripts/missingFields/addSBOterms.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% model = addSBOterms(model)
%
% Benjamín J. Sánchez
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function model = addSBOterms(model)

%Get RAVEN model for matching names & compartments
model_r = ravenCobraWrapper(model);

%Add SBO terms for mets:
model.metSBOTerms = cell(size(model.mets));
for i = 1:length(model.mets)
metName = model_r.metNames{i};
if ismember(metName,{'biomass','DNA','RNA','protein','carbohydrate','lipid'}) ...
|| endsWith(metName,' backbone') || endsWith(metName,' chain')
model.metSBOTerms{i} = 'SBO:0000649'; %Biomass
else
model.metSBOTerms{i} = 'SBO:0000247'; %Simple chemical
end
end

%Add SBO terms for rxns:
model.rxnSBOTerms = cell(size(model.rxns));
for i = 1:length(model.rxns)
rxnName = model_r.rxnNames{i};
metNames = model_r.metNames(model.S(:,i) ~= 0);
metComps = model_r.metComps(model.S(:,i) ~= 0);
metStoich = model_r.S(model.S(:,i) ~= 0,i);

if length(metNames) == 1
if strcmp(model_r.comps{metComps},'e')
model.rxnSBOTerms{i} = 'SBO:0000627'; %Exchange rxn

elseif metStoich > 0
model.rxnSBOTerms{i} = 'SBO:0000628'; %Demand rxn
else
model.rxnSBOTerms{i} = 'SBO:0000632'; %Sink rxn
end

elseif strcmp(rxnName,'biomass pseudoreaction')
model.rxnSBOTerms{i} = 'SBO:0000629'; %Biomass pseudo-rxn

elseif strcmp(rxnName,'non-growth associated maintenance reaction')
model.rxnSBOTerms{i} = 'SBO:0000630'; %ATP maintenance

elseif contains(rxnName,'pseudoreaction') || contains(rxnName,'SLIME rxn')
model.rxnSBOTerms{i} = 'SBO:0000395'; %Encapsulating process

elseif length(unique(metComps)) > 1 && length(unique(metNames)) < length(metNames)
model.rxnSBOTerms{i} = 'SBO:0000655'; %Transport rxn

else
model.rxnSBOTerms{i} = 'SBO:0000176'; %Metabolic rxn
end
end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5 changes: 5 additions & 0 deletions ComplementaryScripts/saveYeastModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ function saveYeastModel(model,upDATE)
scriptFolder = fileparts(which(mfilename));
currentDir = cd(scriptFolder);

%Update SBO terms in model:
cd missingFields
model = addSBOterms(model);
cd ..

%Check if model is a valid SBML structure:
writeCbModel(model,'sbml','tempModel.xml');
[~,errors] = TranslateSBML('tempModel.xml');
Expand Down
Loading

0 comments on commit e2d594c

Please sign in to comment.