Snakemake Target rules may not contain wildcards.
1
0
Entering edit mode
2.0 years 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)

rule readqc:
    input:
        read="{samp}.fastq.gz"
    threads:
        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.

Thank you in advance.

Snakemake • 1.9k views
ADD COMMENT
2
Entering edit mode
2.0 years ago
Shred ★ 1.6k

From your question

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 :)

ADD COMMENT
0
Entering edit mode

Thank you, it's working.

ADD REPLY

Login before adding your answer.

Traffic: 1930 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6