-
Notifications
You must be signed in to change notification settings - Fork 1
/
PlotFigures_phosphoproteome.m
78 lines (66 loc) · 2.9 KB
/
PlotFigures_phosphoproteome.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
function [] = PlotFigures_phosphoproteome()
% This function will plot all figures corresponding to the automatic model
% expansion
%% Setup initial things
close all
warning off
choice = input("\n\nDo you want to simulate the supplemental figures in addition to the main figures? \nThis will take a long time. \nPress ctrl+C to cancel. \nSimulate supplemental figures (y/N): ", 's');
plotSupplemental = lower(choice) == 'y';
format shortg
cwd = pwd;
cd('phosphoproteome scripts')
try
%% Setup the model
coreModelName = 'combined';
Setup_phosphoproteome()
%% Generate the layerwise inibition prediction plot.
InhibitionsForAllLayers(coreModelName)
%% Plot supplemental timeseries
disp('Plotting diabetes time series for the first 5 layers.')
load('Results/layer6.mat','x', 'list','expData','structure','parameters') % Note: the second added layer is empty, therefore the fifth layer correspond to the saved layer6.
list = RemoveEmptyLayers(list);
modelName='layer5';
disp('Starting to build the model file.')
GenerateModel(structure,modelName,pwd,100);
disp('Starting to compile the model. This may take a while')
IQMmakeMEXmodel(IQMmodel([modelName '.txt']))
PlotFinalModel(parameters,x, expData, modelName, coreModelName, list, 1, 0,1,0);
disp('Finished plotting the figures');
disp('The main figures are available as PDFs in the root folder.')
figFiles = dir('../Phosphoproteome-plots/Diabetes/*.pdf');
for i =1:length(figFiles)
copyfile([figFiles(i).folder '/' figFiles(i).name], ['../Fig. 9 ' figFiles(i).name])
end
rmdir('../Phosphoproteome-plots/Diabetes/','s')
close all
if plotSupplemental
disp('Plotting all supplemental figures. This might take a while. ')
load('Results/DataDriven.mat','x', 'list','expData','structure','parameters') % Load to restart the algorithm from this point later on if necessary
list = RemoveEmptyLayers(list);
modelName='FinalExpandedModel';
GenerateModel(structure,modelName,pwd,100);
IQMmakeMEXmodel(IQMmodel([modelName '.txt']))
PlotFinalModel(parameters,x, expData, modelName, coreModelName, list, 1, 1,1,1);
disp('Finished plotting the supplemental figures figures');
disp('The supplemental figures are available as PDFs in the Phosphoproteome-plots folder.')
disp('Note that some layers are empty, and thus no plots for that layer is saved (e.g., in layer 2).')
end
%% Final cleanup
close all
warning on
cd(cwd)
catch err
disp('Something went wrong, returning to the original directory')
cd(cwd)
rethrow(err)
end
end
function [list] = RemoveEmptyLayers(list)
layers = list.ExpansionIteration;
maxlayer = max(layers(~isinf(layers)));
emptyLayers = find(~ismember(1:maxlayer, layers));
for i =1:length(layers)
layers(i) = layers(i)-sum(emptyLayers<layers(i));
end
list.ExpansionIteration = layers;
end