Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions +nla/+net/+mcc/FreedmanLane.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
classdef FreedmanLane < nla.net.mcc.Base
properties (Constant)
name = "Freedman-Lane"
end

methods
function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
p_max = input_struct.prob_max;
is_sig_vector = prob.v < p_max;
end
function correction_label = createLabel(obj, net_atlas, input_struct)
correction_label = sprintf("P < %.2g", input_struct.prob_max);
end
end
end
15 changes: 15 additions & 0 deletions +nla/+net/+mcc/WestfallYoung.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
classdef WestfallYoung < nla.net.mcc.Base
properties (Constant)
name = "Westfall-Young"
end

methods
function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
p_max = input_struct.prob_max;
is_sig_vector = prob.v < p_max;
end
function correction_label = createLabel(obj, net_atlas, input_struct)
correction_label = sprintf("P < %.2g", input_struct.prob_max);
end
end
end
388 changes: 0 additions & 388 deletions +nla/+net/+result/+plot/NetworkTestPlot.m

This file was deleted.

Binary file modified +nla/+net/+result/+plot/NetworkTestPlotApp.mlapp
Binary file not shown.
61 changes: 14 additions & 47 deletions +nla/+net/+result/+plot/NetworkTestPlotApp_exported.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
Panel matlab.ui.container.Panel
PlotScaleDropDownLabel matlab.ui.control.Label
PlotScaleDropDown matlab.ui.control.DropDown
RankingDropDownLabel matlab.ui.control.Label
RankingDropDown matlab.ui.control.DropDown
UpperLimitEditFieldLabel matlab.ui.control.Label
UpperLimitEditField matlab.ui.control.NumericEditField
LowerLimitEditFieldLabel matlab.ui.control.Label
Expand Down Expand Up @@ -89,15 +87,6 @@ function getPlotTitle(app)
if isequal(app.CohensDThresholdCheckBox.Value, true)
app.title = sprintf("%s (D > %g)", app.title, app.CohensDThresholdEditField.Value);
end
if ~isequal(app.test_method, "no_permutations")
if isequal(app.RankingDropDown.Value, "nla.RankingMethod.FREEDMAN_LANE") % Look at me, I'm MATLAB. I have no idea why enums are beneficial or how to use them
app.title = strcat(app.title, "\nRanking by Freedman-Lane Method");
elseif isequal(app.RankingDropDown.Value, "nla.RankingMethod.WESTFALL_YOUNG")
app.title = strcat(app.title, "\nRanking by Westfall-Young Method");
else
app.title = strcat(app.title, "\nUncorrected data");
end
end
end

function [width, height] = drawTriMatrixPlot(app)
Expand All @@ -106,15 +95,6 @@ function getPlotTitle(app)
if ~isequal(app.matrix_plot, false)
app.save_plot_settings();
end

if isfield(app.settings, "ranking")
app.network_test_options.ranking_method = app.settings.ranking;
if isobject(app.matrix_plot)
app.matrix_plot.removeLegend();
delete(app.matrix_plot.image_display);
delete(app.matrix_plot.color_bar);
end
end

switch app.MultipleComparisonCorrectionDropDown.Value
case "Benjamini-Hochberg"
Expand All @@ -123,13 +103,16 @@ function getPlotTitle(app)
mcc = "BenjaminiYekutieli";
case "Holm-Bonferroni"
mcc = "HolmBonferroni";
case "Freedman-Lane"
mcc = "FreedmanLane";
case "Westfall-Young"
mcc = "WestfallYoung";
otherwise
mcc = app.MultipleComparisonCorrectionDropDown.Value;
end
app.getPlotTitle();

if isequal(app.old_data, true)
app.RankingDropDown.Enable = false;
if ~isfield(app.network_test_result.full_connectome, 'd')
app.CohensDThresholdCheckBox.Enable = false;
app.CohensDThresholdEditField.Enable = false;
Expand All @@ -141,7 +124,7 @@ function getPlotTitle(app)
app.edge_test_options.net_atlas, app.network_test_options);
probability_parameters = app.parameters.plotProbabilityParameters(app.edge_test_options, app.edge_test_result,...
app.test_method, probability, sprintf(app.title), mcc, app.createEffectSizeFilter(),...
app.RankingDropDown.Value, app.PlotValueDropDown.Value);
app.PlotValueDropDown.Value);

% if ~isequal(app.UpperLimitEditField.Value, 0.3) && ~isequal(app.LowerLimitEditField.Value, 0.3)
probability_parameters.plot_max = app.pvalueThresholdEditField.Value;
Expand Down Expand Up @@ -189,7 +172,6 @@ function save_plot_settings(app)
app.matrix_plot.display_legend.Visible = app.LegendVisibleDropDown.Value;
app.matrix_plot.plot_title.String = {};
app.network_test_options.prob_max = app.pvalueThresholdEditField.Value;
app.settings.ranking = app.RankingDropDown.Value;
end

