Skip to content

Commit 0e84b73

Browse files
committed
🥅 Catch anatomical only data + functional config combo
1 parent bfd6fb5 commit 0e84b73

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

CPAC/pipeline/cpac_pipeline.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,21 @@ def build_workflow(subject_id, sub_dict, cfg, pipeline_name=None,
13231323
pipeline_blocks += qc_stack
13241324

13251325
# Connect the entire pipeline!
1326-
wf = connect_pipeline(wf, cfg, rpool, pipeline_blocks)
1326+
try:
1327+
wf = connect_pipeline(wf, cfg, rpool, pipeline_blocks)
1328+
except LookupError as lookup_error:
1329+
errorstrings = lookup_error.args[0].split('\n')
1330+
missing_key = errorstrings[
1331+
errorstrings.index('[!] C-PAC says: The listed resource is not '
1332+
'in the resource pool:') + 1]
1333+
if missing_key.endswith('_bold') and 'func' not in sub_dict:
1334+
raise FileNotFoundError(
1335+
'The provided pipeline configuration requires functional '
1336+
'data but no functional data were found for ' +
1337+
'/'.join([sub_dict[key] for key in ['site', 'subject_id',
1338+
'unique_id'] if key in sub_dict]) + '. Please check '
1339+
'your data and pipeline configurations.') from lookup_error
1340+
raise lookup_error
13271341

13281342
# Write out the data
13291343
# TODO enforce value with schema validation

0 commit comments

Comments
 (0)