randomKO knock out N random genes and reports products from FBA [products,productRates,KOrxns,BOF] = randomKO(modelRed,selectedRxns,N) INPUTS modelRed a reduced model (from the reduceModel.m function) selectedRxns the reactions eligible for deletion (from the getOptKnockTargets.m function) N the number of reactions to randomly knockout OUTPUTS products the exchange reactions that produce a siginifcant output productRates the rates of those exhange reactions KOrxns the N reactions randomly knocked out BOF the value of thebiomass objective function of the knockout strain Jeff Orth (5/15/07)
0001 function [products,productRates,KOrxns,BOF] = randomKO(modelRed,selectedRxns,N) 0002 % randomKO knock out N random genes and reports products from FBA 0003 % 0004 % [products,productRates,KOrxns,BOF] = randomKO(modelRed,selectedRxns,N) 0005 % 0006 %INPUTS 0007 % modelRed a reduced model (from the reduceModel.m function) 0008 % selectedRxns the reactions eligible for deletion (from the 0009 % getOptKnockTargets.m function) 0010 % N the number of reactions to randomly knockout 0011 % 0012 %OUTPUTS 0013 % products the exchange reactions that produce a siginifcant output 0014 % productRates the rates of those exhange reactions 0015 % KOrxns the N reactions randomly knocked out 0016 % BOF the value of thebiomass objective function of the 0017 % knockout strain 0018 % 0019 % Jeff Orth (5/15/07) 0020 0021 % pick N unique random targets, no repeats, no 0s 0022 rxnNum = length(selectedRxns); 0023 repeats = true; 0024 while (repeats == true) 0025 rands = ceil(rxnNum*rand(1,N)); 0026 repeatsFound = false; 0027 for i = 1:N 0028 for j = 1:N 0029 if ((i ~= j)&&(rands(i)==rands(j)))||(rands(i)==0) 0030 repeatsFound = true; 0031 end 0032 end 0033 end 0034 repeats = repeatsFound; 0035 end 0036 targets = selectedRxns(rands); 0037 0038 % knockout the N targets 0039 modelKO = modelRed; 0040 for i = 1:N 0041 modelKO = changeRxnBounds(modelKO,targets(i),0,'b'); 0042 end 0043 0044 try 0045 % do flux balance analysis, optimize BOF 0046 FBAsolutionKO = optimizeCbModel(modelKO,'max',false); 0047 0048 % list products 0049 [selExc,selUpt] = findExcRxns(modelKO,false,true); 0050 excRxns = find(selExc); %get indices of all exchange reactions 0051 productRates = FBAsolutionKO.x(excRxns); %get exchange rates of all products 0052 sigProds = excRxns(find(productRates > .000001)); %get indices of sigificant products 0053 products = modelKO.rxns(sigProds); %list the significant products 0054 productRates = FBAsolutionKO.x(sigProds); %list the exchange rates of the products 0055 KOrxns = targets; %list the knockout targets 0056 BOF = FBAsolutionKO.f; %list the biomass objective function 0057 catch 0058 %no FBA solution was found, do another random KO 0059 [products,productRates,KOrxns,BOF] = randomKO(modelRed,selectedRxns,N); 0060 end 0061 0062 0063 0064