From d89af0f35e10468e73c5cc2d53a8c96630646fea Mon Sep 17 00:00:00 2001 From: akhanf Date: Wed, 20 Sep 2023 14:30:31 -0400 Subject: [PATCH 1/2] fixes issue with subject/session parsing Wasn't actuully using zip lists in the target rule (likely since filtering by session was added) - this expands twice to ensure zip lists are used, filtering the session with the filter_list() function. Note: should revamp sometime soon to use new snakebids API --- hippunfold/workflow/rules/common.smk | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/hippunfold/workflow/rules/common.smk b/hippunfold/workflow/rules/common.smk index 6818b4d8..06dc7f04 100644 --- a/hippunfold/workflow/rules/common.smk +++ b/hippunfold/workflow/rules/common.smk @@ -333,12 +333,18 @@ def get_final_output(): modality_suffix = get_modality_suffix(config["modality"]) modality_key = get_modality_key(config["modality"]) + #use a zip list for subject/session: + zip_list = config['input_zip_lists'][modality_key] + if 'session' in zip_list: + zip_list = snakebids.filter_list(zip_list,{'session':config['sessions']}) + final_output.extend( + expand( expand( subj_output, + zip,allow_missing=True, + **zip_list), modality_suffix=modality_suffix, - subject=config["input_lists"][modality_key]["subject"], - session=config["sessions"], ) ) From e3aea4afd1b9adf7b458c259f9aaa66cdc57768c Mon Sep 17 00:00:00 2001 From: Ali Khan Date: Wed, 20 Sep 2023 14:43:55 -0400 Subject: [PATCH 2/2] linting --- hippunfold/workflow/rules/common.smk | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hippunfold/workflow/rules/common.smk b/hippunfold/workflow/rules/common.smk index 06dc7f04..301552bf 100644 --- a/hippunfold/workflow/rules/common.smk +++ b/hippunfold/workflow/rules/common.smk @@ -333,17 +333,14 @@ def get_final_output(): modality_suffix = get_modality_suffix(config["modality"]) modality_key = get_modality_key(config["modality"]) - #use a zip list for subject/session: - zip_list = config['input_zip_lists'][modality_key] - if 'session' in zip_list: - zip_list = snakebids.filter_list(zip_list,{'session':config['sessions']}) + # use a zip list for subject/session: + zip_list = config["input_zip_lists"][modality_key] + if "session" in zip_list: + zip_list = snakebids.filter_list(zip_list, {"session": config["sessions"]}) final_output.extend( expand( - expand( - subj_output, - zip,allow_missing=True, - **zip_list), + expand(subj_output, zip, allow_missing=True, **zip_list), modality_suffix=modality_suffix, ) )