Skip to content

Commit

Permalink
Patch: Use tmpdir/lscratch with fastqc due to gpfs issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
skchronicles committed Feb 6, 2024
1 parent d3b3fc3 commit edff154
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.1
1.3.2
6 changes: 4 additions & 2 deletions config/cluster.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"fastqc": {
"threads": "16",
"mem": "32g",
"time": "0-18:00:00"
"time": "0-18:00:00",
"gres": "lscratch:64"
},
"fastq_screen": {
"threads": "16",
Expand All @@ -33,7 +34,8 @@
"rawfastqc": {
"threads": "16",
"mem": "32g",
"time": "0-18:00:00"
"time": "0-18:00:00",
"gres": "lscratch:64"
},
"trim": {
"threads": "16",
Expand Down
44 changes: 42 additions & 2 deletions workflow/rules/paired-end.smk
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,33 @@ rule rawfastqc:
params:
rname='rawfqc',
outdir=join(workpath,"{name}","rawQC"),
tmpdir=tmpdir,
threads: int(allocated("threads", "rawfastqc", cluster))
# envmodules: config['tools']['fastqc']
container: config['images']['metavirs']
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} \\
-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} \\;
"""


Expand Down Expand Up @@ -288,6 +308,7 @@ rule fastqc:
params:
rname='fqc',
outdir=join(workpath,"{name}","QC"),
tmpdir=tmpdir,
# Building single-end and paired-end options
# Input trimmed R2 FastQ file: PE='{trim.r2}', SE=''
r2_option = lambda w: "{0}.R2.trim.fastq".format(
Expand All @@ -297,9 +318,28 @@ rule fastqc:
# envmodules: config['tools']['fastqc']
container: config['images']['metavirs']
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} {params.r2_option} \\
-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} \\;
"""


Expand Down

0 comments on commit edff154

Please sign in to comment.