Anlin Li
Anlin Li

Reputation: 25

An WorkflowError with wildcards

I want to use snakemake to QC the fastq file, but it show that : WorkflowError:

Target rules may not contain wildcards. Please specify concrete files or a rule without wildcards.

The code I wrote is like this

SAMPLE = ["A","B","C"]

rule trimmomatic:
    input:
        "/data/samples/{sample}.fastq"
    output:
        "/data/samples/{sample}.clean.fastq"
    shell:
        "trimmomatic SE -threads 5 -phred33 -trimlog trim.log {input} {output} LEADING:20 TRAILING:20 MINLEN:16"

I'm a novice, if anyone know that, please tell me. Thanks so much!

Upvotes: 1

Views: 438

Answers (1)

Manavalan Gajapathy
Manavalan Gajapathy

Reputation: 4089

You could do one of the following, but chances are you want to do the latter one.

  • Explicitly specifiy output filenames via commandline:

    snakemake  data/samples/A.clean.fastq
    

    This would run rule to create file data/samples/A.clean.fastq

  • Specify target output files to be created in Snakefile itself using rule all. See here to learn more about adding targets via rule all

    SAMPLE_NAMES = ["A","B", "C"]
    
    rule all:
        input:
            expand("data/samples/{sample}.clean.fastq", sample=SAMPLE_NAMES)
    
    rule trimmomatic:
        input:
            "data/samples/{sample}.fastq"
        output:
            "data/samples/{sample}.clean.fastq"
        shell:
            "trimmomatic SE -threads 5 -phred33 -trimlog trim.log {input} {output} LEADING:20 TRAILING:20 MINLEN:16"
    

Upvotes: 3

Related Questions