From ff1308f746844c0d6718d505b9f53d2f32fc8697 Mon Sep 17 00:00:00 2001 From: Taylor Salo Date: Wed, 20 Nov 2024 15:04:45 -0500 Subject: [PATCH] Don't output concat correlations if "all" not set. --- xcp_d/workflows/bold/concatenation.py | 87 ++++++++++++++------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/xcp_d/workflows/bold/concatenation.py b/xcp_d/workflows/bold/concatenation.py index e4742bcbe..f36a8ac49 100644 --- a/xcp_d/workflows/bold/concatenation.py +++ b/xcp_d/workflows/bold/concatenation.py @@ -362,52 +362,53 @@ def init_concatenate_data_wf(TR, head_radius, name='concatenate_data_wf'): (make_timeseries_dict, ds_timeseries, [('metadata', 'meta_dict')]), ]) # fmt:skip - correlate_timeseries = pe.MapNode( - TSVConnect(), - run_without_submitting=True, - mem_gb=1, - name='correlate_timeseries', - iterfield=['timeseries'], - ) - workflow.connect([ - (concatenate_inputs, correlate_timeseries, [ - ('timeseries', 'timeseries'), - ('temporal_mask', 'temporal_mask'), - ]), - ]) # fmt:skip + if 'all' in config.workflow.correlation_lengths: + correlate_timeseries = pe.MapNode( + TSVConnect(), + run_without_submitting=True, + mem_gb=1, + name='correlate_timeseries', + iterfield=['timeseries'], + ) + workflow.connect([ + (concatenate_inputs, correlate_timeseries, [ + ('timeseries', 'timeseries'), + ('temporal_mask', 'temporal_mask'), + ]), + ]) # fmt:skip - make_correlations_dict = pe.MapNode( - BIDSURI( - numinputs=1, - dataset_links=config.execution.dataset_links, - out_dir=str(output_dir), - ), - run_without_submitting=True, - mem_gb=1, - name='make_correlations_dict', - iterfield=['in1'], - ) - workflow.connect([(ds_timeseries, make_correlations_dict, [('out_file', 'in1')])]) + make_correlations_dict = pe.MapNode( + BIDSURI( + numinputs=1, + dataset_links=config.execution.dataset_links, + out_dir=str(output_dir), + ), + run_without_submitting=True, + mem_gb=1, + name='make_correlations_dict', + iterfield=['in1'], + ) + workflow.connect([(ds_timeseries, make_correlations_dict, [('out_file', 'in1')])]) - ds_correlations = pe.MapNode( - DerivativesDataSink( - dismiss_entities=['desc'], - statistic='pearsoncorrelation', - suffix='relmat', - extension='.tsv', - ), - name='ds_correlations', - run_without_submitting=True, - mem_gb=1, - iterfield=['segmentation', 'in_file', 'meta_dict'], - ) - ds_correlations.inputs.segmentation = atlases + ds_correlations = pe.MapNode( + DerivativesDataSink( + dismiss_entities=['desc'], + statistic='pearsoncorrelation', + suffix='relmat', + extension='.tsv', + ), + name='ds_correlations', + run_without_submitting=True, + mem_gb=1, + iterfield=['segmentation', 'in_file', 'meta_dict'], + ) + ds_correlations.inputs.segmentation = atlases - workflow.connect([ - (clean_name_source, ds_correlations, [('name_source', 'source_file')]), - (correlate_timeseries, ds_correlations, [('correlations', 'in_file')]), - (make_correlations_dict, ds_correlations, [('metadata', 'meta_dict')]), - ]) # fmt:skip + workflow.connect([ + (clean_name_source, ds_correlations, [('name_source', 'source_file')]), + (correlate_timeseries, ds_correlations, [('correlations', 'in_file')]), + (make_correlations_dict, ds_correlations, [('metadata', 'meta_dict')]), + ]) # fmt:skip if file_format == 'cifti': cifti_ts_src = pe.MapNode(