From 0d2b4814ac5ba244bb5ac45e72d34de76646ef2d Mon Sep 17 00:00:00 2001 From: Endre Bakken Stovner Date: Thu, 5 Dec 2019 13:45:05 +0100 Subject: [PATCH 1/2] Allow prefix in config file This allows users to run different analyses from the folder in which the Snakefile is located. --- Snakefile | 19 ++++++++++--------- config_example.yaml | 3 +++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/Snakefile b/Snakefile index 323b83e..3a12330 100644 --- a/Snakefile +++ b/Snakefile @@ -19,19 +19,20 @@ def get_region(wildcards): rule all: input: - expand("methylation_frequency/{region}_{sample}.tsv", + expand("{prefix}methylation_frequency/{region}_{sample}.tsv", sample=config["fastq"], - region=config["region"]) + region=config["region"], + prefix=config.get("prefix", "")) rule nanopolish_index: input: f5 = get_fast5, fq = get_fastq, output: - "indices/index_done_{sample}" + "{prefix}indices/index_done_{sample}" threads: 10 # Just to ensure that this is not ran in parallel for too many samples log: - "logs/nanopolish_index/index_{sample}.log" + "{prefix}logs/nanopolish_index/index_{sample}.log" shell: """ nanopolish index -d {input.f5}/ {input.fq} 2> {log} @@ -45,12 +46,12 @@ rule call_methylation: bam = get_bam, genome = config["genome"], output: - "methylation_calls/{region}_{sample}.tsv" + "{prefix}methylation_calls/{region}_{sample}.tsv" threads: 8 params: region = get_region, log: - "logs/methylation/methcall_{region}_{sample}.log" + "{prefix}logs/methylation/methcall_{region}_{sample}.log" shell: """ nanopolish call-methylation \ @@ -63,11 +64,11 @@ rule call_methylation: rule methylation_frequency: input: - "methylation_calls/{region}_{sample}.tsv" + "{prefix}methylation_calls/{region}_{sample}.tsv" output: - "methylation_frequency/{region}_{sample}.tsv" + "{prefix}methylation_frequency/{region}_{sample}.tsv" log: - "logs/methylation/methfreq_{region}_{sample}.log" + "{prefix}logs/methylation/methfreq_{region}_{sample}.log" params: script = os.path.join(workflow.basedir, "scripts/calculate_methylation_frequency.py") shell: diff --git a/config_example.yaml b/config_example.yaml index b63421f..d5148f3 100644 --- a/config_example.yaml +++ b/config_example.yaml @@ -1,3 +1,6 @@ +prefix: + "analysis_name" + genome: /path/to/database/genome.fa.gz From b36164dd0366d4a9b1985ceb16a26383e2c73489 Mon Sep 17 00:00:00 2001 From: Endre Bakken Stovner Date: Thu, 5 Dec 2019 13:50:50 +0100 Subject: [PATCH 2/2] Update config with example prefix --- config_example.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config_example.yaml b/config_example.yaml index d5148f3..696cc4b 100644 --- a/config_example.yaml +++ b/config_example.yaml @@ -1,5 +1,5 @@ prefix: - "analysis_name" + "analysis_name" # or /path/where/you/want/the/results genome: /path/to/database/genome.fa.gz