-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: getECfromGEM to copy from model.eccodes
And rename getECCodes to getECfromDatabase
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
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,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 |