From d789a13be15cd8ebb3621946fafbf558b15f0658 Mon Sep 17 00:00:00 2001 From: msbentsen Date: Mon, 6 Jan 2020 10:17:44 +0100 Subject: [PATCH] Added exception for configfiles depending on snakemake version --- Snakefile | 7 ++++- environments/tobias.yaml | 56 +++++++++------------------------- snakefiles/preprocessing.snake | 8 +++-- 3 files changed, 26 insertions(+), 45 deletions(-) diff --git a/Snakefile b/Snakefile index d85f306..0147099 100644 --- a/Snakefile +++ b/Snakefile @@ -8,11 +8,16 @@ import itertools import glob import datetime +snakemake.utils.min_version("5.4") #for checkpoints functionality + #-------------------------------------------------------------------------------# #---------------------- SETUP PROCESS-RELATED CONFIGURATION --------------------# #-------------------------------------------------------------------------------# +try: + CONFIGFILE = str(workflow.overwrite_configfiles[0]) +except: + CONFIGFILE = str(workflow.overwrite_configfile[0]) -CONFIGFILE = str(workflow.overwrite_configfile) wd = os.getcwd() config["wd"] = wd diff --git a/environments/tobias.yaml b/environments/tobias.yaml index fac19df..15c7494 100644 --- a/environments/tobias.yaml +++ b/environments/tobias.yaml @@ -5,49 +5,23 @@ channels: - conda-forge dependencies: - - python >= 3 - - pysam - - pybigwig + - python=3 + - snakemake>=5.4 + - uropa=3 + - samtools - moods - - pybedtools - - cython - - matplotlib - - numpy - - scipy - - pypdf2 - - scikit-learn - - snakemake - - bedtools - - uropa - - igvtools - - openjdk - - xlsxwriter - - cloudpickle = 0.5.6 - unzip - - r-base - r-devtools - - r-shiny - - r-data.table - - r-ggplot2 - - r-plotly + - r-knitr + - r-lme4 + - r-htmltable + - tobias>=0.9 + - r-hmisc + - r-pbkrtest + - r-openxlsx + - r-rio + - r-car - bioconductor-deseq2 - - r-plyr - - r-scales - - r-rjson - - r-shinydashboard - - r-reshape - - r-ggrepel >= 0.6.12 - - r-heatmaply >= 0.14.1 - - r-colorspace - - r-shinyjs - - r-viridis - - r-rje - - r-openssl - - r-shinycssloaders - - r-log4r - - r-shinythemes - - r-shinybs - intervene - - pip: - - adjustText - - tobias + - igvtools + - icu diff --git a/snakefiles/preprocessing.snake b/snakefiles/preprocessing.snake index d8df927..8284c02 100644 --- a/snakefiles/preprocessing.snake +++ b/snakefiles/preprocessing.snake @@ -94,7 +94,7 @@ rule process_peaks: peaks = lambda wildcards: [os.path.join(OUTPUTDIR, "peak_calling", wildcards.condition, sample_id + "_raw.bed") for sample_id in id2bam[wildcards.condition].keys()], blacklisted = BLACKLIST output: - peaks = os.path.join(OUTPUTDIR, "peak_calling", "{condition}_union.bed"), + peaks = os.path.join(OUTPUTDIR, "peak_calling", "{condition}_union.bed") message: "Processing peaks from condition {wildcards.condition}" shell: "cat {input.peaks} | cut -f1-3 | sort -k1,1 -k2,2n | bedtools merge -d 5 | bedtools subtract -a - -b {input.blacklisted} -A | " @@ -103,8 +103,10 @@ rule process_peaks: # Union peaks across all conditions rule merge_condition_peaks: - input: expand(rules.process_peaks.output.peaks, condition=CONDITION_IDS) #expand(os.path.join(OUTPUTDIR, "peak_calling", "{condition}_union.bed"), condition=CONDITION_IDS) - output: temp(os.path.join(OUTPUTDIR, "peak_calling", "all_merged.tmp")) + input: + [os.path.join(OUTPUTDIR, "peak_calling", condition + "_union.bed") for condition in CONDITION_IDS] + output: + temp(os.path.join(OUTPUTDIR, "peak_calling", "all_merged.tmp")) message: "Merging peaks across conditions" shell: "cat {input} | sort -k1,1 -k2,2n | bedtools merge -d 5 -c 4 -o distinct > {output}"