Commit 40ddc1b7 authored by Peter van 't Hof's avatar Peter van 't Hof

Fixing gearssingle report

parent 0740963c
......@@ -27,12 +27,22 @@
}
}#
<%
val summaries = summary.getStatsForSamples(runId, summaryModuleTag, summaryStatsTag, sampleId.map(SummaryDb.SampleId),
val summaries = if (libId.isDefined) summary.getStatsForLibraries(runId, summaryModuleTag, summaryStatsTag, sampleId,
Map("all" -> Nil)
).filter(_._1._2 == libId.get).map(x => x._1._1 -> x._2)
else summary.getStatsForSamples(runId, summaryModuleTag, summaryStatsTag, sampleId.map(SummaryDb.SampleId),
Map("all" -> Nil)
)
val totalReads = centrifugeTag.map { tag =>
summary.getStatsForSamples(runId, summaryModuleTag, ModuleName(tag), sampleId.map(SummaryDb.SampleId),
if (libId.isDefined) {
val stats = summary.getStatsForLibraries(runId, summaryModuleTag, ModuleName(tag), sampleId,
Map("total" -> List("metrics", "Read"))
).filter(_._1._2 == libId.get).head
val lib = allLibraries.filter(_.id == stats._1._2).head
val sample = allSamples.filter(_.id == stats._1._1).head
Map(s"${sample.name}" -> stats._2("total").map(_.toString.toLong).getOrElse(0L))
} else summary.getStatsForSamples(runId, summaryModuleTag, ModuleName(tag), sampleId.map(SummaryDb.SampleId),
Map("total" -> List("metrics", "Read"))
).map(x => allSamples.find(_.id == x._1).head.name -> x._2("total").map(_.toString.toLong).getOrElse(0L))
}
......
......@@ -124,7 +124,7 @@ object GearsKraken {
val taxs: mutable.Map[String, Any] = mutable.Map()
def addTax(map: Map[String, Any], path: List[String] = Nil): Unit = {
val name = map("name").toString
val name = map.get("name").getOrElse("noName").toString
val x = path.foldLeft(taxs)((a, b) => if (a.contains(b)) a(b).asInstanceOf[mutable.Map[String, Any]] else {
a += b -> mutable.Map[String, Any]()
a(b).asInstanceOf[mutable.Map[String, Any]]
......@@ -132,13 +132,13 @@ object GearsKraken {
if (!x.contains(name)) x += name -> mutable.Map[String, Any]()
map("children").asInstanceOf[List[Any]].foreach(x => addTax(x.asInstanceOf[Map[String, Any]], path ::: name :: Nil))
map.get("children").getOrElse(List()).asInstanceOf[List[Any]].foreach(x => addTax(x.asInstanceOf[Map[String, Any]], path ::: name :: Nil))
}
summaries.foreach { x => addTax(x._2("classified").asInstanceOf[Map[String, Any]]) }
summaries.foreach { x => addTax(x._2.get("classified").getOrElse(Map()).asInstanceOf[Map[String, Any]]) }
def getValue(sample: String, path: List[String], key: String) = {
path.foldLeft(summaries(sample)("classified").asInstanceOf[Map[String, Any]]) { (b, a) =>
path.foldLeft(summaries(sample).get("classified").getOrElse(Map()).asInstanceOf[Map[String, Any]]) { (b, a) =>
b.getOrElse("children", List[Map[String, Any]]())
.asInstanceOf[List[Map[String, Any]]]
.find(_.getOrElse("name", "") == a).getOrElse(Map[String, Any]())
......
Markdown is supported
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