This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Snakemake workflow for trimmomatic

Hello everybody !

I'm a novice in Snakemake. I want to create a workflow for Illumina data analysis. I'm currently programming trimmomatic rule and I'm facing to issue. This is the code:

SAMPLES = ["1G_S15", "7G_S13"]
rule trimmomatic_pe:
input:
    adaptaters ="Illumina/adaptaters/TruSeq2-PE.fa",
    forward = expand("HHV8/fastq_raw_/fastq_H8/{sample}_R1.fastq.gz", sample = SAMPLES),
    backward = expand("HHV8/fastq_raw_/fastq_H8/{sample}_R2.fastq.gz", sample = SAMPLES)
output:
    # forward reads
    forward_paired = "HHV8/test/output_forward_paired_{sample}.fq.gz",
    forward_unpaired = "HHV8/test/output_forward_unpaired_{sample}.fq.gz",
    # Backward reads
    backward_paired = "HHV8/test/output_reverse_paired_{sample}.fq.gz",
    backward_unpaired = "HHV8/test/output_reverse_unpaired_{sample}.fq.gz"
conda:
    "condaf_file/base_env.yaml"
log:
    "HHV8/logs/trimmomatic/{sample}.log"
shell:
    "trimmomatic PE "
    "-threads 20 "
    "-phred33 "
    "{input.forward} {input.backward} "
    "{output.forward_paired} {output.forward_unpaired} {output.backward_paired} {output.backward_unpaired} "
    "ILLUMINACLIP:{input.adaptaters}:2:30:10 "
    "LEADING:3 TRAILING:3 SLIDINGWINDOW:4:15 MINLEN:36"

Then, the error message:

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

Can you help me to resolve it ?

Sincerely yours!

snakemake

1 answer

The provided error is very concise:

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)

You need to add a rule on top which would contain the final desired output files. That's how Snakemake is able to determine which rule has to be executed. In your case, given that there's only one process to run

rule all:
input:
    expand("HHV8/test/output_forward_paired_{sample}.fq.gz", sample=SAMPLES),
    expand("HHV8/test/output_forward_unpaired_{sample}.fq.gz", sample=SAMPLES),
    expand("HHV8/test/output_reverse_paired_{sample}.fq.gz", sample=SAMPLES),
    expand("HHV8/test/output_reverse_unpaired_{sample}.fq.gz", sample=SAMPLES) 

Please accept this answer (green check mark) to provide closure to this thread.

Log in to answer this question.