Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/yeast compatibility #66

Merged
merged 3 commits into from Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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

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