getAllowedBounds Returns the minimal and maximal fluxes through each reaction. model a model structure rxns either a cell array of reaction IDs, a logical vector with the same number of elements as reactions in the model, or a vector of reaction indexes (opt, default model.rxns) minFluxes minimal allowed fluxes maxFluxes maximal allowed fluxes exitFlags exit flags for min/max for each of the reactions. True if it was possible to calculate a flux NOTE: In cases where no solution can be calculated, NaN is returned. Usage: [minFluxes, maxFluxes, exitFlags]=getAllowedBounds(model,rxns) Rasmus Agren, 2013-04-21
0001 function [minFluxes, maxFluxes, exitFlags]=getAllowedBounds(model,rxns) 0002 % getAllowedBounds 0003 % Returns the minimal and maximal fluxes through each reaction. 0004 % 0005 % model a model structure 0006 % rxns either a cell array of reaction IDs, a logical vector with the 0007 % same number of elements as reactions in the model, or a vector 0008 % of reaction indexes (opt, default model.rxns) 0009 % 0010 % minFluxes minimal allowed fluxes 0011 % maxFluxes maximal allowed fluxes 0012 % exitFlags exit flags for min/max for each of the reactions. True if 0013 % it was possible to calculate a flux 0014 % 0015 % NOTE: In cases where no solution can be calculated, NaN is returned. 0016 % 0017 % Usage: [minFluxes, maxFluxes, exitFlags]=getAllowedBounds(model,rxns) 0018 % 0019 % Rasmus Agren, 2013-04-21 0020 % 0021 0022 if nargin<2 0023 rxns=1:numel(model.rxns); 0024 else 0025 rxns=getIndexes(model,rxns, 'rxns'); 0026 end 0027 0028 minFluxes=zeros(numel(rxns),1); 0029 maxFluxes=zeros(numel(rxns),1); 0030 exitFlags=zeros(numel(rxns),2); 0031 0032 c=zeros(numel(model.rxns),1); 0033 hsSolMin=[]; 0034 hsSolMax=[]; 0035 for i=1:numel(rxns) 0036 model.c=c; 0037 0038 %Get minimal flux 0039 model.c(rxns(i))=-1; 0040 [solution hsSolMin]=solveLP(model,0,[],hsSolMin); 0041 exitFlags(i,1)=solution.stat; 0042 if ~isempty(solution.f) 0043 minFluxes(i)=solution.x(rxns(i)); 0044 else 0045 minFluxes(i)=NaN; 0046 end 0047 0048 %Get maximal flux 0049 model.c(rxns(i))=1; 0050 [solution hsSolMax]=solveLP(model,0,[],hsSolMax); 0051 exitFlags(i,2)=solution.stat; 0052 if ~isempty(solution.f) 0053 maxFluxes(i)=solution.x(rxns(i)); 0054 else 0055 maxFluxes(i)=NaN; 0056 end 0057 end 0058 end