Commit 6075c248 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added qscripts to final output file

parent ebe2bb5f
package nl.lumc.sasc.biopet.core.summary package nl.lumc.sasc.biopet.core.summary
import java.io.{FileInputStream, PrintWriter, File} import java.io.{ FileInputStream, PrintWriter, File }
import java.security.MessageDigest import java.security.MessageDigest
import nl.lumc.sasc.biopet.core.config.Configurable import nl.lumc.sasc.biopet.core.config.Configurable
...@@ -40,24 +40,27 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -40,24 +40,27 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
} }
def run(): Unit = { def run(): Unit = {
val writer = new PrintWriter(out) val map = (for (
((name, sampleId, libraryId), summarizables) <- summaryQScript.summarizables;
val bla = for (((name, sampleId, libraryId), summarizables) <- summaryQScript.summarizables; summarizable <- summarizables
summarizable <- summarizables) yield { ) yield {
val map = Map(name -> parseSummarizable(summarizable)) val map = Map(name -> parseSummarizable(summarizable))
(sampleId match { (sampleId match {
case Some(sampleId) => Map("samples" -> Map(sampleId -> (libraryId match { case Some(sampleId) => Map("samples" -> Map(sampleId -> (libraryId match {
case Some(libraryId) => Map("libraries" -> Map(libraryId -> map)) case Some(libraryId) => Map("libraries" -> Map(libraryId -> map))
case _ => map case _ => map
}))) })))
case _ => map case _ => map
}, (v1:Any, v2:Any, key:String) => summarizable.resolveSummaryConflict(v1, v2, key)) }, (v1: Any, v2: Any, key: String) => summarizable.resolveSummaryConflict(v1, v2, key))
} }).foldRight(Map[String, Any]())((a, b) => ConfigUtils.mergeMaps(a._1, b, a._2))
bla.foldRight(Map[String, Any]())((a, b) => ConfigUtils.mergeMaps(a._1, b, a._2))
//TODO: QScript merging val combinedMap = (for (qscript <- summaryQScript.summaryQScripts) yield {
ConfigUtils.fileToConfigMap(qscript.summaryFile)
}).foldRight(map)((a, b) => ConfigUtils.mergeMaps(a, b))
val writer = new PrintWriter(out)
writer.println(ConfigUtils.mapToJson(combinedMap).spaces2)
writer.close() writer.close()
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment