From ea9fe97777f08304a552292f6d148b535904ea64 Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Thu, 19 Feb 2015 14:10:45 +0100
Subject: [PATCH] Changed executables for summary

---
 .../sasc/biopet/core/summary/SummaryQScript.scala | 11 -----------
 .../sasc/biopet/core/summary/WriteSummary.scala   | 15 +++++++++++----
 .../lumc/sasc/biopet/extensions/bwa/BwaMem.scala  |  1 +
 .../sasc/biopet/pipelines/mapping/Mapping.scala   |  3 ++-
 4 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/SummaryQScript.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/SummaryQScript.scala
index 21704aa3e..f54eda7c8 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/SummaryQScript.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/SummaryQScript.scala
@@ -61,17 +61,6 @@ trait SummaryQScript extends BiopetQScript {
     for ((_, summarizableList) <- summarizables; summarizable <- summarizableList; (_, file) <- summarizable.summaryFiles)
       addChecksum(file)
 
-    for ((_, sl) <- summarizables) {
-      for (s <- sl) {
-        s match {
-          case c: BiopetCommandLineFunctionTrait => {
-            executables += c.configName -> (new File(c.executable), c.getVersion)
-          }
-          case _ =>
-        }
-      }
-    }
-
     for ((_, file) <- this.summaryFiles)
       addChecksum(file)
 
diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
index fac1055e3..c73cc0505 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/summary/WriteSummary.scala
@@ -48,10 +48,17 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
     val pipelineMap = {
       val files = parseFiles(qscript.summaryFiles)
       val settings = qscript.summarySettings
-      val executables = {
-        for ((name, (file, version)) <- qscript.executables) yield {
-          name -> Map("version" -> version, "md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(file.getCanonicalPath, "N/A"))
-        }
+      val executables: Map[String, Any] = {
+        (for (f <- qscript.functions if f.isInstanceOf[BiopetCommandLineFunctionTrait]) yield {
+          f match {
+            case f: BiopetCommandLineFunctionTrait => {
+              f.configName -> Map("version" -> f.getVersion,
+                "md5" -> BiopetCommandLineFunctionTrait.executableMd5Cache.getOrElse(f.executable, None))
+            }
+            case _ => throw new IllegalStateException("This should not be possible")
+          }
+
+        }).toMap
       }
 
       val map = Map(qscript.summaryName -> ((if (settings.isEmpty) Map[String, Any]() else Map("settings" -> settings)) ++
diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/bwa/BwaMem.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/bwa/BwaMem.scala
index 74cdad0ce..731cdc278 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/bwa/BwaMem.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/bwa/BwaMem.scala
@@ -19,6 +19,7 @@ import java.io.File
 
 import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
 import nl.lumc.sasc.biopet.core.config.Configurable
+import nl.lumc.sasc.biopet.core.summary.Summarizable
 import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
 
 class BwaMem(val root: Configurable) extends Bwa {
diff --git a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala
index 3ee791dc2..d7e125f3f 100644
--- a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala
+++ b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala
@@ -94,7 +94,8 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
 
   def summaryFile = new File(outputDir, sampleId.getOrElse("x") + "-" + libId.getOrElse("x") + ".summary.json")
 
-  def summaryFiles = Map()
+  def summaryFiles: Map[String, File] = Map("output_bamfile" -> finalBamFile, "input_R1" -> input_R1) ++
+    (if (input_R2.isDefined) Map("input_R2" -> input_R2.get) else Map())
 
   def summarySettings = Map(
     "skip_metrics" -> skipMetrics,
-- 
GitLab