removeCorrelRxns

PURPOSE ^

removeCorrelRxns Remove fully or almost fully correlated reactions

SYNOPSIS ^

function [selRxns,rxnSets,rxnList,Rfilt] = removeCorrelRxns(model,R,correlCutoff)

DESCRIPTION ^

removeCorrelRxns Remove fully or almost fully correlated reactions

 [selRxns,rxnSets,rxnList,Rfilt] = removeCorrelRxns(model,R,correlCutoff)

INPUTS
 model         COBRA model structure
 R             Correl coefficient matrix

OPTIONAL INPUT
 correlCutoff  Cutoff level for fully correlated rxns (Default 0.99999)

OUTPUTS
 selRxns       true/false vector that allow selecting non-redundant data
 rxnSets       Correlated reaction sets
 rxnList       Reaction list with correlated reactions concatenated
 Rfilt         Filtered R

 Markus Herrgard 3/21/07

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [selRxns,rxnSets,rxnList,Rfilt] = removeCorrelRxns(model,R,correlCutoff)
0002 %removeCorrelRxns Remove fully or almost fully correlated reactions
0003 %
0004 % [selRxns,rxnSets,rxnList,Rfilt] = removeCorrelRxns(model,R,correlCutoff)
0005 %
0006 %INPUTS
0007 % model         COBRA model structure
0008 % R             Correl coefficient matrix
0009 %
0010 %OPTIONAL INPUT
0011 % correlCutoff  Cutoff level for fully correlated rxns (Default 0.99999)
0012 %
0013 %OUTPUTS
0014 % selRxns       true/false vector that allow selecting non-redundant data
0015 % rxnSets       Correlated reaction sets
0016 % rxnList       Reaction list with correlated reactions concatenated
0017 % Rfilt         Filtered R
0018 %
0019 % Markus Herrgard 3/21/07
0020 
0021 if (nargin < 3)
0022     correlCutoff = 1-1e-5;
0023 end
0024 
0025 % Filter out correlated reactions
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);

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003