From cf38ed9de68367d0d1700ccff262e91ad6f1fbc0 Mon Sep 17 00:00:00 2001 From: Max Schubach Date: Tue, 11 Jun 2024 14:26:32 +0200 Subject: [PATCH] feat: snakemake 8 compatibility --- workflow/rules/common.smk | 11 ++--------- workflow/rules/counts/counts_noUMI.smk | 2 ++ workflow/rules/counts/counts_umi.smk | 2 ++ workflow/scripts/count/MergeTrimReadsBAM_python3.py | 3 --- workflow/scripts/count/MergeTrimReads_python3.py | 3 +-- 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/workflow/rules/common.smk b/workflow/rules/common.smk index 5e4dbbf..eeffe8a 100644 --- a/workflow/rules/common.smk +++ b/workflow/rules/common.smk @@ -1,18 +1,11 @@ ################################ #### Global functions #### ################################ -from snakemake.workflow import srcdir - -SCRIPTS_DIR = srcdir("../scripts") +SCRIPTS_DIR = "../scripts" def getScript(name): - return "%s/%s" % (SCRIPTS_DIR, name) - - -# this container defines the underlying OS for each job when using the workflow -# with --use-conda --use-singularity -container: "docker://continuumio/miniconda3" + return workflow.source_path("%s/%s" % (SCRIPTS_DIR, name)) ##### load config and sample sheets ##### diff --git a/workflow/rules/counts/counts_noUMI.smk b/workflow/rules/counts/counts_noUMI.smk index 9f8f2c9..e0af257 100644 --- a/workflow/rules/counts/counts_noUMI.smk +++ b/workflow/rules/counts/counts_noUMI.smk @@ -14,7 +14,9 @@ rule counts_noUMI_create_BAM: fw_fastq=lambda wc: getFW(wc.project, wc.condition, wc.replicate, wc.type), rev_fastq=lambda wc: getRev(wc.project, wc.condition, wc.replicate, wc.type), script_FastQ2doubleIndexBAM=getScript("count/FastQ2doubleIndexBAM_python3.py"), + module_FastQ2doubleIndexBAM=getScript("count/library_python3.py"), script_MergeTrimReadsBAM=getScript("count/MergeTrimReadsBAM_python3.py"), + module_MergeTrimReadsBAM=getScript("count/MergeTrimReads_python3.py"), output: "results/experiments/{project}/counts/noUMI.{condition}_{replicate}_{type}.bam", params: diff --git a/workflow/rules/counts/counts_umi.smk b/workflow/rules/counts/counts_umi.smk index 5a86e6d..5f4b1b7 100644 --- a/workflow/rules/counts/counts_umi.smk +++ b/workflow/rules/counts/counts_umi.smk @@ -15,7 +15,9 @@ rule counts_umi_create_BAM: rev_fastq=lambda wc: getRev(wc.project, wc.condition, wc.replicate, wc.type), umi_fastq=lambda wc: getUMI(wc.project, wc.condition, wc.replicate, wc.type), script_FastQ2doubleIndexBAM=getScript("count/FastQ2doubleIndexBAM_python3.py"), + module_FastQ2doubleIndexBAM=getScript("count/library_python3.py"), script_MergeTrimReadsBAM=getScript("count/MergeTrimReadsBAM_python3.py"), + module_MergeTrimReadsBAM=getScript("count/MergeTrimReads_python3.py"), output: "results/experiments/{project}/counts/useUMI.{condition}_{replicate}_{type}.bam", params: diff --git a/workflow/scripts/count/MergeTrimReadsBAM_python3.py b/workflow/scripts/count/MergeTrimReadsBAM_python3.py index fd86182..46fe94e 100644 --- a/workflow/scripts/count/MergeTrimReadsBAM_python3.py +++ b/workflow/scripts/count/MergeTrimReadsBAM_python3.py @@ -21,12 +21,9 @@ """ import sys, os -import math -import random import pysam from optparse import OptionParser,OptionGroup -import string from MergeTrimReads_python3 import set_adapter_sequences, set_options, set_keys, process_SR, process_PE table = str.maketrans('TGCA','ACGT') # COMPLEMENT DNA diff --git a/workflow/scripts/count/MergeTrimReads_python3.py b/workflow/scripts/count/MergeTrimReads_python3.py index e5b55a9..c08d063 100644 --- a/workflow/scripts/count/MergeTrimReads_python3.py +++ b/workflow/scripts/count/MergeTrimReads_python3.py @@ -18,10 +18,9 @@ """ -import sys, os +import sys import math import random -import string table = str.maketrans('TGCA','ACGT') # COMPLEMENT DNA