From b71ac0fe8a5de253fa4f6c513c92b22e1399355e Mon Sep 17 00:00:00 2001
From: bow <bow@bow.web.id>
Date: Mon, 9 Mar 2015 11:22:50 +0100
Subject: [PATCH] =?UTF-8?q?Add=20initial=20version=20table=20to=20report?=
 =?UTF-8?q?=1B[C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../pipelines/gentrap/scripts/pdf_report.py   | 22 ++++++++++++++-
 .../pipelines/gentrap/templates/pdf/main.tex  | 27 ++++++++++++++++++-
 2 files changed, 47 insertions(+), 2 deletions(-)

diff --git a/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/pdf_report.py b/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/pdf_report.py
index 9cdcaf951..455c142de 100755
--- a/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/pdf_report.py
+++ b/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/pdf_report.py
@@ -510,9 +510,29 @@ class GentrapRun(object):
                 for s in self.sample_names}
 
         self.files = summary["gentrap"]["files"]
-        self.executables = summary["gentrap"]["executables"]
         self.settings = summary["gentrap"]["settings"]
         self.version = self.settings["version"]
+        # list containing all exes
+        self.all_executables = summary["gentrap"]["executables"]
+        # list containing exes we want to display
+        executables = [
+            ("cutadapt", "adapter clipping"),
+            ("sickle", "base quality trimming"),
+            ("fastqc", "sequence metrics collection"),
+            ("gsnap", "alignment"),
+            ("htseqcount", "fragment counting"),
+        ]
+        self.executables = {k: self.all_executables[k] for k, _ in executables}
+        for exe, desc in executables:
+            self.executables[exe]["desc"] = desc
+        # since we get the version from the tools we use
+        if self.all_executables.get("collectalignmentsummarymetrics") is not None:
+            self.executables["picard"] = self.all_executables["collectalignmentsummarymetrics"]
+            self.executables["picard"]["desc"] = "alignment_metrics_collection"
+        # since we get the version from the sub tools we use
+        if self.all_executables.get("samtoolsview") is not None:
+            self.executables["samtools"] = self.all_executables["samtoolsview"]
+            self.executables["samtools"]["desc"] = "various post-alignment processing"
 
     def __repr__(self):
         return "{0}(\"{1}\")".format(self.__class__.__name__,
diff --git a/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf/main.tex b/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf/main.tex
index 0673d4c0d..a02acdd12 100644
--- a/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf/main.tex
+++ b/public/gentrap/src/main/resources/nl/lumc/sasc/biopet/pipelines/gentrap/templates/pdf/main.tex
@@ -66,7 +66,32 @@
 \label{sec:intro}
 
 This document outlines the results obtained from running Gentrap, a generic
-pipeline for transcriptome analysis.
+pipeline for transcriptome analysis. The pipeline itself is composed of several
+programs, listed in Table~\ref{tab:programs}. Note that the list only contains
+the programs used in this pipeline run.
+
+\begin{center}
+    \captionof{table}{Programs in Gentrap}
+    \label{tab:programs}
+    \begin{longtable}{ l l l p{0.2\textwidth} }
+            \hline
+            Program & Version & Checksum & Usage\\
+            \hline \hline
+        \endhead
+            \hline
+            \multicolumn{3}{c}{\textit{Continued on next page}}\\
+            \hline
+        \endfoot
+            \hline
+        \endlastfoot
+        Gentrap & ((( run.version ))) & - & the full pipeline\\
+        ((* for program, info in run.executables.items()|sort *))
+            ((( program ))) & ((( info.version ))) & ((( info.md5|truncate(7, True, "") ))) & ((( info.desc )))\\
+        ((* endfor *))
+    \end{longtable}
+\end{center}
+% HACK: to keep table counters in sync
+\addtocounter{table}{-1}
 
 \clearpage
 
-- 
GitLab