Skip to content

Commit 2ff531a

Browse files
authored
Merge pull request #1647 from FCP-INDI/fix/anat-only
🐛 Allow anatomical-data only runs
2 parents 74c1eac + 0e84b73 commit 2ff531a

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
### Fixed
2727
- Fixed [bug](https://github.com/FCP-INDI/C-PAC/issues/1638) in which working connectivity matrix filepaths were generated incorrectly, preventing generating matrices depending on container bindings
2828
- Fixed broken links in README
29+
- Fixed [bug](https://github.com/FCP-INDI/C-PAC/issues/1575) in which anatomical-only configurations required functional data directories
2930

3031
## [1.8.2] - 2021-12-02
3132

CPAC/pipeline/cpac_pipeline.py

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

13421342
# Connect the entire pipeline!
1343-
wf = connect_pipeline(wf, cfg, rpool, pipeline_blocks)
1343+
try:
1344+
wf = connect_pipeline(wf, cfg, rpool, pipeline_blocks)
1345+
except LookupError as lookup_error:
1346+
errorstrings = lookup_error.args[0].split('\n')
1347+
missing_key = errorstrings[
1348+
errorstrings.index('[!] C-PAC says: The listed resource is not '
1349+
'in the resource pool:') + 1]
1350+
if missing_key.endswith('_bold') and 'func' not in sub_dict:
1351+
raise FileNotFoundError(
1352+
'The provided pipeline configuration requires functional '
1353+
'data but no functional data were found for ' +
1354+
'/'.join([sub_dict[key] for key in ['site', 'subject_id',
1355+
'unique_id'] if key in sub_dict]) + '. Please check '
1356+
'your data and pipeline configurations.') from lookup_error
1357+
raise lookup_error
13441358

13451359
# Write out the data
13461360
# TODO enforce value with schema validation

CPAC/pipeline/engine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,10 +1894,10 @@ def initiate_rpool(wf, cfg, data_paths=None, part_id=None):
18941894
if data_paths:
18951895
rpool = ingress_raw_anat_data(wf, rpool, cfg, data_paths, unique_id,
18961896
part_id, ses_id)
1897-
1898-
wf, rpool, diff, blip, fmap_rp_list = \
1899-
ingress_raw_func_data(wf, rpool, cfg, data_paths, unique_id,
1900-
part_id, ses_id)
1897+
if 'func' in data_paths:
1898+
wf, rpool, diff, blip, fmap_rp_list = \
1899+
ingress_raw_func_data(wf, rpool, cfg, data_paths, unique_id,
1900+
part_id, ses_id)
19011901

19021902
# grab already-processed data from the output directory
19031903
rpool = ingress_output_dir(cfg, rpool, unique_id, creds_path)

CPAC/pipeline/test/test_engine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def test_ingress_func_raw_data(pipe_config, bids_dir, test_dir):
2828

2929
rpool = ResourcePool(name=unique_id, cfg=cfg)
3030

31-
wf, rpool, diff, blip, fmap_rp_list = ingress_raw_func_data(wf, rpool, cfg,
32-
sub_data_dct,
33-
unique_id,
34-
part_id, ses_id)
31+
if 'func' in sub_data_dct:
32+
wf, rpool, diff, blip, fmap_rp_list = \
33+
ingress_raw_func_data(wf, rpool, cfg, sub_data_dct, unique_id,
34+
part_id, ses_id)
3535

3636
rpool.gather_pipes(wf, cfg, all=True)
3737

0 commit comments

Comments
 (0)