Skip to content

Commit

Permalink
feat: getECfromGEM to copy from model.eccodes
Browse files Browse the repository at this point in the history
And rename getECCodes to getECfromDatabase
  • Loading branch information
edkerk committed Dec 21, 2022
1 parent 79c06a1 commit ad3f39a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
File renamed without changes.
27 changes: 27 additions & 0 deletions geckomat/get_enzyme_data/getECfromGEM.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
function model = getECfromGEM(model, ecRxns)
% getECfromGEM
% Use the model.eccodes to populates the model.ec.eccodes field.
%
% Input:
% model ec-model in GECKO 3 format
% ecRxns logical of length model.ec.rxns that specifies for
% which reactions the existing model.ec.eccodes entry
% should be kept and not modified by this function
% (optional, by default all model.ec.eccodes entries
% are populated by this function)
%
% Output:
% model ec-model with populated model.ec.eccodes

if ~isfield(model,'eccodes')
error('The model has no eccodes field.')
end

rxnIdxs = getIndexes(model,model.ec.rxns,'rxns');

if nargin<2 || all(ecRxns)
model.ec.eccodes = model.eccodes(rxnIdxs);
else
model.ec.eccodes(ecRxns) = model.eccodes(rxnIdxs(ecRxns));
end
end

0 comments on commit ad3f39a

Please sign in to comment.