0001 function targets=FSEOF(model,biomassRxn,targetRxn,iterations,coefficient,outputFile)
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
0030
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
0051 model=setParam(model,'obj',targetRxn,1);
0052 sol=solveLP(model,1);
0053 targetMax=sol.f*coefficient;
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
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
0071
0072 for j=1:length(fseof.results)
0073 if fseof.results(j,1) > 0
0074
0075 if i == 1
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
0088
0089 if i == 1
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
0106 formatSpec='%s\t%s\t%s\t%s\t%s\t%s\t%s\n';
0107 if output == 1
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
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));
0118 A1=num2str(num);
0119 A2=char(model.rxns(num));
0120 A3=char(model.rxnNames(num));
0121 if isfield(model,'subSystems') && ~isempty(model.subSystems{num});
0122 A4=char(strjoin(model.subSystems{num,1},';'));
0123 else
0124 A4='';
0125 end
0126 A5=num2str(model.rev(num)*rxnDirection(num,1));
0127 A6=char(model.grRules(num));
0128 if output == 1
0129 fprintf(fid,formatSpec,A0,A1,A2,A3,A4,A5,A6);
0130 else
0131 fprintf(formatSpec,A0,A1,A2,A3,A4,A5,A6);
0132 end
0133 end
0134 end
0135
0136 if output == 1
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);
0143 end
0144 end