From bd8658548afa825d92f3f15306b8a8873ff9adac Mon Sep 17 00:00:00 2001
From: Blaise Li <blaise.li__git@nsup.org>
Date: Mon, 14 Oct 2019 13:36:15 +0200
Subject: [PATCH] Save snakefile in the analysis folder.

---
 .gitignore      | 2 ++
 run_pipeline.sh | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index 391eea7..939b396 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
+.RData
+.Rhistory
 *~
 *\.wrapper\.py
diff --git a/run_pipeline.sh b/run_pipeline.sh
index ff7681f..38637d4 100755
--- a/run_pipeline.sh
+++ b/run_pipeline.sh
@@ -82,6 +82,10 @@ config_base=$(basename ${configfile})
 config_snapshot="${output_dir}/${config_base}"
 echo "Saving a local copy of the configuration in ${config_snapshot}"
 cp -f ${configfile} ${config_snapshot}
+snakefile_base=$(basename ${snakefile})
+snakefile_snapshot="${output_dir}/${snakefile_base}"
+echo "Saving a local copy of the snakefile in ${snakefile_snapshot}"
+cp -f ${snakefile} ${snakefile_snapshot}
 
 kilobytes_tot=$(mawk '$1 == "MemTotal:" {print $2}' /proc/meminfo)
 # Some rules were given a "mem_mb" resource section based on the "max_vms" benchmarking result.
@@ -91,7 +95,9 @@ kilobytes_tot=$(mawk '$1 == "MemTotal:" {print $2}' /proc/meminfo)
 # to avoid pretending that we have all this memory available for snakemake rules.
 megabytes_resource=$(echo "${kilobytes_tot} / 1100" | bc)
 
-cmd="(cd ${output_dir}; snakemake -s ${snakefile} --configfile ${config_base} --resources mem_mb=${megabytes_resource} $@)"
+#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} $@)"
 
 echo ${cmd} > ${log_base}.log
 # https://unix.stackexchange.com/a/245610/55127
-- 
GitLab