0001 function report=checkRxn(model,rxn,cutoff,revDir,printReport)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 if isstr(rxn)
0030 rxn={rxn};
0031 end
0032 if nargin<3
0033 cutoff=10^-7;
0034 end
0035 if nargin<4
0036 revDir=false;
0037 end
0038 if isempty(cutoff)
0039 cutoff=10^-7;
0040 end
0041 if nargin<4
0042 printReport=true;
0043 end
0044
0045 [I rxnID]=ismember(rxn,model.rxns);
0046
0047 if ~I
0048 throw(MException('','Reaction ID not found'));
0049 end
0050
0051 if revDir==false
0052 report.reactants=find(model.S(:,rxnID)<0);
0053 report.products=find(model.S(:,rxnID)>0);
0054 else
0055 report.reactants=find(model.S(:,rxnID)>0);
0056 report.products=find(model.S(:,rxnID)<0);
0057 end
0058 report.canMake=false(numel(report.reactants),1);
0059 report.canConsume=false(numel(report.products),1);
0060
0061
0062
0063 for i=1:numel(report.reactants)
0064 [tempModel testRxn]=addExchangeRxns(model,'out',report.reactants(i));
0065 tempModel=setParam(tempModel,'obj',testRxn,1);
0066 sol=solveLP(tempModel);
0067 if sol.f*-1>cutoff
0068 report.canMake(i)=true;
0069 else
0070 if printReport==true
0071 fprintf(['Failed to make ' model.metNames{report.reactants(i)} '[' model.comps{model.metComps(report.reactants(i))} ']\n']);
0072 end
0073 end
0074 end
0075
0076 for i=1:numel(report.products)
0077 [tempModel testRxn]=addExchangeRxns(model,'in',report.products(i));
0078 tempModel=setParam(tempModel,'obj',testRxn,1);
0079 sol=solveLP(tempModel);
0080 if sol.f*-1>cutoff
0081 report.canConsume(i)=true;
0082 else
0083 if printReport==true
0084 fprintf(['Failed to consume ' model.metNames{report.products(i)} '[' model.comps{model.metComps(report.products(i))} ']\n']);
0085 end
0086 end
0087 end
0088 end