Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wildcards added via cli are not deduplicated #422

Closed
pvandyken opened this issue May 6, 2024 · 0 comments · Fixed by #455
Closed

Wildcards added via cli are not deduplicated #422

pvandyken opened this issue May 6, 2024 · 0 comments · Fixed by #455
Labels
bug Something isn't working

Comments

@pvandyken
Copy link
Contributor

If a wildcard is specified via the CLI (e.g. --wildcards-COMP ...), it is merely appended to the list of wildcards specified in the config.yaml without any deduplication. This creates a spurious downstream error:

KeyError in file /scratch/knavynde/skeletonize/skeletonize/workflow/rules/setup.smk, line 31:
'pop from an empty set'
  File "/scratch/knavynde/skeletonize/skeletonize/workflow/Snakefile", line 7, in <module>
  File "/scratch/knavynde/skeletonize/skeletonize/workflow/rules/setup.smk", line 31, in <module>
  File "/home/knavynde/.local/pipx/venvs/snakemake/lib/python3.11/site-packages/snakebids/core/input_generation.py", line 311, in generate_inputs
  File "/home/knavynde/.local/pipx/venvs/snakemake/lib/python3.11/site-packages/snakebids/core/datasets.py", line 832, in from_iterable
  File "/home/knavynde/.local/pipx/venvs/snakemake/lib/python3.11/site-packages/snakebids/core/input_generation.py", line 520, in _get_components
  File "/home/knavynde/.local/pipx/venvs/snakemake/lib/python3.11/site-packages/snakebids/core/input_generation.py", line 591, in _get_component
  File "/home/knavynde/.local/pipx/venvs/snakemake/lib/python3.11/site-packages/snakebids/core/input_generation.py", line 752, in _parse_bids_path

This occurs when snakebids checks that all wildcards have been matched. It's simply comparing the number of specified wildcards to the number of found wildcards. But when some wildcards have been specified multiple times, the specified wildcards will be greater than the found.

Can be resolved simply by incorporating deduplication. The meanwhile workaround is to not specify wildcards from the CLI that have already been listed in config.

@pvandyken pvandyken added the bug Something isn't working label May 6, 2024
pvandyken added a commit to pvandyken/snakebids that referenced this issue Jul 26, 2024
Specifying a wildcard multiple times leads to an unintuitive KeyError.
This includes re-specifying a wildcard defined in the config by the
developer.

Fix by using a set to deduplicate wildcards before parsing.

Resolves khanlab#422
@pvandyken pvandyken linked a pull request Jul 26, 2024 that will close this issue
pvandyken added a commit that referenced this issue Jul 29, 2024
Specifying a wildcard multiple times leads to an unintuitive KeyError.
This includes re-specifying a wildcard defined in the config by the
developer.

Fix by using a set to deduplicate wildcards before parsing.

Resolves #422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant