From 1ac7267fbd4e381488048bf4ae66d6ef5f64799d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Cl=C3=A9net?= Date: Tue, 17 Oct 2023 11:24:50 +0200 Subject: [PATCH] Group analysis workflow bug --- narps_open/pipelines/team_08MQ.py | 80 ++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 11 deletions(-) diff --git a/narps_open/pipelines/team_08MQ.py b/narps_open/pipelines/team_08MQ.py index d5919a4f..43dee1bd 100644 --- a/narps_open/pipelines/team_08MQ.py +++ b/narps_open/pipelines/team_08MQ.py @@ -267,7 +267,30 @@ def get_preprocessing(self): def get_preprocessing_outputs(self): """ Return a list of the files generated by the preprocessing """ - return [] + + # Contrat maps + templates = [join( + self.directories.output_dir, + 'l1_analysis', '_subject_id_{subject_id}', f'con_{contrast_id}.nii')\ + for contrast_id in self.contrast_list] + + # SPM.mat file + templates += [join( + self.directories.output_dir, + 'l1_analysis', '_subject_id_{subject_id}', 'SPM.mat')] + + # spmT maps + templates += [join( + self.directories.output_dir, + 'l1_analysis', '_subject_id_{subject_id}', f'spmT_{contrast_id}.nii')\ + for contrast_id in self.contrast_list] + + # Format with subject_ids + return_list = [] + for template in templates: + return_list += [template.format(subject_id = s) for s in self.subject_list] + + return return_list def get_run_level_analysis(self): """ Return a Nipype workflow describing the run level analysis part of the pipeline """ @@ -275,7 +298,7 @@ def get_run_level_analysis(self): def get_run_level_outputs(self): """ Return a list of the files generated by the run level analysis """ - return [] + return ['fake_file'] def get_subject_information(event_file: str): """ @@ -507,7 +530,7 @@ def get_subject_level_analysis(self): def get_subject_level_outputs(self): """ Return a list of the files generated by the subject level analysis """ - return [] + return ['fake_file'] def get_subgroups_contrasts( copes, varcopes, subject_list: list, participants_file: str @@ -642,6 +665,7 @@ def get_group_level_analysis(self): Returns; - a list of nipype.WorkFlow """ + return None methods = ['equalRange', 'equalIndifference', 'groupComp'] return [self.get_group_level_analysis_sub_workflow(method) for method in methods] @@ -736,12 +760,6 @@ def get_group_level_analysis_sub_workflow(self, method): ) group_level_analysis.connect([ (info_source, select_files, [('contrast_id', 'contrast_id')]) - """(info_source, subgroups_contrasts, [('subject_list', 'subject_ids')]), - (select_files, subgroups_contrasts, [ - ('cope', 'copes'), - ('varcope', 'varcopes'), - ('participants', 'participants_file'), - ])""" ]) # [INFO] Here we define the contrasts used for the group level analysis, depending on the @@ -759,8 +777,48 @@ def get_group_level_analysis_sub_workflow(self, method): def get_group_level_outputs(self): """ Return a list of the files generated by the group level analysis """ - return [] + return ['fake_file'] def get_hypotheses_outputs(self): """ Return the names of the files used by the team to answer the hypotheses of NARPS. """ - return [] + + nb_sub = len(self.subject_list) + files = [ + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_pgain', 'randomise_tfce_corrp_tstat1.nii.gz'), + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_pgain', 'zstat1.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_pgain', 'randomise_tfce_corrp_tstat1.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_pgain', 'zstat1.nii.gz'), + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_pgain', 'randomise_tfce_corrp_tstat1.nii.gz'), + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_pgain', 'zstat1.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_pgain', 'randomise_tfce_corrp_tstat1.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_pgain', 'zstat1.nii.gz'), + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_ploss', 'randomise_tfce_corrp_tstat2.nii.gz'), + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_ploss', 'zstat2.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_ploss', 'randomise_tfce_corrp_tstat2.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_ploss', 'zstat2.nii.gz'), + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_ploss', 'randomise_tfce_corrp_tstat1.nii.gz'), + join(f'l3_analysis_equalIndifference_nsub_{nb_sub}', + '_contrast_id_ploss', 'zstat1.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_ploss', 'randomise_tfce_corrp_tstat1.nii.gz'), + join(f'l3_analysis_equalRange_nsub_{nb_sub}', + '_contrast_id_ploss', 'zstat1.nii.gz'), + join(f'l3_analysis_groupComp_nsub_{nb_sub}', + '_contrast_id_ploss', 'randomise_tfce_corrp_tstat1.nii.gz'), + join(f'l3_analysis_groupComp_nsub_{nb_sub}', + '_contrast_id_ploss', 'zstat1.nii.gz') + ] + return [join(self.directories.output_dir, f) for f in files]