Skip to content

Commit 72096f3

Browse files
author
Yu-Wei Chang
committed
Revert "Merge branch 'develop' into alpha2_MultiplexPipelines"
This reverts commit 699938e, reversing changes made to 5c9cca0.
1 parent 699938e commit 72096f3

File tree

566 files changed

+5604
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

566 files changed

+5604
-1
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
%EXAMPLE_CON_FUN_MP_GA_BUD
2+
% Script example pipeline CON FUN MP GA BUD
3+
4+
clear variables %#ok<*NASGU>
5+
6+
%% Load BrainAtlas
7+
im_ba = ImporterBrainAtlasXLS( ...
8+
'FILE', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'aal90_atlas.xlsx'], ...
9+
'WAITBAR', true ...
10+
);
11+
12+
ba = im_ba.get('BA');
13+
14+
%% Load Groups of SubjectCON
15+
im_gr1 = ImporterGroupSubjectCON_XLS( ...
16+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'connectivity' filesep 'GroupName1'], ...
17+
'BA', ba, ...
18+
'WAITBAR', true ...
19+
);
20+
21+
gr1_CON = im_gr1.get('GR');
22+
23+
im_gr2 = ImporterGroupSubjectCON_XLS( ...
24+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'connectivity' filesep 'GroupName2'], ...
25+
'BA', ba, ...
26+
'WAITBAR', true ...
27+
);
28+
29+
gr2_CON = im_gr2.get('GR');
30+
31+
%% Load Groups of SubjectFUN
32+
im_gr1 = ImporterGroupSubjectFUN_XLS( ...
33+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'functional' filesep 'GroupName1'], ...
34+
'BA', ba, ...
35+
'WAITBAR', true ...
36+
);
37+
38+
gr1_FUN = im_gr1.get('GR');
39+
40+
im_gr2 = ImporterGroupSubjectFUN_XLS( ...
41+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'functional' filesep 'GroupName2'], ...
42+
'BA', ba, ...
43+
'WAITBAR', true ...
44+
);
45+
46+
gr2_FUN = im_gr2.get('GR');
47+
48+
%% Combine Groups of SubjectCON with Groups of SubjectFUN
49+
co_gr1 = CombineGroups_CON_FUN( ...
50+
'GR1', gr1_CON, ...
51+
'GR2', gr1_FUN, ...
52+
'WAITBAR', true ...
53+
);
54+
55+
gr1 = co_gr1.get('GR');
56+
57+
co_gr2 = CombineGroups_CON_FUN( ...
58+
'GR1', gr2_CON, ...
59+
'GR2', gr2_FUN, ...
60+
'WAITBAR', true ...
61+
);
62+
63+
gr2 = co_gr2.get('GR');
64+
65+
%% Analysis CON FUN MP GA BUD
66+
densities = [0 100];
67+
68+
a_BUD1 = AnalyzeGroup_CON_FUN_MP_GA_BUD( ...
69+
'GR', gr1, ...
70+
'DENSITIES', densities ...
71+
);
72+
73+
a_BUD2 = AnalyzeGroup_CON_FUN_MP_GA_BUD( ...
74+
'GR', gr2, ...
75+
'DENSITIES', densities ...
76+
);
77+
78+
% measure calculation
79+
g_BUD1 = a_BUD1.get('G');
80+
degree_BUD1 = g_BUD1.getMeasure('Degree').get('M');
81+
degree_av_BUD1 = g_BUD1.getMeasure('DegreeAv').get('M');
82+
distance_BUD1 = g_BUD1.getMeasure('Distance').get('M');
83+
84+
g_BUD2 = a_BUD2.get('G');
85+
degree_BUD2 = g_BUD2.getMeasure('Degree').get('M');
86+
degree_av_BUD2 = g_BUD2.getMeasure('DegreeAv').get('M');
87+
distance_BUD2 = g_BUD2.getMeasure('Distance').get('M');
88+
89+
% comparison
90+
c_BUD = CompareGroup( ...
91+
'P', 10, ...
92+
'A1', a_BUD1, ...
93+
'A2', a_BUD2, ...
94+
'WAITBAR', true, ...
95+
'VERBOSE', false, ...
96+
'MEMORIZE', true ...
97+
);
98+
99+
degree_BUD_diff = c_BUD.getComparison('Degree').get('DIFF');
100+
degree_BUD_p1 = c_BUD.getComparison('Degree').get('P1');
101+
degree_BUD_p2 = c_BUD.getComparison('Degree').get('P2');
102+
degree_BUD_cil = c_BUD.getComparison('Degree').get('CIL');
103+
degree_BUD_ciu = c_BUD.getComparison('Degree').get('CIU');
104+
105+
degree_av_BUD_diff = c_BUD.getComparison('DegreeAv').get('DIFF');
106+
degree_av_BUD_p1 = c_BUD.getComparison('DegreeAv').get('P1');
107+
degree_av_BUD_p2 = c_BUD.getComparison('DegreeAv').get('P2');
108+
degree_av_BUD_cil = c_BUD.getComparison('DegreeAv').get('CIL');
109+
degree_av_BUD_ciu = c_BUD.getComparison('DegreeAv').get('CIU');
110+
111+
distance_BUD_diff = c_BUD.getComparison('Distance').get('DIFF');
112+
distance_BUD_p1 = c_BUD.getComparison('Distance').get('P1');
113+
distance_BUD_p2 = c_BUD.getComparison('Distance').get('P2');
114+
distance_BUD_cil = c_BUD.getComparison('Distance').get('CIL');
115+
distance_BUD_ciu = c_BUD.getComparison('Distance').get('CIU');
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
%EXAMPLE_CON_FUN_MP_GA_WU
2+
% Script example pipeline CON FUN MP GA WU
3+
4+
clear variables %#ok<*NASGU>
5+
6+
%% Load BrainAtlas
7+
im_ba = ImporterBrainAtlasXLS( ...
8+
'FILE', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'aal90_atlas.xlsx'], ...
9+
'WAITBAR', true ...
10+
);
11+
12+
ba = im_ba.get('BA');
13+
14+
%% Load Groups of SubjectCON
15+
im_gr1 = ImporterGroupSubjectCON_XLS( ...
16+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'connectivity' filesep 'GroupName1'], ...
17+
'BA', ba, ...
18+
'WAITBAR', true ...
19+
);
20+
21+
gr1_CON = im_gr1.get('GR');
22+
23+
im_gr2 = ImporterGroupSubjectCON_XLS( ...
24+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'connectivity' filesep 'GroupName2'], ...
25+
'BA', ba, ...
26+
'WAITBAR', true ...
27+
);
28+
29+
gr2_CON = im_gr2.get('GR');
30+
31+
%% Load Groups of SubjectFUN
32+
im_gr1 = ImporterGroupSubjectFUN_XLS( ...
33+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'functional' filesep 'GroupName1'], ...
34+
'BA', ba, ...
35+
'WAITBAR', true ...
36+
);
37+
38+
gr1_FUN = im_gr1.get('GR');
39+
40+
im_gr2 = ImporterGroupSubjectFUN_XLS( ...
41+
'DIRECTORY', [fileparts(which('SubjectCON_FUN_MP')) filesep 'example data CON-FUN_MP' filesep 'xls' filesep 'functional' filesep 'GroupName2'], ...
42+
'BA', ba, ...
43+
'WAITBAR', true ...
44+
);
45+
46+
gr2_FUN = im_gr2.get('GR');
47+
48+
%% Combine Groups of SubjectCON with Groups of SubjectFUN
49+
co_gr1 = CombineGroups_CON_FUN( ...
50+
'GR1', gr1_CON, ...
51+
'GR2', gr1_FUN, ...
52+
'WAITBAR', true ...
53+
);
54+
55+
gr1 = co_gr1.get('GR');
56+
57+
co_gr2 = CombineGroups_CON_FUN( ...
58+
'GR1', gr2_CON, ...
59+
'GR2', gr2_FUN, ...
60+
'WAITBAR', true ...
61+
);
62+
63+
gr2 = co_gr2.get('GR');
64+
65+
%% Analysis CON FUN MP GA WU
66+
a_WU1 = AnalyzeGroup_CON_FUN_MP_GA_WU( ...
67+
'GR', gr1 ...
68+
);
69+
70+
a_WU2 = AnalyzeGroup_CON_FUN_MP_GA_WU( ...
71+
'GR', gr2 ...
72+
);
73+
74+
% measure calculation
75+
g_WU1 = a_WU1.get('G');
76+
degree_WU1 = g_WU1.getMeasure('Degree').get('M');
77+
degree_av_WU1 = g_WU1.getMeasure('DegreeAv').get('M');
78+
distance_WU1 = g_WU1.getMeasure('Distance').get('M');
79+
80+
g_WU2 = a_WU2.get('G');
81+
degree_WU2 = g_WU2.getMeasure('Degree').get('M');
82+
degree_av_WU2 = g_WU2.getMeasure('DegreeAv').get('M');
83+
distance_WU2 = g_WU2.getMeasure('Distance').get('M');
84+
85+
% comparison
86+
c_WU = CompareGroup( ...
87+
'P', 10, ...
88+
'A1', a_WU1, ...
89+
'A2', a_WU2, ...
90+
'WAITBAR', true, ...
91+
'VERBOSE', false, ...
92+
'MEMORIZE', true ...
93+
);
94+
95+
degree_WU_diff = c_WU.getComparison('Degree').get('DIFF');
96+
degree_WU_p1 = c_WU.getComparison('Degree').get('P1');
97+
degree_WU_p2 = c_WU.getComparison('Degree').get('P2');
98+
degree_WU_cil = c_WU.getComparison('Degree').get('CIL');
99+
degree_WU_ciu = c_WU.getComparison('Degree').get('CIU');
100+
101+
degree_av_WU_diff = c_WU.getComparison('DegreeAv').get('DIFF');
102+
degree_av_WU_p1 = c_WU.getComparison('DegreeAv').get('P1');
103+
degree_av_WU_p2 = c_WU.getComparison('DegreeAv').get('P2');
104+
degree_av_WU_cil = c_WU.getComparison('DegreeAv').get('CIL');
105+
degree_av_WU_ciu = c_WU.getComparison('DegreeAv').get('CIU');
106+
107+
distance_WU_diff = c_WU.getComparison('Distance').get('DIFF');
108+
distance_WU_p1 = c_WU.getComparison('Distance').get('P1');
109+
distance_WU_p2 = c_WU.getComparison('Distance').get('P2');
110+
distance_WU_cil = c_WU.getComparison('Distance').get('CIL');
111+
distance_WU_ciu = c_WU.getComparison('Distance').get('CIU');
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
%% Pipeline Connectivity-Functional Multiplex Group-Average Comparison WU
2+
3+
% This is the pipeline script to compare two groups of subjects using connectivity-functional multiplex data averaged by group and weighted undirected graphs.
4+
% 1. It loads a brain atlas from an XLS file (e.g., desikan_atlas.xlsx).
5+
% 2.1 It loads the connectivity data of two groups of subjects from two directories (e.g., GroupName1 and GroupName2) containing XLS files of each subject.
6+
% 2.2 It loads the functional data of two groups of subjects from two directories (e.g., GroupName1 and GroupName2) containing XLS files of each subject.
7+
% 3. It analyzes the first group using connectivity-functional multiplex analyses (CON_FUN_MP) based on weighted undirected graphs (WU) averaged by group (GA).
8+
% 4. It analyzes the second group using the same parameters selected for the first group.
9+
% 5. It compares the results of the two analyses.
10+
11+
%% Brain Atlas
12+
ba = ImporterBrainAtlasXLS('WAITBAR', true).get('BA'); % Load a Brain Atlas XLS % Brain Atlas
13+
14+
%% Groups
15+
gr1 = ImporterGroupSubjectCON_FUN_MP_XLS('BA', ba, 'WAITBAR', true).get('GR'); % Load Group CON_FUN_MP 1 from XLS % Group CON_FUN_MP 1
16+
gr2 = ImporterGroupSubjectCON_FUN_MP_XLS('BA', ba, 'WAITBAR', true).get('GR'); % Load Group CON_FUN_MP 2 from XLS % Group CON_FUN_MP 2
17+
18+
%% Analysis 1
19+
a_WU1 = AnalyzeGroup_CON_FUN_MP_GA_WU('GR', gr1); % Analyze Group 1 % Group 1 Analysis
20+
21+
%% Analysis 2
22+
a_WU2 = AnalyzeGroup_CON_FUN_MP_GA_WU('GR', gr2, 'TEMPLATE', a_WU1); % Analyze Group 2 % Group 2 Analysis
23+
24+
%% Comparison
25+
c_WU = CompareGroup('P', 10, 'A1', a_WU1, 'A2', a_WU2, 'MEMORIZE', true); % Compare Groups % Group Comparison
26+
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
%% ¡header!
2+
CombineGroups_CON_FUN < Element (co, combines the CON subject group with the FUN subject group) combines a group of subjects with connectivity data with a group of subjects with functional data.
3+
%%% ¡description!
4+
CombineGroups_CON_FUN combines a group of subjects with connectivity data with a group of subjects with functional data.
5+
Combines the data uploaded through the connectivity and functional workflows. The ID and covariates of subjects are
6+
copied from the first group, in this case connectivity.
7+
8+
%%% ¡seealso!
9+
Element
10+
11+
%% ¡props!
12+
13+
%%% ¡prop!
14+
ID (data, string) is a few-letter code for the group combiner.
15+
16+
%%% ¡prop!
17+
LABEL (metadata, string) is an extended label of the group combiner.
18+
19+
%%% ¡prop!
20+
NOTES (metadata, string) are some specific notes about the group combiner.
21+
22+
%%% ¡prop!
23+
WAITBAR (metadata, logical) detemines whether to show the waitbar.
24+
25+
%%% ¡prop!
26+
GR1 (data, item) is a group of subjects with connectivity data.
27+
%%%% ¡default!
28+
Group('SUB_CLASS', 'SubjectCON')
29+
30+
%%% ¡prop!
31+
GR2 (data, item) is a group of subjects with functional data.
32+
%%%% ¡default!
33+
Group('SUB_CLASS', 'SubjectFUN')
34+
35+
%%% ¡prop!
36+
GR (result, item) is a group of subjects with connectivity and functional data.
37+
%%%% ¡settings!
38+
'Group'
39+
%%%% ¡check_value!
40+
check = any(strcmp(value.get(Group.SUB_CLASS_TAG), subclasses('SubjectCON_FUN_MP', [], [], true)));
41+
%%%% ¡default!
42+
Group('SUB_CLASS', 'SubjectCON_FUN_MP', 'SUB_DICT', IndexedDictionary('IT_CLASS', 'SubjectCON_FUN_MP'))
43+
%%%% ¡calculate!
44+
wb = braph2waitbar(co.get('WAITBAR'), 0, 'Combining subject groups ...');
45+
46+
% creates empty Group
47+
gr = Group( ...
48+
'SUB_CLASS', 'SubjectCON_FUN_MP', ...
49+
'SUB_DICT', IndexedDictionary('IT_CLASS', 'SubjectCON_FUN_MP') ...
50+
);
51+
52+
% get connectivity and functional groups
53+
group1 = co.get('GR1');
54+
group2 = co.get('GR2');
55+
56+
% assert that the 2 groups have the same number of subjects
57+
assert(isequal(group1.get('SUB_DICT').length(), group2.get('SUB_DICT').length()), ...
58+
[BRAPH2.STR ':CombineGroups_CON_FUN:' BRAPH2.BUG_ERR], ...
59+
['The 2 groups to be combined need to have the same number of subjects while ', ...
60+
'group 1 has ' tostring(group1.get('SUB_DICT').length()) ' subjects and group 2 has ' tostring(group2.get('SUB_DICT').length()) ' subjects.'])
61+
62+
% sets group props
63+
gr.set( ...
64+
'ID', group1.get('ID'), ...
65+
'LABEL', group1.get('LABEL'), ...
66+
'NOTES', 'Combined group with CON and FUN data'...
67+
);
68+
69+
subdict = gr.get('SUB_DICT');
70+
subdict_gr1 = group1.get('SUB_DICT');
71+
subdict_gr2 = group2.get('SUB_DICT');
72+
73+
for i = 1:1:group1.get('SUB_DICT').length()
74+
braph2waitbar(wb, .30 + .70 * i / group1.get('SUB_DICT').length(), ['Combining subject ' num2str(i) ' of ' num2str(group1.get('SUB_DICT').length()) ' ...'])
75+
76+
sub1 = subdict_gr1.getItem(i);
77+
sub2 = subdict_gr2.getItem(i);
78+
CON_FUN_MP = cell(2, 1);
79+
CON_FUN_MP(1) = {sub1.get('CON')};
80+
CON_FUN_MP(2) = {sub2.get('FUN')};
81+
82+
% add CON_FUN_MP subject
83+
sub = SubjectCON_FUN_MP( ...
84+
'ID', sub1.get('ID'), ...
85+
'BA', sub1.get('BA'), ...
86+
'CON_FUN_MP', CON_FUN_MP, ...
87+
'age', sub1.get('age'), ...
88+
'sex', sub1.get('sex') ...
89+
);
90+
subdict.add(sub);
91+
end
92+
gr.set('sub_dict', subdict);
93+
94+
value = gr;
95+
96+
braph2waitbar(wb, 'close')

0 commit comments

Comments
 (0)