snakebids icon indicating copy to clipboard operation
snakebids copied to clipboard

Wildcards added via cli are not deduplicated

Open pvandyken opened this issue 1 year ago • 0 comments

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 avatar May 06 '24 20:05 pvandyken