Skip to content Skip to sidebar Skip to footer

Snakemake - Problem Trying To Use Global_wildcards (TypeError: Expected Str, Got List)

I'm a newbie using Snakemake and not an expert in Python neither so the answer might be quite obvious. Everything in my workflow worked fine in my tests until I tried to use glob_w

Solution 1:

You are not using wildcards here.

Your rule fastqc_generate_qc takes as input ALL the fastq files and output ALL the fastqc files here.
One thing to remember in snakemake is: expand produces a list of files. You don't want that here:

rule fastqc_generate_qc:
    input:
        FASTQDIR + "{sample}.fastq.gz"
    output:
        WDIR + "Fastqc/{sample}_fastqc.html",
        WDIR + "Fastqc/{sample}_fastqc.zip"
    shell:
        "fastqc --outdir Fastqc/ {input}"

Here sample is a wildcard. It is your rule all that will trigger the real file names to produce. The rule fastqc_generate_qc will then use wildcards to apply the rule to any output asked for in rule all.

For information, if you want to use a wildcard in an expand function, you have to double the brackets: expand("path/{{study}}/{sample}, sample=SAMPLES)
Here, study is a wildcard, sample is not. sample values are defined in the second argument of the expand function.


Post a Comment for "Snakemake - Problem Trying To Use Global_wildcards (TypeError: Expected Str, Got List)"