Skip to content

Commit 1dbffdc

Browse files
AndyEck16Andyactions-user
authored
Net267 remove cohens d effect from user view (#106)
* [NET-267] Hide and disable cohens D, make cohens D calculations zero. Change edge color map to jet(1000) * Exported mlapp files --------- Co-authored-by: Andy <me@something.com> Co-authored-by: Github Action <action@github.com>
1 parent deb88f2 commit 1dbffdc

File tree

8 files changed

+85
-59
lines changed

8 files changed

+85
-59
lines changed

+nla/+gfx/+plots/MatrixPlot.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
figure_size % Size to display. Either nla.gfx.FigSize.SMALL or nla.gfx.FigSize.LARGE
2222
draw_legend % Legend on/off
2323
draw_colorbar % Colorbar on/off
24-
color_map % Colormap to use (enter 'turbo(256)' for default)
24+
color_map % Colormap to use (enter 'jet(1000)' for default)
2525
marked_networks % networks to mark with a symbol
2626
discrete_colorbar % colorbar as discrete. TRUE == discrete, FALSE == continuous
2727
network_clicked_callback % Button function to add to each network. Used for clickable networks
@@ -55,7 +55,7 @@
5555
end
5656

5757
properties (Constant)
58-
colormap_choices = {"Parula", "Turbo", "HSV", "Hot", "Cool", "Spring", "Summer", "Autumn", "Winter", "Gray",...
58+
colormap_choices = {"Jet", "Parula", "Turbo", "HSV", "Hot", "Cool", "Spring", "Summer", "Autumn", "Winter", "Gray",...
5959
"Bone", "Copper", "Pink"}; % Colorbar choices
6060
end
6161

@@ -82,7 +82,7 @@
8282
% figure_margins = nla.gfx.FigMargins.WHITESPACE
8383
% draw_legend = true
8484
% draw_colorbar = true
85-
% color_map = turbo(256)
85+
% color_map = jet(1000)
8686
% lower_limit = -0.3
8787
% upper_limit = 0.3
8888
% x_position = 0
@@ -104,7 +104,7 @@
104104
addParameter(matrix_input_parser, 'figure_margins', nla.gfx.FigMargins.WHITESPACE, @isenum);
105105
addParameter(matrix_input_parser, 'draw_legend', true, @islogical);
106106
addParameter(matrix_input_parser, 'draw_colorbar', true, @islogical);
107-
addParameter(matrix_input_parser, 'color_map', turbo(256));
107+
addParameter(matrix_input_parser, 'color_map', jet(1000)); %reverted to jet(1000) by request
108108
addParameter(matrix_input_parser, 'lower_limit', -0.3, validNumberInput);
109109
addParameter(matrix_input_parser, 'upper_limit', 0.3, validNumberInput);
110110
addParameter(matrix_input_parser, 'x_position', 0, validNumberInput);
763 Bytes
Binary file not shown.

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

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -175,28 +175,41 @@ function getPlotTitle(app)
175175
methods (Access = private)
176176

177177
function cohens_d_filter = createSignificanceFilter(app)
178-
cohens_d_filter = nla.TriMatrix(app.edge_test_options.net_atlas.numNets, "logical", nla.TriMatrixDiag.KEEP_DIAGONAL);
179-
if isequal(app.CohensDThresholdCheckBox.Enable, true) && isequal(app.CohensDThresholdCheckBox.Value, true)
180-
if isequal(app.test_method, "no_permutations") && ~isequal(app.network_test_result.no_permutations, false)
181-
182-
end
183-
if isequal(app.test_method, "full_connectome") && ~isequal(app.network_test_result.full_connectome, false)
184-
cohens_d_filter.v = (app.network_test_result.full_connectome.d.v >= app.network_test_options.d_max);
185-
end
186-
if ~isequal(app.network_test_result.within_network_pair, false) && isfield(app.network_test_result.within_network_pair, "d")...
187-
&& ~isequal(app.test_method, "full_connectome")
188-
cohens_d_filter.v = (app.network_test_result.within_network_pair.d.v >= app.network_test_options.d_max);
189-
end
190-
else
191-
cohens_d_filter.v = true(numel(cohens_d_filter.v), 1);
192-
end
178+
%REMOVE COHENS D FILTERING UNTIL WE DETERMINE CORRECT CALCULATION FOR IT - ADE 2025MAR24
179+
num_nets = app.edge_test_options.net_atlas.numNets;
180+
cohens_d_filter = nla.TriMatrix(num_nets, "logical", nla.TriMatrixDiag.KEEP_DIAGONAL);
181+
cohens_d_filter.v = true(numel(cohens_d_filter.v), 1);
182+
return;
183+
184+
% cohens_d_filter = nla.TriMatrix(app.edge_test_options.net_atlas.numNets, "logical", nla.TriMatrixDiag.KEEP_DIAGONAL);
185+
% if isequal(app.CohensDThresholdCheckBox.Enable, true) && isequal(app.CohensDThresholdCheckBox.Value, true)
186+
% if isequal(app.test_method, "no_permutations") && ~isequal(app.network_test_result.no_permutations, false)
187+
%
188+
% end
189+
% if isequal(app.test_method, "full_connectome") && ~isequal(app.network_test_result.full_connectome, false)
190+
% cohens_d_filter.v = (app.network_test_result.full_connectome.d.v >= app.network_test_options.d_max);
191+
% end
192+
% if ~isequal(app.network_test_result.within_network_pair, false) && isfield(app.network_test_result.within_network_pair, "d")...
193+
% && ~isequal(app.test_method, "full_connectome")
194+
% cohens_d_filter.v = (app.network_test_result.within_network_pair.d.v >= app.network_test_options.d_max);
195+
% end
196+
% else
197+
% cohens_d_filter.v = true(numel(cohens_d_filter.v), 1);
198+
% end
193199
end
194200

195201
function applyScaleChange(app)
196202
progress_bar = uiprogressdlg(app.UIFigure, "Title", "Please Wait", "Message", "Applying Changes...", "Indeterminate", true);
197203
progress_bar.Message = "Chaning scale of existing TriMatrix...";
198204
app.matrix_plot.applyScale(false, false, app.UpperLimitEditField.Value, app.LowerLimitEditField.Value, app.PlotScaleDropDown.Value, app.ColormapDropDown.Value)
199205
end
206+
207+
function hideCohensDControls(app)
208+
app.CohensDThresholdEditField.Visible = false;
209+
app.CohensDThresholdCheckBox.Visible = false;
210+
app.CohensDThresholdEditFieldLabel.Visible = false;
211+
212+
end
200213
end
201214

202215

@@ -213,6 +226,8 @@ function startupFcn(app, network_test_result, edge_test_result, flags, edge_test
213226
test_method = "within_network_pair";
214227
end
215228

229+
app.hideCohensDControls(); %keep cohens d controls in code, but hide from user until we get right calcluations - ADE2025MAR24
230+
216231
app.network_test_result = network_test_result;
217232
app.edge_test_result = edge_test_result;
218233
app.test_method = test_method;
@@ -232,7 +247,7 @@ function startupFcn(app, network_test_result, edge_test_result, flags, edge_test
232247
app.ColormapDropDown.Items = app.colormap_choices;
233248
app.ColormapDropDown.Value = app.colormap_choices{1};
234249

235-
app.drawTriMatrixPlot()
250+
app.drawTriMatrixPlot();
236251
end
237252

238253
% Callback function
@@ -451,13 +466,14 @@ function createComponents(app)
451466
% Create CohensDThresholdEditFieldLabel
452467
app.CohensDThresholdEditFieldLabel = uilabel(app.Panel);
453468
app.CohensDThresholdEditFieldLabel.HorizontalAlignment = 'right';
469+
app.CohensDThresholdEditFieldLabel.Enable = 'off';
454470
app.CohensDThresholdEditFieldLabel.Position = [195 237 118 22];
455471
app.CohensDThresholdEditFieldLabel.Text = 'Cohen''s D Threshold';
456472

457473
% Create CohensDThresholdEditField
458474
app.CohensDThresholdEditField = uieditfield(app.Panel, 'numeric');
475+
app.CohensDThresholdEditField.Enable = 'off';
459476
app.CohensDThresholdEditField.Position = [339 237 52 22];
460-
app.CohensDThresholdEditField.Value = 0.5;
461477

462478
% Create ColormapDropDownLabel
463479
app.ColormapDropDownLabel = uilabel(app.Panel);
@@ -501,9 +517,9 @@ function createComponents(app)
501517

502518
% Create CohensDThresholdCheckBox
503519
app.CohensDThresholdCheckBox = uicheckbox(app.Panel);
520+
app.CohensDThresholdCheckBox.Enable = 'off';
504521
app.CohensDThresholdCheckBox.Text = 'Cohen''s D Threshold';
505522
app.CohensDThresholdCheckBox.Position = [257 207 134 22];
506-
app.CohensDThresholdCheckBox.Value = true;
507523

508524
% Create ROIcentroidsonbrainplotsCheckBox
509525
app.ROIcentroidsonbrainplotsCheckBox = uicheckbox(app.Panel);

+nla/+net/CohenDTest.m

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,40 @@
1515
end
1616

1717
function result_object = run(obj, edge_test_results, network_atlas, result_object)
18-
import nla.TriMatrix nla.TriMatrixDiag
19-
20-
number_of_networks = network_atlas.numNets();
21-
22-
for row = 1:number_of_networks
23-
for column = 1:row
24-
25-
network_rho = edge_test_results.coeff.get(network_atlas.nets(row).indexes,...
26-
network_atlas.nets(column).indexes);
27-
28-
single_sample_d = abs(mean(network_rho)) / std(network_rho);
29-
d = abs((mean(network_rho) - mean(edge_test_results.coeff.v)) / sqrt(((std(network_rho).^2)) +...
30-
(std(edge_test_results.coeff.v).^2)));
31-
32-
if isprop(result_object, "no_permutations") && ~isequal(result_object.no_permutations, false)
33-
result_object.no_permutations.d.set(row, column, single_sample_d);
34-
end
35-
if isprop(result_object, "full_connectome") && ~isequal(result_object.full_connectome, false)
36-
result_object.full_connectome.d.set(row, column, d);
37-
end
38-
if isprop(result_object, "within_network_pair") && ~isequal(result_object.within_network_pair, false)
39-
result_object.within_network_pair.d.set(row, column, single_sample_d);
40-
end
41-
end
42-
end
18+
19+
20+
%DETERMINED THAT CURRENT COHEN'S D CALC IS INVALID
21+
%RETURN WITHOUT MODIFYING EXISTING D PLACEHOLDER VALUE FROM 0
22+
%RECOMMEND THAT, WHEN REENABLED, THIS FN BE CHANGED TO ACCEPT
23+
%VECTOR OF INPUT AND RETURN VECTOR OF OUTPUT RATHER THAN
24+
%RESULTS CLASS
25+
%ADE 2025MAR24
26+
return;
27+
28+
29+
30+
31+
%LEAVING COMMENTED CODE BELOW THAT WOULD MODIFY FIELDS AS DONE
32+
%PREVIOUSLY FOR REFERENCE.
33+
% number_of_networks = network_atlas.numNets();
34+
%
35+
% for row = 1:number_of_networks
36+
% for column = 1:row
37+
%
38+
% if isprop(result_object, "no_permutations") && ~isequal(result_object.no_permutations, false)
39+
% %this_netpair_nonperm_d = COMPUTE NONPERMUTED D HERE;
40+
% result_object.no_permutations.d.set(row, column, this_netpair_nonperm_d);
41+
% end
42+
% if isprop(result_object, "full_connectome") && ~isequal(result_object.full_connectome, false)
43+
% %this_netpair_fullconn_d = COMPUTE FULLCONN D HERE;
44+
% result_object.full_connectome.d.set(row, column, this_netpair_fullconn_d);
45+
% end
46+
% if isprop(result_object, "within_network_pair") && ~isequal(result_object.within_network_pair, false)
47+
% %this_netpair_withinNP_d = COMPUTE WITHIN NET PAIR D HERE
48+
% result_object.within_network_pair.d.set(row, column, this_netpair_withinNP_d);
49+
% end
50+
% end
51+
% end
4352
end
4453
end
4554
end

+nla/TestPool.m

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@
6464
function ranked_results = collateNetworkPermutationResults(obj, nonpermuted_edge_test_results, network_atlas, nonpermuted_network_test_results,...
6565
permuted_network_test_results, network_test_options)
6666

67-
% Run Cohen's D
68-
cohen_d_test = nla.net.CohenDTest();
67+
6968

7069
% Warning: Hacky code. Because of the way non-permuted network tests and permuted are called from the front, they are stored
7170
% in different objects. (Notice the input argument for non-permuted network results). Eventually, it should probably be done
@@ -78,10 +77,15 @@
7877
end
7978
end
8079
end
81-
for test_index = 1:numNetTests(obj)
82-
permuted_network_test_results{test_index} = cohen_d_test.run(nonpermuted_edge_test_results, network_atlas,...
83-
permuted_network_test_results{test_index});
84-
end
80+
81+
% REMOVE CALL TO COHENS D UNTIL WE DETERMINE CORRECT CALC FOR IT ADE 2025MAR24
82+
% Run Cohen's D
83+
% cohen_d_test = nla.net.CohenDTest();
84+
% for test_index = 1:numNetTests(obj)
85+
%
86+
% permuted_network_test_results{test_index} = cohen_d_test.run(nonpermuted_edge_test_results, network_atlas,...
87+
% permuted_network_test_results{test_index});
88+
% end
8589

8690
ranked_results = obj.rankResults(network_test_options, permuted_network_test_results, network_atlas.numNetPairs());
8791
end
@@ -274,11 +278,11 @@
274278
end
275279

276280
function ranked_results = rankResults(obj, input_options, permuted_network_results, number_of_network_pairs)
277-
import nla.net.ResultRank
281+
278282

279283
ranked_results = permuted_network_results;
280284
for test = 1:numNetTests(obj)
281-
ranker = ResultRank(permuted_network_results{test}, number_of_network_pairs);
285+
ranker = nla.net.ResultRank(permuted_network_results{test}, number_of_network_pairs);
282286
ranked_results_object = ranker.rank();
283287
ranked_results{test} = ranked_results_object;
284288
if any(strcmp(ranked_results{test}.test_name, obj.correlation_input_tests))

NLAResult.mlapp

-83 Bytes
Binary file not shown.

NLAResult_exported.m

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,7 @@ function initFromResult(app, result, file_name, ~, old_data)
293293
app.results = false;
294294
end
295295

296-
if ~islogical(result.network_test_results)
297-
app.genadjustableNetParams();
298-
end
296+
299297
end
300298

301299
function enableNetButtons(app, val)
@@ -416,7 +414,6 @@ function RunButtonPushed(app, event)
416414
drawnow();
417415

418416
app.setNesting();
419-
app.genadjustableNetParams();
420417

421418
close(prog);
422419
end

NLA_GUI.mlapp

8.02 KB
Binary file not shown.

0 commit comments

Comments
 (0)