Skip to content

Commit

Permalink
Added the plotting of the individual datapoints for the phosphoproteome
Browse files Browse the repository at this point in the history
  • Loading branch information
willov committed Mar 3, 2023
1 parent 84a857b commit 511fef3
Show file tree
Hide file tree
Showing 87 changed files with 41 additions and 15 deletions.
Binary file modified Data/MS data/Humphrey_2013.mat
Binary file not shown.
14 changes: 13 additions & 1 deletion PlotFigures_phosphoproteome.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
%% 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.ExpansionIteration(list.ExpansionIteration>2) = list.ExpansionIteration(list.ExpansionIteration>2)-1; % Adjust the layer names since layer 2 is empty
list = RemoveEmptyLayers(list);
modelName='layer5';
disp('Starting to build the model file.')
GenerateModel(structure,modelName,pwd,100);
Expand All @@ -44,6 +44,7 @@
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']))
Expand All @@ -63,4 +64,15 @@
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
12 changes: 6 additions & 6 deletions phosphoproteome scripts/InhibitionsForAllLayers.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function []=InhibitionsForAllLayers(coreModel)

choice = input('Do you want to rerun the calculations, or only plot the figure? \nRerunning the calculations will be slow. \nOnly plot? \nPress ctrl+C to cancel \n(y/n): ', 's');
choice = input('Do you want to rerun the calculations, or only plot the figure? \nRerunning the calculations will be slow. \nOnly plot? \nPress ctrl+C to cancel \n(Y/n): ', 's');
if lower(choice)=='n'
files = [dir('Results/empty*'); dir('Results/layer*')];
layers=double(regexprep(string({files.name}),{'[a-zA-Z\.]'},{''}));
Expand All @@ -27,7 +27,7 @@
disp('Calculating prediction accuracy for each layer, this may take a while')

for i = 1:length(files)
fprintf('Done with %i of %i layers\n', i, length(files))
fprintf('\nCalculating accuracy for layer %i (of %i layers)\n\n', i, length(files))
try
load([files(i).folder '/' files(i).name],'list','expData','structure','parameters', 'layer', 'rel', 'layerStructure')

Expand Down Expand Up @@ -189,7 +189,7 @@
% yticks((0:5)*10+50)
yticks(0:25:100)
xt = ((0:4)*ceil(((max(direction_MK.Layer)-min(direction_MK.Layer))/6)/10)*10+ceil(min(direction_MK.Layer)/10)*10);
xticks([min(direction_MK.Layer) xt max(direction_MK.Layer)])
xticks(unique([min(direction_MK.Layer) xt max(direction_MK.Layer)]))
box off
set(gca, 'FontSize',20)

Expand Down Expand Up @@ -235,7 +235,7 @@
axis([direction_LY.Layer(1), direction_LY.Layer(end), ylower,100])
yticks(0:25:100)
xt = ((0:4)*ceil(((max(direction_LY.Layer)-min(direction_LY.Layer))/6)/10)*10+ceil(min(direction_LY.Layer)/10)*10);
xticks([min(direction_LY.Layer) xt max(direction_LY.Layer)])
xticks(unique([min(direction_LY.Layer) xt max(direction_LY.Layer)]))
box off
set(gca, 'FontSize',20)

Expand All @@ -257,7 +257,7 @@
set(gca, 'FontSize',20)
axis([direction_LY.Layer(1), direction_LY.Layer(end), 0.5, maxAdditions])
xt = ((0:4)*ceil(((max(direction_LY.Layer)-min(direction_LY.Layer))/6)/10)*10+ceil(min(direction_LY.Layer)/10)*10);
xticks([min(direction_LY.Layer) xt max(direction_LY.Layer)])
xticks(unique([min(direction_LY.Layer) xt max(direction_LY.Layer)]))
yticks(10.^(0:3))

%%% PLOT LEGENDS
Expand Down Expand Up @@ -286,7 +286,7 @@

axis([direction_LY.Layer(1), direction_LY.Layer(end), ylower,100])
xt = ((0:4)*ceil(((max(direction_LY.Layer)-min(direction_LY.Layer))/6)/10)*10+ceil(min(direction_LY.Layer)/10)*10);
xticks([min(direction_LY.Layer) xt max(direction_LY.Layer)])
xticks(unique([min(direction_LY.Layer) xt max(direction_LY.Layer)]))

title('Legend for layer')

Expand Down
30 changes: 22 additions & 8 deletions phosphoproteome scripts/PlotFinalModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,15 @@
interactions(interactions.Tested~=min(interactions.Tested),:)=[]; %Remove all tested, not best, interactions
layer = unique(interactions.ExpansionIteration);
maxLayer=max(list.ExpansionIteration(list.Tested<chi2inv(0.95,length(time)-1))); % only works if loading the final layer
if maxLayer==5
maxLayer = 77; % To manage the colors if only plotting the first
if maxLayer<15
formatFig9 = true;
maxLayer = 57; % To manage the colors if only plotting the first
else
formatFig9 = false;
end
data=expData(ismember(expData.Genenamesprimary,protein),:);


data.simulatedValues=data.simulatedValues/data.simulatedValues(1);

cost=sum((data.meanValues-normalSim.statevalues(ismember(normalSim.time,time),i)').^2./data.SEMValues.^2);
Expand Down Expand Up @@ -170,7 +175,7 @@
PlotSims(protein, layer, maxLayer, time, data, normTime,normVal,[],[], [],'', titleStr); % plot normal
end
if plotDiabetes
PlotSims(protein, layer, maxLayer, time, data, normTime,normVal,diabTime,diabVal, [],'', titleStr); % plot diabetes
PlotSims(protein, layer, maxLayer, time, data, normTime,normVal,diabTime,diabVal, [],'', titleStr, formatFig9); % plot diabetes
end
if plotInhib
type.type='MK';
Expand All @@ -193,7 +198,8 @@
end
end

function [] = PlotSims(protein, layer, maxLayer, time, data, normTime,normVal,diabTime,diabVal, inhibSim, inhibType, titleStr)
function [] = PlotSims(protein, layer, maxLayer, time, data, normTime,normVal,diabTime,diabVal, inhibSim, inhibType, titleStr, formatFig9)
if nargin <13, formatFig9=false; end
clf

colorNorm = [2 64 167]/256;
Expand Down Expand Up @@ -226,24 +232,32 @@
value=data.meanValues(1,ismember(time,20))*(data.MKMean);
upper=data.meanValues(1,ismember(time,20))*(data.MKMean+data.MKSEM);
lower=data.meanValues(1,ismember(time,20))*(data.MKMean-data.MKSEM);
plot(20, data.meanValues(1,ismember(time,20)).*data.MKExpInsulin, 'o','MarkerSize',5,'linewidth', 1.5,'Color',colorInhib, 'MarkerFaceColor','None')
elseif strcmp(inhibType.type,'LY')
value=data.meanValues(1,ismember(time,20))*(data.LYMean);
upper=data.meanValues(1,ismember(time,20))*(data.LYMean+data.LYSEM);
lower=data.meanValues(1,ismember(time,20))*(data.LYMean-data.LYSEM);
plot(20, data.meanValues(1,ismember(time,20)).*data.LYExpInsulin, 'o','MarkerSize',5,'linewidth', 1.5,'Color',colorInhib, 'MarkerFaceColor','None')
else
disp('Something went wrong.. Incorrect inhibition type!')
end
errorbar(20,value,upper-lower ,'o','linewidth',3,'Color',colorInhib, 'CapSize',12, 'MarkerFaceColor','auto')
hold on
errorbar(20,value,(upper-lower)/2 ,'o','linewidth',3,'Color',colorInhib, 'CapSize',12, 'MarkerFaceColor','auto')
end

plot(time(2:end), 2.^[data.TC_Exp1; data.TC_Exp2; data.TC_Exp3], 'o','MarkerSize',5,'linewidth', 1.5,'Color',colorNorm, 'MarkerFaceColor','None')
errorbar(time,data.meanValues,data.SEMValues,'o','linewidth',3,'Color',colorNorm,'CapSize',12, 'MarkerFaceColor','auto') % Plot data

axis tight
box off
xlabel('Time (min)')
ylabel('Fold over basal')
set(gca,'fontsize',26)
set(gcf, 'Units','pixels', 'outerposition',[0 0 2560 1440], 'PaperType','a4')
if formatFig9 % only for figure 9
set(gcf, 'Units','pixels', 'outerposition',[731 292 809 515],'PaperType','a4') %format for the figure 9 in the paper
else
set(gcf, 'Units','pixels', 'outerposition',[0 0 2560 1440], 'PaperType','a4')
end

%% setup legend
entries={'Normal'}';
Expand All @@ -253,9 +267,9 @@
end
if ~isempty(inhibSim)
inhibEntries=cellstr(strcat(inhibType.type,num2str(inhibType.values')));
entries=[entries; inhibEntries; {[inhibType.type ' data']}];
entries=[entries; inhibEntries; {'';'';'';[inhibType.type ' data']}];
end
entries=[entries; {'Normal data'}];
entries=[entries; {'';'';'';'Normal data'}];

legend(entries,'location','best')
title(titleStr, 'Interpreter','none')
Expand Down
Loading

0 comments on commit 511fef3

Please sign in to comment.