-
Notifications
You must be signed in to change notification settings - Fork 2
Wildcards
Romain Feron edited this page Oct 29, 2019
·
5 revisions
Wildcards are a core feature of Snakemake. In short, wildcards can be considered as Snakemake's variables that will be completed when Snakemake evaluates the workflow. They are defined with the traditional python {wildcard_name} syntax.
To introduce the concept of wildcards, let us look at this rule from the Defining rules section:
rule first_step:
input:
'data/first_step.tsv'
output:
'results/first_step.txt'
shell:
'cp {input} {output}'With this definition, this rule only works for the input file data/first_step.tsv and the output file results/first_step.txt. Now, let's assume we have data for many samples, and we would like to apply this rule to each of them. Using wildcards, we could modify this rule to generate an output for any sample:
rule first_step:
input:
'data/{sample}.tsv'
output:
'results/{sample}.txt'
shell:
'cp {input} {output}'- Defining rules
- Rule dependencies
- Wildcards
- Executing workflows
- The expand syntax
- Non-file rule parameters
- Executing Python code