function load_plot_settings(app)
Expand Down Expand Up @@ -298,7 +280,7 @@ function drawChords(app, event)
p_value = strcat("uncorrected_", probability);
probability_parameters = app.parameters.plotProbabilityParameters(app.edge_test_options, app.edge_test_result,...
app.test_method, p_value, sprintf(app.title), app.MultipleComparisonCorrectionDropDown.Value, app.createEffectSizeFilter(),...
app.RankingDropDown.Value);
app.PlotValueDropDown.Value);

chord_plotter = nla.net.result.chord.ChordPlotter(app.edge_test_options.net_atlas, app.edge_test_result);

Expand All @@ -309,7 +291,7 @@ function drawChords(app, event)
% Value changed function: ColormapDropDown,
% LegendVisibleDropDown, LowerLimitEditField,
% MultipleComparisonCorrectionDropDown, PlotScaleDropDown,
% RankingDropDown, UpperLimitEditField
% UpperLimitEditField
function PlotScaleValueChanged(app, event)
if isequal(app.settings, false)
app.settings = struct();
Expand All @@ -329,7 +311,6 @@ function PlotScaleValueChanged(app, event)
app.settings.cohensD = app.CohensDThresholdCheckBox.Value;
app.settings.cohensDValue = app.CohensDThresholdEditField.Value;
app.settings.legend = app.LegendVisibleDropDown.Value;
app.settings.ranking = app.RankingDropDown.Value;
end

% Value changed function: ROIcentroidsonbrainplotsCheckBox
Expand Down Expand Up @@ -470,20 +451,6 @@ function createComponents(app)
app.PlotScaleDropDown.Position = [78 297 100 22];
app.PlotScaleDropDown.Value = 'nla.gfx.ProbPlotMethod.DEFAULT';

% Create RankingDropDownLabel
app.RankingDropDownLabel = uilabel(app.Panel);
app.RankingDropDownLabel.HorizontalAlignment = 'right';
app.RankingDropDownLabel.Position = [226 297 50 22];
app.RankingDropDownLabel.Text = 'Ranking';

% Create RankingDropDown
app.RankingDropDown = uidropdown(app.Panel);
app.RankingDropDown.Items = {'Uncorrected', 'Freedman-Lane', 'Westfall-Young'};
app.RankingDropDown.ItemsData = {'nla.RankingMethod.UNCORRECTED', 'nla.RankingMethod.FREEDMAN_LANE', 'nla.RankingMethod.WESTFALL_YOUNG'};
app.RankingDropDown.ValueChangedFcn = createCallbackFcn(app, @PlotScaleValueChanged, true);
app.RankingDropDown.Position = [291 297 100 22];
app.RankingDropDown.Value = 'nla.RankingMethod.UNCORRECTED';

% Create UpperLimitEditFieldLabel
app.UpperLimitEditFieldLabel = uilabel(app.Panel);
app.UpperLimitEditFieldLabel.HorizontalAlignment = 'right';
Expand Down Expand Up @@ -534,41 +501,41 @@ function createComponents(app)
% Create ColormapDropDownLabel
app.ColormapDropDownLabel = uilabel(app.Panel);
app.ColormapDropDownLabel.HorizontalAlignment = 'right';
app.ColormapDropDownLabel.Position = [9 177 58 22];
app.ColormapDropDownLabel.Position = [221 297 58 22];
app.ColormapDropDownLabel.Text = 'Colormap';

% Create ColormapDropDown
app.ColormapDropDown = uidropdown(app.Panel);
app.ColormapDropDown.Items = {};
app.ColormapDropDown.ValueChangedFcn = createCallbackFcn(app, @PlotScaleValueChanged, true);
app.ColormapDropDown.Position = [78 177 100 22];
app.ColormapDropDown.Position = [290 297 100 22];
app.ColormapDropDown.Value = {};

% Create LegendVisibleDropDownLabel
app.LegendVisibleDropDownLabel = uilabel(app.Panel);
app.LegendVisibleDropDownLabel.HorizontalAlignment = 'right';
app.LegendVisibleDropDownLabel.Position = [233 177 84 22];
app.LegendVisibleDropDownLabel.Position = [231 147 84 22];
app.LegendVisibleDropDownLabel.Text = 'Legend Visible';

% Create LegendVisibleDropDown
app.LegendVisibleDropDown = uidropdown(app.Panel);
app.LegendVisibleDropDown.Items = {'On', 'Off'};
app.LegendVisibleDropDown.ItemsData = {'on', 'off'};
app.LegendVisibleDropDown.ValueChangedFcn = createCallbackFcn(app, @PlotScaleValueChanged, true);
app.LegendVisibleDropDown.Position = [332 177 59 22];
app.LegendVisibleDropDown.Position = [330 147 59 22];
app.LegendVisibleDropDown.Value = 'on';

