Petras Nasvytis
Petras Nasvytis

Reputation: 57

Snakemake taking the whole wildcard list as input

I am trying to run multiple fastq files through snakemake. This is part of the code I have now:

import os
import glob

docker_run = "docker run -v $(pwd):$(pwd) -w $(pwd)"
fastqc_image = "staphb/fastqc"
cutadapt_image = "kfdrc/cutadapt"
bowtie_image = "biocontainers/bowtie:v1.1.2_cv4"

SRA = glob_wildcards("input/{sra}.fastq")
genome = 'hg38'

rule all:
    input:
        expand("results/raw_qc/{sra}_fastqc.{extension}", sra=SRA, extension=['zip','html']),
        expand("results/trimmed/{sra}.fastq", sra=SRA),
        expand("results/trimmed_qc/{sra}_fastqc.{extension}", sra=SRA, extension=['zip','html']),
        expand("index/{genome}_index.{numbers}.ebwt", genome=genome, numbers=['1','2']),
        expand("results/aligned/aligned_sam/{sra}.sam", sra=SRA)

rule rawFastqc:
    input:
        rawread = "input/{sra}.fastq"
    output:
        zip = "results/raw_qc/{sra}_fastqc.zip",
        html = "results/raw_qc/{sra}_fastqc.html"
    threads:
        2
    params:
        docker = docker_run,
        image = fastqc_image,
        path="results/raw_qc"
    # singularity: 'docker://staphb/fastqc:latest'
    shell:
        """
        echo 'Raw QC';
        {params.docker} {params.image} \
        fastqc {input.rawread} --threads {threads} -o {params.path}
        """

I get this error:

MissingInputException in line 20 of /mnt/c/Coding/laverock/new_workflow/Snakefile: Missing input files for rule rawFastqc: input/['24_mil', '24_mil2'].fastq

I see that Snakemake is using the whole list of inputs as one input. How would I fix this?

Thanks in advance!

Upvotes: 0

Views: 35

Answers (1)

kEks
kEks

Reputation: 553

you need to add a comma in the following line. This converts it from a wildcard object into a list (see here)

SRA, = glob_wildcards("input/{sra}.fastq")

Upvotes: 1

Related Questions