Skip to content

Commit

Permalink
Group analysis workflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bclenet committed Oct 17, 2023
1 parent 95fe702 commit 1ac7267
Showing 1 changed file with 69 additions and 11 deletions.
80 changes: 69 additions & 11 deletions narps_open/pipelines/team_08MQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,38 @@ 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 """
return None

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):
"""
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand All @@ -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]

0 comments on commit 1ac7267

Please sign in to comment.