This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error in snakemake with working shell script

I want to run fastqc using snakemake.

This is my snakemake script.

configfile: 'sample_config.yaml'
configfile: srcdir('path_config.yaml')

FASTQC = config['FASTQC']
UNZIP = config['UNZIP']

rule all:
    input:
        fqc1 = expand("00_QC/{sample}_fastqc.txt", sample = config['sample']),

rule fastqc:
    input:
        fq1 = lambda wildcards: config['sample'][wildcards.sample]['fq1'],
    output:
        fqc1 = "00_QC/{sample}_fastqc.txt",
    params:
        outdir = "00_QC",
        zip1 = "00_QC/{sample}_fastqc.zip",
        sum1 = "{sample}_fastqc/summary.txt",
    threads: 1
    log:
        fail = "00_QC/log/{sample}.fastqc.log",
        success = "00_QC/log/{sample}.fastqc.success",
    shell:
        "({FASTQC} {input.fq1} -o {params.outdir} -t {threads} "
        "&& {UNZIP} -p {params.zip1} {params.sum1} > {output.fqc1} "
        "&> {log.fail} && mv {log.fail} {log.success}"

And the error message is

one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!

the log file is empty.

But when I run the shell script (the same one snakemake shows as output) it runs well. How can I fix it? I already updated snakemake version and used fastqc in the conda environment but it doesn't work.

snakemake

1 answer

shell:
        "({FASTQC} {input.fq1} -o {params.outdir} -t {threads} "

There is a ( before {FASTQC} which shouldn't be there. Is this a typo in the question or it is actually in the script? If this doesn't fix it, post the snakemake command you executed (better if you include the -p option) and the terminal logs you get until the error.

Thank you for your comment. I forgot to type ) in the second line of the shell. I fixed it as "&& {UNZIP} -p {params.zip1} {params.sum1} > {output.fqc1}) " and it works.

Log in to answer this question.