0001 function [selRxns,rxnSets,rxnList,Rfilt] = removeCorrelRxns(model,R,correlCutoff)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 if (nargin < 3)
0022 correlCutoff = 1-1e-5;
0023 end
0024
0025
0026 rxns = model.rxns;
0027 nRxns = length(rxns);
0028 selRxns = false(nRxns,1);
0029 alreadyIncluded = false(nRxns,1);
0030 selNaN = isnan(diag(R));
0031 alreadyIncluded(selNaN) = true;
0032 newRxnCnt = 0;
0033 for rxnID = 1:nRxns
0034 if ~alreadyIncluded(rxnID)
0035 selRxns(rxnID) = true;
0036 alreadyIncluded(rxnID) = true;
0037 newRxnCnt = newRxnCnt + 1;
0038 correlRxns = find(abs(R(rxnID,:)) >= correlCutoff);
0039 rxnSets{newRxnCnt} = rxns(correlRxns);
0040 if (~isempty(correlRxns))
0041 alreadyIncluded(correlRxns) = true;
0042 end
0043 end
0044 end
0045
0046 rxnSets = columnVector(rxnSets);
0047 Rfilt = R(selRxns,selRxns);
0048
0049 for i = 1:length(rxnSets)
0050 setSize = length(rxnSets{i});
0051 if (setSize > 1)
0052 tmpString = [];
0053 for j = 1:setSize
0054 if (j == 1)
0055 divider = '';
0056 else
0057 divider = '/';
0058 end
0059 tmpString = [tmpString divider rxnSets{i}{j}];
0060 end
0061 rxnList{i} = tmpString;
0062 else
0063 try
0064 rxnList{i} = rxnSets{i}{1};
0065 catch
0066 rxnSets{i}
0067 end
0068 end
0069 end
0070
0071 rxnList = columnVector(rxnList);