0001 function [model,removed] = checkDuplicateRxn(model,method)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 [nMets,nRxns] = size(model.S);
0018 cnt = 1;
0019 switch method
0020 case 1
0021 h = waitbar(0, 'Checking by Abbreviation ...');
0022 i = 1;
0023 while i <= nRxns
0024 model2 = model;
0025 model2.rxns{i} = '';
0026 if isempty(strmatch(model.rxns(i),model2.rxns,'exact')) == 0
0027 matches = strmatch(model.rxns(i),model2.rxns,'exact');
0028 nRxns = nRxns - length(matches);
0029 model2 = removeRxns(model2,model.rxns(i));
0030 model2.rxns{i} = model.rxns{i};
0031 model = model2;
0032 removed(cnt,1) = i;
0033 cnt = cnt+1;
0034 end
0035 i = i+1;
0036 waitbar(i/nRxns,h);
0037 end
0038 close(h);
0039 case 2
0040 h = waitbar(0, 'Checking by reaction ...');
0041 for i = 1:nMets
0042 possibleMatches = find(model.S(i,:));
0043 for j = 1:length(possibleMatches)
0044 for k = 1:length(possibleMatches)
0045 if model.S(:,possibleMatches(j)) == model.S(:,possibleMatches(k)) & strcmp(model.rxns(possibleMatches(j)),model.rxns(possibleMatches(k))) == 0
0046 model = removeRxns(model,model.rxns(possibleMatches(k)));
0047 elseif model.S(:,possibleMatches(j)) == model.S(:,possibleMatches(k)) & strcmp(model.rxns(possibleMatches(j)),model.rxns(possibleMatches(k))) == 1
0048 model2 = model;
0049 model2.rxns{possibleMatches(j)} = '';
0050 model2 = removeRxns(model2,model.rxns(possibleMatches(j)));
0051 model2.rxns{possibleMatches(j)} = model.rxns{possibleMatches(j)};
0052 model = model2;
0053 end
0054 end
0055 end
0056 waitbar(i/nMets,h);
0057 end
0058 close(h);
0059 end