theoretMaxProd

PURPOSE ^

determines the max theoretical output for each exchange reaction

SYNOPSIS ^

function [ExRxns,MaxTheoOut]= theoretMaxProd(model, criterion, inputrxn, normalize, rxns)

DESCRIPTION ^

 determines the max theoretical output for each exchange reaction
 
 [ExRxns,MaxTheoOut]= theoreticalMaxProduction(model,criterion,inputrxn,normalize,rxns)
 
INPUT
 ExRxns        The Exchagne reactions in the model

OPTIONAL INPUT
 criterion   
               'pr_mol' (default) 
               'pr_mw'  (same thing in molecular weight)
               'pr_other_mol' (other carbon compounds secretion rate) 
               'pr_other_mw'  (same thing in molecular weight)
               weight yield)
 inputrxn      the input reaction ('EX_glu(e)', etc.)
 normalize     normalize by input flux.  Either the flux rate in mol or 
               in molecular weight (Default = false)
 rxns          Selection Vector (1 for selected, 0 otherwise)

OUTPUTS
 ExRxns        Vector of exchange reactions
 MaxThroOut    The max theoretical output for each exchange reaction
 
 Jan Schellenberger 11/7/08

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ExRxns,MaxTheoOut]= theoretMaxProd(model, criterion, inputrxn, normalize, rxns)
0002 % determines the max theoretical output for each exchange reaction
0003 %
0004 % [ExRxns,MaxTheoOut]= theoreticalMaxProduction(model,criterion,inputrxn,normalize,rxns)
0005 %
0006 %INPUT
0007 % ExRxns        The Exchagne reactions in the model
0008 %
0009 %OPTIONAL INPUT
0010 % criterion
0011 %               'pr_mol' (default)
0012 %               'pr_mw'  (same thing in molecular weight)
0013 %               'pr_other_mol' (other carbon compounds secretion rate)
0014 %               'pr_other_mw'  (same thing in molecular weight)
0015 %               weight yield)
0016 % inputrxn      the input reaction ('EX_glu(e)', etc.)
0017 % normalize     normalize by input flux.  Either the flux rate in mol or
0018 %               in molecular weight (Default = false)
0019 % rxns          Selection Vector (1 for selected, 0 otherwise)
0020 %
0021 %OUTPUTS
0022 % ExRxns        Vector of exchange reactions
0023 % MaxThroOut    The max theoretical output for each exchange reaction
0024 %
0025 % Jan Schellenberger 11/7/08
0026 
0027 % find the exchange reactions
0028 if nargin < 2 
0029     criterion = 'pr_mol';
0030 end
0031 if isempty(criterion)
0032     criterion = 'pr_mol';
0033 end
0034 if nargin < 4
0035     normalize = false;
0036 end
0037 
0038 if nargin < 5
0039     [selExc,selUpt] = findExcRxns(model,0,0);
0040 else
0041     selExc = rxns;
0042 end
0043 
0044 ExRxns = model.rxns(selExc);
0045 
0046 [mw Ematrix] = computeMW(model, [], false);
0047 MaxTheoOut = zeros(size(ExRxns));
0048 if(strcmp(criterion, 'pr_mol') || strcmp(criterion, 'pr_mw') )
0049     inputRxnID = findRxnIDs(model, inputrxn);
0050     inputMetID = find(model.S(:,inputRxnID));
0051     for i=1:length(ExRxns)
0052         % make the new objective vector
0053         newC = zeros(length(model.c),1);
0054                 rxn =  ExRxns(i);
0055         rxnID = find(strcmp(model.rxns,rxn));
0056         metID = find(model.S(:,rxnID));
0057         newC(rxnID,1) = 1;
0058         model.c = newC;
0059         % run the LP optimization
0060         FBAsolution = optimizeCbModel(model);
0061         % store the result
0062         if(strcmp(criterion, 'pr_mol') )
0063             MaxTheoOut(i,1) = FBAsolution.f;
0064             if normalize
0065                 MaxTheoOut(i,1) = MaxTheoOut(i,1)/abs(FBAsolution.x(inputRxnID));
0066             end
0067         else
0068             MaxTheoOut(i,1) = FBAsolution.f * mw(metID);
0069             if normalize
0070                 MaxTheoOut(i,1) = MaxTheoOut(i,1)/(abs(FBAsolution.x(inputRxnID))*mw(inputMetID));
0071             end
0072         end
0073     end
0074 
0075 elseif( strcmp(criterion, 'pr_other_mol') || strcmp(criterion, 'pr_other_mw'))
0076     inputRxnID = findRxnIDs(model, inputrxn);
0077     inputMetID = find(model.S(:,inputRxnID));
0078     cmets = zeros(length(model.mets),1);
0079     cmets(Ematrix(:,1)~=0) = 1;
0080     coefficients = zeros(size(model.c));
0081     inputRxnID = findRxnIDs(model, inputrxn);
0082     selExcF = find(selExc);
0083 
0084     for i=1:length(ExRxns)
0085         rxnID = selExcF(i);
0086         metID = find(model.S(:,rxnID));
0087         if cmets(metID)>0
0088             coefficients(rxnID) = mw(metID);
0089 %             if strcmp(ExRxns(i), 'EX_co2(e)') % get rid of CO2 if required
0090 %                 coefficients(rxnID) = 0;
0091 %             end
0092         end
0093     end
0094 
0095     for i=1:length(ExRxns)
0096         % make the new objective vector
0097         newC = zeros(length(model.c),1);
0098         rxnID = find(strcmp(model.rxns,ExRxns(i)));
0099         newC(rxnID,1) = 1;
0100         model.c = newC;
0101         % run the LP optimization
0102         FBAsolution = optimizeCbModel(model);
0103 %            optimalFlux = FBAsolution.f;
0104         cf2 = coefficients;
0105         cf2(inputRxnID) = 0;
0106         cf2(rxnID) = 0;
0107         if( strcmp(criterion, 'pr_other_mol') )
0108             MaxTheoOut(i,1) = sum(FBAsolution.x .* (cf2>0) .* (FBAsolution.x > 0));
0109             if normalize
0110                 MaxTheoOut(i,1) = MaxTheoOut(i,1)/abs(FBAsolution.x(inputRxnID));
0111             end
0112         else
0113             MaxTheoOut(i,1) = sum(FBAsolution.x .* (cf2) .* (FBAsolution.x > 0));
0114             if normalize
0115                 MaxTheoOut(i,1) = MaxTheoOut(i,1)/(abs(FBAsolution.x(inputRxnID))*mw(inputMetID));
0116             end
0117         end
0118     end
0119 else
0120     display('unknown criterion');
0121     criterion
0122 end

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