diff --git a/config/cluster_config.yaml b/config/cluster_config.yaml index 0cb5ef93f59e75c67a32261c4cd0455a4fde6beb..3964707d950c67b474c643afb486c98b25ea3665 100644 --- a/config/cluster_config.yaml +++ b/config/cluster_config.yaml @@ -27,6 +27,9 @@ resources: samtools: mem: 4096 time: "12h" + samtools_multithread: + mem_per_thread: 4096 + time: "12h" samtools_25G: mem: 25600 time: "12h" diff --git a/snakemodules/contigmap.smk b/snakemodules/contigmap.smk index 9b88b06c2550761320b54516ccfb2405cbd88284..84d8bfb35858b05c69132ecd280f956d9603fa7e 100644 --- a/snakemodules/contigmap.smk +++ b/snakemodules/contigmap.smk @@ -96,9 +96,9 @@ rule name_sort_unsorted: conda: os.path.join(WORKFLOW_PATH,"snakemodules/envs/samtools.yml") resources: - # mem_mb = resources["samtools"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] log: @@ -106,7 +106,9 @@ rule name_sort_unsorted: benchmark: "benchmarks/contigmap/{sample}_name_sort_unsorted.txt" shell: - "samtools sort -n -@ {threads} -m {resources.mem_mb}M -o {output} {input} 2> {log.err}" + """ + samtools sort -n -@ {threads} -m {resources.mem_per_thread}M -o {output} {input} 2> {log.err} + """ ################################################################################ @@ -171,9 +173,9 @@ rule coordinate_sort_unsorted: conda: os.path.join(WORKFLOW_PATH,"snakemodules/envs/samtools.yml") resources: - # mem_mb = resources["samtools_25G"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools_25G"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] log: @@ -181,7 +183,9 @@ rule coordinate_sort_unsorted: benchmark: "benchmarks/contigmap/{sample}_coordinate_sort_unsorted.txt" shell: - "samtools sort -@ {threads} -m {resources.mem_mb}M -o {output} {input} 2> {log.err}" + """ + samtools sort -@ {threads} -m {resources.mem_per_thread}M -o {output} {input} 2> {log.err} + """ rule index_sorted: diff --git a/snakemodules/crop_remapped.smk b/snakemodules/crop_remapped.smk index 2a6864bb1481245364c8ba56380940aad3a9b7bd..d91fafc0e4ad8531cd16ed7df22c17f6cceaf0f0 100644 --- a/snakemodules/crop_remapped.smk +++ b/snakemodules/crop_remapped.smk @@ -60,9 +60,9 @@ if config["SICKLE"]=="no": conda: os.path.join(WORKFLOW_PATH,"snakemodules/envs/samtools.yml") resources: - # mem_mb = resources["samtools"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] log: @@ -70,7 +70,7 @@ if config["SICKLE"]=="no": benchmark: "benchmarks/crop_remapped/{sample}_sort.txt" shell: - "samtools sort -n -@ {threads} -m {resources.mem_mb}M -o {output} {input.mates} 2> {log.err}" + "samtools sort -n -@ {threads} -m {resources.mem_per_thread}M -o {output} {input.mates} 2> {log.err}" elif config["SICKLE"]=="yes": @@ -113,9 +113,9 @@ elif config["SICKLE"]=="yes": conda: os.path.join(WORKFLOW_PATH,"snakemodules/envs/samtools.yml") resources: - # mem_mb = resources["samtools"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] log: @@ -123,7 +123,7 @@ elif config["SICKLE"]=="yes": benchmark: "benchmarks/crop_remapped/{sample}_sort_sickle.txt" shell: - "samtools sort -n -@ {threads} -m {resources.mem_mb}M -o {output} {input.mates} 2> {log.err}" + "samtools sort -n -@ {threads} -m {resources.mem_per_thread}M -o {output} {input.mates} 2> {log.err}" rule popins2_sickle: input: diff --git a/snakemodules/crop_unmapped.smk b/snakemodules/crop_unmapped.smk index 9b04065354fb233d99ef6cb0a3e35a5652ed99b7..1f0e9a3fa40ec6751cf08400c4b744c3c1f0897c 100644 --- a/snakemodules/crop_unmapped.smk +++ b/snakemodules/crop_unmapped.smk @@ -58,9 +58,9 @@ if config["SICKLE"]=="no": conda: os.path.join(WORKFLOW_PATH,"snakemodules/envs/samtools.yml") resources: - # mem_mb = resources["samtools"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] log: @@ -68,7 +68,7 @@ if config["SICKLE"]=="no": benchmark: "benchmarks/crop_unmapped/{sample}_sort.txt" shell: - "samtools sort -n -@ {threads} -m {resources.mem_mb}M -o {output} {input.mates} 2> {log.err}" + "samtools sort -n -@ {threads} -m {resources.mem_per_thread}M -o {output} {input.mates} 2> {log.err}" elif config["SICKLE"]=="yes": @@ -109,9 +109,9 @@ elif config["SICKLE"]=="yes": output: WORK_DIR + "/{sample}/non_ref.bam" resources: - # mem_mb = resources["samtools"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] conda: @@ -121,7 +121,7 @@ elif config["SICKLE"]=="yes": benchmark: "benchmarks/crop_unmapped/{sample}_sort_sickle.txt" shell: - "samtools sort -n -@ {threads} -m {resources.mem_mb}M -o {output} {input.mates} 2> {log.err}" + "samtools sort -n -@ {threads} -m {resources.mem_per_thread}M -o {output} {input.mates} 2> {log.err}" rule popins2_sickle: input: diff --git a/snakemodules/kraken.smk b/snakemodules/kraken.smk index 220eb5ed1497087ac1fb8f8b83b69f4e1117be5f..ea2abfed170aee5fc7ab3e09897d3bb1a0bf82c1 100644 --- a/snakemodules/kraken.smk +++ b/snakemodules/kraken.smk @@ -150,9 +150,9 @@ rule samtools_remap_classified_human: conda: os.path.join(WORKFLOW_PATH,"snakemodules/envs/samtools.yml") resources: - # mem_mb = resources["samtools"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] log: @@ -162,7 +162,7 @@ rule samtools_remap_classified_human: shell: """ samtools view -Sb {input.sam} > {output.remapped_unsorted} 2> {log.err}; - samtools sort -@ {threads} -m {resources.mem_mb}M -o {output.remapped_bam} {output.remapped_unsorted} 2>> {log.err} + samtools sort -@ {threads} -m {resources.mem_per_thread}M -o {output.remapped_bam} {output.remapped_unsorted} 2>> {log.err} """ rule index_reads: @@ -224,9 +224,9 @@ rule remapping_samsort_mates: conda: os.path.join(WORKFLOW_PATH,"snakemodules/envs/samtools.yml") resources: - # mem_mb = resources["samtools"]["mem"], - mem_mb = lambda wildcards, input, threads, attempt: resources["samtools"]["mem"] * threads, - runtime = resources["samtools"]["time"] + mem_per_thread = resources["samtools_multithread"]["mem_per_thread"], + mem_mb = lambda wildcards, input, threads, attempt: resources["samtools_multithread"]["mem_per_thread"] * threads, + runtime = resources["samtools_multithread"]["time"] threads: threads["multi"]["samtools"] log: @@ -234,7 +234,7 @@ rule remapping_samsort_mates: benchmark: "benchmarks/kraken/{sample}_remapping_samsort_mates.txt" shell: - "samtools sort -n -@ {threads} -m {resources.mem_mb}M -o {output} {input} 2> {log.err}" + "samtools sort -n -@ {threads} -m {resources.mem_per_thread}M -o {output} {input} 2> {log.err}" rule merge_set_mate: