diff --git a/CHANGELOG.md b/CHANGELOG.md index 84ca5bd3..3e526c58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* [ENH] add support for one-way ANOVA across groups at the group level #1296 by @Remi-Gau +* [ENH] allow for 2 sample T-Test, within group T-Test and one-way ANOVA to ne more flexible with respect to what praticipants.tsv column to use to allocate subjects in each group #1296 by @Remi-Gau * [ENH] make `addConfoundsToDesignMatrix` a method of `BidsModel` #1294 by @Remi-Gau * [ENH] add Apptainer definition #1254 by @Remi-Gau and @monique2208 * [ENH] allow to copy anat only on raw datasets #1181 by @Remi-Gau @@ -43,7 +45,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - * [ENH] align specification of F contrasts on the BIDS stats model: they should now be specified as a 2D matrix and not a 1D vector. #1276 @Remi-Gau * [DOC] change theme and structure of the documentation #1256 @Remi-Gau * [REF] Refactor and update CLI in #1096 @Remi-Gau diff --git a/src/batches/stats/setBatchFactorialDesign.m b/src/batches/stats/setBatchFactorialDesign.m index 0b055df1..0f5534af 100644 --- a/src/batches/stats/setBatchFactorialDesign.m +++ b/src/batches/stats/setBatchFactorialDesign.m @@ -32,8 +32,6 @@ return end - [~, opt] = getData(opt, opt.dir.preproc); - printBatchName(sprintf('specify group level fmri model for node "%s"', nodeName), opt); % now we fetch the contrast for each subject and allocate them in the batch diff --git a/src/workflows/stats/bidsRFX.m b/src/workflows/stats/bidsRFX.m index 3d1a9c69..be1bf060 100644 --- a/src/workflows/stats/bidsRFX.m +++ b/src/workflows/stats/bidsRFX.m @@ -90,6 +90,8 @@ case 'rfx' + [~, opt] = getData(opt, opt.dir.preproc); + participants = bids.util.tsvread(fullfile(opt.dir.raw, 'participants.tsv')); matlabbatch = {}; diff --git a/tests/data/models/model-vislocalizerSeveralDatasetLevels_smdl.json b/tests/data/models/model-vislocalizerSeveralDatasetLevels_smdl.json index 546c8043..bc419f8c 100644 --- a/tests/data/models/model-vislocalizerSeveralDatasetLevels_smdl.json +++ b/tests/data/models/model-vislocalizerSeveralDatasetLevels_smdl.json @@ -171,5 +171,19 @@ ] } } + ], + "Edges": [ + { + "Source": "run_level", + "Destination": "subject_level" + }, + { + "Source": "subject_level", + "Destination": "simple contrast" + }, + { + "Source": "subject_level", + "Destination": "complex contrast" + } ] } diff --git a/tests/data/models/model-vismotionNoOverWrite_smdl.json b/tests/data/models/model-vismotionNoOverWrite_smdl.json index 6ed049f3..1d4d6fbc 100644 --- a/tests/data/models/model-vismotionNoOverWrite_smdl.json +++ b/tests/data/models/model-vismotionNoOverWrite_smdl.json @@ -227,5 +227,27 @@ } ] } + ], + "Edges": [ + { + "Source": "run_level", + "Destination": "subject_level" + }, + { + "Source": "subject_level", + "Destination": "simple contrast" + }, + { + "Source": "subject_level", + "Destination": "complex contrast" + }, + { + "Source": "subject_level", + "Destination": "within_group" + }, + { + "Source": "subject_level", + "Destination": "between_groups" + } ] } diff --git a/tests/data/models/model-vismotionSeveralDatasetLevel_smdl.json b/tests/data/models/model-vismotionSeveralDatasetLevel_smdl.json index e28a198b..ea24e9d5 100644 --- a/tests/data/models/model-vismotionSeveralDatasetLevel_smdl.json +++ b/tests/data/models/model-vismotionSeveralDatasetLevel_smdl.json @@ -160,5 +160,19 @@ ] } } + ], + "Edges": [ + { + "Source": "run_level", + "Destination": "subject_level" + }, + { + "Source": "subject_level", + "Destination": "simple contrast" + }, + { + "Source": "subject_level", + "Destination": "complex contrast" + } ] } diff --git a/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign.m b/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign.m index 28fbce85..74036151 100644 --- a/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign.m +++ b/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign.m @@ -8,12 +8,45 @@ initTestSuite; end +function test_setBatchFactorialDesign_complex_alone() + + markTestAs('slow'); + + opt = setOptions('vismotion', {'^01'}, 'pipelineType', 'stats'); + + [~, opt] = getData(opt, opt.dir.preproc); + + opt.model.file = spm_file(opt.model.file, ... + 'basename', ... + 'model-vismotionSeveralDatasetLevel_smdl'); + + opt.model.bm = BidsModel('file', opt.model.file); + + datasetNode = opt.model.bm.get_nodes('Name', 'complex contrast'); + + matlabbatch = {}; + matlabbatch = setBatchFactorialDesign(matlabbatch, opt, datasetNode.Name); + + % (1 contrasts) specified at the dataset level * 2 + % batches (design specification + figure design matrix) + assertEqual(numel(matlabbatch), 2); + + % check that directory name contains: + % desc-Node(dataset).name_contrast_contrastName + [~, dir] = fileparts(matlabbatch{1}.spm.stats.factorial_design.dir{1}); + assertEqual(dir, ... + [basedirName 'node-complexContrast_contrast-VisMotGtVisStat']); + +end + function test_setBatchFactorialDesign_within_group() markTestAs('slow'); opt = setOptions('vislocalizer', '', 'pipelineType', 'stats'); + [~, opt] = getData(opt, opt.dir.preproc); + opt.model.file = spm_file(opt.model.file, ... 'basename', ... 'model-vislocalizerWithinGroup_smdl'); @@ -37,6 +70,8 @@ function test_setBatchFactorialDesign_complex() opt = setOptions('vismotion', {'^01'}, 'pipelineType', 'stats'); + [~, opt] = getData(opt, opt.dir.preproc); + opt.model.file = spm_file(opt.model.file, ... 'basename', ... 'model-vismotionSeveralDatasetLevel_smdl'); @@ -83,6 +118,8 @@ function test_setBatchFactorialDesign_basic() opt = setOptions('vismotion', {'01' 'ctrl01'}, 'pipelineType', 'stats'); + [~, opt] = getData(opt, opt.dir.preproc); + datasetNode = opt.model.bm.get_nodes('Level', 'dataset'); opt.model.bm.Nodes{3}.Model.Options = rmfield(opt.model.bm.Nodes{3}.Model.Options, ... diff --git a/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign_3_groups.m b/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign_3_groups.m index 8d925969..5d814c2c 100644 --- a/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign_3_groups.m +++ b/tests/tests_slow/tests_batches/stats/test_setBatchFactorialDesign_3_groups.m @@ -13,6 +13,8 @@ function test_setBatchFactorialDesign_between_3_groups() opt = setOptions('3_groups', '', 'pipelineType', 'stats'); opt.verbosity = 0; + [~, opt] = getData(opt, opt.dir.preproc); + matlabbatch = {}; [matlabbatch, ~, ~] = setBatchFactorialDesign(matlabbatch, ... opt, ... diff --git a/tests/tests_workflows/stats/test_bidsRFX_3_groups.m b/tests/tests_workflows/stats/test_bidsRFX_3_groups.m index f6a77bae..97f52366 100644 --- a/tests/tests_workflows/stats/test_bidsRFX_3_groups.m +++ b/tests/tests_workflows/stats/test_bidsRFX_3_groups.m @@ -27,6 +27,8 @@ function test_bidsRFX_one_way_anova_contrast() opt = setOptions('3_groups', '', 'pipelineType', 'stats'); + [~, opt] = getData(opt, opt.dir.preproc); + opt.model.bm = BidsModel('file', opt.model.file); opt.verbosity = 0;