-
Notifications
You must be signed in to change notification settings - Fork 1
/
braph2memorycapacity_genesis.m
157 lines (135 loc) · 7.35 KB
/
braph2memorycapacity_genesis.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
%BRAPH2GENESIS_WITH_EXCLUSIONS
% This script generates and tests BRAPH2 including or excluding some
% directories and elements, whose list is defined by the variable rollcall.
delete(findall(0, 'type', 'figure'))
close all
clear all %#ok<CLALL>
clc
%% Download braph2genesis
braph2genesis_dir = 'braph2genesis';
if ~exist(braph2genesis_dir, 'dir')
repo = 'https://github.com/braph-software/BRAPH-2/archive/refs/heads/develop.zip';
zipfile = 'BRAPH-2-develop.zip';
websave(zipfile, repo);
% create directory for braph2genesis
folder_tmp = 'tmp_unzip';
folder_genesis = 'braph2genesis';
mkdir(folder_tmp);
mkdir(folder_genesis)
% unzip braph
unzip(zipfile, folder_tmp)
% copy braph2genesis from unzipped folder
copyfile([fileparts(which('braph2memorycapacity_genesis')) filesep 'tmp_unzip' filesep 'BRAPH-2-develop' filesep 'braph2genesis'], ...
[fileparts(which('braph2memorycapacity_genesis')) filesep 'braph2genesis'])
% remove not needed directory and file
rmdir(folder_tmp, 's')
delete(zipfile)
end
addpath(['.' filesep() 'braph2genesis'])
addpath(['.' filesep() 'braph2genesis' filesep() 'genesis'])
%% Move memorycapacity to pipelines folder
copyfile([fileparts(which('braph2memorycapacity_genesis')) filesep 'memorycapacity'], [fileparts(which('braph2genesis')) filesep 'pipelines' filesep 'memorycapacity'])
%% Add here all included and excluded folders and elements
% '-folder' the folder and its elements will be excluded
%
% '+folder' the folder is included, but not its elements
% '+_ElementName.gen.m' the element is included,
% if the folder is included
%
% '+folder*' the folder and its elements are included
% '-_ElementName.gen.m' the element is excluded,
% if the folder and its elements are included
% (by default, the folders are included as '+folder*')
rollcall = { ...
'+util', '+_Exporter.gen.m', '+_Importer.gen.m', ...
'+ds*', '-ds_examples', ...
'+atlas*', ...
'+gt', '+_Measure.gen.m', '+_Graph.gen.m', '+_GraphAdjPF.gen.m', '+_GraphHistPF.gen.m', '+_GraphPP_MDict.gen.m', '+_NoValue.gen.m', ...
'+_MeasurePF.gen.m', '+_MeasurePF_GU.gen.m', '+_MeasurePF_NU.gen.m', '+_MeasurePF_NxPP_Node.gen.m', '+_MeasurePF_xUPP_Layer.gen.m', ...
'+cohort*', ...
'+analysis', '+_AnalyzeEnsemble.gen.m', '+_AnalyzeEnsemblePP_GDict.gen.m', '+_AnalyzeEnsemblePP_MeDict.gen.m', '+_MeasureEnsemble.gen.m', ...
'+_MeasureEnsembleBrainPF.gen.m', '+_MeasureEnsembleBrainPF_GU.gen.m', '+_MeasureEnsembleBrainPF_NU.gen.m', '+_MeasureEnsembleBrainPF_xUPP_Layer.gen.m', ...
'+_MeasureEnsemblePF.gen.m', '+_MeasureEnsemblePF_GU.gen.m', '+_MeasureEnsemblePF_NU.gen.m', '+_MeasureEnsemblePF_NxPP_Node.gen.m', '+_MeasureEnsemblePF_xUPP_Layer.gen.m', ...
'+_PanelPropCellFDR.gen.m', ...
'-nn', ...
'+gui*', '-gui_examples', ...
'+brainsurfs*', ...
'+atlases*', ...
'+graphs', '+_GraphWU.gen.m', ...
'+measures', ...
'-neuralnetworks', ...
'+pipelines', ...
'+connectivity*', '-_AnalyzeEnsemble_CON_BUD.gen.m', '-_AnalyzeEnsemble_CON_BUT.gen.m', ...
'+memorycapacity*', ...
'+test*', ...
'-sandbox' ...
};
%% Genesis With Rollcall
if ispc
fprintf([ ...
'\n' ...
'<strong>@@@@ @@@@ @@@ @@@@ @ @ #### #### ØØØØØ ØØØØ Ø Ø ØØØØ ØØØØ Ø ØØØØ\n</strong>' ...
'<strong>@ @ @ @ @ @ @ @ @ @ # # # Ø Ø ØØ Ø Ø Ø Ø Ø \n</strong>' ...
'<strong>@@@@ @@@@ @@@@@ @@@@ @@@@@ #### # # Ø ØØ ØØØ Ø Ø Ø ØØØ ØØØ Ø ØØØ \n</strong>' ...
'<strong>@ @ @ @ @ @ @ @ @ # # # Ø Ø Ø Ø ØØ Ø Ø Ø Ø\n</strong>' ...
'<strong>@@@@ @ @ @ @ @ @ @ #### # #### ØØØØØ ØØØØ Ø Ø ØØØØ ØØØØ Ø ØØØØ \n</strong>' ...
'\n' ...
' M E M O R Y C A P A C I T Y\n' ...
'\n' ...
]);
else
fprintf([ ...
'\n' ...
' ████ ████ ███ ████ █ █ ▓▓▓▓ ▓▓▓▓ ▒▒▒▒▒ ▒▒▒▒ ▒ ▒ ▒▒▒▒ ▒▒▒▒ ▒ ▒▒▒▒\n' ...
' █ █ █ █ █ █ █ █ █ █ ▓ ▓ ▓ ▒ ▒ ▒▒ ▒ ▒ ▒ ▒ ▒ \n' ...
' ████ ████ █████ ████ █████ ▓▓▓▓ ▓ ▓ ▒ ▒▒ ▒▒▒ ▒ ▒ ▒ ▒▒▒ ▒▒▒ ▒ ▒▒▒ \n' ...
' █ █ █ █ █ █ █ █ █ ▓ ▓ ▓ ▒ ▒ ▒ ▒ ▒▒ ▒ ▒ ▒ ▒\n' ...
' ████ █ █ █ █ █ █ █ ▓▓▓▓ ▓ ▓▓▓▓ ▒▒▒▒▒ ▒▒▒▒ ▒ ▒ ▒▒▒▒ ▒▒▒▒ ▒ ▒▒▒▒ \n' ...
'\n' ...
' M E M O R Y C A P A C I T Y\n' ...
'\n' ...
]);
end
rollcall_per_line = 5;
offset = max(cellfun(@(x) length(x), rollcall)) + 2;
for i = 1:rollcall_per_line:length(rollcall)
cellfun(@(x) fprintf([x repmat(' ', 1, offset - length(x))]), rollcall(i:min(i + rollcall_per_line - 1, length(rollcall))))
fprintf('\n')
end
disp(' ')
target_dir = [fileparts(fileparts(which('braph2genesis'))) filesep 'braph2memorycapacity'];
if exist(target_dir, 'dir')
if input([ ...
'The target directory already exists:\n' ...
target_dir '\n'...
'It will be erased with all its content.\n' ...
'Proceed anyways? (y/n)\n'
], 's') == 'y'
backup_warning_state = warning('off', 'MATLAB:RMDIR:RemovedFromPath');
rmdir(target_dir, 's')
warning(backup_warning_state)
else
disp('Compilation interrupted.')
end
end
if ~exist(target_dir, 'dir')
time_start = tic;
[target_dir, source_dir] = genesis(target_dir, [], 2, rollcall);
addpath(target_dir)
delete([fileparts(which('braph2')) filesep 'pipelines' filesep 'connectivity' filesep 'pipeline_connectivity_analysis_wu.braph2'])
delete([fileparts(which('braph2')) filesep 'pipelines' filesep 'connectivity' filesep 'pipeline_connectivity_comparison_wu.braph2'])
delete([fileparts(which('braph2')) filesep 'pipelines' filesep 'connectivity' filesep 'pipeline_connectivity_analysis_bud.braph2'])
delete([fileparts(which('braph2')) filesep 'pipelines' filesep 'connectivity' filesep 'pipeline_connectivity_analysis_but.braph2'])
delete([fileparts(which('braph2')) filesep 'pipelines' filesep 'connectivity' filesep 'pipeline_connectivity_comparison_bud.braph2'])
delete([fileparts(which('braph2')) filesep 'pipelines' filesep 'connectivity' filesep 'pipeline_connectivity_comparison_but.braph2'])
time_end = toc(time_start);
disp( 'BRAPH 2 is now fully compiled and ready to be used.')
disp(['Its compilation has taken ' int2str(time_end) '.' int2str(mod(time_end, 1) * 10) 's'])
disp('')
braph2(false)
%test_braph2
test_GlobalMemoryCapacity
test_NodalMemoryCapacity
% remove genesis directory
rmdir(braph2genesis_dir, 's')
end