Skip to content

Commit

Permalink
fix: minor bugs
Browse files Browse the repository at this point in the history
- have conditional check when adding model fields
- use `isequal` that returns logical scalar value
  • Loading branch information
haowang-bioinfo committed Mar 30, 2022
1 parent c56b4eb commit 2708eea
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions code/annotateGEM.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
annPath = strcat(fileparts(ST(I).file),'/../model');
end

if nargin < 3 || isempty(annType) || strcmpi(annType,'all')
if nargin < 3 || isempty(annType) || isequal(annType,'all')
annType = {'rxn','met','gene'};
elseif ~all(ismember(annType,{'rxn','met','gene','reaction','metabolite'}))
error('annType input(s) not recognized. Valid options are "rxn", "met", and/or "gene", or "all"');
Expand Down Expand Up @@ -277,9 +277,18 @@

% get fields and their types
f = fieldnames(allAssoc);
fieldType = repmat({'rxn'}, numel(f), 1);
fieldType(ismember(f, fieldnames(metAssoc))) = {'met'};
fieldType(ismember(f, fieldnames(geneAssoc))) = {'gene'};

if ~isempty(rxnAssoc)
fieldType = repmat({'rxn'}, numel(f), 1);
end

if ~isempty(metAssoc)
fieldType(ismember(f, fieldnames(metAssoc))) = {'met'};
end

if ~isempty(geneAssoc)
fieldType(ismember(f, fieldnames(geneAssoc))) = {'gene'};
end

% add individual ID fields to the model
for i = 1:numel(f)
Expand Down

0 comments on commit 2708eea

Please sign in to comment.