Skip to content

Commit

Permalink
fix: compliance with yeast-GEM
Browse files Browse the repository at this point in the history
molecular formulas assigned to all backbones based on mass balances. A couple of other changes in the model format
  • Loading branch information
BenjaSanchez committed May 20, 2018
1 parent 2a8dc31 commit 9368d42
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 10 deletions.
21 changes: 14 additions & 7 deletions models/SLIMEr.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% model = SLIMEr(model,data,includeTails)
%
% Benjamín J. Sánchez. Last update: 2018-03-30
% Benjamín J. Sánchez. Last update: 2018-05-20
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function model = SLIMEr(model,data,includeTails)
Expand All @@ -12,13 +12,19 @@
for i = 1:length(metIDs)
backName = getBackboneName(metNames{i});
if ~isempty(backName)
if ~ismember(backName,model.metNames)
if ismember(backName,model.metNames)
if ~startsWith(backName,'ergosterol [')
model.metFormulas{strcmp(model.metNames,backName)} = '';
end
else
model = addLipidSpecies(model,backName,'',false);
end
%Add transport rxn to cytoplasm for non cytoplasmic backbones:
if ~contains(backName,'cytoplasm')
cytoName = [backName(1:strfind(backName,'[')) 'cytoplasm]'];
if ~ismember(cytoName,model.metNames)
if ismember(cytoName,model.metNames)
model.metFormulas{strcmp(model.metNames,cytoName)} = '';
else
model = addLipidSpecies(model,cytoName,'',false);
end
backID = model.mets(strcmp(model.metNames,backName));
Expand Down Expand Up @@ -53,12 +59,12 @@
end

%Create lipid pseudo-rxn for backbones:
model = addLipidSpecies(model,'lipid - backbones [cytoplasm]','NA',includeTails);
model = addLipidSpecies(model,'lipid - backbones [cytoplasm]','',includeTails);
model = changeLipidComp(model,data.lipidData);

%Create lipid pseudo-rxn for tails:
if includeTails
model = addLipidSpecies(model,'lipid - tails [cytoplasm]','NA',includeTails);
model = addLipidSpecies(model,'lipid - tails [cytoplasm]','',includeTails);
model = changeChainComp(model,data.chainData);
end

Expand Down Expand Up @@ -121,8 +127,9 @@
model.S(Hpos,bioRxn) = +GAM;
model.S(Ppos,bioRxn) = +GAM;

%Remove wrongly created field:
model = rmfield(model,'grRules');
%Correct some wrongly created fields:
model = rmfield(model,'grRules');
model.S = full(model.S);

end

Expand Down
24 changes: 21 additions & 3 deletions models/addSLIMErxn.m
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,30 @@
tailCoeffs = zeros(size(tailIDs));

%Match to corresponding tail:
prodFormulas = cell(size(tailsRxn));
for i = 1:length(tailsRxn)
tailName = [tailsRxn{i} ' chain [cytoplasm]'];
tailMatch = strcmp(tailsModel,tailName);
tailCoeffs = tailCoeffs + tailMatch.*tailsMWs;
tailName = [tailsRxn{i} ' chain [cytoplasm]'];
tailMatch = strcmp(tailsModel,tailName);
tailCoeffs = tailCoeffs + tailMatch.*tailsMWs;
prodFormulas{i} = tailsFormulas{tailMatch};
end

%Assign molecular formula to backbone by balancing out the SLIME rxns:
backName = [backName ' ['];
formula = '';
elements = {'C','H','N','O','P','S'};
for j = 1:length(elements)
Nin = getStoichFromFormula(specFormula, elements{j});
Nout = getStoichFromFormula(prodFormulas, elements{j});
diff = Nin - sum(Nout);
if diff == 1
formula = [formula elements{j}];
elseif diff > 1
formula = [formula elements{j} num2str(diff)];
end
end
model.metFormulas(startsWith(model.metNames,backName)) = {formula};

%Create SLIME rxn (with same ID as previous ISA rxn but different name):
model = addReaction(model,rxnID, ...
'reactionName', rxnName, ...
Expand Down

0 comments on commit 9368d42

Please sign in to comment.