0001 function [model2] = generateRules(model)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 grRules = model.grRules;
0013 genes = model.genes;
0014
0015 [m,n] = size(model.S);
0016
0017 rules(1:n,1) = {''};
0018
0019 for i = 1:n
0020 if length(grRules{i}) > 0
0021 tmp = grRules{i};
0022
0023 tmp = splitString(tmp,' ');
0024 tmp = strrep(tmp,' ','');
0025
0026 tmp2 = [];
0027 for j = 1:length(tmp)
0028 if strcmp(tmp{j},'or')
0029 tmp2 = [tmp2,'| '];
0030 elseif strcmp(tmp{j},'and')
0031 tmp2 = [tmp2,'& '];
0032 elseif strcmp(tmp{j}(1),'(') & strcmp(tmp{j}(end),')')
0033 tmp{j} = strrep(tmp{j},'(','');
0034 tmp{j} = strrep(tmp{j},')','');
0035 loc = strmatch(tmp{j},genes,'exact');
0036 tmp2 = [tmp2,'(x(',num2str(loc),')) '];
0037 elseif strcmp(tmp{j}(1),'(')
0038 tmp{j} = strrep(tmp{j},'(','');
0039 tmp{j} = strrep(tmp{j},')','');
0040 loc = strmatch(tmp{j},genes,'exact');
0041 tmp2 = [tmp2,'(x(',num2str(loc),') '];
0042 elseif strcmp(tmp{j}(end),')')
0043 tmp{j} = strrep(tmp{j},'(','');
0044 tmp{j} = strrep(tmp{j},')','');
0045 loc = strmatch(tmp{j},genes,'exact');
0046 tmp2 = [tmp2,'x(',num2str(loc),')) '];
0047 else
0048 loc = strmatch(tmp{j},genes,'exact');
0049 tmp2 = [tmp2,'x(',num2str(loc),') '];
0050 end
0051 end
0052
0053 tmp2 = tmp2(1:end-1);
0054 rules{i} = tmp2;
0055
0056 end
0057 end
0058
0059
0060 model2 = model;
0061 model2.rules = rules;