|
2 | 2 | %PERMUTATIONNODE Node which defines one grouping of each permutatino tree |
3 | 3 | % |
4 | 4 | % node = permutationNode(level, input_data, permutation_groups) |
5 | | - % node = One grouping of data for each permutation group. Each group contains the data (functional connectivity) |
6 | | - % along with the index (column) the data is located and the original column |
| 5 | + % node = One grouping of data for each permutation group. Each group contains the data to be permuted |
| 6 | + % along with the index (column) |
7 | 7 | % level = The level of the tree. 0 is the root, 1 the first column of permutation groups, 2 the next... |
8 | | - % input_data = The input data. Currently, this is the functional connectivity |
| 8 | + % input_data = The input data to be permuted |
9 | 9 | % permutation_groups = the columns from the csv file that characterizes the permutation groupings |
10 | 10 | % Each column of the data is 1 permutation grouping. |
11 | 11 | % Each row is one subject/data entry |
|
16 | 16 | children = [] % Nodes that descend from the current node. The column to the right of the current level in permutation groups |
17 | 17 | level = 0 % 0 is root, initial_data |
18 | 18 | parent = false % if false, this is the root of the tree. If not, this is the node that came before |
19 | | - data_with_indexes = {} % The data. 3 cell object. {data (some big array), current index, original index} |
| 19 | + data_with_indexes = {} % The data. 2 cell object. {data (some big array), original index} |
20 | 20 | permutation_groups = [] % The groups that descend off of this one |
21 | 21 | end |
22 | 22 |
|
23 | 23 | properties (SetAccess = immutable) |
24 | | - original_data % matrix of size input_data.length x 3 with each row [data_value, current_index, original_index] |
| 24 | + original_data % matrix of size input_data.length x 3 with each row [data_value, original_index] |
25 | 25 | end |
26 | 26 |
|
27 | 27 | methods |
|
32 | 32 |
|
33 | 33 | if isequal(level, 0) |
34 | 34 | obj.permutation_groups = permutation_groups; |
35 | | - obj.original_data = {input_data, [1:size(input_data, 2)], [1:size(input_data, 2)]}; |
| 35 | + obj.original_data = {input_data, [1:size(input_data)]'}; |
36 | 36 | obj.data_with_indexes = obj.original_data; |
37 | 37 | else |
38 | 38 | size_permutation_groups = size(permutation_groups); |
39 | 39 | if size_permutation_groups(2) > 1 |
40 | 40 | obj.permutation_groups = permutation_groups(:, 2:end); |
41 | 41 | end |
42 | | - functional_connectivity = input_data{1}; |
43 | | - index_length = size(input_data{2}, 2); |
44 | | - current_index = [1:index_length]; |
45 | | - original_index = input_data{3}; |
46 | | - obj.original_data = {functional_connectivity, current_index, original_index}; |
| 42 | + obj.original_data = {input_data{1}, input_data{2}}; |
47 | 43 | obj.data_with_indexes = obj.original_data; |
48 | 44 | end |
| 45 | + |
49 | 46 | if ~isempty(obj.permutation_groups) |
50 | 47 | group_numbers = unique(obj.permutation_groups(:, 1)); |
51 | 48 | for group_number = 1:numel(group_numbers) |
52 | 49 | group_indexes = (obj.permutation_groups(:, 1) == group_numbers(group_number)); |
53 | 50 | temp_permutation_groups = obj.permutation_groups(group_indexes, :); |
54 | 51 | group_input_data = obj.data_with_indexes{1}; |
55 | 52 | group_current_indexes = obj.data_with_indexes{2}; |
56 | | - group_original_indexes = obj.data_with_indexes{3}; |
57 | | - group_data = {group_input_data(:, group_indexes), group_current_indexes(group_indexes), group_original_indexes(group_indexes)}; |
| 53 | + group_data = {group_input_data, group_current_indexes(group_indexes)}; |
58 | 54 | obj.children = [obj.children obj.createNodes(obj.level + 1, temp_permutation_groups, group_data, obj)]; |
59 | 55 | end |
60 | 56 | end |
|
0 commit comments