From 728f268bbadfc03260ea99c4d2b4879503ca44d8 Mon Sep 17 00:00:00 2001 From: skchronicles Date: Wed, 7 Feb 2024 10:46:03 -0500 Subject: [PATCH] Patch: Use tmpdir/lscratch with fastqc due to gpfs issue. --- VERSION | 2 +- config/cluster.json | 6 ++++-- workflow/Snakefile | 44 ++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 47 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index b49b253..d3532a1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.6 +0.5.7 diff --git a/config/cluster.json b/config/cluster.json index 7a0a2cd..01f4040 100644 --- a/config/cluster.json +++ b/config/cluster.json @@ -48,12 +48,14 @@ "mem": "24g" }, "rawfastqc": { - "threads": "8" + "threads": "8", + "gres": "lscratch:64" }, "fastqc": { "mem": "24g", "threads": "32", - "time": "18:00:00" + "time": "18:00:00", + "gres": "lscratch:64" }, "fastq_screen": { "mem": "24g", diff --git a/workflow/Snakefile b/workflow/Snakefile index c9d16d0..c50388f 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -693,16 +693,36 @@ rule rawfastqc: params: rname='rawfastqc', outdir=join(workpath,"rawfastQC"), + tmpdir=tmpdir, envmodules: config['tools']['FASTQCVER'] threads: int(allocated("threads", "rawfastqc", cluster)) shell: """ + # Setups temporary directory for + # intermediate files with built-in + # mechanism for deletion on exit + if [ ! -d "{params.tmpdir}" ]; then mkdir -p "{params.tmpdir}"; fi + tmp=$(mktemp -d -p "{params.tmpdir}") + trap 'rm -rf "${{tmp}}"' EXIT + + # Running fastqc with local + # disk or a tmpdir, fastqc + # has been observed to lock + # up gpfs filesystems, adding + # this on request by HPC staff fastqc \\ {input.R1} \\ {input.R2} \\ -t {threads} \\ - -o {params.outdir} + -o "${{tmp}}" + + # Copy output files from tmpdir + # to output directory + find "${{tmp}}" \\ + -type f \\ + \\( -name '*.html' -o -name '*.zip' \\) \\ + -exec cp {{}} {params.outdir} \\; """ @@ -725,16 +745,36 @@ rule fastqc: params: rname='fastqc', outdir=join(workpath,"fastQC"), + tmpdir=tmpdir, envmodules: config['tools']['FASTQCVER'] threads: int(allocated("threads", "fastqc", cluster)) shell: """ + # Setups temporary directory for + # intermediate files with built-in + # mechanism for deletion on exit + if [ ! -d "{params.tmpdir}" ]; then mkdir -p "{params.tmpdir}"; fi + tmp=$(mktemp -d -p "{params.tmpdir}") + trap 'rm -rf "${{tmp}}"' EXIT + + # Running fastqc with local + # disk or a tmpdir, fastqc + # has been observed to lock + # up gpfs filesystems, adding + # this on request by HPC staff fastqc \\ {input.R1} \\ {input.R2} \\ -t {threads} \\ - -o {params.outdir} + -o "${{tmp}}" + + # Copy output files from tmpdir + # to output directory + find "${{tmp}}" \\ + -type f \\ + \\( -name '*.html' -o -name '*.zip' \\) \\ + -exec cp {{}} {params.outdir} \\; """