From 4a829491452cf47a62406227ea2c0127d42f828d Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Wed, 5 Feb 2020 16:55:16 +0100
Subject: [PATCH] Generate a rulegraph for each run.

---
 run_pipeline.sh              | 2 +-
 singularity/run_pipeline.def | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/run_pipeline.sh b/run_pipeline.sh
index 8660f68..2a8da87 100755
--- a/run_pipeline.sh
+++ b/run_pipeline.sh
@@ -98,7 +98,7 @@ megabytes_resource=$(echo "${kilobytes_tot} / 1100" | bc)
 
 #cmd="(cd ${output_dir}; snakemake -s ${snakefile} --configfile ${config_base} --resources mem_mb=${megabytes_resource} $@)"
 # TODO: check that this works
-cmd="(cd ${output_dir}; snakemake -s ${snakefile_base} --configfile ${config_base} --resources mem_mb=${megabytes_resource} $@)"
+cmd="(cd ${output_dir}; snakemake -s ${snakefile_base} --configfile ${config_base} --rulegraph | dot -Tpdf > rulegraph.pdf; snakemake -s ${snakefile_base} --configfile ${config_base} --resources mem_mb=${megabytes_resource} $@)"
 
 echo ${cmd} | tee -a ${log_base}.log
 # https://unix.stackexchange.com/a/245610/55127
diff --git a/singularity/run_pipeline.def b/singularity/run_pipeline.def
index be2ff9f..93e9672 100644
--- a/singularity/run_pipeline.def
+++ b/singularity/run_pipeline.def
@@ -36,6 +36,8 @@ From:python:3.7-buster
 	apt-get -y update
 	# Useful for interactive work using the container
 	apt-get -y install vim
+	# To be able to generate rule graphs of the workflows
+	apt-get -y install graphviz
 	# run_pipeline.sh (and maybe other tools) needs bc
 	apt-get -y install bc rsync
 	apt-get -y install bedops bedtools bowtie2 cutadapt subread hisat2 parallel samtools
-- 
GitLab