Snakemake Target rules may not contain wildcards.
1
0
Entering edit mode
3 months ago

Hello,

I am trying to build a basic Snakemake pipeline to run on all fastq.gz files and perform readqc on them. I have come up with the following:

SAMPLES, = glob_wildcards("{samp}.fastq.gz")

rule all:
input:
expand("{samp}.fastq.gz", samp=SAMPLES)

input:
3
output:
html="{samp}_fastqc.html"
log:
"{samp}.log"
shell:
"fastqc --extract --nogroup {input}"


When I run the following I get:

snakemake --cores 3 readqc
Building DAG of jobs...
WorkflowError:
Target rules may not contain wildcards. Please specify concrete files or a rule without wildcards at the command line, or have a rule without wildcards at the very top of your workflow (e.g. the typical "rule all" which just collects all results you want to generate in the end).


When I run:

snakemake --cores 3
Building DAG of jobs...
Nothing to be done (all requested files are present and up to date).
Complete log: .snakemake/log/2022-12-10T160227.549413.snakemake.log


I am running the snakemake file from the directory containing the fastq.gz files but I don't understand why it is not working.

Snakemake • 520 views
2
Entering edit mode
3 months ago
Shred ★ 1.0k

Target rules may not contain wildcards. Please specify concrete files or a rule without wildcards at the command line, or have a rule without wildcards at the very top of your workflow (e.g. the typical "rule all" which just collects all results you want to generate in the end)

Your rule all has inputs, not outputs.

Remember that Snakemakes thinks backwards: it identifies what has to be done starting from your desired final output (the input of the rule_all) then going backwards following each rule input/output dependencies.

So your use case has to be

rule all:
input: expand("{samp}_fastqc.html", samp=SAMPLES)


Always run first snakemake in dry mode snakemake -n to check input/output dependencies, schemas, syntax errors, etc.. without actually launching rules. This will save your as* many time :)

0
Entering edit mode

Thank you, it's working.