From 3810996c58f1b02e4e7a4676ec79fd0e020b2f96 Mon Sep 17 00:00:00 2001 From: alsmith151 Date: Tue, 23 Jul 2024 18:34:34 +0100 Subject: [PATCH] Refactor Snakefiles to include SCALE_RESOURCES variable --- seqnado/workflow/rules/align.smk | 8 +++---- seqnado/workflow/rules/align_rna.smk | 2 +- seqnado/workflow/rules/alignment_counts.smk | 12 +++++----- .../rules/alignment_post_processing.smk | 14 +++++------ seqnado/workflow/rules/exogenous_norm.smk | 6 ++--- seqnado/workflow/rules/fastq_screen.smk | 2 +- seqnado/workflow/rules/fastq_trim.smk | 8 +++---- seqnado/workflow/rules/heatmap.smk | 6 ++--- seqnado/workflow/rules/hub.smk | 2 +- seqnado/workflow/rules/motif.smk | 6 ++--- seqnado/workflow/rules/peak_call_chip.smk | 24 +++++++++---------- seqnado/workflow/rules/peak_call_grouped.smk | 2 +- seqnado/workflow/rules/peak_call_other.smk | 10 ++++---- seqnado/workflow/rules/pileup_default.smk | 20 ++++++++-------- seqnado/workflow/rules/pileup_grouped.smk | 4 ++-- seqnado/workflow/rules/pileup_norm.smk | 8 +++---- seqnado/workflow/rules/qc.smk | 16 ++++++------- 17 files changed, 75 insertions(+), 75 deletions(-) diff --git a/seqnado/workflow/rules/align.smk b/seqnado/workflow/rules/align.smk index 20d74d85..349260ea 100755 --- a/seqnado/workflow/rules/align.smk +++ b/seqnado/workflow/rules/align.smk @@ -13,8 +13,8 @@ rule align_paired: bam=temp("seqnado_output/aligned/raw/{sample}.bam"), threads: config["bowtie2"]["threads"] resources: - runtime=lambda wildcards, attempt: f"{4 * 2 ** (attempt - 1)}h", - mem=lambda wildcards, attempt: f"{4 * 2 ** (attempt - 1)}GB", + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/align/{sample}.log", shell: @@ -34,8 +34,8 @@ rule align_single: output: bam=temp("seqnado_output/aligned/raw/{sample}.bam"), resources: - runtime=lambda wildcards, attempt: f"{4 * 2 ** (attempt - 1)}h", - mem=lambda wildcards, attempt: f"{4 * 2 ** (attempt - 1)}GB", + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), threads: config["bowtie2"]["threads"] log: "seqnado_output/logs/align/{sample}.log", diff --git a/seqnado/workflow/rules/align_rna.smk b/seqnado/workflow/rules/align_rna.smk index 4105a31f..38ce1cc4 100755 --- a/seqnado/workflow/rules/align_rna.smk +++ b/seqnado/workflow/rules/align_rna.smk @@ -16,7 +16,7 @@ rule align_paired: threads: config["star"]["threads"] resources: mem=lambda wildcards, attempt: define_memory_requested(initial_value=35, attempts=attempt, scale=SCALE_RESOURCES), - runtime=lambda wildcards, attempt: define_time_requested(initial_value=6, attempts=attempt, scale=SCALE_RESOURCES) + runtime=lambda wildcards, attempt: define_time_requested(initial_value=6, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/align/{sample}.log", shell: diff --git a/seqnado/workflow/rules/alignment_counts.smk b/seqnado/workflow/rules/alignment_counts.smk index e0084fe9..63699574 100755 --- a/seqnado/workflow/rules/alignment_counts.smk +++ b/seqnado/workflow/rules/alignment_counts.smk @@ -11,8 +11,8 @@ rule feature_counts: options=check_options(config["featurecounts"]["options"]), threads: config["featurecounts"]["threads"] resources: - mem=lambda wildcards, attempt: f"{3 * 2 ** (attempt)}GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=3, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/readcounts/featurecounts/featurecounts.log", shell: @@ -41,8 +41,8 @@ rule salmon_counts_paired: options=check_options(config["salmon"]["options"]), threads: config["salmon"]["threads"] resources: - mem=lambda wildcards, attempt: f"{3 * 2 ** (attempt)}GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=3, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/readcounts/salmon/salmon_{sample}.log", shell: @@ -61,8 +61,8 @@ rule salmon_counts_single: options=check_options(config["salmon"]["options"]), threads: config["salmon"]["threads"] resources: - mem=lambda wildcards, attempt: f"{3 * 2 ** (attempt)}GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=3, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/readcounts/salmon/salmon_{sample}.log", shell: diff --git a/seqnado/workflow/rules/alignment_post_processing.smk b/seqnado/workflow/rules/alignment_post_processing.smk index 5867c9d9..b461bcfc 100755 --- a/seqnado/workflow/rules/alignment_post_processing.smk +++ b/seqnado/workflow/rules/alignment_post_processing.smk @@ -7,7 +7,7 @@ rule sort_bam: output: bam=temp("seqnado_output/aligned/sorted/{sample}.bam"), resources: - mem=lambda wildcards, attempt: f"{4 * 2 ** (attempt - 1)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), threads: 8 log: "seqnado_output/logs/sorted/{sample}.log", @@ -26,7 +26,7 @@ rule index_bam: bai=temp("seqnado_output/aligned/sorted/{sample}.bam.bai"), threads: 1 resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt - 1)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "samtools index -@ {threads} -b {input.bam}" @@ -46,8 +46,8 @@ if config["remove_blacklist"] and os.path.exists(config.get("blacklist", "")): params: blacklist=check_options(config["blacklist"]), resources: - mem="5GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=5, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/blacklist/{sample}.log", shell: @@ -72,7 +72,7 @@ else: ), threads: 1 resources: - mem="1GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=1, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/blacklist/{sample}.log", shell: @@ -99,8 +99,8 @@ if config["remove_pcr_duplicates_method"] == "picard": params: options=check_options(config["picard"]["options"]), resources: - mem="5GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=5, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/duplicates/{sample}.log", shell: diff --git a/seqnado/workflow/rules/exogenous_norm.smk b/seqnado/workflow/rules/exogenous_norm.smk index 38c9b4df..da556927 100755 --- a/seqnado/workflow/rules/exogenous_norm.smk +++ b/seqnado/workflow/rules/exogenous_norm.smk @@ -5,14 +5,14 @@ use rule align_paired as align_paired_spikein with: output: bam=temp("seqnado_output/aligned/spikein/raw/{sample}.bam"), resources: - mem=lambda wildcards, attempt: f"{8 * 2 ** (attempt - 1)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=8, attempts=attempt, scale=SCALE_RESOURCES), use rule align_single as align_single_spikein with: output: bam=temp("seqnado_output/aligned/spikein/raw/{sample}.bam"), resources: - mem=lambda wildcards, attempt: f"{8 * 2 ** (attempt - 1)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=8, attempts=attempt, scale=SCALE_RESOURCES), use rule sort_bam as sort_bam_spikein with: @@ -21,7 +21,7 @@ use rule sort_bam as sort_bam_spikein with: output: bam=temp("seqnado_output/aligned/spikein/sorted/{sample}.bam"), resources: - mem=lambda wildcards, attempt: f"{8 * 2 ** (attempt - 1)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=8, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/aligned_spikein/{sample}_sort.log", diff --git a/seqnado/workflow/rules/fastq_screen.smk b/seqnado/workflow/rules/fastq_screen.smk index 6bc95159..92b3fb16 100755 --- a/seqnado/workflow/rules/fastq_screen.smk +++ b/seqnado/workflow/rules/fastq_screen.smk @@ -54,7 +54,7 @@ rule multiqc_fastqscreen: log: "seqnado_output/logs/multiqc_fastqscreen.log", resources: - mem=lambda wildcards, attempt: f"{2 * 2**attempt}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "multiqc -o seqnado_output/qc -n full_fastqscreen_report.html --force seqnado_output/qc/fastq_screen > {log} 2>&1" diff --git a/seqnado/workflow/rules/fastq_trim.smk b/seqnado/workflow/rules/fastq_trim.smk index c76bba98..065c1641 100755 --- a/seqnado/workflow/rules/fastq_trim.smk +++ b/seqnado/workflow/rules/fastq_trim.smk @@ -11,8 +11,8 @@ rule trimgalore_paired: trimmed2=temp("seqnado_output/trimmed/{sample}_2.fastq.gz"), threads: 4 resources: - mem="2GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), params: options=check_options(config["trim_galore"]["options"]), trim_dir="seqnado_output/trimmed", @@ -34,8 +34,8 @@ rule trimgalore_single: trimmed=temp("seqnado_output/trimmed/{sample}.fastq.gz"), threads: 4 resources: - mem="2GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), params: options=check_options(config["trim_galore"]["options"]), trim_dir="seqnado_output/trimmed", diff --git a/seqnado/workflow/rules/heatmap.smk b/seqnado/workflow/rules/heatmap.smk index e7ad0ec6..2f9ed7fe 100755 --- a/seqnado/workflow/rules/heatmap.smk +++ b/seqnado/workflow/rules/heatmap.smk @@ -23,7 +23,7 @@ rule heatmap_matrix: threads: config["deeptools"]["threads"] resources: runtime=lambda wildcards, attempt: f"{1 * 2**attempt}h", - mem=lambda wildcards, attempt: f"{4 * 2**attempt}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/heatmap/matrix.log", shell: @@ -38,7 +38,7 @@ rule heatmap_plot: params: colormap=check_options(config["heatmap"]["colormap"]), resources: - mem=lambda wildcards, attempt: f"{2 * 2**attempt}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/heatmap/heatmap.log", shell: @@ -51,7 +51,7 @@ rule heatmap_metaplot: output: metaplot="seqnado_output/heatmap/metaplot.pdf", resources: - mem=lambda wildcards, attempt: f"{2 * 2**attempt}GB" + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/heatmap/metaplot.log", shell: diff --git a/seqnado/workflow/rules/hub.smk b/seqnado/workflow/rules/hub.smk index e59f2732..053d2f09 100755 --- a/seqnado/workflow/rules/hub.smk +++ b/seqnado/workflow/rules/hub.smk @@ -72,7 +72,7 @@ rule bed_to_bigbed: params: chrom_sizes=config["genome"]["chromosome_sizes"], resources: - mem="1GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=1, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/bed_to_bigbed/{directory}/{sample}.log", shell: diff --git a/seqnado/workflow/rules/motif.smk b/seqnado/workflow/rules/motif.smk index 1b752810..80040198 100755 --- a/seqnado/workflow/rules/motif.smk +++ b/seqnado/workflow/rules/motif.smk @@ -8,7 +8,7 @@ rule get_fasta: params: genome=config["genome"]["fasta"], resources: - mem=lambda wildcards, attempt: f"{1 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=1, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/motifs/fasta/{sample}.log", shell: @@ -28,7 +28,7 @@ rule motif_meme_chip: meme_chip_params=config["meme"]["meme_chip_params"], meme_chip_db=config["meme"]["meme_chip_db"], resources: - mem=lambda wildcards, attempt: f"{1 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=1, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/motifs/meme/{sample}.log", shell: @@ -47,7 +47,7 @@ rule motif_homer: homer_params=config["homer"]["homer_params"], homer_bg=config["homer"]["homer_bg"], resources: - mem=lambda wildcards, attempt: f"{1 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=1, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/motifs/homer/{sample}.log", shell: diff --git a/seqnado/workflow/rules/peak_call_chip.smk b/seqnado/workflow/rules/peak_call_chip.smk index bc6c3427..403de9c0 100755 --- a/seqnado/workflow/rules/peak_call_chip.smk +++ b/seqnado/workflow/rules/peak_call_chip.smk @@ -54,8 +54,8 @@ rule macs2_with_input: basename=lambda wc, output: output.peaks.replace(".bed", ""), threads: 1 resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/macs/{sample}_{treatment}.log", shell: @@ -77,8 +77,8 @@ rule macs2_no_input: basename=lambda wc, output: output.peaks.replace(".bed", ""), threads: 1 resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/macs/{sample}_{treatment}.log", shell: @@ -100,8 +100,8 @@ rule homer_with_input: options=check_options(config["homer"]["findpeaks"]), threads: 1 resources: - mem="4GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: """ findPeaks {input.treatment} {params.options} -o {output.peaks}.tmp -i {input.control} > {log} 2>&1 && @@ -122,8 +122,8 @@ rule homer_no_input: options=check_options(config["homer"]["findpeaks"]), threads: 1 resources: - mem="4GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: """ findPeaks {input.treatment} {params.options} -o {output.peaks}.tmp > {log} 2>&1 && @@ -149,7 +149,7 @@ rule lanceotron_with_input: threads: 1 resources: mem="10GB", - runtime="6h", + runtime=lambda wildcards, attempt: define_time_requested(initial_value=6, attempts=attempt, scale=SCALE_RESOURCES), shell: """ lanceotron callPeaksInput {input.treatment} -i {input.control} -f {params.outdir} --skipheader > {log} 2>&1 && @@ -174,7 +174,7 @@ rule lanceotron_no_input: "library://asmith151/seqnado/seqnado_extra:latest" resources: mem=lambda wildcards, attempt: f"{10 * 2 ** (attempt)}GB", - runtime="6h", + runtime=lambda wildcards, attempt: define_time_requested(initial_value=6, attempts=attempt, scale=SCALE_RESOURCES), shell: """ lanceotron callPeaks {input.treatment} -f {params.outdir} --skipheader {params.options} > {log} 2>&1 && @@ -195,8 +195,8 @@ rule seacr: prefix=lambda wc, output: pathlib.Path(output.peaks).parent / pathlib.Path(output.peaks).name, threads: 1 resources: - mem="5GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=5, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: """ SEACR_1.3.sh {input.treatment} {params.threshold} {params.norm} {params.stringency} {output.peaks} > {log} 2>&1 || touch {params.prefix}.{params.stringency}.bed diff --git a/seqnado/workflow/rules/peak_call_grouped.smk b/seqnado/workflow/rules/peak_call_grouped.smk index 4e9e99d1..5cd99717 100755 --- a/seqnado/workflow/rules/peak_call_grouped.smk +++ b/seqnado/workflow/rules/peak_call_grouped.smk @@ -7,7 +7,7 @@ rule lanceotron_no_input_consensus: peaks="seqnado_output/peaks/merged/lanceotron/{group}.bed", threads: 8 resources: - runtime=lambda wildcards, attempt: f"{4 * 2 ** (attempt - 1)}h", + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), mem=lambda wildcards, attempt: f"{10 * 2 ** (attempt - 1)}GB", params: outdir="seqnado_output/peaks/merged/lanceotron", diff --git a/seqnado/workflow/rules/peak_call_other.smk b/seqnado/workflow/rules/peak_call_other.smk index 05bd892f..f4039e40 100755 --- a/seqnado/workflow/rules/peak_call_other.smk +++ b/seqnado/workflow/rules/peak_call_other.smk @@ -21,8 +21,8 @@ rule macs2_no_input: basename=lambda wc, output: output.peaks.replace(".bed", ""), threads: 1 resources: - mem="2GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/macs/{sample}.bed", shell: @@ -43,8 +43,8 @@ rule homer_no_input: options=check_options(config["homer"]["findpeaks"]), threads: 1 resources: - mem="4GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: """ findPeaks {input.treatment} {params.options} -o {output.peaks}.tmp > {log} 2>&1 && @@ -68,7 +68,7 @@ rule lanceotron_no_input: "library://asmith151/seqnado/seqnado_extra:latest" resources: mem=lambda wildcards, attempt: f"{10 * 2 ** (attempt)}GB", - runtime="6h", + runtime=lambda wildcards, attempt: define_time_requested(initial_value=6, attempts=attempt, scale=SCALE_RESOURCES), shell: """ lanceotron callPeaks {input.treatment} -f {params.outdir} --skipheader {params.options} > {log} 2>&1 && diff --git a/seqnado/workflow/rules/pileup_default.smk b/seqnado/workflow/rules/pileup_default.smk index dcb7824f..ef1060d7 100755 --- a/seqnado/workflow/rules/pileup_default.smk +++ b/seqnado/workflow/rules/pileup_default.smk @@ -21,8 +21,8 @@ rule homer_make_tag_directory: params: options=check_options(config["homer"]["maketagdirectory"]), resources: - mem="4GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/homer/maketagdirectory_{sample}.log", shell: @@ -37,8 +37,8 @@ rule homer_make_bigwigs: log: "seqnado_output/logs/homer/makebigwigs_{sample}.log", resources: - mem="4GB", - runtime="2h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), params: genome_name=config["genome"]["name"], genome_chrom_sizes=config["genome"]["chromosome_sizes"], @@ -62,8 +62,8 @@ rule deeptools_make_bigwigs: params: options=lambda wildcards: format_deeptools_options(wildcards, config["deeptools"]["bamcoverage"]), resources: - mem="2GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), threads: config["deeptools"]["threads"] log: @@ -84,8 +84,8 @@ rule deeptools_make_bigwigs_rna_plus: options=check_options(config["deeptools"]["bamcoverage"]), threads: config["deeptools"]["threads"] resources: - mem="2GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/pileups/deeptools/unscaled/{sample}_plus.log", shell: @@ -104,8 +104,8 @@ rule deeptools_make_bigwigs_rna_minus: options=check_options(config["deeptools"]["bamcoverage"]), threads: config["deeptools"]["threads"] resources: - mem="2GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/pileups/deeptools/unscaled/{sample}_minus.log", shell: diff --git a/seqnado/workflow/rules/pileup_grouped.smk b/seqnado/workflow/rules/pileup_grouped.smk index 8b81f590..f334ca52 100755 --- a/seqnado/workflow/rules/pileup_grouped.smk +++ b/seqnado/workflow/rules/pileup_grouped.smk @@ -20,8 +20,8 @@ rule deeptools_make_bigwigs_consensus: params: options=lambda wildcards: format_deeptools_options_grouped(wildcards, config["deeptools"]["bamcoverage"]), resources: - mem="4GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), threads: config["deeptools"]["threads"] log: diff --git a/seqnado/workflow/rules/pileup_norm.smk b/seqnado/workflow/rules/pileup_norm.smk index eba894de..af46f0e6 100755 --- a/seqnado/workflow/rules/pileup_norm.smk +++ b/seqnado/workflow/rules/pileup_norm.smk @@ -183,8 +183,8 @@ rule deeptools_make_bigwigs_rna_spikein_plus: scale=get_norm_factor_spikein, threads: config["deeptools"]["threads"] resources: - mem="2GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/pileups/deeptools/spikein/{sample}_plus.log", shell: @@ -203,8 +203,8 @@ rule deeptools_make_bigwigs_rna_spikein_minus: scale=lambda wc: get_norm_factor_spikein(wc, negative=True), threads: config["deeptools"]["threads"] resources: - mem="2GB", - runtime="4h", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), + runtime=lambda wildcards, attempt: define_time_requested(initial_value=4, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/pileups/deeptools/spikein/{sample}_minus.log", shell: diff --git a/seqnado/workflow/rules/qc.smk b/seqnado/workflow/rules/qc.smk index 2939af3e..6effa02d 100755 --- a/seqnado/workflow/rules/qc.smk +++ b/seqnado/workflow/rules/qc.smk @@ -17,7 +17,7 @@ rule fastqc_raw_paired: threads: 1 resources: mem="1.5GB", - runtime=lambda wildcards, attempt: f"{1 * 2 ** (attempt - 1)}h", + runtime=lambda wildcards, attempt: define_time_requested(initial_value=1, attempts=attempt, scale=SCALE_RESOURCES), log: "seqnado_output/logs/fastqc_raw/{sample}.log", shell: @@ -82,7 +82,7 @@ rule samtools_stats: stats="seqnado_output/qc/alignment_raw/{sample}.txt", threads: 1 resources: - mem=lambda wildcards, attempt: f"{1 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=1, attempts=attempt, scale=SCALE_RESOURCES), shell: """samtools stats {input.bam} > {output.stats}""" @@ -142,7 +142,7 @@ rule multiqc: log: "seqnado_output/logs/multiqc.log", resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "multiqc -o seqnado_output/qc seqnado_output/qc -n full_qc_report.html --force > {log} 2>&1" @@ -170,7 +170,7 @@ rule multiqc_raw: log: "seqnado_output/logs/multiqc_raw.log", resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "multiqc -o seqnado_output/qc seqnado_output/qc/fastqc_raw -n fastq_raw_qc.html --force > {log} 2>&1" @@ -198,7 +198,7 @@ rule multiqc_trimmed: log: "seqnado_output/logs/multiqc_trimmed.log", resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "multiqc -o seqnado_output/qc seqnado_output/qc/fastqc_trimmed -n fastq_trimmed_qc.html --force > {log} 2>&1" @@ -214,7 +214,7 @@ rule multiqc_alignment_raw: log: "seqnado_output/logs/multiqc_alignment_raw.log", resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "multiqc -o seqnado_output/qc seqnado_output/qc/alignment_raw -n alignment_raw_qc.html --force > {log} 2>&1" @@ -230,7 +230,7 @@ rule multiqc_alignment_filtered: log: "seqnado_output/logs/multiqc_alignment_filtered.log", resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "multiqc -o seqnado_output/qc seqnado_output/qc/alignment_filtered -n alignment_filtered_qc.html --force > {log} 2>&1" @@ -246,7 +246,7 @@ rule multiqc_library_complexity: log: "seqnado_output/logs/multiqc_library_complexity.log", resources: - mem=lambda wildcards, attempt: f"{2 * 2 ** (attempt)}GB", + mem=lambda wildcards, attempt: define_memory_requested(initial_value=2, attempts=attempt, scale=SCALE_RESOURCES), shell: "multiqc -o seqnado_output/qc seqnado_output/aligned/duplicates_removed -n library_complexity_qc.html --force > {log} 2>&1"