Skip to content

Commit 49aaf25

Browse files
committed
correct cohort for tests
1 parent 30a320b commit 49aaf25

10 files changed

Lines changed: 14 additions & 62 deletions

File tree

braph2/workflows/Connectivity/SubjectCON.m

Lines changed: 10 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -262,30 +262,23 @@ function update_brainatlases(sub, atlases)
262262
% load subjects
263263
for i = 1:1:length(files)
264264
% read file
265-
[num, ~, raw] = xlsread(fullfile(path, files(i).name));
265+
raw = readmatrix(fullfile(path, files(i).name));
266266
atlases = cohort.getBrainAtlases();
267267
% get age
268268

269269
% create subject
270270
sub_id = erase(files(i).name, '.xlsx');
271271
sub_id = erase(sub_id, '.xls');
272272
subject = Subject.getSubject(subject_class, ...
273-
sub_id, char(raw{1, 1}), char(raw{2, 1}), atlases, ...
274-
'CON', num);
273+
sub_id, '', '', atlases, ...
274+
'CON', raw);
275275

276276
cohort.getSubjects().add(subject.getID(), subject);
277277
subjects{i} = subject; %#ok<AGROW>
278-
end
279-
280-
% retrieve group information
281-
file_group = [directory filesep() sub_folders(j).name filesep() 'group_info.txt'];
282-
group_raw = textread(file_group, '%s', 'delimiter', '\t', 'whitespace', ''); %#ok<DTXTRD>
283-
group_id = group_raw{1, 1};
284-
group_label = group_raw{2, 1};
285-
group_notes = group_raw{3, 1};
278+
end
286279

287280
% creates a group per subfolder
288-
group = Group(subject_class, group_id, group_label, group_notes, subjects);
281+
group = Group(subject_class, ['Group_' num2str(j)], '', '', subjects);
289282
cohort.getGroups().add(group.getID(), group, j);
290283
end
291284
end
@@ -319,24 +312,9 @@ function save_to_xls(cohort, varargin)
319312
mkdir(root_directory, cohort.getGroups().getValue(i).getID());
320313
end
321314

322-
% cohort info
323-
file_info_cohort = [root_directory filesep() 'cohort_info.txt'];
324-
if ~isfile(file_info_cohort)
325-
cohort_info = cell(3, 1);
326-
cohort_info{1, 1} = cohort.getID();
327-
cohort_info{2, 1} = cohort.getLabel();
328-
cohort_info{3, 1} = cohort.getNotes();
329-
writecell(cohort_info, file_info_cohort, 'Delimiter', '\t');
330-
end
331-
332315
% group info
333316
group = cohort.getGroups().getValue(i);
334-
group_info = cell(3, 1);
335-
group_info{1, 1} = group.getID();
336-
group_info{2, 1} = group.getLabel();
337-
group_info{3, 1} = group.getNotes();
338-
writecell(group_info, [root_directory filesep() group.getID() filesep() 'group_info.txt'], 'Delimiter', '\t');
339-
317+
340318
% get subject info
341319
subjects_list = group.getSubjects();
342320
for j = 1:1:group.subjectnumber()
@@ -352,9 +330,9 @@ function save_to_xls(cohort, varargin)
352330

353331
% save
354332
file = [root_directory filesep() cohort.getGroups().getValue(i).getID() filesep() id '.xlsx'];
355-
writematrix(string(label), file, 'Sheet', 1, 'Range', 'A1');
356-
writematrix(string(notes), file, 'Sheet', 1, 'Range', 'A2');
357-
writetable(tab, file, 'Sheet', 1, 'WriteVariableNames', 0, 'Range', 'A3');
333+
% writematrix(string(label), file, 'Sheet', 1, 'Range', 'A1');
334+
% writematrix(string(notes), file, 'Sheet', 1, 'Range', 'A2');
335+
writetable(tab, file, 'Sheet', 1, 'WriteVariableNames', 0, 'Range', 'A1');
358336
end
359337
end
360338
end
@@ -476,43 +454,17 @@ function save_to_txt(cohort, varargin)
476454
for i=1:1:cohort.getGroups().length()
477455
mkdir(root_directory, cohort.getGroups().getValue(i).getID());
478456

479-
% cohort info
480-
file_info_cohort = [root_directory filesep() 'cohort_info.txt'];
481-
if ~isfile(file_info_cohort)
482-
cohort_info = cell(3, 1);
483-
cohort_info{1, 1} = cohort.getID();
484-
cohort_info{2, 1} = cohort.getLabel();
485-
cohort_info{3, 1} = cohort.getNotes();
486-
writecell(cohort_info, file_info_cohort, 'Delimiter', '\t');
487-
end
488-
489-
% group info
490-
group = cohort.getGroups().getValue(i);
491-
group_info = cell(3, 1);
492-
group_info{1, 1} = group.getID();
493-
group_info{2, 1} = group.getLabel();
494-
group_info{3, 1} = group.getNotes();
495-
writecell(group_info, [root_directory filesep() group.getID() filesep() 'group_info.txt'], 'Delimiter', '\t');
496-
497457
% get info
498458
group = cohort.getGroups().getValue(i);
499459
subjects_list = group.getSubjects();
500460
for j = 1:1:group.subjectnumber()
501461
% get subject data
502462
subject = subjects_list{j};
503463
id = subject.getID();
504-
label = subject.getLabel();
505-
notes = subject.getNotes();
506464
data = subject.getData('CON').getValue();
507465

508466
% create table
509-
extra_info = cell(2, size(data, 1));
510-
extra_info{1, 1} = label;
511-
extra_info{2, 1} = notes;
512-
tab = [
513-
extra_info;
514-
num2cell(data)
515-
];
467+
tab = num2cell(data);
516468

517469
% save
518470
file = [root_directory filesep() cohort.getGroups().getValue(i).getID() filesep() id '.txt'];
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

braph2/workflows/Connectivity/test_AnalysisCON_BUD.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
group = group1;
146146

147147
number_of_randomizations = 10;
148-
calculated_randomcomparison = analysis.getRandomComparison(measure, group, 'RandomComparisonCON.RandomizationNumber', number_of_randomizations);
148+
calculated_randomcomparison = analysis.getRandomComparison(measure, group, 'RandomizationNumber', number_of_randomizations);
149149

150150
assert(~isempty(calculated_randomcomparison), ...
151151
[BRAPH2.STR ':AnalysisCON_BUD:' BRAPH2.BUG_FUNC], ...

braph2/workflows/Connectivity/test_AnalysisCON_BUT.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
group = group1;
146146

147147
number_of_randomizations = 10;
148-
calculated_randomcomparison = analysis.getRandomComparison(measure, group, 'RandomComparisonCON.RandomizationNumber', number_of_randomizations);
148+
calculated_randomcomparison = analysis.getRandomComparison(measure, group, 'RandomizationNumber', number_of_randomizations);
149149

150150
assert(~isempty(calculated_randomcomparison), ...
151151
[BRAPH2.STR ':AnalysisCON_BUT:' BRAPH2.BUG_FUNC], ...

braph2/workflows/Connectivity/test_AnalysisCON_WU.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
group = group1;
143143

144144
number_of_randomizations = 10;
145-
calculated_randomcomparison = analysis.getRandomComparison(measure, group, 'RandomComparisonCON.RandomizationNumber', number_of_randomizations);
145+
calculated_randomcomparison = analysis.getRandomComparison(measure, group, 'RandomizationNumber', number_of_randomizations);
146146

147147
assert(~isempty(calculated_randomcomparison), ...
148148
[BRAPH2.STR ':AnalysisCON_WU:' BRAPH2.BUG_FUNC], ...

braph2/workflows/Functional/SubjectFNC.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ function update_brainatlases(sub, atlases)
243243
cohort_notes = raw_cohort{3, 1};
244244
end
245245

246-
% creates cohor
246+
% creates cohort
247247
atlases = tmp;
248248
subject_class = 'SubjectFNC';
249249
cohort = Cohort(cohort_id, cohort_label, cohort_notes, subject_class, atlases, {});

0 commit comments

Comments
 (0)