% Create MultipleComparisonCorrectionDropDownLabel
app.MultipleComparisonCorrectionDropDownLabel = uilabel(app.Panel);
app.MultipleComparisonCorrectionDropDownLabel.HorizontalAlignment = 'right';
app.MultipleComparisonCorrectionDropDownLabel.Position = [11 147 178 22];
app.MultipleComparisonCorrectionDropDownLabel.Position = [11 177 178 22];
app.MultipleComparisonCorrectionDropDownLabel.Text = 'Multiple Comparison Correction';

% Create MultipleComparisonCorrectionDropDown
app.MultipleComparisonCorrectionDropDown = uidropdown(app.Panel);
app.MultipleComparisonCorrectionDropDown.Items = {'None', 'Bonferroni', 'Benjamini-Hochberg', 'Benjamini-Yekutieli', 'Holm-Bonferroni'};
app.MultipleComparisonCorrectionDropDown.Items = {'None', 'Bonferroni', 'Benjamini-Hochberg', 'Benjamini-Yekutieli', 'Holm-Bonferroni', 'Freedman-Lane', 'Westfall-Young'};
app.MultipleComparisonCorrectionDropDown.ValueChangedFcn = createCallbackFcn(app, @PlotScaleValueChanged, true);
app.MultipleComparisonCorrectionDropDown.Position = [226 147 165 22];
app.MultipleComparisonCorrectionDropDown.Position = [226 177 165 22];
app.MultipleComparisonCorrectionDropDown.Value = 'None';

% Create CohensDThresholdCheckBox
Expand Down
33 changes: 12 additions & 21 deletions +nla/+net/+result/NetworkResultPlotParameter.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
end

function result = plotProbabilityParameters(obj, edge_test_options, edge_test_result, test_method, plot_statistic,...
plot_title, fdr_correction, effect_size_filter, ranking_method, plot_value)
plot_title, fdr_correction, effect_size_filter, plot_value)
% plot_title - this will be a string
% plot_statistic - this is the stat that will be plotted
% effect_size_filter - this will be a boolean or some sort of object (like Cohen's D > D-value)
Expand All @@ -48,7 +48,7 @@
end

% Grab the data from the NetworkTestResult object
statistic_input = obj.getStatsFromMethodAndName(test_method, plot_statistic, ranking_method);
statistic_input = obj.getStatsFromMethodAndName(test_method, fdr_correction);

% Get the scale max and the labels
if isstring(fdr_correction) || ischar(fdr_correction)
Expand All @@ -60,15 +60,6 @@
p_value_breakdown_label = fdr_correction.createLabel(obj.network_atlas, obj.updated_test_options);
name_label = sprintf("%s %s\n%s", obj.network_test_results.test_display_name, plot_title,...
p_value_breakdown_label);
% else
%
% name_label = sprintf("%s %s\nP < %.2g (%s)", obj.network_test_results.test_display_name, plot_title,...
% p_value_max, p_value_breakdown_label);
% if p_value_max == 0
% name_label = sprintf("%s %s\nP = %.2g (%s)", obj.network_test_results.test_display_name, plot_title,...
% p_value_max, p_value_breakdown_label);
% end
% end

% Filtering if there's a filter provided
significance_plot = TriMatrix(obj.number_of_networks, "logical", TriMatrixDiag.KEEP_DIAGONAL);
Expand Down Expand Up @@ -162,7 +153,7 @@ function brainFigureButtonCallback(network1, network2)
function result = plotProbabilityVsNetworkSize(obj, test_method, plot_statistic)
% Two convience methods
network_size = obj.getNetworkSizes();
statistic_input = obj.getStatsFromMethodAndName(test_method, plot_statistic, obj.updated_test_options.ranking_method);
statistic_input = obj.getStatsFromMethodAndName(test_method, obj.updated_test_options.fdr_correction);

negative_log10_statistics = -log10(statistic_input.v);

Expand Down Expand Up @@ -204,8 +195,8 @@ function brainFigureButtonCallback(network1, network2)
end
end

function statistic = getStatsFromMethodAndName(obj, method, plot_statistic, ranking_method)
import nla.RankingMethod nla.NetworkLevelMethod nla.net.result.NetworkTestResult
function statistic = getStatsFromMethodAndName(obj, method, fdr_correction)
import nla.NetworkLevelMethod nla.net.result.NetworkTestResult

switch method
case "no_permutations"
Expand All @@ -216,18 +207,18 @@ function brainFigureButtonCallback(network1, network2)
test_method = "within_network_pair";
end

switch ranking_method
case "nla.RankingMethod.FREEDMAN_LANE"
ranking = "freedman_lane_";
case "nla.RankingMethod.WESTFALL_YOUNG"
ranking = "westfall_young_";
switch lower(erase(fdr_correction, "-"))
case "freedmanlane"
fdr_method = "freedman_lane_";
case "westfallyoung"
fdr_method = "westfall_young_";
otherwise
ranking = "uncorrected_";
fdr_method = "uncorrected_";
end

probability = NetworkTestResult().getPValueNames(method, obj.network_test_results.test_name);

statistic = obj.network_test_results.(test_method).(strcat(ranking, probability));
statistic = obj.network_test_results.(test_method).(strcat(fdr_method, probability));
end
end

Expand Down
1 change: 0 additions & 1 deletion +nla/+net/+result/NetworkTestResult.m
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ function createPValueTriMatrices(obj, number_of_networks, test_method)
test_options = result_struct.input_struct;

network_test_options = result_struct.net_input_struct;
network_test_options.ranking_method = "Uncorrected";
network_test_options.no_permutations = network_test_options.nonpermuted;
network_test_options.full_connectome = network_test_options.full_conn;
network_test_options.within_network_pair = network_test_options.within_net_pair;
Expand Down
1 change: 0 additions & 1 deletion +nla/+net/genBaseInputs.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
'full_connectome', true,...
'within_network_pair', true,...
'prob_plot_method',nla.gfx.ProbPlotMethod.DEFAULT,...
'ranking_method', "Uncorrected",...
'edge_chord_plot_method', nla.gfx.EdgeChordPlotMethod.PROB,...
'fdr_correction', nla.net.mcc.Bonferroni(),...
'd_thresh_chord_plot', true...
Expand Down
12 changes: 6 additions & 6 deletions +nla/+net/unittests/NetworkResultPlotParameterTestCase.m
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ function plotProbabilityParametersDefaultPlottingTest(testCase)
probability = NetworkTestResult().getPValueNames("full_connectome", permutation_result.test_name);

probability_parameters = plot_parameters.plotProbabilityParameters(testCase.edge_test_options,...
testCase.edge_test_result, "full_connectome", probability, 'Title', nla.net.mcc.Bonferroni(),...
false, nla.RankingMethod.UNCORRECTED, "nla.gfx.PlotValue.PVALUE");
testCase.edge_test_result, "full_connectome", probability, 'Title', "Bonferroni",...
false, "nla.gfx.PlotValue.PVALUE");

expected_p_value_max = testCase.network_test_options.prob_max / testCase.network_atlas.numNetPairs();
expected_plot = nla.TriMatrix(plot_parameters.number_of_networks, "double", nla.TriMatrixDiag.KEEP_DIAGONAL);
Expand All @@ -119,8 +119,8 @@ function plotProbabilityParametersLogPlottingTest(testCase)
probability = NetworkTestResult().getPValueNames("full_connectome", permutation_result.test_name);

probability_parameters = plot_parameters.plotProbabilityParameters(testCase.edge_test_options,...
testCase.edge_test_result, "full_connectome", probability, 'Title', nla.net.mcc.Bonferroni(),...
false, nla.RankingMethod.UNCORRECTED, "nla.gfx.PlotValue.PVALUE");
testCase.edge_test_result, "full_connectome", probability, 'Title', "Bonferroni",...
false, "nla.gfx.PlotValue.PVALUE");

expected_p_value_max = testCase.network_test_options.prob_max / testCase.network_atlas.numNetPairs();
expected_plot = nla.TriMatrix(plot_parameters.number_of_networks, "double", nla.TriMatrixDiag.KEEP_DIAGONAL);
Expand Down Expand Up @@ -157,8 +157,8 @@ function plotProbabilityParametersNegLogTest(testCase)
probability = NetworkTestResult().getPValueNames("full_connectome", permutation_result.test_name);

probability_parameters = plot_parameters.plotProbabilityParameters(testCase.edge_test_options,...
testCase.edge_test_result, "full_connectome", probability, 'Title', nla.net.mcc.Bonferroni(),...
false, nla.RankingMethod.UNCORRECTED, "nla.gfx.PlotValue.PVALUE");
testCase.edge_test_result, "full_connectome", probability, 'Title', "Bonferroni",...
false, "nla.gfx.PlotValue.PVALUE");

expected_p_value_max = 2;
expected_plot = nla.TriMatrix(plot_parameters.number_of_networks, "double", nla.TriMatrixDiag.KEEP_DIAGONAL);
Expand Down
5 changes: 0 additions & 5 deletions +nla/RankingMethod.m

This file was deleted.

Loading