Skip to content

Commit

Permalink
feat: Added detection of logical errors in grRules
Browse files Browse the repository at this point in the history
  • Loading branch information
IVANDOMENZAIN committed Mar 28, 2018
1 parent b4f338b commit a24209e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions core/standardizeGeneRules.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
RGMat = sparse(n,g);

if isfield(model,'grRules')
% Search logical errors in the grRules field
findLogicalErrors(model)
for i=1:length(model.grRules)
originalSTR = model.grRules{i};
newSTR = [];
Expand Down Expand Up @@ -84,4 +86,19 @@
end
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% function that gets a simple genes set (single gene or enzyme complex) and
% a rxn index. The rxnGeneMat row (rxn) will be modified accordingly to the
function findLogicalErrors(model)
errors_l = find(~cellfun(@isempty,strfind(model.grRules,') and (')));
errors_U = find(~cellfun(@isempty,strfind(model.grRules,') AND (')));
errors = union(errors_l,errors_U);
if ~isempty(errors)
for i=1:length(errors)
index = errors(i);
disp([' grRule #:',num2str(index),' ',model.grRules{index}])
end
error('Logical errors found on grRules')
end
end

0 comments on commit a24209e

Please sign in to comment.