From 953b56db0a5f13c6fb0770c7cdb339727225fa04 Mon Sep 17 00:00:00 2001
From: Tamas Borbath <tamas.borbath@tuebingen.mpg.de>
Date: Thu, 25 Mar 2021 10:28:05 +0100
Subject: [PATCH] Visualization changes in files from createTestData

---
 createTestData/createSimulatedSpectra.m       | 42 ++++++++++++-------
 .../evaluateProFitFittingParameters.m         |  4 +-
 createTestData/plotSimulationResults.m        | 18 ++++----
 createTestData/plot_all_test_data_profit.m    | 16 +++++--
 4 files changed, 52 insertions(+), 28 deletions(-)

diff --git a/createTestData/createSimulatedSpectra.m b/createTestData/createSimulatedSpectra.m
index 5e2a1dc..a287c53 100644
--- a/createTestData/createSimulatedSpectra.m
+++ b/createTestData/createSimulatedSpectra.m
@@ -140,8 +140,10 @@ conc_std_factor = zeros(1,numMetabolites);
     current_pc0, current_pc1, current_df2, current_gm, current_em_std_factor, conc_std_factor, noiseVector, ...
     truncPoint, saveData, 'meanConc', [], dwellTime * 1e3, scanFrequency, dataExportPathBase, water_ppm, scalingFactorRefPeak);
 
-figure(2);
-subplot(3,4,7:8)
+figure(1);
+subplot(5,4,8+7:8+8)
+% figure(2);
+% subplot(3,4,7:8)
 plot(ppmVector,real(fftshift(fft(defaultSummedFid))));
     
 %% generate the series of different concentrations
@@ -208,7 +210,8 @@ dataExportPath = [dataExportPathBase, paramKeyword, '\'];
 concentrationsRm = zeros(length(gaussianValues), numMetabolites);
 
 figure(1);
-subplot(2,4,5:6)
+subplot(5,4,5:6)
+% subplot(2,4,5:6)
 for indexParam = 1:length(gaussianValues)
     
     current_gm = gaussianValues(indexParam);
@@ -237,7 +240,8 @@ dataExportPath = [dataExportPathBase, paramKeyword, '\'];
 concentrationsRm = zeros(length(pc0), numMetabolites);
 
 figure(1);
-subplot(2,4,1:2)
+subplot(5,4,1:2)
+% subplot(2,4,1:2)
 for indexParam = 1:length(pc0)
     
     current_pc0 = pc0(indexParam);
@@ -265,7 +269,8 @@ dataExportPath = [dataExportPathBase, paramKeyword, '\'];
 concentrationsRm = zeros(length(pc1), numMetabolites);
 
 figure(1);
-subplot(2,4,3:4)
+subplot(5,4,3:4)
+% subplot(2,4,3:4)
 for indexParam = 1:length(pc1)
     
     current_pc1 = pc1(indexParam);
@@ -292,8 +297,10 @@ paramKeyword = 'df2_local';
 dataExportPath = [dataExportPathBase, paramKeyword, '\'];
 concentrationsRm = zeros(length(df2_local_scale), numMetabolites);
 
-figure(2);
-subplot(3,4,1:2)
+figure(1);
+subplot(5,4,8+1:8+2)
+% figure(2);
+% subplot(3,4,1:2)
 for indexParam = 1:length(df2_local_scale)
 
     for indexMetabolite = 1:numMetabolites
@@ -337,7 +344,8 @@ dataExportPath = [dataExportPathBase, paramKeyword, '\'];
 concentrationsRm = zeros(length(df2_global), numMetabolites);
 
 figure(1);
-subplot(2,4,7:8)
+subplot(5,4,7:8)
+% subplot(2,4,7:8)
 for indexParam = 1:length(df2_global)  
     for indexMetabolite = 1:numMetabolites
         current_df2(indexMetabolite) = df2_global(indexParam);
@@ -365,8 +373,10 @@ paramKeyword = 'em';
 dataExportPath = [dataExportPathBase, paramKeyword, '\'];
 concentrationsRm = zeros(length(df2_global), numMetabolites);
 
-figure(2);
-subplot(3,4,3:4)
+figure(1);
+subplot(5,4,8+3:8+4)
+% figure(2);
+% subplot(3,4,3:4)
 for indexParam = 1:length(df2_global)
     for indexMetabolite = 1:numMetabolites
         % generate a random number between [-stdLim; stdLim]
@@ -409,8 +419,10 @@ paramKeyword = 'noise';
 dataExportPath = [dataExportPathBase, paramKeyword, '\'];
 concentrationsRm = zeros(length(noiseLevel), numMetabolites);
 
-figure(2);
-subplot(3,4,5:6)
+figure(1);
+subplot(5,4,8+5:8+6)
+% figure(2);
+% subplot(3,4,5:6)
 for indexParam = 1:length(noiseLevel)
     noiseVector = wgn(1,nTimepoints, noiseLevel(indexParam));
     [summedFid, summedFidWithNoise, current_em, currentConcentrationRm] = createSummedSpectrum(...
@@ -441,8 +453,10 @@ prefixBaseline = 'Baseline_';
 baselines = {'1Flat_drop_H20'; '2Flat'; '3Flat'; '4Flat'; '5Wildish'; '6Wildish'; '7Very_wild';...
      '8Very_wild'; '9Wild'; '10Wild'; '11Wildish'; '12Wildish'; '13Normal'; '14Lipid_1.3'; '15Lipid_1.3_phased'; '16Zero'};         
 
-figure(2);
-subplot(3,4,10:11)
+figure(1);
+subplot(5,4,8+10:8+11)
+% figure(2);
+% subplot(3,4,10:11)
 for indexParam = 1:length(baselines)
     baselineFileName = strcat(prefixBaseline, baselines{indexParam});
     [currentBaseline, ~, ~, ~, ~] = ImportLCModelBasis(baselinesPath, baselineFileName, plotBasis, '1H');
diff --git a/createTestData/evaluateProFitFittingParameters.m b/createTestData/evaluateProFitFittingParameters.m
index 5766a57..df93d77 100644
--- a/createTestData/evaluateProFitFittingParameters.m
+++ b/createTestData/evaluateProFitFittingParameters.m
@@ -4,8 +4,8 @@ folderName = 'final_simulations';
 exportFolder = {'11 Simulations'};
 pathNameExport = 'ProFit test data';
 pathBaseExportFiles = pathToDataFolder(pathNameExport, exportFolder);
-pathBaseExportFiles = pathBaseExportFiles(1:end-1);
-pathBaseExportFiles = [pathBaseExportFiles ' - R3\'];
+% pathBaseExportFiles = pathBaseExportFiles(1:end-1);
+% pathBaseExportFiles = [pathBaseExportFiles ' - R3\'];
 dataExportPathBase = strcat(pathBaseExportFiles, exportFolder{1}, '\');
 truncSuffix = '_truncOn';
 folderFigures = [pathBaseExportFiles 'Output\' folderName, truncSuffix, '\'];
diff --git a/createTestData/plotSimulationResults.m b/createTestData/plotSimulationResults.m
index 9dd3413..fde9ce3 100644
--- a/createTestData/plotSimulationResults.m
+++ b/createTestData/plotSimulationResults.m
@@ -423,14 +423,14 @@ end
 % Main Figure = 12 subplots
 figureMainRows = 4;
 figureMainCols = 3;
-metabolitesFigureMain = {'NAA(CH_2)', 'tCho+', 'mI', 'sI','Gly','Glu','Gln',...
-    'GABA', 'Lac', 'GSH', 'NAAG', 'MM spectrum'};
+metabolitesFigureMain = {'NAA(CH_2)', 'tCr(CH_2)', 'tCho+','Gly','Glu','Gln',...
+    'Asp', 'GABA', 'Lac', 'GSH', 'NAAG', 'MM spectrum'};
 figID_Main = figure();
 mainFigureRunningIndex = 0;
 % Supporting Figure = 5 subplots
 figureSupportingRows = 3;
 figureSupportingCols = 4;
-metabolitesFigureSupporting = {'tCr(CH_3)', 'tCr(CH_2)', 'NAA(CH_3)','Asp','Tau'};
+metabolitesFigureSupporting = {'tCr(CH_3)', 'mI', 'sI', 'NAA(CH_3)','Tau'};
 figID_Supporting = figure();
 supportingFigureRunningIndex = 0;
 
@@ -490,21 +490,21 @@ for indexMetabolite = 1:numberOfMet
         fittedMetConcProFit  = fittedMetConcProFit *1e-7;
     end
     hold on
-    scatter(simulatedMetConc, fittedMetConcLCModel, 'MarkerEdgeColor', colorLCModel);
-    scatter(simulatedMetConc, fittedMetConcProFit, 'x', 'MarkerEdgeColor', colorProFit);
+    scatter(simulatedMetConc, fittedMetConcLCModel, 15, 'MarkerEdgeColor', colorLCModel);
+    scatter(simulatedMetConc, fittedMetConcProFit, 15, 'x', 'MarkerEdgeColor', colorProFit);
     offSetEnds = max(simulatedMetConc)*0.05;
     identityLine = min(simulatedMetConc)-offSetEnds:0.01:max(simulatedMetConc)+offSetEnds;
     plot(identityLine,identityLine,'color',colorOriginal);
     title(metabolitesToDisplay(indexMetabolite))
     
     if plotXLabel
-        xlabel('$c_{k}^{simulated} \,\, (mmol/kg)$', 'Interpreter', 'latex')
+        xlabel('$c_{k}^{simulated} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', 10)
     end
     if plotYLabel
-        ylabel('$c_k^{fitted} \,\, (mmol/kg)$', 'Interpreter', 'latex')
+        ylabel('$c_k^{fitted} \,\, (mmol/kg)$', 'Interpreter', 'latex','FontSize', 10)
     end
-    legend('$LCModel \,\, c_k^{fitted}$', '$ProFit \,\, c_k^{fitted}$', '$Identity \, Line$', 'Location', 'best', 'Interpreter', 'latex')
-    set(gca, 'FontSize', 13)
+    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)])
diff --git a/createTestData/plot_all_test_data_profit.m b/createTestData/plot_all_test_data_profit.m
index d7b90a9..bba246e 100644
--- a/createTestData/plot_all_test_data_profit.m
+++ b/createTestData/plot_all_test_data_profit.m
@@ -179,17 +179,27 @@ rpc_table{end,1} = 'Mean';
 %title('Reproducibility');
 subplotsX = 4;
 subplotsY = 4;
-totalSubplots = subplotsX * subplotsY;
+totalSubplots1 = subplotsX * subplotsY;
 rpcSum = zeros(1,numberOfMet);
 diffMedian = zeros(1,numberOfMet);
 for indexMet = 1: numberOfMet
     if indexMet == metaboliteRef
         continue;
     end
-    if mod(indexMet,totalSubplots/2) == 1
+    if (indexMet == 1) || (indexMet == totalSubplots1/2+1)
         figure;
+        if indexMet >= 8 
+            subplotsX = 6;
+            subplotsY = 3;
+            totalSubplots = subplotsX * subplotsY;
+        end
+    end
+    if indexMet <= totalSubplots1/2
+        runningIndexPlot = (indexMet-1)+1+floor((indexMet-1)/subplotsY)*subplotsY-floor((indexMet-1)/totalSubplots1*2)*totalSubplots1;
+    else
+        indexMet2 = indexMet - totalSubplots1/2;
+        runningIndexPlot = (indexMet2-1)+1+floor((indexMet2-1)/subplotsY)*subplotsY-floor((indexMet2-1)/totalSubplots*2)*totalSubplots;
     end
-    runningIndexPlot = (indexMet-1)+1+floor((indexMet-1)/subplotsY)*subplotsY-floor((indexMet-1)/totalSubplots*2)*totalSubplots;
 
     %ProFit Concentrations
     metConcAllSubjProFitScaled_ = metConcAllSubjProFitScaled(:, :, indexMet);
-- 
GitLab