Home > core > FSEOF.m

FSEOF

PURPOSE ^

FSEOF

SYNOPSIS ^

function targets=FSEOF(model,biomassRxn,targetRxn,iterations,coefficient,outputFile)

DESCRIPTION ^

 FSEOF
   Implements the Flux Scanning based on Enforced Objective Flux algorithm.

 Input:
   model           a model structure
   biomassRxn      string with reaction ID of the biomass formation or
                   growth reaction
   targetRxn       string with reaction ID of target reaction
   iterations      numeric indicating number of iterations (optional,
                   default 10)
   coefficient     numeric indicating ratio of optimal target reaction
                   flux, must be less than 1 (optional, default 0.9)
   outputFile      string with output filename (optional, default prints
                   to command window)

 Output:
   targets         structure with information for identified targets
       logical     logical array indicating whether a model reaction was
                   identified as target by FSEOF
       slope       numeric array with FSEOF slopes for target reactions

 This function writes an tab-delimited file or prints to command window.
 If an output has been specified (targets), it will also generate a
 structure indicating for each model reaction whether it is identified by
 FSEOF as a target and the slope of the reaction when switching from
 biomass formation to product formation.

 Usage: targets = FSEOF(model, biomassRxn, targetRxn, iterations,...
                   coefficient, outputFile)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function targets=FSEOF(model,biomassRxn,targetRxn,iterations,coefficient,outputFile)
0002 % FSEOF
0003 %   Implements the Flux Scanning based on Enforced Objective Flux algorithm.
0004 %
0005 % Input:
0006 %   model           a model structure
0007 %   biomassRxn      string with reaction ID of the biomass formation or
0008 %                   growth reaction
0009 %   targetRxn       string with reaction ID of target reaction
0010 %   iterations      numeric indicating number of iterations (optional,
0011 %                   default 10)
0012 %   coefficient     numeric indicating ratio of optimal target reaction
0013 %                   flux, must be less than 1 (optional, default 0.9)
0014 %   outputFile      string with output filename (optional, default prints
0015 %                   to command window)
0016 %
0017 % Output:
0018 %   targets         structure with information for identified targets
0019 %       logical     logical array indicating whether a model reaction was
0020 %                   identified as target by FSEOF
0021 %       slope       numeric array with FSEOF slopes for target reactions
0022 %
0023 % This function writes an tab-delimited file or prints to command window.
0024 % If an output has been specified (targets), it will also generate a
0025 % structure indicating for each model reaction whether it is identified by
0026 % FSEOF as a target and the slope of the reaction when switching from
0027 % biomass formation to product formation.
0028 %
0029 % Usage: targets = FSEOF(model, biomassRxn, targetRxn, iterations,...
0030 %                   coefficient, outputFile)
0031 
0032 biomassRxn=char(biomassRxn);
0033 targetRxn=char(targetRxn);
0034 
0035 if nargin<4
0036     iterations=10;
0037     coefficient=0.9;
0038 end
0039 
0040 if nargin <5
0041     coefficient=0.9;
0042 end
0043 
0044 if nargin == 6
0045     output=1;
0046 else
0047     output=0;
0048 end
0049 
0050 %Find out the maximum theoretical yield of target reaction
0051 model=setParam(model,'obj',targetRxn,1);
0052 sol=solveLP(model,1);
0053 targetMax=sol.f*coefficient;   % 90 percent of the theoretical yield
0054 
0055 model=setParam(model,'obj',biomassRxn,1);
0056 
0057 fseof.results=zeros(length(model.rxns),iterations);
0058 fseof.target=zeros(length(model.rxns),1);
0059 rxnDirection=zeros(length(model.rxns),1);
0060 
0061 %Enforce objective flux iteratively
0062 for i=1:iterations
0063     n=i*targetMax/iterations;
0064     model=setParam(model,'lb',targetRxn,n);
0065     
0066     sol=solveLP(model,1);
0067     
0068     fseof.results(:,i)=sol.x;
0069     
0070     %Loop through all fluxes and identify the ones that increased upon the
0071     %enforced objective flux
0072     for j=1:length(fseof.results)
0073         if fseof.results(j,1) > 0   %Check the positive fluxes
0074             
0075             if i == 1   %The initial round
0076                 rxnDirection(j,1)=1;
0077                 fseof.target(j,1)=1;
0078             else
0079                 
0080                 if (fseof.results(j,i) > fseof.results(j,i-1)) & fseof.target(j,1)
0081                     fseof.target(j,1)=1;
0082                 else
0083                     fseof.target(j,1)=0;
0084                 end
0085             end
0086             
0087         elseif fseof.results(j,1) < 0 %Check the negative fluxes
0088             
0089             if i == 1   %The initial round
0090                 rxnDirection(j,1)=-1;
0091                 fseof.target(j,1)=1;
0092             else
0093                 if (fseof.results(j,i) < fseof.results(j,i-1)) & fseof.target(j,1)
0094                     fseof.target(j,1)=1;
0095                 else
0096                     fseof.target(j,1)=0;
0097                 end
0098             end
0099             
0100         end
0101         
0102     end
0103 end
0104 
0105 %Generating output
0106 formatSpec='%s\t%s\t%s\t%s\t%s\t%s\t%s\n';
0107 if output == 1    %Output to a file
0108     outputFile=char(outputFile);
0109     fid=fopen(outputFile,'w');
0110     fprintf(fid,formatSpec,'Slope','rowID','Enzyme ID','Enzyme Name','Subsystems','Direction','Gr Rule');
0111 else              %Output to screen
0112     fprintf(formatSpec,'Slope','rowID','Enzyme ID','Enzyme Name','Subsystems','Direction','Gr Rule');
0113 end
0114 
0115 for num=1:length(fseof.target)
0116     if fseof.target(num,1) == 1
0117         A0=num2str(abs(fseof.results(num,iterations)-fseof.results(num,1))/abs(targetMax-targetMax/iterations)); %Slope calculation
0118         A1=num2str(num);                                  %row ID
0119         A2=char(model.rxns(num));                         %enzyme ID
0120         A3=char(model.rxnNames(num));                     %enzyme Name
0121         if isfield(model,'subSystems') && ~isempty(model.subSystems{num});
0122             A4=char(strjoin(model.subSystems{num,1},';'));                   %Subsystems
0123         else
0124             A4='';
0125         end
0126         A5=num2str(model.rev(num)*rxnDirection(num,1));   %reaction Dirction
0127         A6=char(model.grRules(num));                      %Gr Rule
0128         if output == 1    %Output to a file
0129             fprintf(fid,formatSpec,A0,A1,A2,A3,A4,A5,A6);
0130         else              %Output screen
0131             fprintf(formatSpec,A0,A1,A2,A3,A4,A5,A6);
0132         end
0133     end
0134 end
0135 
0136 if output == 1    %Output to a file
0137     fclose(fid);
0138 end
0139 
0140 if nargout == 1
0141     targets.logical=logical(fseof.target);
0142     targets.slope=abs(fseof.results(:,iterations)-fseof.results(:,1))/abs(targetMax-targetMax/iterations); %Slope calculation
0143 end
0144 end

Generated by m2html © 2005