Skip to content

Commit

Permalink
[feature] lofreq parallel threads
Browse files Browse the repository at this point in the history
Co-authored-by: AugusteRi <[email protected]>
  • Loading branch information
DrYak and AugusteRi committed Dec 4, 2024
1 parent 6735fe5 commit 5f83ffa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 8 additions & 2 deletions workflow/rules/snv.smk
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,11 @@ rule lofreq:
EXTRA=config.lofreq["extra"],
SAMTOOLS=config.applications["samtools"],
LOFREQ=config.applications["lofreq"],
kind=lambda wildcards, threads: "parallel" if threads > 1 else "old-school",
subcmd=lambda wildcards, threads: "call-parallel" if threads > 1 else "call",
threadspar=lambda wildcards, threads: (
f"--pp-threads {threads}" if threads > 1 else ""
),
log:
outfile="{dataset}/variants/SNVs/lofreq.out.log",
errfile="{dataset}/variants/SNVs/lofreq.err.log",
Expand All @@ -274,6 +279,7 @@ rule lofreq:
disk_mb=2000,
mem_mb=config.lofreq["mem"],
runtime=config.lofreq["time"],
threads: config.lofreq["threads"]
shell:
"""
# Add qualities to indels
Expand All @@ -282,8 +288,8 @@ rule lofreq:
{params.SAMTOOLS} index {output.BAM} 2> >(tee {log.errfile} >&2)
# Run Lofreq
echo "Running LoFreq" >> {log.outfile}
{params.LOFREQ} call {params.EXTRA} --call-indels -f {input.REF} -o {output.SNVs} --verbose {output.BAM} >> {log.outfile} 2> >(tee -a {log.errfile} >&2)
echo "Running {params.kind} LoFreq ({params.subcmd})" >> {log.outfile}
{params.LOFREQ} "{params.subcmd}" {params.EXTRA} --call-indels {params.threadspar} -f {input.REF} -o {output.SNVs} --verbose {output.BAM} >> {log.outfile} 2> >(tee -a {log.errfile} >&2)
"""


Expand Down
4 changes: 4 additions & 0 deletions workflow/schemas/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,10 @@
"type": "integer",
"default": 2000
},
"threads": {
"type": "integer",
"default": 4
},
"time": {
"type": "integer",
"default": 60
Expand Down

0 comments on commit 5f83ffa

Please sign in to comment.