Skip to content
Snippets Groups Projects
Commit 0e65526e authored by Tamas Borbath's avatar Tamas Borbath
Browse files

Changed plot orientation and added correlation plots for Glx

parent f05ee0a5
Branches
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ exportFolder = {'11 Simulations'};
pathNameExport = 'ProFit test data';
pathBaseExportFiles = pathToDataFolder(pathNameExport, exportFolder);
pathBaseExportFiles = pathBaseExportFiles(1:end-1);
pathBaseExportFiles = [pathBaseExportFiles ' - R3\'];
pathBaseExportFiles = [pathBaseExportFiles ' - R3_new\'];
dataExportPathBase = strcat(pathBaseExportFiles, exportFolder{1}, '\');
truncSuffix = '_truncOn';
scalingOn = true;
......@@ -138,17 +138,19 @@ sumAllStdProFitMain = sumAllStdProFitMain + allStdProFitMain;
%% -----------------------------------------------------------------------------------------------------------
axes(figIds{1})
str = {'$$\varphi_0$$', '$$\varphi_1$$', '$$\omega_{global}$$', '{\boldmath$\omega_{local}$}'};
xOffset = 0.65;
yOffsetRect = 0.085; %0.075; -for two subfigures
% xOffset = 0.65;
xOffset = 0.38; %Revision 1
yOffsetRect = 0.080; %0.085 - submission 1 %0.075; -for two subfigures
for indexSim = 1:4
yOffset = 0.84;% 4 subfigs%0.80; - Two figs placed lower%0.86 -Two figs
% yOffset = 0.84;% 4 subfigs%0.80; - Two figs placed lower%0.86 -Two figs
yOffset = 0.87;% Revision 1
annotation('textbox',[xOffset yOffset 0.1 0.1],'String',str{indexSim},'FitBoxToText','On', ...
'EdgeColor','none', 'FontSize', 12, 'Interpreter','latex','Color',plotColors{indexSim})
annotation('rectangle',[xOffset-0.012 yOffset+yOffsetRect 0.01 0.01],'EdgeColor','none', 'FaceColor',plotColors{indexSim})
yOffset = 0.612;% 4 subfigs%0.37; - Two figs placed lower%0.37 -Two figs
annotation('textbox',[xOffset yOffset 0.1 0.1],'String',str{indexSim},'FitBoxToText','On', ...
'EdgeColor','none', 'FontSize', 12, 'FontWeight','bold', 'Interpreter','latex','Color',plotColors{indexSim})
annotation('rectangle',[xOffset-0.012 yOffset+yOffsetRect 0.01 0.01],'EdgeColor','none', 'FaceColor',plotColors{indexSim})
% yOffset = 0.612;% 4 subfigs%0.37; - Two figs placed lower%0.37 -Two figs
% annotation('textbox',[xOffset yOffset 0.1 0.1],'String',str{indexSim},'FitBoxToText','On', ...
% 'EdgeColor','none', 'FontSize', 12, 'FontWeight','bold', 'Interpreter','latex','Color',plotColors{indexSim})
% annotation('rectangle',[xOffset-0.012 yOffset+yOffsetRect 0.01 0.01],'EdgeColor','none', 'FaceColor',plotColors{indexSim})
xOffset = xOffset + 0.004*length(str{indexSim});
end
......@@ -157,8 +159,9 @@ xlswrite([dataExportPathBase, 'SimulationsTable1.xlsx'],metaboliteTable);
numOfParameters2 = 5;
[metaboliteTable, indexTable] = setupTable(numberOfMet, numOfParameters2, metabolitesLabels);
% figIds = [];
figIds = [];
secondaryFigures = 2;
secondaryFigures = 0;
%% -----------------------------------------------------------------------------------------------------------
%%
paramKeyword = 'gauss';
......@@ -286,17 +289,19 @@ sumAllStdProFitMain = sumAllStdProFitMain / (numOfParameters + numOfParameters
axes(figIds{1})
str = {'$$\nu_g$$', '{\boldmath$\nu_{e}$}', '{\boldmath$noise$}', '{\boldmath$baseline$}'};
stringLenghts = {13, 13, 19, 27};
xOffset = 0.63;
yOffsetRect = 0.085; %0.075; -for two subfigures
% xOffset = 0.63;
xOffset = 0.38; %Revision 1
yOffsetRect = 0.080; %0.085 - submission 1 %0.075; -for two subfigures
for indexSim = 1:4
yOffset = 0.392;% 4 subfigs%0.80; - Two figs placed lower%0.86 -Two figs
% yOffset = 0.392;% 4 subfigs%0.80; - Two figs placed lower%0.86 -Two figs
yOffset = 0.87;% Revision 1
annotation('textbox',[xOffset yOffset 0.1 0.1],'String',str{indexSim},'FitBoxToText','On', ...
'EdgeColor','none', 'FontSize', 12, 'Interpreter','latex','Color',plotColors{indexSim})
annotation('rectangle',[xOffset-0.012 yOffset+yOffsetRect 0.01 0.01],'EdgeColor','none', 'FaceColor',plotColors{indexSim})
yOffset = 0.172;% 4 subfigs%0.37; - Two figs placed lower%0.37 -Two figs
annotation('textbox',[xOffset yOffset 0.1 0.1],'String',str{indexSim},'FitBoxToText','On', ...
'EdgeColor','none', 'FontSize', 12, 'FontWeight','bold', 'Interpreter','latex','Color',plotColors{indexSim})
annotation('rectangle',[xOffset-0.012 yOffset+yOffsetRect 0.01 0.01],'EdgeColor','none', 'FaceColor',plotColors{indexSim})
% yOffset = 0.172;% 4 subfigs%0.37; - Two figs placed lower%0.37 -Two figs
% annotation('textbox',[xOffset yOffset 0.1 0.1],'String',str{indexSim},'FitBoxToText','On', ...
% 'EdgeColor','none', 'FontSize', 12, 'FontWeight','bold', 'Interpreter','latex','Color',plotColors{indexSim})
% annotation('rectangle',[xOffset-0.012 yOffset+yOffsetRect 0.01 0.01],'EdgeColor','none', 'FaceColor',plotColors{indexSim})
xOffset = xOffset + 0.004*stringLenghts{indexSim};
end
......@@ -341,6 +346,11 @@ allStdLCModelMain = mean(abs(stdConcDevLCModel(indexesMainMet)));
allMeanProFitMain = mean(abs(meanConcDevProFit(indexesMainMet)));
allStdProFitMain = mean(abs(stdConcDevProFit(indexesMainMet)));
allMeanLCModelSmall = mean(abs(meanConcDevLCModel(~indexesMainMet)));
allStdLCModelSmall = mean(abs(stdConcDevLCModel(~indexesMainMet)));
allMeanProFitSmall = mean(abs(meanConcDevProFit(~indexesMainMet)));
allStdProFitSmall = mean(abs(stdConcDevProFit(~indexesMainMet)));
plusMinusSign = char(177);
metaboliteTable{2,indexTable} = 'ProFit';
metaboliteTable{2,indexTable+1} = 'LCModel';
......@@ -354,6 +364,9 @@ metaboliteTable{numberOfMet+3,indexTable+1} = [num2str(allMeanLCModel,'%.1f'),
metaboliteTable{numberOfMet+4,indexTable} = [num2str(allMeanProFitMain,'%.1f'), plusMinusSign, num2str(allStdProFitMain,'%.1f')];
metaboliteTable{numberOfMet+4,indexTable+1} = [num2str(allMeanLCModelMain,'%.1f'), plusMinusSign, num2str(allStdLCModelMain,'%.1f')];
metaboliteTable{numberOfMet+5,indexTable} = [num2str(allMeanProFitSmall,'%.1f'), plusMinusSign, num2str(allStdProFitSmall,'%.1f')];
metaboliteTable{numberOfMet+5,indexTable+1} = [num2str(allMeanLCModelSmall,'%.1f'), plusMinusSign, num2str(allStdLCModelSmall,'%.1f')];
end
%% reorganize the fitted concentrations to 2D tables
......@@ -413,6 +426,12 @@ end
function figIdsCorr = plotCorrelationFigs(concentrationsRm, allLCModelMetConc, allProFitMetConc,...
metabolitesToDisplay, numberOfMet, dataExportPathBase, paramKeyword, truncSuffix, figIdsCorr)
%TODO should I have this here? I don't know
plotCorrelationsGlx(concentrationsRm, allLCModelMetConc, allProFitMetConc,...
metabolitesToDisplay,1:100);
plotCorrelationsGlx(concentrationsRm, allLCModelMetConc, allProFitMetConc,...
metabolitesToDisplay,1:5:100);
if isempty(figIdsCorr)
emptyFigureIdsCorr = true;
figIdsCorr = cell(1,numberOfMet);
......@@ -450,16 +469,23 @@ for indexMetabolite = 1:numberOfMet
figure(figID_Main);
mainFigureRunningIndex = mainFigureRunningIndex + 1;
subplot(figureMainRows, figureMainCols, mainFigureRunningIndex);
if mod(mainFigureRunningIndex,figureMainCols)== 1
% if mod(mainFigureRunningIndex,figureMainCols)== 1 %first submission. Label on every row
if mainFigureRunningIndex == 7 % Revision 1: Just one label
plotYLabel = true;
else
plotYLabel = false;
end
if round((mainFigureRunningIndex+1)/figureMainCols)== figureMainRows
% if round((mainFigureRunningIndex+1)/figureMainCols)== figureMainRows %first submission. Label on every column
if mainFigureRunningIndex == 11 %Revision 1: Just one label
plotXLabel = true;
else
plotXLabel = false;
end
if mainFigureRunningIndex == 3 %Revision 1: Just one legend
plotLegend = true;
else
plotLegend = false;
end
elseif sum(contains(metabolitesFigureSupporting, metabolitesToDisplay{indexMetabolite}))
figure(figID_Supporting);
supportingFigureRunningIndex = supportingFigureRunningIndex + 2;
......@@ -477,6 +503,11 @@ for indexMetabolite = 1:numberOfMet
else
plotXLabel = false;
end
if supportingFigureRunningIndex == 4 %Revision 1: Just one legend
plotLegend = true;
else
plotLegend = false;
end
else
warning('Metabolite not associated with either main or supporting figure: ', metabolitesToDisplay{indexMetabolite});
figure();
......@@ -498,13 +529,15 @@ for indexMetabolite = 1:numberOfMet
title(metabolitesToDisplay(indexMetabolite))
if plotXLabel
xlabel('$c_{k}^{simulated} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', 10)
xlabel('$\bf c_{k}^{simulated} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', 11)
end
if plotYLabel
ylabel('$c_k^{fitted} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', 10)
ylabel('$\bf c_k^{fitted} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', 11)
end
if plotLegend
handleLegend = legend('$LCModel \,\, c_k^{fitted}$', '$ProFit \,\, c_k^{fitted}$', '$Identity \, Line$', 'Location', 'best', 'Interpreter', 'latex', 'FontSize', 10);
title(handleLegend,'Legend', 'FontSize',10);
end
legend('$LCModel \,\, c_k^{fitted}$', '$ProFit \,\, c_k^{fitted}$', '$Identity \, Line$', 'Location', 'best', 'Interpreter', 'latex', 'FontSize', 8)
xlim([min(identityLine),max(identityLine)])
ylim([min(identityLine),max(identityLine)])
......@@ -529,43 +562,51 @@ function figIds = plotPrecisionFigs(figIds, numberOfMet, offsetPlot, secondaryFi
% figure('Position',[100,275,890,680],'Units','pixels')
% figIds{1} = subplot(2,1,2);
% figIds{2} = subplot(2,1,1);%, 'Position', [0.58,0.16,0.35,0.76], 'Position', [0.13,0.16,0.35,0.76]
%
figure('Position',[-908,-589,890,1400],'Units','pixels')
figIds{1} = subplot(4,1,2);
figIds{2} = subplot(4,1,1);
figIds{3} = subplot(4,1,4);
figIds{4} = subplot(4,1,3);
%%Revision 1
% figure('Position',[612,509,1132,469],'OuterPosition',[604,501,1148,562], 'Units','pixels')
figure('Position',[9,10,1033,986],'Units','pixels')
figIds{1} = subplot(1,2,2);
figIds{2} = subplot(1,2,1);%, 'Position', [0.58,0.16,0.35,0.76], 'Position', [0.13,0.16,0.35,0.76]
% figure('Position',[-908,-589,890,1400],'Units','pixels')
% figIds{1} = subplot(4,1,2);
% figIds{2} = subplot(4,1,1);
% figIds{3} = subplot(4,1,4);
% figIds{4} = subplot(4,1,3);
end
positionsTicks = [2.2:1.5:1.5*numberOfMet+1.5];
positions = positionsTicks + offsetPlot;
axes(figIds{1 + secondaryFigures})
hold on
boxPlotLCModel = boxplot(allLCModelMetConcDev, metabolitesLabels,'colors',plotColors,'symbol','+', 'positions',positions,'width',0.18);
xticks(positionsTicks)
xticklabels(metabolitesLabels)
xtickangle(45)
xlim([1 27.5])
boxPlotLCModel = boxplot(allLCModelMetConcDev, metabolitesLabels,'colors',plotColors,'symbol','+', 'positions',positions,'width',0.18,'orientation', 'horizontal');
yticks(positionsTicks)
yticklabels(metabolitesLabels)
set(gca,'Ydir','reverse')
% xtickangle(45)
title('LCModel')
ylim([-yLimValue,yLimValue]);
xlim([positionsTicks(1)-1, positionsTicks(end)+1])
set(gca, 'FontSize', 11)
ylabel('$Concentration\,\,change\,\,c^\%_{k}\,(\%)$', 'FontSize', 13, 'Interpreter', 'latex')
xlim([-yLimValue,yLimValue]);
ylim([positionsTicks(1)-1, positionsTicks(end)+1])
set(gca, 'FontSize', 12)
set(gca, 'YAxisLocation', 'right')
xlabel('$Concentration\,\,change\,\,c^\%_{k}\,(\%)$', 'FontSize', 13, 'Interpreter', 'latex')
set(boxPlotLCModel(:,:),'linewidth',1);
yline(0,':', 'Color',[0.5 0.5 0.5]);
xline(0,':', 'Color',[0.5 0.5 0.5]);
%%
axes(figIds{2 + secondaryFigures})
hold on
boxPlotProFit = boxplot(allProFitMetConcDev, metabolitesLabels,'colors',plotColors,'symbol','+', 'positions',positions,'width',0.18);
xticks(positionsTicks)
xticklabels(metabolitesLabels)
xtickangle(45)
xlim([1 27.5])
boxPlotProFit = boxplot(allProFitMetConcDev, metabolitesLabels,'colors',plotColors,'symbol','+', 'positions',positions,'width',0.18,'orientation', 'horizontal');
yticks(positionsTicks)
yticklabels(metabolitesLabels)
set(gca,'Ydir','reverse')
% ytickangle(45)
ylim([1 27.5])
title('ProFit')
ylim([-yLimValue,yLimValue]);
set(gca, 'FontSize', 11)
ylabel('$Concentration\,\,change\,\,c^\%_{k}\,(\%)$', 'FontSize', 13, 'Interpreter', 'latex')
xlim([-yLimValue,yLimValue]);
set(gca, 'FontSize', 12)
set(gca, 'YAxisLocation', 'left')
xlabel('$Concentration\,\,change\,\,c^\%_{k}\,(\%)$', 'FontSize', 13, 'Interpreter', 'latex')
set(boxPlotProFit(:,:),'linewidth',1);
yline(0,':', 'Color',[0.5 0.5 0.5]);
xline(0,':', 'Color',[0.5 0.5 0.5]);
end
%% setup the table to show metabolite concentration changes
......@@ -574,5 +615,62 @@ metaboliteTable = cell(numberOfMet+4,numOfParameters*2+1);
metaboliteTable(3:numberOfMet+2,1) = metabolitesLabels;
metaboliteTable{numberOfMet+3,1} = 'Mean';
metaboliteTable{numberOfMet+4,1} = 'Mean Main Metabolites';
metaboliteTable{numberOfMet+5,1} = 'Mean Small Metabolites';
indexTable = 0;
end
function plotCorrelationsGlx(concentrationsRm, allLCModelMetConc, allProFitMetConc,...
metabolitesToDisplay, subsample)
colorOriginal = [0 0 0];
colorProFit = [0.49 0.18 0.56];
colorLCModel = [0.85 0.33 0.1];
indexGlu = find(strcmp(metabolitesToDisplay, 'Glu'));
indexGln = find(strcmp(metabolitesToDisplay, 'Gln'));
simulatedGluConc = concentrationsRm(:, indexGlu);
simulatedGlnConc = concentrationsRm(:, indexGln);
fittedGluConcLCModel = allLCModelMetConc(:, indexGlu);
fittedGlnConcLCModel = allLCModelMetConc(:, indexGln);
fittedGluConcProFit = allProFitMetConc(:, indexGlu);
fittedGlnConcProFit = allProFitMetConc(:, indexGln);
% subsample = 1:5:100;
figure();
plotYLabel = true;
plotXLabel = true;
plotLegend = true;
scatterSize = 50;
fontSize = 14;
hold on
scatter(fittedGluConcLCModel(subsample), fittedGlnConcLCModel(subsample), scatterSize, 'd', 'MarkerEdgeColor', colorLCModel);
scatter(simulatedGluConc(subsample), simulatedGlnConc(subsample), scatterSize, 'o', 'MarkerEdgeColor', colorOriginal);
scatter(fittedGluConcProFit(subsample), fittedGlnConcProFit(subsample), scatterSize, 'x', 'MarkerEdgeColor', colorProFit);
for index = subsample
plot([fittedGluConcLCModel(index), simulatedGluConc(index), fittedGluConcProFit(index)],[fittedGlnConcLCModel(index), simulatedGlnConc(index), fittedGlnConcProFit(index)], 'color', colorOriginal);
end
offSetEnds = max(simulatedGluConc)*0.05;
identityLineGlu = min(simulatedGluConc)-offSetEnds:0.01:max(simulatedGluConc)+offSetEnds;
offSetEnds = max(simulatedGlnConc)*0.05;
identityLineGln = min(simulatedGlnConc)-offSetEnds:0.01:max(simulatedGlnConc)+offSetEnds;
set(gca, 'FontSize', fontSize)
if plotXLabel
xlabel('$c_{Glu} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', fontSize+2)
end
if plotYLabel
ylabel('$c_{Gln} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', fontSize+2)
end
if plotLegend
handleLegend = legend('$LCModel$', '$Simulated$', '$ProFit$', 'Location', 'best', 'Interpreter', 'latex', 'FontSize', fontSize-2);
title(handleLegend,'Legend');
end
xlim([min(identityLineGlu),max(identityLineGlu)])
ylim([min(identityLineGln),max(identityLineGln)])
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment