Skip to content

Commit 29dafdf

Browse files
AndyEck16Andypollaroactions-user
authored
pull master changes into SWE branch (#135)
* HolmBonferroni threshold and label quick fix * [NET-300] Change Winkler Ranking to Freedman-Lane (#133) * changed names for winkler and freedman_lane * fixed up typo * Exported mlapp files --------- Co-authored-by: Github Action <action@github.com> * [NET-302] Rename variable in NetworkTestResult (#134) renamed * Change logic of fdr tests to return vector of significant net pairs instead of a single p threshold --------- Co-authored-by: Andy <me@something.com> Co-authored-by: Jim Pollaro <30908497+pollaro@users.noreply.github.com> Co-authored-by: Github Action <action@github.com>
1 parent 53c0553 commit 29dafdf

17 files changed

Lines changed: 84 additions & 104 deletions

+nla/+net/+mcc/Base.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
classdef Base
22
methods (Abstract)
3-
p_max = correct(obj, net_atlas, input_struct, prob)
3+
[is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
44
correction_label = createLabel(obj, net_atlas, input_struct, prob)
55
end
66
end

+nla/+net/+mcc/BenjaminiHochberg.m

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@
44
end
55

66
methods
7-
function p_max = correct(obj, net_atlas, input_struct, prob)
8-
[~, p_max] = nla.lib.fdr_bh(prob.v, input_struct.prob_max, 'pdep');
7+
function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
8+
[is_sig_vector, p_max] = nla.lib.fdr_bh(prob.v, input_struct.prob_max, 'pdep');
99
end
1010
function correction_label = createLabel(obj, net_atlas, input_struct, prob)
11-
p_max = obj.correct(net_atlas, input_struct, prob);
12-
if p_max == 0
13-
correction_label = sprintf('FDR_{BH} produced no significant nets');
14-
else
15-
format_specs = "%g/%d tests";
16-
if isequal(input_struct.behavior_count, 1)
17-
format_specs = "%g/%d test";
18-
end
19-
correction_label = sprintf(strcat("FDR_{BH}(", format_specs, ")"), input_struct.prob_max * input_struct.behavior_count,...
20-
input_struct.behavior_count);
21-
end
11+
correction_label = sprintf("Benjamini-Hochberg (alpha = %g)",input_struct.prob_max);
2212
end
2313
end
2414
end

+nla/+net/+mcc/BenjaminiYekutieli.m

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,11 @@
44
end
55

66
methods
7-
function p_max = correct(obj, net_atlas, input_struct, prob)
8-
[~, p_max] = nla.lib.fdr_bh(prob.v, input_struct.prob_max, 'dep');
7+
function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
8+
[is_sig_vector, p_max] = nla.lib.fdr_bh(prob.v, input_struct.prob_max, 'dep');
99
end
1010
function correction_label = createLabel(obj, net_atlas, input_struct, prob)
11-
p_max = obj.correct(net_atlas, input_struct, prob);
12-
if p_max == 0
13-
correction_label = sprintf('FDR_{BY} produced no significant nets');
14-
else
15-
format_specs = "%g/%d tests";
16-
if isequal(input_struct.behavior_count, 1)
17-
format_specs = "%g/%d test";
18-
end
19-
correction_label = sprintf(strcat("FDR_{BY}(", format_specs, ")"), input_struct.prob_max * input_struct.behavior_count,...
20-
input_struct.behavior_count);
21-
end
11+
correction_label = sprintf("Benjamini-Yekutieli (alpha = %g)",input_struct.prob_max);
2212
end
2313
end
2414
end

+nla/+net/+mcc/Bonferroni.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44
end
55

66
methods
7-
function p_max = correct(obj, net_atlas, input_struct, prob)
7+
function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
8+
89
p_max = input_struct.prob_max / net_atlas.numNetPairs();
10+
is_sig_vector = prob.v < p_max;
911
end
1012
function correction_label = createLabel(obj, net_atlas, input_struct, prob)
11-
format_specs_tests = "%d tests";
13+
format_specs_tests = "%d tests)";
1214
if isequal(input_struct.behavior_count, 1)
13-
format_specs_tests = "%d test";
15+
format_specs_tests = "%d test)";
1416
end
15-
correction_label = sprintf(strcat("%g/%d net-pairs/", format_specs_tests), input_struct.prob_max * input_struct.behavior_count,...
17+
p_max = input_struct.prob_max / net_atlas.numNetPairs();
18+
correction_label = sprintf(strcat("P < %.2g (%.2g/%d net-pairs/", format_specs_tests), p_max, input_struct.prob_max * input_struct.behavior_count,...
1619
net_atlas.numNetPairs(), input_struct.behavior_count);
1720
end
1821
end

+nla/+net/+mcc/HolmBonferroni.m

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,16 @@
44
end
55

66
methods
7-
function p_max = correct(obj, net_atlas, input_struct, prob)
8-
[is_significant, adjusted_pvals, ~] = nla.lib.bonferroni_holm(prob.v, input_struct.prob_max);
9-
p_max = max(is_significant .* adjusted_pvals);
7+
function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
8+
[is_sig_vector, adjusted_pvals, ~] = nla.lib.bonferroni_holm(prob.v, input_struct.prob_max);
9+
10+
p_max = max(is_sig_vector .* prob.v);
1011
end
1112
function correction_label = createLabel(obj, net_atlas, input_struct, prob)
12-
p_max = obj.correct(net_atlas, input_struct, prob);
13-
if p_max == 0
14-
correction_label = sprintf('Holm-Bonferroni produced no significant networks');
15-
else
16-
format_specs = "%g/%d tests";
17-
if isequal(input_struct.behavior_count, 1)
18-
format_specs = "%g/%d test";
19-
end
20-
correction_label = sprintf(strcat("Holm-Bonferroni(", format_specs, ")"), input_struct.prob_max * input_struct.behavior_count,...
21-
input_struct.behavior_count);
22-
end
13+
correction_label = sprintf("Holm-Bonferroni (alpha = %g)",input_struct.prob_max);
14+
15+
%Since p threshold is variable with this test, exclude it and
16+
%just use the initial 'alpha' term used in the algorithm.
2317
end
2418
end
2519
end

+nla/+net/+mcc/None.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
end
55

66
methods
7-
function p_max = correct(obj, net_atlas, input_struct, prob)
7+
function [is_sig_vector, p_max] = correct(obj, net_atlas, input_struct, prob)
88
p_max = input_struct.prob_max;
9+
is_sig_vector = prob.v < p_max;
910
end
1011
function correction_label = createLabel(obj, net_atlas, input_struct, prob)
11-
format_specs = "%g/%d tests";
12+
format_specs = "P < %.2g (%g/%d tests)";
1213
if isequal(input_struct.behavior_count, 1)
13-
format_specs = "%g/%d test";
14+
format_specs = "P < %.2g (%g/%d test)";
1415
end
15-
correction_label = sprintf(format_specs, input_struct.prob_max * input_struct.behavior_count,...
16+
correction_label = sprintf(format_specs, input_struct.prob_max, input_struct.prob_max * input_struct.behavior_count,...
1617
input_struct.behavior_count);
1718
end
1819
end

+nla/+net/+result/+plot/NetworkTestPlot.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ function getPlotTitle(obj)
8989
obj.title = sprintf("%s (D > %g)", obj.title, obj.network_test_options.d_max);
9090
end
9191
if ~isequal(obj.test_method, "no_permutations")
92-
if isequal(obj.current_settings.ranking, nla.RankingMethod.WINKLER)
93-
obj.title = strcat(obj.title, "\nRanking by Winkler Method");
92+
if isequal(obj.current_settings.ranking, nla.RankingMethod.FREEDMAN_LANE)
93+
obj.title = strcat(obj.title, "\nRanking by Freedman-Lane Method");
9494
elseif isequal(obj.current_settings.ranking, nla.RankingMethod.WESTFALL_YOUNG)
9595
obj.title = strcat(obj.title, "\nRanking by Westfall-Young Method");
9696
else
@@ -228,8 +228,8 @@ function resizeFigure(obj, plot_width, plot_height)
228228
% All the options (buttons, pulldowns, checkboxes)
229229
scale_option = PullDown("plot_scale", "Plot Scale", ["Linear", "Log", "Negative Log10"],...
230230
[ProbPlotMethod.DEFAULT, ProbPlotMethod.LOG, ProbPlotMethod.NEGATIVE_LOG_10]);
231-
ranking_method = PullDown("ranking", "Ranking", ["Uncorrected", "Winkler", "Westfall-Young"],...
232-
[RankingMethod.UNCORRECTED, RankingMethod.WINKLER, RankingMethod.WESTFALL_YOUNG]);
231+
ranking_method = PullDown("ranking", "Ranking", ["Uncorrected", "Freedman-Lane", "Westfall-Young"],...
232+
[RankingMethod.UNCORRECTED, RankingMethod.FREEDMAN_LANE, RankingMethod.WESTFALL_YOUNG]);
233233
cohens_d = CheckBox("cohens_d", "Cohen's D Threshold", true);
234234
centroids = CheckBox("centroids", "ROI Centroids in brain plots", false);
235235
multiple_comparison_correction = PullDown("mcc", "Multiple Comparison Correction",...
55 Bytes
Binary file not shown.

+nla/+net/+result/+plot/NetworkTestPlotApp_exported.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ function getPlotTitle(app)
8888
app.title = sprintf("%s (D > %g)", app.title, app.CohensDThresholdEditField.Value);
8989
end
9090
if ~isequal(app.test_method, "no_permutations")
91-
if isequal(app.RankingDropDown.Value, "nla.RankingMethod.WINKLER") % Look at me, I'm MATLAB. I have no idea why enums are beneficial or how to use them
92-
app.title = strcat(app.title, "\nRanking by Winkler Method");
91+
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
92+
app.title = strcat(app.title, "\nRanking by Freedman-Lane Method");
9393
elseif isequal(app.RankingDropDown.Value, "nla.RankingMethod.WESTFALL_YOUNG")
9494
app.title = strcat(app.title, "\nRanking by Westfall-Young Method");
9595
else
@@ -439,8 +439,8 @@ function createComponents(app)
439439

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

+nla/+net/+result/NetworkResultPlotParameter.m

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
end
2828

2929
function result = plotProbabilityParameters(obj, edge_test_options, edge_test_result, test_method, plot_statistic,...
30-
plot_title, fdr_correction, significance_filter, ranking_method)
30+
plot_title, fdr_correction, effect_size_filter, ranking_method)
3131
% plot_title - this will be a string
3232
% plot_statistic - this is the stat that will be plotted
3333
% significance filter - this will be a boolean or some sort of object (like Cohen's D > D-value)
@@ -36,9 +36,9 @@
3636

3737
import nla.TriMatrix nla.TriMatrixDiag
3838
% We're going to use a default filter here
39-
if isequal(significance_filter, false)
40-
significance_filter = TriMatrix(obj.number_of_networks, "logical", TriMatrixDiag.KEEP_DIAGONAL);
41-
significance_filter.v = true(numel(significance_filter.v), 1);
39+
if isequal(effect_size_filter, false)
40+
effect_size_filter = TriMatrix(obj.number_of_networks, "logical", TriMatrixDiag.KEEP_DIAGONAL);
41+
effect_size_filter.v = true(numel(effect_size_filter.v), 1);
4242
end
4343

4444
% Adding on to the plot title if it's a -log10 plot
@@ -53,20 +53,26 @@
5353
if isstring(fdr_correction) || ischar(fdr_correction)
5454
fdr_correction = nla.net.mcc.(erase(fdr_correction, "-"))();
5555
end
56-
p_value_max = fdr_correction.correct(obj.network_atlas, obj.updated_test_options, statistic_input);
56+
57+
[is_sig_vector, p_value_max] = fdr_correction.correct(obj.network_atlas, obj.updated_test_options, statistic_input);
58+
5759
p_value_breakdown_label = fdr_correction.createLabel(obj.network_atlas, obj.updated_test_options,...
5860
statistic_input);
59-
60-
name_label = sprintf("%s %s\nP < %.2g (%s)", obj.network_test_results.test_display_name, plot_title,...
61-
p_value_max, p_value_breakdown_label);
62-
if p_value_max == 0
63-
name_label = sprintf("%s %s\nP = %.2g (%s)", obj.network_test_results.test_display_name, plot_title,...
64-
p_value_max, p_value_breakdown_label);
65-
end
61+
name_label = sprintf("%s %s\n%s", obj.network_test_results.test_display_name, plot_title,...
62+
p_value_breakdown_label);
63+
% else
64+
%
65+
% name_label = sprintf("%s %s\nP < %.2g (%s)", obj.network_test_results.test_display_name, plot_title,...
66+
% p_value_max, p_value_breakdown_label);
67+
% if p_value_max == 0
68+
% name_label = sprintf("%s %s\nP = %.2g (%s)", obj.network_test_results.test_display_name, plot_title,...
69+
% p_value_max, p_value_breakdown_label);
70+
% end
71+
% end
6672

6773
% Filtering if there's a filter provided
6874
significance_plot = TriMatrix(obj.number_of_networks, "logical", TriMatrixDiag.KEEP_DIAGONAL);
69-
significance_plot.v = (statistic_input.v < p_value_max) & significance_filter.v;
75+
significance_plot.v = is_sig_vector & effect_size_filter.v;
7076

7177
% scale values very slightly for display so numbers just below
7278
% the threshold don't show up white but marked significant
@@ -195,8 +201,8 @@ function brainFigureButtonCallback(network1, network2)
195201
end
196202

197203
switch ranking_method
198-
case "nla.RankingMethod.WINKLER"
199-
ranking = "winkler_";
204+
case "nla.RankingMethod.FREEDMAN_LANE"
205+
ranking = "freedman_lane_";
200206
case "nla.RankingMethod.WESTFALL_YOUNG"
201207
ranking = "westfall_young_";
202208
otherwise

0 commit comments

Comments
 (0)