From de427288858c761145960f98931a648bd55114b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Tr=C3=B6ndle?= Date: Wed, 13 Mar 2024 14:23:08 +0100 Subject: [PATCH] Add rule that generates the DAG Fixes #208 --- CHANGELOG.md | 1 + Snakefile | 15 +++++++++++++++ envs/dag.yaml | 5 +++++ 3 files changed, 21 insertions(+) create mode 100644 envs/dag.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index f507f28b..fa172799 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ### Added (workflow) +* **ADD** DAG rule that generates a visualisation of Snakemake's directed acyclic graph (#208). * **ADD** IPython debugger to all conda environments to ease debugging (#254). * **ADD** a default Snakemake profile to run on local machines in addition to the existing profile for Euler (#211). * **ADD** a Snakemake profile to run using conda instead of mamba (#211). diff --git a/Snakefile b/Snakefile index 2642c118..1a507244 100644 --- a/Snakefile +++ b/Snakefile @@ -201,6 +201,21 @@ rule build_metadata: script: "scripts/metadata.py" +rule dag_dot: + output: temp("build/dag.dot") + shell: + "snakemake --rulegraph > {output}" + + +rule dag: + message: "Plot dependency graph of the workflow." + input: rules.dag_dot.output[0] + # Output is deliberatly omitted so rule is executed each time. + conda: "envs/dag.yaml" + shell: + "dot -Tpdf {input} -o build/dag.pdf" + + rule clean: # removes all generated results shell: """ diff --git a/envs/dag.yaml b/envs/dag.yaml new file mode 100644 index 00000000..cb46e7d0 --- /dev/null +++ b/envs/dag.yaml @@ -0,0 +1,5 @@ +name: dag +channels: + - conda-forge +dependencies: + - graphviz=2.50.0