Skip to content

Commit

Permalink
Workflow output file names
Browse files Browse the repository at this point in the history
  • Loading branch information
bclenet committed Feb 5, 2024
1 parent b2fac35 commit 20ae9a5
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 21 deletions.
48 changes: 29 additions & 19 deletions narps_open/pipelines/team_X19V.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,10 @@ def get_group_level_outputs(self):
'contrast_id': self.contrast_list,
'method': ['equalRange', 'equalIndifference'],
'file': [
# TODO : add thresold_file and pval_file
'_cluster0/zstat1_pval.nii.gz ',
'_cluster0/zstat1_threshold.nii.gz',
'_cluster1/zstat2_pval.nii.gz',
'_cluster1/zstat2_threshold.nii.gz',
'tstat1.nii.gz',
'tstat2.nii.gz',
'zstat1.nii.gz',
Expand All @@ -748,21 +751,28 @@ def get_group_level_outputs(self):
'_contrast_id_{contrast_id}',
'{file}'
)

return_list = [template.format(**dict(zip(parameters.keys(), parameter_values)))\
for parameter_values in parameter_sets]

# Handle groupComp
files = [
# TODO : add thresold_file and pval_file
'zstat1.nii.gz',
'tstat1.nii.gz'
]

return_list += [join(
parameters = {
'contrast_id': self.contrast_list,
'file': [
'_cluster0/zstat1_pval.nii.gz ',
'_cluster0/zstat1_threshold.nii.gz',
'tstat1.nii.gz',
'zstat1.nii.gz'
]
}
parameter_sets = product(*parameters.values())
template = join(
self.directories.output_dir,
f'group_level_analysis_groupComp_nsub_{len(self.subject_list)}',
'_contrast_id_2', file) for file in files] # TODO contrast ID 2 only ????
'_contrast_id_{contrast_id}',
'{file}'
)
return_list += [template.format(**dict(zip(parameters.keys(), parameter_values)))\
for parameter_values in parameter_sets]

return return_list

Expand All @@ -772,39 +782,39 @@ def get_hypotheses_outputs(self):
nb_sub = len(self.subject_list)
files = [
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_1', 'randomise_tfce_corrp_tstat1.nii.gz'),# TODO : add thresold_file
'_contrast_id_1', '_cluster0', 'zstat1_threshold.nii.gz'),
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_1', 'zstat1.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_1', 'randomise_tfce_corrp_tstat1.nii.gz'),# TODO : add thresold_file
'_contrast_id_1', '_cluster0', 'zstat1_threshold.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_1', 'zstat1.nii.gz'),
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_1', 'randomise_tfce_corrp_tstat1.nii.gz'),# TODO : add thresold_file
'_contrast_id_1', '_cluster0', 'zstat1_threshold.nii.gz'),
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_1', 'zstat1.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_1', 'randomise_tfce_corrp_tstat1.nii.gz'),# TODO : add thresold_file
'_contrast_id_1', '_cluster0', 'zstat1_threshold.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_1', 'zstat1.nii.gz'),
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_2', 'randomise_tfce_corrp_tstat2.nii.gz'),# TODO : add thresold_file
'_contrast_id_2', '_cluster1', 'zstat2_threshold.nii.gz'),
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_2', 'zstat2.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_2', 'randomise_tfce_corrp_tstat2.nii.gz'),# TODO : add thresold_file
'_contrast_id_2', '_cluster1', 'zstat2_threshold.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_2', 'zstat2.nii.gz'),
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_2', 'randomise_tfce_corrp_tstat1.nii.gz'),# TODO : add thresold_file
'_contrast_id_2', '_cluster0', 'zstat1_threshold.nii.gz'),
join(f'group_level_analysis_equalIndifference_nsub_{nb_sub}',
'_contrast_id_2', 'zstat1.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_2', 'randomise_tfce_corrp_tstat1.nii.gz'),# TODO : add thresold_file
'_contrast_id_2', '_cluster0', 'zstat1_threshold.nii.gz'),
join(f'group_level_analysis_equalRange_nsub_{nb_sub}',
'_contrast_id_2', 'zstat1.nii.gz'),
join(f'group_level_analysis_groupComp_nsub_{nb_sub}',
'_contrast_id_2', 'randomise_tfce_corrp_tstat1.nii.gz'),# TODO : add thresold_file
'_contrast_id_2', '_cluster0', 'zstat1_threshold.nii.gz'),
join(f'group_level_analysis_groupComp_nsub_{nb_sub}',
'_contrast_id_2', 'zstat1.nii.gz')
]
Expand Down
4 changes: 2 additions & 2 deletions tests/pipelines/test_team_X19V.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def test_outputs():

# 1 - 1 subject outputs
pipeline.subject_list = ['001']
helpers.test_pipeline_outputs(pipeline, [0, 4*1 + 4*4*4*1, 4*4*1 + 4*1, 0, 18])
helpers.test_pipeline_outputs(pipeline, [0, 4*1 + 4*4*4*1, 4*4*1 + 4*1, 8*4*2 + 4*4, 18])

# 2 - 4 subjects outputs
pipeline.subject_list = ['001', '002', '003', '004']
helpers.test_pipeline_outputs(pipeline, [0, 4*4 + 4*4*4*4, 4*4 + 4*4, 0, 18])
helpers.test_pipeline_outputs(pipeline, [0, 4*4 + 4*4*4*4, 4*4*4 + 4*4, 8*4*2 + 4*4, 18])

@staticmethod
@mark.unit_test
Expand Down

0 comments on commit 20ae9a5

Please sign in to comment.