From 1b0cc0acc5a839ed933427301070966fc6bea938 Mon Sep 17 00:00:00 2001 From: Arya Massarat <23412689+aryarm@users.noreply.github.com> Date: Wed, 25 Sep 2024 13:45:01 -0700 Subject: [PATCH] allow pipeline to run on geuvadis --- analysis/run.bash | 3 +++ analysis/workflow/rules/happler.smk | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/analysis/run.bash b/analysis/run.bash index 793c01a..d66c578 100755 --- a/analysis/run.bash +++ b/analysis/run.bash @@ -10,6 +10,9 @@ #SBATCH --time 0:30:00 #SBATCH --mem 2G #SBATCH --output /dev/null +#SBATCH --signal=B:SIGUSR1@15 + +trap "slack job terminating early" SIGUSR1 # An example bash script demonstrating how to run the entire snakemake pipeline # This script creates two separate log files in the output dir: diff --git a/analysis/workflow/rules/happler.smk b/analysis/workflow/rules/happler.smk index b8f6e81..08cc773 100644 --- a/analysis/workflow/rules/happler.smk +++ b/analysis/workflow/rules/happler.smk @@ -35,6 +35,7 @@ rule run: region=lambda wildcards: wildcards.locus.replace("_", ":"), covar=lambda wildcards, input: ("--covar " + input["covar"] + " ") if check_config("covar") else "", maf = check_config("min_maf", 0), + indep=lambda wildcards: 0.05 if "indep_alpha" not in wildcards else wildcards.indep_alpha, output: hap=out + "/happler.hap", gz=out + "/happler.hap.gz", @@ -43,12 +44,15 @@ rule run: resources: runtime=lambda wildcards, input: ( Path(input.gts).with_suffix(".pvar").stat().st_size/1000 * 0.5454649806119475 + 0.6935132147046765 - if Path(input.gts).suffix == ".pgen" else 30 + if Path(input.gts).suffix == ".pgen" and check_config("dynamic_resources") else 45 ), # slurm_partition="hotel", # slurm_extra="--qos=hotel", # mem_mb=lambda wildcards, threads: threads*4.57, - mem_mb=lambda wildcards: 5000, + mem_mb=lambda wildcards, input: ( + Path(input.gts).with_suffix(".pvar").stat().st_size/1000 * 14.90840694595845 + 401.8011129664152 + if Path(input.gts).suffix == ".pgen" and check_config("dynamic_resources") else 5000 + ), threads: 1 log: logs + "/run", @@ -58,9 +62,9 @@ rule run: "happler" shell: "happler run -o {output.hap} --verbosity DEBUG --maf {params.maf} " - "--discard-multiallelic --region {params.region} {params.covar}" - "-t {params.thresh} --show-tree {input.gts} {input.pts} &>{log} && " - "haptools index -o {output.gz} {output.hap} &>>{log}" + "--discard-multiallelic --region {params.region} {params.covar} --indep-thresh" + " {params.indep} -t {params.thresh} --show-tree {input.gts} {input.pts} &>{log}" + " && haptools index -o {output.gz} {output.hap} &>>{log}" rule tree: @@ -106,7 +110,7 @@ rule cond_linreg: runtime=lambda wildcards, input: ( 1.5 * Path(input.pvar).stat().st_size/1000 * ( 0.2400978997329614 + get_num_variants(input.hap) * 0.045194464826048095 - ) if Path(input.pgen).suffix == ".pgen" else 50 + ) if Path(input.pgen).suffix == ".pgen" and check_config("dynamic_resources") else 50 ), log: logs + "/cond_linreg", @@ -301,7 +305,7 @@ rule merge: resources: runtime=lambda wildcards, input: ( Path(input.gts_pvar).stat().st_size/1000 * 0.05652315368728583 + 2.0888654705656844 - if Path(input.gts).suffix == ".pgen" else 10 + if Path(input.gts).suffix == ".pgen" and check_config("dynamic_resources") else 10 ), log: logs + "/{ex}clude/merge", @@ -344,7 +348,7 @@ rule finemapper: resources: # runtime=lambda wildcards, input: ( # Path(input.gt_pvar).stat().st_size/1000 * 0.08 -# if Path(input.gt).suffix == ".pgen" else 75 +# if Path(input.gt).suffix == ".pgen" and check_config("dynamic_resources") else 75 # ), runtime=120, mem_mb = 7000,