0001 function [growthRates, shadowPrices1, shadowPrices2] = runPhenotypePhasePlane(model, controlRxn1, controlRxn2, nPts, range1, range2)
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 close all force
0029 if nargin < 4
0030 nPts = 50;
0031 end
0032 if nargin < 5
0033 range1 = 20;
0034 end
0035 if nargin < 6
0036 range2 = 20;
0037 end
0038
0039 rxnID1 = getIndexes(model,controlRxn1,'rxns',true);
0040 metID1 = find(model.S(:,rxnID1));
0041 rxnID2 = getIndexes(model,controlRxn2,'rxns',true);
0042 metID2 = find(model.S(:,rxnID2));
0043
0044
0045 ind1 = linspace(0,range1,nPts);
0046 ind2 = linspace(0,range2,nPts);
0047 growthRates = zeros(nPts);
0048 shadowPrices1 = zeros(nPts);
0049 shadowPrices2 = zeros(nPts);
0050 [~,hsSol] = solveLP(model);
0051
0052 PB = ProgressBar2(nPts,'Running PhPP analysis','cli');
0053 for i = 1:nPts
0054 for j = 1:nPts
0055 model1 = setParam(model,'eq',controlRxn1,-1*ind1(i));
0056 model1 = setParam(model1,'eq',controlRxn2,-1*ind2(j));
0057 [fbasol,hsSol] = solveLP(model1,0,[],hsSol);
0058 try
0059 growthRates(j,i) = fbasol.x(logical(model1.c));
0060 shadowPrices1(j,i) = fbasol.sPrice(metID1);
0061 shadowPrices2(j,i) = fbasol.sPrice(metID2);
0062 end
0063 end
0064 count(PB);
0065 end
0066 fprintf('\b\b\b\b\b\b\b\b\b\b\b\b\bCOMPLETE\n');
0067
0068
0069 figure(2);
0070 pcolor(ind1,ind2,shadowPrices1);
0071 xlabel(strrep(strcat(controlRxn1,' (mmol/g DW-hr)'),'_','\_')), ylabel(strrep(strcat(controlRxn2,' (mmol/g DW-hr)'),'_','\_')), zlabel('growth rate (1/hr)');
0072 title(['Shadow price ' strrep(model.mets{metID1},'_','-')]);
0073 colorbar();
0074 xticklabels(sprintfc('%d', -xticks))
0075 yticklabels(sprintfc('%d', -yticks))
0076 figure(3);
0077 pcolor(ind1,ind2,shadowPrices2);
0078 xlabel(strrep(strcat(controlRxn1,' (mmol/g DW-hr)'),'_','\_')), ylabel(strrep(strcat(controlRxn2,' (mmol/g DW-hr)'),'_','\_')), zlabel('growth rate (1/hr)');
0079 title(['Shadow price ' strrep(model.mets{metID2},'_','-')]);
0080 colorbar();
0081 xticklabels(sprintfc('%d', -xticks))
0082 yticklabels(sprintfc('%d', -yticks))
0083 figure(1);
0084 surfl(ind1,ind2,growthRates);
0085 xlabel(strrep(strcat(controlRxn1,' (mmol/g DW-hr)'),'_','\_')), ylabel(strrep(strcat(controlRxn2,' (mmol/g DW-hr)'),'_','\_')), zlabel('growth rate (1/hr)');
0086 colormap(hsv(17));
0087 xticklabels(sprintfc('%d', -xticks))
0088 yticklabels(sprintfc('%d', -yticks))
0089 end