How to access wildcards within a run directive

Viewed 120

I'm using a run directive for a rule and would like to access a wildcard called ref. How do I do that?

2 Answers

I believe it's just: wildcards.ref

A Snakefile with the following rule demonstrates the answer provided by @maarten-vd-sande is correct:

rule a:
        output: "{prefix}/{ref}/file.out"
        run:
                with open(output[0], "w") as out:
                        out.write(wildcards.ref)

Calling it like so:

snakemake prefix/reference/file.out

Results in a file with the following text:

reference
Related