Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MR_spectroS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AG_Henning
MR_spectroS
Commits
8137b895
Commit
8137b895
authored
4 years ago
by
Tamas Borbath
Browse files
Options
Downloads
Patches
Plain Diff
Just restructured the code of plotSimulationResults.m to allow better modifications.
parent
24c824df
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
createTestData/plotSimulationResults.m
+188
-165
188 additions, 165 deletions
createTestData/plotSimulationResults.m
with
188 additions
and
165 deletions
createTestData/plotSimulationResults.m
+
188
−
165
View file @
8137b895
...
...
@@ -142,7 +142,7 @@ xOffset = 0.65;
yOffsetRect
=
0.085
;
%0.075; -for two subfigures
for
indexSim
=
1
:
4
yOffset
=
0.84
;
% 4 subfigs%0.80; - Two figs placed lower%0.86 -Two figs
annotation
(
'textbox'
,[
xOffset
yOffset
0.1
0.1
],
'String'
,
str
{
indexSim
},
'FitBoxToText'
,
'On'
,
...
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
...
...
@@ -153,7 +153,7 @@ for indexSim = 1:4
end
% save Table
xlswrite
([
dataExportPathBase
,
'SimulationsTable1.xlsx'
],
metaboliteTable
);
xlswrite
([
dataExportPathBase
,
'SimulationsTable1.xlsx'
],
metaboliteTable
);
numOfParameters2
=
5
;
[
metaboliteTable
,
indexTable
]
=
setupTable
(
numberOfMet
,
numOfParameters2
,
metabolitesLabels
);
...
...
@@ -260,7 +260,7 @@ concentrationsLCModel = concentrations;
load
([
dataExportPathBase
,
'concentrations_'
,
paramKeyword
,
truncSuffix
,
'_profit.mat'
],
'concentrations'
,
'activeMetabolites'
);
concentrationsProFit
=
concentrations
;
plotCorrelations
=
fals
e
;
plotCorrelations
=
tru
e
;
offsetPlot
=
0.
;
plotPrecision
=
false
;
indexTable
=
indexTable
+
2
;
...
...
@@ -290,7 +290,7 @@ xOffset = 0.63;
yOffsetRect
=
0.085
;
%0.075; -for two subfigures
for
indexSim
=
1
:
4
yOffset
=
0.392
;
% 4 subfigs%0.80; - Two figs placed lower%0.86 -Two figs
annotation
(
'textbox'
,[
xOffset
yOffset
0.1
0.1
],
'String'
,
str
{
indexSim
},
'FitBoxToText'
,
'On'
,
...
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
...
...
@@ -300,179 +300,202 @@ for indexSim = 1:4
xOffset
=
xOffset
+
0.004
*
stringLenghts
{
indexSim
};
end
xlswrite
([
dataExportPathBase
,
'SimulationsTable2.xlsx'
],
metaboliteTable
);
xlswrite
([
dataExportPathBase
,
'SimulationsTable2.xlsx'
],
metaboliteTable
);
end
function
[
allSimulMetConc
,
allLCModelMetConc
,
allProFitMetConc
,
allLCModelMetConcDev
,
allProFitMetConcDev
,
metaboliteTable
,
figIds
,
figIdsCorr
,
...
allMeanProFit
,
allStdProFit
,
allMeanProFitMain
,
allStdProFitMain
]
=
...
getConcentrations
(
metabolites
,
metabolitesLCModel
,
metabolitesProFit
,
metabolitesToDisplay
,
metabolitesLabels
,
...
concentrationsRm
,
concentrationsLCModel
,
concentrationsProFit
,
activeMetabolites
,
...
scalingOn
,
plotCorrelations
,
dataExportPathBase
,
paramKeyword
,
truncSuffix
,
...
plotPrecision
,
plotColors
,
offsetPlot
,
figIds
,
figIdsCorr
,
metaboliteTable
,
indexTable
,
indexesMainMet
,
secondaryFigures
)
numberOfMet
=
length
(
metabolites
);
iterationProFit
=
4
;
if
isempty
(
figIdsCorr
)
emptyFigureIdsCorr
=
true
;
figIdsCorr
=
cell
(
1
,
numberOfMet
);
else
emptyFigureIdsCorr
=
false
;
end
allSimulMetConc
=
concentrationsRm
;
allLCModelMetConc
=
zeros
(
size
(
allSimulMetConc
));
allProFitMetConc
=
zeros
(
size
(
allSimulMetConc
));
allLCModelMetConcDev
=
zeros
(
size
(
allSimulMetConc
));
allProFitMetConcDev
=
zeros
(
size
(
allSimulMetConc
));
for
indexMetabolite
=
1
:
numberOfMet
simulatedMetConc
=
concentrationsRm
(:,
indexMetabolite
);
indexMetSim
=
find
(
strcmp
(
metabolites
,
'tCr(CH3)'
));
%'MMB'
fittedMetConcLCModel
=
zeros
(
size
(
simulatedMetConc
));
for
indexFit
=
1
:
length
(
concentrationsLCModel
)
currentConcentrationsLCModel
=
concentrationsLCModel
{
indexFit
};
indexMetLCModel
=
find
(
strcmp
(
currentConcentrationsLCModel
(
1
,:),
'Cr'
));
%'Leu'
RefConc
=
currentConcentrationsLCModel
{
2
,
indexMetLCModel
};
RefConcSim
=
concentrationsRm
(
indexFit
,
indexMetSim
);
if
scalingOn
scaling
=
RefConcSim
/
RefConc
;
else
scaling
=
1
;
end
indexMetLCModel
=
find
(
strcmp
(
currentConcentrationsLCModel
(
1
,:),
metabolitesLCModel
(
indexMetabolite
)));
fittedMetConcLCModel
(
indexFit
)
=
currentConcentrationsLCModel
{
2
,
indexMetLCModel
}
*
scaling
;
end
fittedMetConcProFit
=
zeros
(
size
(
simulatedMetConc
));
for
indexFit
=
1
:
length
(
concentrationsProFit
)
currentConcentrationsProFit
=
concentrationsProFit
{
indexFit
}{
iterationProFit
};
indexMetProFit
=
find
(
strcmp
(
activeMetabolites
{
iterationProFit
},
'Cr'
));
%'Leu'
RefConc
=
currentConcentrationsProFit
(
indexMetProFit
);
RefConcSim
=
concentrationsRm
(
indexFit
,
indexMetSim
);
if
scalingOn
scaling
=
RefConcSim
/
RefConc
;
else
scaling
=
1
;
end
indexMetProFit
=
find
(
strcmp
(
activeMetabolites
{
iterationProFit
},
metabolitesProFit
(
indexMetabolite
)));
fittedMetConcProFit
(
indexFit
)
=
currentConcentrationsProFit
(
indexMetProFit
)
*
scaling
;
end
if
strcmp
(
metabolitesProFit
(
indexMetabolite
),
'Leu'
)
fittedMetConcProFit
=
fittedMetConcProFit
*
1e8
;
end
allLCModelMetConc
(:,
indexMetabolite
)
=
fittedMetConcLCModel
;
allProFitMetConc
(:,
indexMetabolite
)
=
fittedMetConcProFit
;
allLCModelMetConcDev
(:,
indexMetabolite
)
=
(
simulatedMetConc
-
fittedMetConcLCModel
)
.
/
simulatedMetConc
.*
100
;
allProFitMetConcDev
(:,
indexMetabolite
)
=
(
simulatedMetConc
-
fittedMetConcProFit
)
.
/
simulatedMetConc
.*
100
;
if
plotCorrelations
if
emptyFigureIdsCorr
figIdsCorr
{
indexMetabolite
}
=
figure
;
end
figure
(
figIdsCorr
{
indexMetabolite
});
hold
on
scatter
(
simulatedMetConc
,
fittedMetConcLCModel
);
scatter
(
simulatedMetConc
,
fittedMetConcProFit
,
'x'
);
plot
(
simulatedMetConc
,
simulatedMetConc
);
title
(
metabolitesToDisplay
(
indexMetabolite
))
xlabel
(
'Simulated concentrations {\boldmath$c$}$_{k}$ (mmol/kg)'
,
'Interpreter'
,
'latex'
)
ylabel
(
'Fitted concentrations {\boldmath$c$}$_{k}$ (mmol/kg)'
,
'Interpreter'
,
'latex'
)
legend
(
'LCModel {\boldmath$c$}$_{k}$'
,
'ProFit {\boldmath$c$}$_{k}$'
,
'Identity Line'
,
'Location'
,
'Northwest'
,
'Interpreter'
,
'latex'
)
set
(
gca
,
'FontSize'
,
13
)
xl
=
xlim
;
if
xl
(
2
)
>
max
(
simulatedMetConc
)
xl
(
2
)
=
max
(
simulatedMetConc
);
end
xlim
(
xl
);
pathName
=
[
dataExportPathBase
,
paramKeyword
,
'/correlations/'
];
if
~
exist
(
pathName
,
'dir'
)
mkdir
(
pathName
);
end
fileName
=
[
metabolitesToDisplay
{
indexMetabolite
},
'_'
,
paramKeyword
,
truncSuffix
];
saveas
(
figIdsCorr
{
indexMetabolite
},
[
pathName
,
fileName
,
'.tif'
]);
savefig
(
figIdsCorr
{
indexMetabolite
},
[
pathName
,
fileName
,
'.fig'
],
'compact'
);
% BlandAltman(simulatedMetConc, fittedMetConcLCModel);
% title(metabolites(indexMetabolite));
% BlandAltman(simulatedMetConc, fittedMetConcProFit);
% title(metabolites(indexMetabolite));
concentrationsRm
,
concentrationsLCModel
,
concentrationsProFit
,
activeMetabolites
,
...
scalingOn
,
plotCorrelations
,
dataExportPathBase
,
paramKeyword
,
truncSuffix
,
...
plotPrecision
,
plotColors
,
offsetPlot
,
figIds
,
figIdsCorr
,
metaboliteTable
,
indexTable
,
indexesMainMet
,
secondaryFigures
)
numberOfMet
=
length
(
metabolites
);
[
allSimulMetConc
,
allLCModelMetConc
,
allProFitMetConc
,
allLCModelMetConcDev
,
allProFitMetConcDev
]
=
...
reorganizeMetConcentrationsToMatrices
(
metabolites
,
metabolitesLCModel
,
metabolitesProFit
,
...
concentrationsRm
,
concentrationsLCModel
,
concentrationsProFit
,
activeMetabolites
,
scalingOn
);
if
plotCorrelations
figIdsCorr
=
plotCorrelationFigs
(
concentrationsRm
,
allLCModelMetConc
,
allProFitMetConc
,
metabolitesToDisplay
,
numberOfMet
,
...
dataExportPathBase
,
paramKeyword
,
truncSuffix
,
figIdsCorr
);
end
if
plotPrecision
figIds
=
plotPrecisionFigs
(
figIds
,
numberOfMet
,
offsetPlot
,
secondaryFigures
,
plotColors
,
...
allLCModelMetConcDev
,
allProFitMetConcDev
,
metabolitesLabels
);
end
display
([
paramKeyword
,
' NANs:'
,
num2str
(
sum
(
isnan
(
allLCModelMetConcDev
)))]);
meanConcDevLCModel
=
mean
(
allLCModelMetConcDev
,
'omitnan'
);
stdConcDevLCModel
=
std
(
allLCModelMetConcDev
,
'omitnan'
);
display
([
paramKeyword
,
' NANs ProFit:'
,
num2str
(
sum
(
isnan
(
allProFitMetConcDev
)))]);
meanConcDevProFit
=
mean
(
allProFitMetConcDev
,
'omitnan'
);
stdConcDevProFit
=
std
(
allProFitMetConcDev
,
'omitnan'
);
allMeanLCModel
=
mean
(
abs
(
meanConcDevLCModel
));
allStdLCModel
=
mean
(
abs
(
stdConcDevLCModel
));
allMeanProFit
=
mean
(
abs
(
meanConcDevProFit
));
allStdProFit
=
mean
(
abs
(
stdConcDevProFit
));
allMeanLCModelMain
=
mean
(
abs
(
meanConcDevLCModel
(
indexesMainMet
)));
allStdLCModelMain
=
mean
(
abs
(
stdConcDevLCModel
(
indexesMainMet
)));
allMeanProFitMain
=
mean
(
abs
(
meanConcDevProFit
(
indexesMainMet
)));
allStdProFitMain
=
mean
(
abs
(
stdConcDevProFit
(
indexesMainMet
)));
plusMinusSign
=
char
(
177
);
metaboliteTable
{
2
,
indexTable
}
=
'ProFit'
;
metaboliteTable
{
2
,
indexTable
+
1
}
=
'LCModel'
;
for
indexMet
=
1
:
numberOfMet
metaboliteTable
{
indexMet
+
2
,
indexTable
}
=
[
num2str
(
meanConcDevProFit
(
indexMet
),
'%.1f'
),
plusMinusSign
,
num2str
(
stdConcDevProFit
(
indexMet
),
'%.1f'
)];
metaboliteTable
{
indexMet
+
2
,
indexTable
+
1
}
=
[
num2str
(
meanConcDevLCModel
(
indexMet
),
'%.1f'
),
plusMinusSign
,
num2str
(
stdConcDevLCModel
(
indexMet
),
'%.1f'
)];
end
metaboliteTable
{
numberOfMet
+
3
,
indexTable
}
=
[
num2str
(
allMeanProFit
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdProFit
,
'%.1f'
)];
metaboliteTable
{
numberOfMet
+
3
,
indexTable
+
1
}
=
[
num2str
(
allMeanLCModel
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdLCModel
,
'%.1f'
)];
metaboliteTable
{
numberOfMet
+
4
,
indexTable
}
=
[
num2str
(
allMeanProFitMain
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdProFitMain
,
'%.1f'
)];
metaboliteTable
{
numberOfMet
+
4
,
indexTable
+
1
}
=
[
num2str
(
allMeanLCModelMain
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdLCModelMain
,
'%.1f'
)];
end
function
[
allSimulMetConc
,
allLCModelMetConc
,
allProFitMetConc
,
allLCModelMetConcDev
,
allProFitMetConcDev
]
=
...
reorganizeMetConcentrationsToMatrices
(
metabolites
,
metabolitesLCModel
,
metabolitesProFit
,
...
concentrationsRm
,
concentrationsLCModel
,
concentrationsProFit
,
activeMetabolites
,
scalingOn
)
iterationProFit
=
4
;
numberOfMet
=
length
(
metabolites
);
allSimulMetConc
=
concentrationsRm
;
allLCModelMetConc
=
zeros
(
size
(
allSimulMetConc
));
allProFitMetConc
=
zeros
(
size
(
allSimulMetConc
));
allLCModelMetConcDev
=
zeros
(
size
(
allSimulMetConc
));
allProFitMetConcDev
=
zeros
(
size
(
allSimulMetConc
));
for
indexMetabolite
=
1
:
numberOfMet
simulatedMetConc
=
concentrationsRm
(:,
indexMetabolite
);
indexMetSim
=
find
(
strcmp
(
metabolites
,
'tCr(CH3)'
));
%'MMB'
fittedMetConcLCModel
=
zeros
(
size
(
simulatedMetConc
));
for
indexFit
=
1
:
length
(
concentrationsLCModel
)
currentConcentrationsLCModel
=
concentrationsLCModel
{
indexFit
};
indexMetLCModel
=
find
(
strcmp
(
currentConcentrationsLCModel
(
1
,:),
'Cr'
));
%'Leu'
RefConc
=
currentConcentrationsLCModel
{
2
,
indexMetLCModel
};
RefConcSim
=
concentrationsRm
(
indexFit
,
indexMetSim
);
if
scalingOn
scaling
=
RefConcSim
/
RefConc
;
else
scaling
=
1
;
end
indexMetLCModel
=
find
(
strcmp
(
currentConcentrationsLCModel
(
1
,:),
metabolitesLCModel
(
indexMetabolite
)));
fittedMetConcLCModel
(
indexFit
)
=
currentConcentrationsLCModel
{
2
,
indexMetLCModel
}
*
scaling
;
end
% allLCModelMetConcDev = allLCModelMetConcDev - median(allLCModelMetConcDev,1, 'omitnan');
% allProFitMetConcDev = allProFitMetConcDev - median(allProFitMetConcDev,1, 'omitnan');
if
plotPrecision
yLimValue
=
100
;
if
isempty
(
figIds
)
% figure('Position',[612,509,1132,469],'OuterPosition',[604,501,1148,562], 'Units','pixels')
% 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
);
fittedMetConcProFit
=
zeros
(
size
(
simulatedMetConc
));
for
indexFit
=
1
:
length
(
concentrationsProFit
)
currentConcentrationsProFit
=
concentrationsProFit
{
indexFit
}{
iterationProFit
};
indexMetProFit
=
find
(
strcmp
(
activeMetabolites
{
iterationProFit
},
'Cr'
));
%'Leu'
RefConc
=
currentConcentrationsProFit
(
indexMetProFit
);
RefConcSim
=
concentrationsRm
(
indexFit
,
indexMetSim
);
if
scalingOn
scaling
=
RefConcSim
/
RefConc
;
else
scaling
=
1
;
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
])
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'
)
set
(
boxPlotLCModel
(:,:),
'linewidth'
,
1
);
yline
(
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
])
title
(
'ProFit'
)
ylim
([
-
yLimValue
,
yLimValue
]);
set
(
gca
,
'FontSize'
,
11
)
ylabel
(
'$Concentration\,\,change\,\,c^\%_{k}\,(\%)$'
,
'FontSize'
,
13
,
'Interpreter'
,
'latex'
)
set
(
boxPlotProFit
(:,:),
'linewidth'
,
1
);
yline
(
0
,
':'
,
'Color'
,[
0.5
0.5
0.5
]);
indexMetProFit
=
find
(
strcmp
(
activeMetabolites
{
iterationProFit
},
metabolitesProFit
(
indexMetabolite
)));
fittedMetConcProFit
(
indexFit
)
=
currentConcentrationsProFit
(
indexMetProFit
)
*
scaling
;
end
if
strcmp
(
metabolitesProFit
(
indexMetabolite
),
'Leu'
)
fittedMetConcProFit
=
fittedMetConcProFit
*
1e8
;
end
allLCModelMetConc
(:,
indexMetabolite
)
=
fittedMetConcLCModel
;
allProFitMetConc
(:,
indexMetabolite
)
=
fittedMetConcProFit
;
allLCModelMetConcDev
(:,
indexMetabolite
)
=
(
simulatedMetConc
-
fittedMetConcLCModel
)
.
/
simulatedMetConc
.*
100
;
allProFitMetConcDev
(:,
indexMetabolite
)
=
(
simulatedMetConc
-
fittedMetConcProFit
)
.
/
simulatedMetConc
.*
100
;
end
end
function
figIdsCorr
=
plotCorrelationFigs
(
concentrationsRm
,
allLCModelMetConc
,
allProFitMetConc
,
...
metabolitesToDisplay
,
numberOfMet
,
dataExportPathBase
,
paramKeyword
,
truncSuffix
,
figIdsCorr
)
if
isempty
(
figIdsCorr
)
emptyFigureIdsCorr
=
true
;
figIdsCorr
=
cell
(
1
,
numberOfMet
);
else
emptyFigureIdsCorr
=
false
;
end
for
indexMetabolite
=
1
:
numberOfMet
simulatedMetConc
=
concentrationsRm
(:,
indexMetabolite
);
fittedMetConcLCModel
=
allLCModelMetConc
(:,
indexMetabolite
);
fittedMetConcProFit
=
allProFitMetConc
(:,
indexMetabolite
);
if
emptyFigureIdsCorr
figIdsCorr
{
indexMetabolite
}
=
figure
;
end
figure
(
figIdsCorr
{
indexMetabolite
});
hold
on
scatter
(
simulatedMetConc
,
fittedMetConcLCModel
);
scatter
(
simulatedMetConc
,
fittedMetConcProFit
,
'x'
);
plot
(
simulatedMetConc
,
simulatedMetConc
);
title
(
metabolitesToDisplay
(
indexMetabolite
))
display
([
paramKeyword
,
' NANs:'
,
num2str
(
sum
(
isnan
(
allLCModelMetConcDev
)))]);
meanConcDevLCModel
=
mean
(
allLCModelMetConcDev
,
'omitnan'
);
stdConcDevLCModel
=
std
(
allLCModelMetConcDev
,
'omitnan'
);
display
([
paramKeyword
,
' NANs ProFit:'
,
num2str
(
sum
(
isnan
(
allProFitMetConcDev
)))]);
meanConcDevProFit
=
mean
(
allProFitMetConcDev
,
'omitnan'
);
stdConcDevProFit
=
std
(
allProFitMetConcDev
,
'omitnan'
);
allMeanLCModel
=
mean
(
abs
(
meanConcDevLCModel
));
allStdLCModel
=
mean
(
abs
(
stdConcDevLCModel
));
allMeanProFit
=
mean
(
abs
(
meanConcDevProFit
));
allStdProFit
=
mean
(
abs
(
stdConcDevProFit
));
allMeanLCModelMain
=
mean
(
abs
(
meanConcDevLCModel
(
indexesMainMet
)));
allStdLCModelMain
=
mean
(
abs
(
stdConcDevLCModel
(
indexesMainMet
)));
allMeanProFitMain
=
mean
(
abs
(
meanConcDevProFit
(
indexesMainMet
)));
allStdProFitMain
=
mean
(
abs
(
stdConcDevProFit
(
indexesMainMet
)));
plusMinusSign
=
char
(
177
);
metaboliteTable
{
2
,
indexTable
}
=
'ProFit'
;
metaboliteTable
{
2
,
indexTable
+
1
}
=
'LCModel'
;
for
indexMet
=
1
:
numberOfMet
metaboliteTable
{
indexMet
+
2
,
indexTable
}
=
[
num2str
(
meanConcDevProFit
(
indexMet
),
'%.1f'
),
plusMinusSign
,
num2str
(
stdConcDevProFit
(
indexMet
),
'%.1f'
)];
metaboliteTable
{
indexMet
+
2
,
indexTable
+
1
}
=
[
num2str
(
meanConcDevLCModel
(
indexMet
),
'%.1f'
),
plusMinusSign
,
num2str
(
stdConcDevLCModel
(
indexMet
),
'%.1f'
)];
xlabel
(
'Simulated concentrations {\boldmath$c$}$_{k}$ (mmol/kg)'
,
'Interpreter'
,
'latex'
)
ylabel
(
'Fitted concentrations {\boldmath$c$}$_{k}$ (mmol/kg)'
,
'Interpreter'
,
'latex'
)
legend
(
'LCModel {\boldmath$c$}$_{k}$'
,
'ProFit {\boldmath$c$}$_{k}$'
,
'Identity Line'
,
'Location'
,
'Northwest'
,
'Interpreter'
,
'latex'
)
set
(
gca
,
'FontSize'
,
13
)
xl
=
xlim
;
if
xl
(
2
)
>
max
(
simulatedMetConc
)
xl
(
2
)
=
max
(
simulatedMetConc
);
end
xlim
(
xl
);
metaboliteTable
{
numberOfMet
+
3
,
indexTable
}
=
[
num2str
(
allMeanProFit
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdProFit
,
'%.1f'
)];
metaboliteTable
{
numberOfMet
+
3
,
indexTable
+
1
}
=
[
num2str
(
allMeanLCModel
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdLCModel
,
'%.1f'
)];
metaboliteTable
{
numberOfMet
+
4
,
indexTable
}
=
[
num2str
(
allMeanProFitMain
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdProFitMain
,
'%.1f'
)];
metaboliteTable
{
numberOfMet
+
4
,
indexTable
+
1
}
=
[
num2str
(
allMeanLCModelMain
,
'%.1f'
),
plusMinusSign
,
num2str
(
allStdLCModelMain
,
'%.1f'
)];
pathName
=
[
dataExportPathBase
,
paramKeyword
,
'/correlations/'
];
if
~
exist
(
pathName
,
'dir'
)
mkdir
(
pathName
);
end
fileName
=
[
metabolitesToDisplay
{
indexMetabolite
},
'_'
,
paramKeyword
,
truncSuffix
];
saveas
(
figIdsCorr
{
indexMetabolite
},
[
pathName
,
fileName
,
'.tif'
]);
savefig
(
figIdsCorr
{
indexMetabolite
},
[
pathName
,
fileName
,
'.fig'
],
'compact'
);
end
end
function
figIds
=
plotPrecisionFigs
(
figIds
,
numberOfMet
,
offsetPlot
,
secondaryFigures
,
plotColors
,
...
allLCModelMetConcDev
,
allProFitMetConcDev
,
metabolitesLabels
)
yLimValue
=
100
;
if
isempty
(
figIds
)
% figure('Position',[612,509,1132,469],'OuterPosition',[604,501,1148,562], 'Units','pixels')
% 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
);
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
])
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'
)
set
(
boxPlotLCModel
(:,:),
'linewidth'
,
1
);
yline
(
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
])
title
(
'ProFit'
)
ylim
([
-
yLimValue
,
yLimValue
]);
set
(
gca
,
'FontSize'
,
11
)
ylabel
(
'$Concentration\,\,change\,\,c^\%_{k}\,(\%)$'
,
'FontSize'
,
13
,
'Interpreter'
,
'latex'
)
set
(
boxPlotProFit
(:,:),
'linewidth'
,
1
);
yline
(
0
,
':'
,
'Color'
,[
0.5
0.5
0.5
]);
end
function
[
metaboliteTable
,
indexTable
]
=
setupTable
(
numberOfMet
,
numOfParameters
,
metabolitesLabels
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment