Search code examples
pythonsnakemake

Use special symbols in Snakemake parameter section


I have created the following snakemake rule:

rule cutadapt:
    input:
        input
    output:
        output
    log:
        logs
    params:
        "-a 'A{100}' --nextseq-trim=20 -m 20"
    wrapper:
        "0.50.4/bio/cutadapt/se"

and I get the following error message:

Wildcards in params cannot be determined from output files.

Snakemake realizes -a 'A{100}' as a Wildcard due to the {}. I tried to escape the {} by -a 'A{{100}}' but it produces the same error.

Is there any chance to escape the parameter section in a snakemake rule?

Thanks


Solution

  • It appears the fix is a bit ugly (see issue https://bitbucket.org/snakemake/snakemake/issues/584/unable-to-escape-curly-braces-in-params) - I don't know if a better solution has been implemented.

    Basically, use a dummy lambda function:

    lambda wc: "-a 'A{100}' --nextseq-trim=20 -m 20"