Commit 2a2e4b44 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

diffrent nesting and emty files / data are now not writen

parent 5acf703f
...@@ -47,7 +47,7 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -47,7 +47,7 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
((name, sampleId, libraryId), summarizables) <- qscript.summarizables; ((name, sampleId, libraryId), summarizables) <- qscript.summarizables;
summarizable <- summarizables summarizable <- summarizables
) yield { ) yield {
val map = Map(qscript.summaryName ->Map(name -> parseSummarizable(summarizable))) val map = Map(qscript.summaryName -> 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 {
...@@ -67,8 +67,12 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -67,8 +67,12 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
writer.close() writer.close()
} }
def parseSummarizable(summarizable: Summarizable): Map[String, Map[String, Any]] = { def parseSummarizable(summarizable: Summarizable) = {
Map("data" -> summarizable.summaryData, "files" -> parseFiles(summarizable.summaryFiles)) val data = summarizable.summaryData
val files = parseFiles(summarizable.summaryFiles)
(if (data.isEmpty) Map[String, Any]() else Map("data" -> data)) ++
(if (files.isEmpty) Map[String, Any]() else Map("files" -> files))
} }
def parseFiles(files: Map[String, File]): Map[String, Map[String, Any]] = { def parseFiles(files: Map[String, File]): Map[String, Map[String, Any]] = {
......
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