From c229ca114dc146f2b791e3666bddbf38ce2da191 Mon Sep 17 00:00:00 2001
From: Redmar van den Berg <RedmarvandenBerg@lumc.nl>
Date: Wed, 20 May 2020 13:45:47 +0200
Subject: [PATCH] Move containers to dictionary

---
 Snakefile | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/Snakefile b/Snakefile
index 32378f7..db186dd 100644
--- a/Snakefile
+++ b/Snakefile
@@ -1,11 +1,14 @@
-CONTAINER_GVCF2COVERAGE = "docker://quay.io/biocontainers/gvcf2coverage:0.1--hfb13731_0"
-CONTAINER_VCF2VARIANTS = "docker://quay.io/biocontainers/vcf2variants:0.3--py_0"
-CONTAINER_CTHREEPO = "docker://quay.io/biocontainers/cthreepo:0.1--py_1"
-CONTAINER_BCFTOOLS = "docker://quay.io/biocontainers/bcftools:1.10.2--hd2cd319_0"
-CONTAINER_VARDA2_CLIENT = "docker://quay.io/biocontainers/varda2-client:0.8--py_0"
 
 localrules: all, submit
 
+containers = {
+    "bcftools": "docker://quay.io/biocontainers/bcftools:1.10.2--hd2cd319_0",
+    "cthreepo": "docker://quay.io/biocontainers/cthreepo:0.1--py_1",
+    "gvcf2coverage": "docker://quay.io/biocontainers/gvcf2coverage:0.1--hfb13731_0",
+    "varda2-client": "docker://quay.io/biocontainers/varda2-client:0.8--py_0",
+    "vcf2variants": "docker://quay.io/biocontainers/vcf2variants:0.3--py_0"
+}
+
 rule all:
     input:
         tasks = expand("{sample}/varda/{sample}_response.json", sample=config["samples"]),
@@ -19,7 +22,7 @@ rule trim_alt_and_uncalled:
     output:
         temp("{sample}/varda/{sample}_trimmed.vcf")
     container:
-        CONTAINER_BCFTOOLS
+        containers["bcftools"]
     shell:
         "bcftools view --trim-alt-alleles --exclude-uncalled --output-file {output} {input}"
 
@@ -29,7 +32,7 @@ rule split_multi:
     output:
         temp("{sample}/varda/{sample}_single.vcf")
     container:
-        CONTAINER_BCFTOOLS
+        containers["bcftools"]
     shell:
         "bcftools norm --multiallelics - --output {output} {input}"
 
@@ -39,7 +42,7 @@ rule exclude_alt_star:
     output:
         temp("{sample}/varda/{sample}_no_alt_star.vcf")
     container:
-        CONTAINER_BCFTOOLS
+        containers["bcftools"]
     shell:
         "bcftools view --exclude 'ALT==\"*\"' --output-file {output} {input}"
 
@@ -49,7 +52,7 @@ rule vcf2varda:
     output:
         temp("{sample}/varda/{sample}_variants_ucsc.varda")
     container:
-        CONTAINER_VCF2VARIANTS
+        containers["vcf2variants"]
     shell:
         "vcf2variants < {input} > {output}"
 
@@ -59,7 +62,7 @@ rule var_cthreepo:
     output:
         "{sample}/varda/{sample}_variants.varda"
     container:
-        CONTAINER_CTHREEPO
+        containers["cthreepo"]
     shell:
         "cthreepo --mapfile h37 --infile {input} --id_from uc --outfile {output} --id_to rs"
 
@@ -72,7 +75,7 @@ rule gvcf2coverage:
     output:
         temp("{sample}/varda/{sample}_coverage_ucsc.varda")
     container:
-        CONTAINER_GVCF2COVERAGE
+        containers["gvcf2coverage"]
     shell:
         "gvcf2coverage -t 10 -d 0 < {input} > {output}"
 
@@ -82,7 +85,7 @@ rule cov_cthreepo:
     output:
         "{sample}/varda/{sample}_coverage.varda"
     container:
-        CONTAINER_CTHREEPO
+        containers["cthreepo"]
     shell:
         "cthreepo --mapfile h37 --infile {input} --id_from uc --outfile {output} --id_to rs"
 
@@ -102,7 +105,7 @@ rule submit:
     output:
         "{sample}/varda/{sample}_response.json"
     container:
-        CONTAINER_VARDA2_CLIENT
+        containers["varda2-client"]
     shell:
         "varda2-client submit \
             --disease-code {params.disease_code} \
-- 
GitLab