Commit c8821092 authored by akaljuvee's avatar akaljuvee

one log line

parent d4b734b1
......@@ -10,7 +10,7 @@
#{
val sampleNames: List[String] = summary.samples.toList.sorted
val counts: Map[String, Map[String, Array[Any]]] = ShivaSvCallingReport.parseSummaryForSvCounts(summary)
val counts: Map[String, Map[String, Array[Long]]] = ShivaSvCallingReport.parseSummaryForSvCounts(summary)
var svTypes = List(
SvTypeForReport("DEL", "Deletions", "svSummaryDeletions.tsv", "svSummaryDeletions.png"),
......@@ -32,12 +32,14 @@
#end
</div>
<div class="panel-footer">
#if (showTable)
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#svSummaryTable">Hide table</button>
#else
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#svSummaryTable">Show table</button>
#end
<i class="glyphicon glyphicon-file"></i> <a href="${tsvAllTypes}">tsv file</a>
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#svSummaryTable">
#if (showTable)
<i class="glyphicon glyphicon-eye-close"></i> Hide table
#else
<i class="glyphicon glyphicon-eye-open"></i> Show table
#end
</button>
<a href="${tsvAllTypes}"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a>
</div>
#end
......@@ -45,7 +47,7 @@
#for (sv <- svTypes)
#{
val countsForSvType: Map[String, Array[Any]] = counts.get(sv.svType).get
val countsForSvType: Map[String, Array[Long]] = counts.get(sv.svType).get
}#
<h3>${sv.displayText}</h3>
<table class="table sortable-theme-bootstrap" data-sortable>
......
......@@ -149,17 +149,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
}
iterator.close()
var counts: Map[String, Any] = Map()
if (isConfiguredForType("DEL")) counts = Map("DEL" -> delCounts)
if (isConfiguredForType("INS")) counts = counts + ("INS" -> insCounts)
if (isConfiguredForType("DUP")) counts = counts + ("DUP" -> dupCounts)
if (isConfiguredForType("INV")) counts = counts + ("INV" -> invCounts)
if (isConfiguredForType("TRA")) counts = counts + ("TRA" -> traCount)
counts
}
def isConfiguredForType(svType: String): Boolean = {
true
Map("DEL" -> delCounts, "INS" -> insCounts, "DUP" -> dupCounts, "INV" -> invCounts, "TRA" -> traCount)
}
}
\ No newline at end of file
......@@ -11,30 +11,31 @@ object ShivaSvCallingReport {
val histogramPlotTicks: Array[Int] = Array(100, 1000, 10000, 100000, 1000000, 10000000, 100000000)
val histogramText: List[String] = List("<=100bp", "0.1-1kb", "1-10kb", "10-100kb", "0.1-1Mb", "1-10Mb", ">10Mb")
def parseSummaryForSvCounts(summary: Summary): Map[String, Map[String, Array[Any]]] = {
var delCounts, insCounts, dupCounts, invCounts: Map[String, Array[Any]] = Map()
def parseSummaryForSvCounts(summary: Summary): Map[String, Map[String, Array[Long]]] = {
var delCounts, insCounts, dupCounts, invCounts: Map[String, Array[Long]] = Map()
for (sampleName <- summary.samples) {
var sampleCounts: Map[String, Any] = summary.getSampleValue(sampleName, "shivasvcalling", "stats", "variantsBySizeAndType").get.asInstanceOf[Map[String, Any]]
for ((svType, counts) <- sampleCounts.collect({ case (k, v: List[_]) => (k, v.toArray[Any]) })) {
val elem: Tuple2[String, Array[Long]] = (sampleName, counts.collect({ case x: Long => x }))
svType match {
case "DEL" => delCounts = delCounts + (sampleName -> counts)
case "INS" => insCounts = insCounts + (sampleName -> counts)
case "DUP" => dupCounts = dupCounts + (sampleName -> counts)
case "INV" => invCounts = invCounts + (sampleName -> counts)
case "DEL" => delCounts += elem
case "INS" => insCounts += elem
case "DUP" => dupCounts += elem
case "INV" => invCounts += elem
}
}
}
var result: Map[String, Map[String, Array[Any]]] = Map()
if (!delCounts.isEmpty) result = Map("DEL" -> delCounts)
if (!insCounts.isEmpty) result = result + ("INS" -> insCounts)
if (!dupCounts.isEmpty) result = result + ("DUP" -> dupCounts)
if (!invCounts.isEmpty) result = result + ("INV" -> invCounts)
var result: Map[String, Map[String, Array[Long]]] = Map()
if (delCounts.exists(elem => (elem._2.sum > 0))) result = Map("DEL" -> delCounts)
if (insCounts.exists(elem => (elem._2.sum > 0))) result += ("INS" -> insCounts)
if (dupCounts.exists(elem => (elem._2.sum > 0))) result += ("DUP" -> dupCounts)
if (invCounts.exists(elem => (elem._2.sum > 0))) result += ("INV" -> invCounts)
result
}
def writeTsvFiles(sampleNames: List[String], counts: Map[String, Map[String, Array[Any]]], svTypes: List[SvTypeForReport], outFileAllTypes: String, outDir: File): Unit = {
def writeTsvFiles(sampleNames: List[String], counts: Map[String, Map[String, Array[Long]]], svTypes: List[SvTypeForReport], outFileAllTypes: String, outDir: File): Unit = {
val tsvWriter = new PrintWriter(new File(outDir, outFileAllTypes))
tsvWriter.print("sv_type\tsample")
......@@ -42,7 +43,7 @@ object ShivaSvCallingReport {
tsvWriter.println()
for (sv <- svTypes) {
val countsForSvType: Map[String, Array[Any]] = counts.get(sv.svType).get
val countsForSvType: Map[String, Array[Long]] = counts.get(sv.svType).get
writeTsvFileForSvType(sv, countsForSvType, sampleNames, outDir)
......@@ -54,7 +55,7 @@ object ShivaSvCallingReport {
tsvWriter.close()
}
def writeTsvFileForSvType(svType: SvTypeForReport, counts: Map[String, Array[Any]], sampleNames: List[String], outDir: File): Unit = {
def writeTsvFileForSvType(svType: SvTypeForReport, counts: Map[String, Array[Long]], sampleNames: List[String], outDir: File): Unit = {
val tsvWriter = new PrintWriter(new File(outDir, svType.tsvFileName))
tsvWriter.print("histogramBin")
......
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