/
illustrate_ppp.m
104 lines (82 loc) · 3.73 KB
/
illustrate_ppp.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
function illustrate_ppp(ResultsAllCellLines,mets,path,samples,label,fonts,tol)
% This function generates and saves heatmaps for the results of the function
% performPPP for all sample models.
%
% USAGE:
%
% illustrate_ppp(ResultsAllCellLines, mets, path, samples, label, fonts, tol)
%
% INPUTS:
% ResultsAllCellLines: Result structure
% mets: Metabolites that were tested in the phase plane analysis
% step_size: Step size of each metabololite tested
% path: Path where output is saved
% samples: Names of conditions
% label: Defining label of X-axis, y-axis and z-axis, e.g., {`Glucose uptake (fmol/cell/hr)`; `Oxygen uptake
% (fmol/cell/hr)`; `Growth rate (hr-1)`} The z-axis is the growth rate which is color coded
% fonts: Font size for labels on heatmap
% tol: Fluxes are considered zero if they are below the tol
%
% Individual pdf files showing the result of the PPP are being saved automatically for each condition.
%
% .. Author: - Maike K. Aurich 19/02/15
k=1;
for i=1:length(samples)
for p=1:size(mets,2)
name = ['phasePlane_' strtok(mets{1,p}, '(') '_' strtok(mets{2,p}, '(')];
%load condition specific performPPP result
growthRates = ResultsAllCellLines.(samples{i}).(name).growthRates;
bounds = ResultsAllCellLines.(samples{k}).(name).bounds;
%chop off the additional entries in bounds
ivalues=bounds(1:size(growthRates,1),1);
jvalues=bounds(1:size(growthRates,2),2);
% to mark the reaction bounds in the pruned model onto the phase plane
modelPruned = eval(['ResultsAllCellLines.' samples{i} '.modelPruned']);
lb = modelPruned.lb(find(ismember(modelPruned.rxns, mets{1,p})));
ub = modelPruned.ub(find(ismember(modelPruned.rxns, mets{1,p})));
clear modelPruned
%make title
name = regexprep(samples{i},'_','-');
title_name = ['Objective values under variation of ' regexprep(mets{1,p},'_','-') ' and ' regexprep(mets{2,p},'_','-') ' in ' name];
% define max of z-axis, which is the growth rate and color coded
zmax = eval(['ResultsAllCellLines.' samples{i} '.maxBiomass.f'])+ 0.001;
B = growthRates;
% set values below tol as zero
B(find(abs(B)<abs(tol)))=0;
B(find(B==0))=nan; % remove zero as value
% 3D plot
figure1=figure;
axes1 = axes('Parent',figure1);
surf(ivalues',jvalues',B','Parent',axes1,'SpecularStrength',0.4,...
'AmbientStrength',0.55,...
'LineStyle','none');
colorbar('peer',axes1);
lowToHigh = [2 15];
caxis(lowToHigh + [-1 1]*diff(lowToHigh));
% set viewpoint
az = 0;
el = 90;
view(az, el);
%hold off
hold on
plot3([lb,lb],[0,-1000],[zmax,zmax],'Color',[0 0 0],'LineWidth',1.2);
hold on
plot3([ub,ub],[-1000,0],[zmax,zmax],'Color',[0 0 0],'LineWidth',1.2);
hold off
xlabel(label(1,1),'FontSize',fonts);
ylabel(label(2,1),'FontSize',fonts);
zlabel(label(3,1),'FontSize',fonts);
title(title_name,'FontSize',fonts);
axis tight %% seems to limit the axis, excludes white edge
set(gcf, 'PaperUnits', 'inches');
zlim([0 32]) % z-axis now from 0 to 10
x_width=8 ;y_width=6;
set(gcf, 'PaperPosition', [0 0 x_width y_width]); %
name = [ 'phasePlane_' samples{i} '_' strtok(mets{1,p}, '(') '_' strtok(mets{2,p}, '(')];
saveas(gcf,[path filesep name '.pdf']);
% saveas(gcf,[path filesep name '.png']);
clear ivalues
clear jvalues
end
end
end