Skip to content

Commit

Permalink
Merge pull request #66 from SysBioChalmers/feat/yeastCompatibility
Browse files Browse the repository at this point in the history
Feat/yeast compatibility
  • Loading branch information
BenjaSanchez committed Jan 7, 2019
2 parents af55d8c + d0c91ec commit 0b14cc3
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 24 deletions.
2 changes: 1 addition & 1 deletion geckomat/change_model/addEnzymesToRxn.m
Expand Up @@ -43,7 +43,7 @@
rxnToAdd.mets = [metS,newMets,metP];
rxnToAdd.stoichCoeffs = [coeffsS,-kvalues.^-1,coeffsP];
if ismember(newRxnName{1},model.rxns)
model = changeRxns(model,newRxnName(1),rxnToAdd,1,comp);
model = changeRxns(model,newRxnName(1),rxnToAdd,1,comp,true);
else
rxnToAdd.rxns = newRxnName(1);
rxnToAdd.rxnNames = newRxnName(2);
Expand Down
15 changes: 7 additions & 8 deletions geckomat/change_model/manualModifications.m
Expand Up @@ -62,20 +62,19 @@
for k = 1:length(prot_set)
model.S(int_pos(k),i) = 0;
end
%If some proteins where not present previously, add them:
newMets = uniprots{j};
%Add new protein stoich. coeffs to rxn:
kvalues = kcats(j)./stoich{j};
rxnID = model.rxns{i};
newMets = strcat('prot_',uniprots{j});
rxnName = model.rxnNames{i};
grRule = protGenes{j};
model = addEnzymesToRxn(model,kvalues,rxnID,newMets,{rxnID,rxnName},grRule);
%If some proteins where not present previously, add them:
for k = 1:length(uniprots{j})
if sum(strcmp(model.enzymes,uniprots{j}{k})) == 0
model = addProtein(model,uniprots{j}{k},kegg,swissprot);
end
newMets{k} = ['prot_' newMets{k}];
end
%Add new protein stoich. coeffs to rxn:
kvalues = kcats(j)./stoich{j};
rxnID = model.rxns{i};
rxnName = model.rxnNames{i};
model = addEnzymesToRxn(model,kvalues,rxnID,newMets,{rxnID,rxnName},grRule);
end
end
%Update int_pos:
Expand Down
12 changes: 7 additions & 5 deletions geckomat/limit_proteins/scaleBioMass.m
Expand Up @@ -60,11 +60,13 @@

rxnName = [metName ' pseudoreaction'];
rxnPos = strcmp(model.rxnNames,rxnName);
for i = 1:length(model.mets)
S_ir = model.S(i,rxnPos);
isProd = strcmp(model.metNames{i},metName);
if S_ir ~= 0 && ~isProd
model.S(i,rxnPos) = f*S_ir;
if sum(rxnPos) == 1
for i = 1:length(model.mets)
S_ir = model.S(i,rxnPos);
isProd = strcmp(model.metNames{i},metName);
if S_ir ~= 0 && ~isProd
model.S(i,rxnPos) = f*S_ir;
end
end
end

Expand Down
30 changes: 20 additions & 10 deletions models/saveECmodel.m
Expand Up @@ -39,16 +39,16 @@
%Transform model back to COBRA for saving purposes:
model_cobra = ravenCobraWrapper(model);
%Remove fields from COBRA model (temporal):
model_cobra = rmfield(model_cobra,'metCharges');
model_cobra = rmfield(model_cobra,'metChEBIID');
model_cobra = rmfield(model_cobra,'metKEGGID');
model_cobra = rmfield(model_cobra,'metSBOTerms');
model_cobra = rmfield(model_cobra,'rxnConfidenceScores');
model_cobra = rmfield(model_cobra,'rxnECNumbers');
model_cobra = rmfield(model_cobra,'rxnKEGGID');
model_cobra = rmfield(model_cobra,'rxnReferences');
model_cobra = rmfield(model_cobra,'subSystems');
model_cobra = rmfield(model_cobra,'rxnSBOTerms');
model_cobra = takeOutField(model_cobra,'metCharges');
model_cobra = takeOutField(model_cobra,'metChEBIID');
model_cobra = takeOutField(model_cobra,'metKEGGID');
model_cobra = takeOutField(model_cobra,'metSBOTerms');
model_cobra = takeOutField(model_cobra,'rxnConfidenceScores');
model_cobra = takeOutField(model_cobra,'rxnECNumbers');
model_cobra = takeOutField(model_cobra,'rxnKEGGID');
model_cobra = takeOutField(model_cobra,'rxnReferences');
model_cobra = takeOutField(model_cobra,'subSystems');
model_cobra = takeOutField(model_cobra,'rxnSBOTerms');
%Save model as sbml and text:
writeCbModel(model_cobra,'sbml',[file_name '.xml']);
writeCbModel(model_cobra,'text',[file_name '.txt']);
Expand Down Expand Up @@ -81,3 +81,13 @@
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function model = takeOutField(model,field)

if isfield(model,field)
model = rmfield(model,field);
end

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

0 comments on commit 0b14cc3

Please sign in to comment.