0001 function [biomassValues, targetValues] = runProductionEnvelope(model, targetRxn, biomassRxn, nPts)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 if nargin < 4
0020 nPts = 20;
0021 end
0022
0023
0024 model = setParam(model,'obj',biomassRxn,1);
0025 [solMax,hsSol] = solveLP(model);
0026 solMax = solMax.x(logical(model.c));
0027 model.c = -model.c;
0028 solMin = solveLP(model,0,[],hsSol);
0029 solMin = solMin.x(logical(model.c));
0030
0031
0032 biomassValues = linspace(solMin,solMax,nPts);
0033 targetUpperBound = nan(1,numel(biomassValues));
0034 targetLowerBound = nan(1,numel(biomassValues));
0035
0036 PB = ProgressBar2(length(biomassValues),'Creating production envelope','cli');
0037
0038 model = setParam(model,'obj',targetRxn,1);
0039 for i = 1:length(biomassValues)
0040 model1 = setParam(model,'eq',biomassRxn,biomassValues(i));
0041 sol = solveLP(model1,0,[],hsSol);
0042 if (sol.stat > 0)
0043 targetUpperBound(i) = sol.x(logical(model.c));
0044 else
0045 targetUpperBound(i) = NaN;
0046 end
0047 model1.c = -model1.c;
0048 sol = solveLP(model1,0,[],hsSol);
0049 if (sol.stat > 0)
0050 targetLowerBound(i) = sol.x(logical(model1.c));
0051 else
0052 targetLowerBound(i) = NaN;
0053 end
0054 count(PB);
0055 end
0056
0057
0058 plot([biomassValues fliplr(biomassValues)],[targetUpperBound fliplr(targetLowerBound)],'blue','LineWidth',2);
0059 axis tight;
0060 ylabel([strrep(targetRxn,'_','-') ' (mmol/gDW h)']);
0061 xlabel('Growth rate (1/h)');
0062 targetValues = [targetLowerBound; targetUpperBound];
0063 end