Commit 9a538c59 authored by Peter van 't Hof's avatar Peter van 't Hof

Fixing krona plots for centrifuge and kraken

parent 40109cd0
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
......@@ -30,14 +31,15 @@
Map("all" -> Nil)
)
val totalReads = if (sampleId.isEmpty) {
centrifugeTag.map {tag => summary.getSampleValues(summaryModuleTag, "stats", tag, "metrics", "Read").map(x => x._1 -> x._2.getOrElse(0L).toString.toLong) }
} else centrifugeTag.flatMap(tag => summary.getValue(sampleId, libId, summaryModuleTag, "stats", tag, "metrics", "Read"))
.map(value => Map(sampleId.get -> value.toString.toLong))
val totalReads = centrifugeTag.map { tag =>
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))
}
val tempFile = File.createTempFile("krona.", ".xml")
tempFile.deleteOnExit()
GearsKraken.convertKrakenSummariesToKronaXml(summaries, tempFile, totalReads)
GearsKraken.convertKrakenSummariesToKronaXml(summaries.map(x => allSamples.find(_.id == x._1).head.name -> x._2("all").map(_.asInstanceOf[Map[String, Any]]).getOrElse(Map())), tempFile, totalReads)
val output = ReportBuilder.renderTemplate("/nl/lumc/sasc/biopet/core/report/krona.ssp",
args ++ Map("kronaXml" -> tempFile))
......
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