-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add metDeltaG and rxnDeltaG fields (#330)
* add_deltaG_for_rxns_and_mets * change data format * refactor: reorganize data and code * feat: make deltaG fields when loading model * fix: round up deltaG and full I/O of deltaG fields # Conflicts: # README.md # model/yeast-GEM.xml # model/yeast-GEM.yml * predicted dG for rmodel.rxns(4063:end) * generate models # Conflicts: # model/yeast-GEM.xml * refactor: prepare curation as 8.7.0 run with RAVEN at commit 15d5c4275ae14e842d6ad0b07eb28dbd2454ef35 --------- Co-authored-by: Eduard Kerkhoven <[email protected]>
- Loading branch information
1 parent
51dca6f
commit 2fa59fe
Showing
16 changed files
with
56,434 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
function model = loadDeltaG(model) | ||
% loadDeltaG | ||
% Add metDeltaG and rxnDeltaG fields to a model, based on datafiles saved at | ||
% /data/databases (model_rxnDeltaG.csv and model_metDeltaG.csv). Metabolites | ||
% and reactions are matched by their identifiers (i.e. model.mets and | ||
% model.rxns). If changes are made that affect the identifiers or what | ||
% metabolites or reactions they refer to, the deltaG values will not be | ||
% correct. | ||
% | ||
% Input: | ||
% model yeast-GEM without deltaG fields | ||
% | ||
% Output: | ||
% model yeast-GEM with metDeltaG and rxnDeltaG fields | ||
% | ||
% Usage: model = loadDeltaG(model) | ||
|
||
if isfield(model,'metDeltaG') | ||
disp('Existing metDeltaG field will be overwritten.') | ||
else | ||
model.metDeltaG = nan(numel(model.mets),1); | ||
end | ||
if isfield(model,'rxnDeltaG') | ||
disp('Existing rxnDeltaG field will be overwritten.') | ||
else | ||
model.rxnDeltaG = nan(numel(model.rxns),1); | ||
end | ||
|
||
metG = readtable('../../data/databases/model_metDeltaG.csv'); | ||
rxnG = readtable('../../data/databases/model_rxnDeltaG.csv'); | ||
|
||
[a,b] = ismember(model.mets,metG.Var1); | ||
model.metDeltaG(a) = metG.Var2(b(a)); | ||
if any(~a) | ||
fprintf(['Not all metabolite identifiers are matched to model_metDeltaG.csv, the latter \n' ... | ||
'file might have to be supplemented with deltaG values for new metabolites.\n']) | ||
end | ||
|
||
[a,b] = ismember(model.rxns,rxnG.Var1); | ||
model.rxnDeltaG(a) = rxnG.Var2(b(a)); | ||
if any(~a) | ||
fprintf(['Not all reaction identifiers are matched to model_rxnDeltaG.csv, the latter \n' ... | ||
'file might have to be supplemented with deltaG values for new reaction.\n']) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
function model = saveDeltaG(model,verbose) | ||
% saveDeltaG | ||
% Saves the metDeltaG and rxnDeltaG fields as tables to /data/databases/... | ||
% model_rxnDeltaG.csv and /data/databases/model_metDeltaG.csv. When | ||
% loadYeastModel is run, these tables will be read to reconstruct the | ||
% metDeltaG and rxnDeltaG fields. | ||
% | ||
% Input: | ||
% model yeast-GEM with deltaG fields | ||
% verbose true or false | ||
% | ||
% Output: | ||
% model yeast-GEM with metDeltaG and rxnDeltaG fields | ||
% | ||
% Usage: model = saveDeltaG(model,verbose) | ||
|
||
if nargin<2 | ||
verbose=false; | ||
end | ||
if ~isfield(model,'metDeltaG') | ||
if verbose | ||
disp('No metDeltaG field found, model_metDeltaG.csv will not be changed.') | ||
end | ||
else | ||
metG = array2table([model.mets, num2cell(model.metDeltaG)]); | ||
writetable(metG,'../../data/databases/model_metDeltaG.csv'); | ||
end | ||
if ~isfield(model,'rxnDeltaG') | ||
if verbose | ||
disp('No rxnDeltaG field found, model_rxnDeltaG.csv will not be changed') | ||
end | ||
else | ||
rxnG = array2table([model.rxns, num2cell(model.rxnDeltaG)]); | ||
writetable(rxnG,'../../data/databases/model_rxnDeltaG.csv'); | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.