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

feat: add support for comma in wildcards #2659

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions snakemake/target_jobs.py
@@ -1,6 +1,6 @@
from collections import namedtuple
import typing

import re
from snakemake_interface_executor_plugins.utils import TargetSpec

from snakemake.common import parse_key_value_arg
Expand All @@ -14,12 +14,12 @@ def parse_target_jobs_cli_args(target_jobs_args):
rulename, wildcards = entry.split(":", 1)
if wildcards:

def parse_wildcard(entry):
return parse_key_value_arg(entry, errmsg)
def remove_len_zero(tpl):
return tuple(val for val in tpl if len(val)>0)

wildcards = dict(
parse_wildcard(entry) for entry in wildcards.split(",")
)
matches = re.findall(r'(\w+)="([^"]*)",|(\w+)=([^,]*),', wildcards+",")
wildcards = dict(map(remove_len_zero, matches))
target_jobs.append(TargetSpec(rulename, wildcards))
target_jobs.append(TargetSpec(rulename, wildcards))
else:
target_jobs.append(TargetSpec(rulename, dict()))
Expand Down
9 changes: 9 additions & 0 deletions tests/test_comma_in_wildcard/Snakefile
@@ -0,0 +1,9 @@


rule all:
input: "a_wildcard_with,.out"


rule a:
output: "{prefix}.out"
shell: "touch {output}"
Empty file.