findExcRxns Find exchange and uptake rxns [selExc,selUpt] = findExcRxns(model,inclObjFlag,irrevFlag) INPUT model COBRA model structure OPTIONAL INPUTS inclObjFlag Include objective rxns in the exchange rxn set (1) or not (0) (Default = false) irrevFlag Model is in irreversible format (1) or not (Default = false) OUTPUTS selExc Boolean vector indicating whether each reaction in model is exchange or not selUpt Boolean vector indicating whether each reaction in model is nutrient uptake or not Exchange reactions only have one non-zero (+1/-1) element in the corresponding column of the stoichiometric matrix. Uptake reactions are exchange reactions are exchange reactions with negative lower bounds. 10/14/05 Markus Herrgard
0001 function [selExc,selUpt] = findExcRxns(model,inclObjFlag,irrevFlag) 0002 %findExcRxns Find exchange and uptake rxns 0003 % 0004 % [selExc,selUpt] = findExcRxns(model,inclObjFlag,irrevFlag) 0005 % 0006 %INPUT 0007 % model COBRA model structure 0008 % 0009 %OPTIONAL INPUTS 0010 % inclObjFlag Include objective rxns in the exchange rxn set (1) or not (0) 0011 % (Default = false) 0012 % irrevFlag Model is in irreversible format (1) or not 0013 % (Default = false) 0014 % 0015 %OUTPUTS 0016 % selExc Boolean vector indicating whether each reaction in 0017 % model is exchange or not 0018 % selUpt Boolean vector indicating whether each reaction in 0019 % model is nutrient uptake or not 0020 % 0021 % Exchange reactions only have one non-zero (+1/-1) element in the 0022 % corresponding column of the stoichiometric matrix. Uptake reactions are 0023 % exchange reactions are exchange reactions with negative lower bounds. 0024 % 0025 % 10/14/05 Markus Herrgard 0026 0027 if (nargin < 2) 0028 inclObjFlag = false; 0029 end 0030 if (nargin < 3) 0031 irrevFlag = false; 0032 end 0033 0034 if (~irrevFlag) 0035 % Find exchange rxns 0036 selExc = full((sum(model.S==-1,1) ==1) & (sum(model.S~=0) == 1))' | full((sum(model.S==1,1) ==1) & (sum(model.S~=0) == 1))'; 0037 0038 if (isfield(model,'c')) 0039 % Remove obj rxns 0040 if (~inclObjFlag) 0041 selExc(model.c ~= 0) = false; 0042 else 0043 selExc(model.c ~= 0) = true; 0044 end 0045 end 0046 0047 if (isfield(model,'lb')) 0048 % Find uptake rxns 0049 selUpt = full(model.lb < 0 & selExc); 0050 else 0051 selUpt = []; 0052 end 0053 0054 else 0055 0056 % Find exchange rxns 0057 selExc = full((sum(abs(model.S)==1,1) ==1) & (sum(model.S~=0) == 1))'; 0058 0059 if (isfield(model,'c')) 0060 % Remove obj rxns 0061 if (~inclObjFlag) 0062 selExc(model.c ~= 0) = false; 0063 else 0064 selExc(model.c ~= 0) = true; 0065 end 0066 end 0067 0068 % Find uptake rxns 0069 selUpt = full((sum(model.S==1,1) ==1) & (sum(model.S~=0) == 1))'; 0070 0071 end 0072