From 35d0b56753ce68327ef43b6fa2828ff6c1a35fce Mon Sep 17 00:00:00 2001 From: Alexander Thomas <77535027+alethomas@users.noreply.github.com> Date: Wed, 16 Feb 2022 15:17:35 +0100 Subject: [PATCH] Update long_read.smk add temp flags for different directories --- workflow/rules/long_read.smk | 41 +++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/workflow/rules/long_read.smk b/workflow/rules/long_read.smk index d356d8053..e2877196f 100644 --- a/workflow/rules/long_read.smk +++ b/workflow/rules/long_read.smk @@ -52,7 +52,7 @@ rule customize_primer_porechop: input: get_artic_primer, output: - "results/.indicators/replacement_notice.txt", + temp("results/.indicators/replacement_notice.txt"), conda: "../envs/primechop.yaml" log: @@ -80,7 +80,7 @@ rule porechop_primer_trimming: "logs/{date}/trimmed/porechop/primer_clipped/{sample}.log", threads: 2 shell: - "(porechop -i {input.fastq_in} -o {output} --no_split --end_size 35 --extra_end_trim 0 -t {threads} -v 1) > {log} 2>&1" + "(porechop -i {input.fastq_in} -o {output} --no_split --end_size 35 --extra_end_trim 0 -t {threads} -v 1) 2> {log}" rule nanofilt: @@ -104,6 +104,8 @@ rule canu_correct: "results/{date}/trimmed/nanofilt/{sample}.fastq", output: "results/{date}/corrected/{sample}/{sample}.correctedReads.fasta.gz", + temp(directory("results/{date}/corrected/{sample}/correction")), + temp(directory("results/{date}/corrected/{sample}/{sample}.seqStore")), log: "logs/{date}/canu/assemble/{sample}.log", params: @@ -113,25 +115,30 @@ rule canu_correct: for_testing=lambda w, threads: get_if_testing( f"corThreads={threads} redMemory=6 oeaMemory=6" ), + resources: + parallel_correction_processes=1, conda: "../envs/canu.yaml" threads: 16 shell: - "( if [ -d {params.outdir} ]; then rm -Rf {params.outdir}; fi &&" - " canu -correct -nanopore {input} -p {wildcards.sample} -d {params.outdir} genomeSize=30k minOverlapLength=10 minReadLength=200" - " useGrid=false {params.for_testing}" - " corMMapMerSize=10 corOutCoverage=50000 corMinCoverage=0 maxInputCoverage=20000" - " corOverlapper=minimap utgOverlapper=minimap obtOverlapper=minimap" - " corConcurrency={params.concurrency}" - " cormhapConcurrency={params.concurrency} cormhapThreads={params.concurrency}" - " cormmapConcurrency={params.concurrency} cormmapThreads={params.concurrency}" - " obtmmapConcurrency={params.concurrency} obtmmapThreads={params.concurrency}" - " utgmmapConcurrency={params.concurrency} utgmmapThreads={params.concurrency}" - " redConcurrency={params.concurrency} redThreads={params.concurrency}" - " ovbConcurrency={params.concurrency}" - " ovsConcurrency={params.concurrency}" - " oeaConcurrency={params.concurrency})" - "> {log} 2>&1" + """ + ( if [ -d {params.outdir} ]; then rm -Rf {params.outdir}; fi && + canu -correct -nanopore {input} -p {wildcards.sample} -d {params.outdir} genomeSize=30k minOverlapLength=10 minReadLength=200 \ + useGrid=false {params.for_testing} \ + corMMapMerSize=10 corOutCoverage=50000 corMinCoverage=0 maxInputCoverage=20000 \ + corOverlapper=minimap utgOverlapper=minimap obtOverlapper=minimap \ + corConcurrency={params.concurrency} \ + cormhapConcurrency={params.concurrency} cormhapThreads={params.concurrency} \ + cormmapConcurrency={params.concurrency} cormmapThreads={params.concurrency} \ + obtmmapConcurrency={params.concurrency} obtmmapThreads={params.concurrency} \ + utgmmapConcurrency={params.concurrency} utgmmapThreads={params.concurrency} \ + redConcurrency={params.concurrency} redThreads={params.concurrency} \ + ovbConcurrency={params.concurrency} \ + ovsConcurrency={params.concurrency} \ + oeaConcurrency={params.concurrency} + ) + > {log} 2>&1 + """ # rule medaka_consensus_reference: