nathza009
nathza009

Reputation: 29

Fastqc errors with non-zero exit status 2

I tried to run fastqc via a Snakemake command on my local computer. It didn’t work.

rule fastqc_raw:
     input:
         "raw/A.fastq"
     output:
         "output/fastqc_raw/A.html"
     shell:
         "fastqc {input} -o {output} -t 4"

It displayed this error:

Error in rule fastqc_raw:
jobid: 1
output: output/fastqc_raw/A.html   RuleException: CalledProcessError in line 13 of
/Users/01/Desktop/Snakemake/Snakefile: Command ' set -euo pipefail; 
fastqc raw/A.fastq -o output/fastqc_raw/A.html -t 4 ' returned
non-zero exit status 2.   File
"/Users/01/Desktop/Snakemake/Snakefile", line 13, in __rule_fastqc_raw
File "/Users/01/miniconda3/lib/python3.6/concurrent/futures/thread.py",line 56, in run

However the snakemake program did created DAG file that looks normal and when I used “snakemake --np” command, it didn’t display any errors.

Upvotes: 2

Views: 752

Answers (3)

torpzorrr
torpzorrr

Reputation: 75

An additional note: I can see you're using 4 threads there with the '-t 4' argument. You should specify this so Snakemake gives it 4 threads, otherwise I believe it will run with 1 thread and may fail due to lack of memory. This can be done like so:

rule fastqc_raw:
input:
    "raw/A.fastq"
output:
    "output/fastqc_raw/A.html"
threads: 4
shell:
    "fastqc {input} -o {output} -t 4"

Upvotes: 0

Emmett Leyne
Emmett Leyne

Reputation: 21

I hope you have gotten an answer by now but I had the exact same issue so I will offer my solution.

The error is in the

shell: "fastqc {input} -o {output} -t 4"

FastQC flag -o expects the output directory and you have given it an output file. Your code should be:

shell: "fastqc {input} -o output/fastqc_raw/ -t 4"

Your error relates to the fact that the output files have been output in a different location (most likely the input directory) and the rule all: has failed as a result.

Additionally, FastQC will give an error if the directories are not already created, so you will need to do that first.

It is strange as I have seen Snakemake scripts that have no -o flag in the fastqc shell and it worked fine, but I haven't been so lucky.

Upvotes: 1

Marmaduke
Marmaduke

Reputation: 591

It looks like Snakemake did its job. It ran the command:

fastqc raw/A.fastq -o output/fastqc_raw/A.html -t 4 

But the command returned an error:

Command ' set -euo pipefail; 
fastqc raw/A.fastq -o output/fastqc_raw/A.html -t 4 ' returned
non-zero exit status 2.

The next step in debugging is to run the fastqc command manually to see if it gives an error.

Upvotes: 1

Related Questions