Skip to content

Commit

Permalink
Merge branch 'Inria-Empenn:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bclenet authored Jan 5, 2024
2 parents 04d5ff2 + 94cf9cb commit c9ee889
Show file tree
Hide file tree
Showing 13 changed files with 2,074 additions and 582 deletions.
21 changes: 21 additions & 0 deletions narps_open/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,24 @@ def list_intersection(list_1: list, list_2: list) -> list:
- list, the intersection of list_1 and list_2
"""
return [e for e in list_1 if e in list_2]

def list_to_file(input_list: list, file_name: str = 'elements.tsv') -> str:
"""
Create a tsv file containing elements of the input list.
This function is meant to be used in a Nipype Function Node.
Parameters :
- input_list: list
Returns:
- output_file: path to the created file
"""
from os.path import abspath
output_file = abspath(file_name)

# Write un element per line
with open(output_file, 'w') as writer:
for element in input_list:
writer.write(f'{element}\n')

return output_file
4 changes: 2 additions & 2 deletions narps_open/pipelines/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# List all the available pipelines and the corresponding class for each
implemented_pipelines = {
'08MQ': None,
'08MQ': 'PipelineTeam08MQ',
'0C7Q': None,
'0ED6': None,
'0H5E': None,
Expand Down Expand Up @@ -43,7 +43,7 @@
'B23O': None,
'B5I6': None,
'C22U': None,
'C88N': None,
'C88N': 'PipelineTeamC88N',
'DC61': None,
'E3B6': None,
'E6R3': None,
Expand Down
1,050 changes: 1,050 additions & 0 deletions narps_open/pipelines/team_08MQ.py

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions narps_open/pipelines/team_2T6S.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ def get_group_level_analysis_sub_workflow(self, method):
height_threshold = 0.001, height_threshold_type = 'p-value',
force_activation = True),
name = 'threshold', iterfield = ['stat_image', 'contrast_index'])
threshold.synchronize = True

l2_analysis = Workflow(
base_dir = self.directories.working_dir,
Expand All @@ -512,7 +513,8 @@ def get_group_level_analysis_sub_workflow(self, method):
(selectfiles_groupanalysis, sub_contrasts, [
('contrast', 'file_list'),
('participants', 'participants_file')]),
(estimate_model, estimate_contrast, [('spm_mat_file', 'spm_mat_file'),
(estimate_model, estimate_contrast, [
('spm_mat_file', 'spm_mat_file'),
('residual_image', 'residual_image'),
('beta_images', 'beta_images')]),
(estimate_contrast, threshold, [('spm_mat_file', 'spm_mat_file'),
Expand All @@ -528,11 +530,9 @@ def get_group_level_analysis_sub_workflow(self, method):

if method in ('equalRange', 'equalIndifference'):
contrasts = [('Group', 'T', ['mean'], [1]), ('Group', 'T', ['mean'], [-1])]

threshold.inputs.contrast_index = [1, 2]
threshold.synchronize = True

## Specify design matrix
# Specify design matrix
one_sample_t_test_design = Node(OneSampleTTestDesign(),
name = 'one_sample_t_test_design')

Expand All @@ -543,11 +543,9 @@ def get_group_level_analysis_sub_workflow(self, method):
elif method == 'groupComp':
contrasts = [
('Eq range vs Eq indiff in loss', 'T', ['Group_{1}', 'Group_{2}'], [-1, 1])]

threshold.inputs.contrast_index = [1]
threshold.synchronize = True

# Node for the design matrix
# Specify design matrix
two_sample_t_test_design = Node(TwoSampleTTestDesign(),
name = 'two_sample_t_test_design')

Expand Down
Loading

0 comments on commit c9ee889

Please sign in to comment.