Himanshu Singh
Himanshu Singh

Reputation: 53

How to pass variable value as input in snakemake?

I want to download the fastq files from SRA database using SRR ID using Snakemake. I read a file to get SRR ID using python code.

I want to parse the Variable one by one as input. My code is below.

I want to run command

fastq-dump SRR390728

#SAMPLES = ['SRR390728','SRR400816']
SAMPLES = [line.strip() for line in open("./srrList", 'r')]

rule all:
    input:
        expand("fastq/{sample}.fastq.log",sample=SAMPLES)

rule download_fastq:
    input:
        "{sample}"
    output:
        "fastq/{sample}.fastq.log"

    shell:
        "fastq-dump {input} > {output}"

Upvotes: 3

Views: 2560

Answers (1)

Manavalan Gajapathy
Manavalan Gajapathy

Reputation: 4089

Skip input and just call the wildcard in shell command. input needs to be a filepath that needs to already exist or be created as part of the pipeline - neither are true in your case.

rule download_fastq:
    output:
        "fastq/{sample}.fastq.log"
    shell:
        "fastq-dump {wildcards.sample} > {output}"

Upvotes: 2

Related Questions