Commit ddada7c6 authored by akaljuvee's avatar akaljuvee
Browse files

sv-s are grouped by type also for the tables

parent 835790c0
...@@ -8,22 +8,28 @@ ...@@ -8,22 +8,28 @@
<%@ var showIntro: Boolean = true %> <%@ var showIntro: Boolean = true %>
#{ #{
val svTypes = List( val sampleNames: List[String] = summary.samples.toList.sorted
SvTypeForReport("DEL", "Deletion", "svSummaryDeletions.tsv", "svSummaryDeletions.png"),
SvTypeForReport("DUP", "Duplication", "svSummaryDuplications.tsv", "svSummaryDuplications.png"),
SvTypeForReport("INS", "Insertion", "svSummaryInsertions.tsv", "svSummaryInsertions.png"),
SvTypeForReport("INV", "Inversion", "svSummaryInversions.tsv", "svSummaryInversions.png"))
val counts: Map[String, Map[String, Array[Any]]] = ShivaSvCallingReport.parseSummaryForSvCounts(summary) val counts: Map[String, Map[String, Array[Any]]] = ShivaSvCallingReport.parseSummaryForSvCounts(summary)
ShivaSvCallingReport.writeTsvForPlots(counts, svTypes, outputDir) var svTypes = List(
SvTypeForReport("DEL", "Deletions", "svSummaryDeletions.tsv", "svSummaryDeletions.png"),
SvTypeForReport("DUP", "Duplications", "svSummaryDuplications.tsv", "svSummaryDuplications.png"),
SvTypeForReport("INS", "Insertions", "svSummaryInsertions.tsv", "svSummaryInsertions.png"),
SvTypeForReport("INV", "Inversions", "svSummaryInversions.tsv", "svSummaryInversions.png"))
svTypes = svTypes.filter(sv => counts.contains(sv.svType))
val tsvAllTypes = "svSummary.tsv"
ShivaSvCallingReport.writeTsvFiles(sampleNames, counts, svTypes, tsvAllTypes, outputDir)
ShivaSvCallingReport.createPlots(svTypes, outputDir) ShivaSvCallingReport.createPlots(svTypes, outputDir)
}# }#
#if (showPlot) #if (showPlot)
<div class="panel-body"> <div class="panel-body">
<img src="svSummaryDeletions.png" class="img-responsive" /> #for (sv <- svTypes)
<img src="${sv.pngFileName}" />
#end
</div> </div>
<div class="panel-footer"> <div class="panel-footer">
#if (showTable) #if (showTable)
...@@ -31,49 +37,34 @@ ...@@ -31,49 +37,34 @@
#else #else
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#svSummaryTable">Show table</button> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#svSummaryTable">Show table</button>
#end #end
<i class="glyphicon glyphicon-file"></i> <a href="svSummary.tsv">tsv file</a> <i class="glyphicon glyphicon-file"></i> <a href="${tsvAllTypes}">tsv file</a>
</div> </div>
#end #end
<div class="panel-body collapse #if (showTable)in#end" id="svSummaryTable"> <div class="panel-body collapse #if (showTable)in#end" id="svSummaryTable">
#for (sv <- svTypes)
#{
val countsForSvType: Map[String, Array[Any]] = counts.get(sv.svType).get
}#
<h3>${sv.displayText}</h3>
<table class="table sortable-theme-bootstrap" data-sortable> <table class="table sortable-theme-bootstrap" data-sortable>
<thead><tr><th data-sorted="true" data-sorted-direction="ascending">Sample</th> <thead><tr><th data-sorted="true" data-sorted-direction="ascending">Sample</th>
<th>Variant Type</th> <!-- TODO: use values from summary.getValue("shivasvcalling", "stats", "histBreaksForCounts") --> #for (text <- ShivaSvCallingReport.histogramText)
<th>&le;100bp</th> <th>${text}</th>
<th>0.1-1kb</th> #end
<th>1-10kb</th>
<th>10-100kb</th>
<th>0.1-1Mb</th>
<th>1-10Mb</th>
<th>&gt;10Mb</th>
</tr></thead> </tr></thead>
<tbody> <tbody>
#for (sampleName <- summary.samples.toList.sorted) #for (sampleName <- sampleNames)
#{ <tr>
val sampleCounts:Map[String, Array[Any]] = counts.get(sampleName).get <td><a href="${rootPath}Samples/${sampleName}/index.html">${sampleName}</a></td>
var firstRow = true #for (countForSize <- countsForSvType.get(sampleName).get)
}# <td>${countForSize}</td>
#for (sv <- svTypes)
<tr>
#if (counts.contains(sv.svType))
#if (firstRow)
<td><a href="${rootPath}Samples/${sampleName}/index.html">${sampleName}</a></td>
#{ firstRow = false }#
#else
<td></td>
#end
<td>${sv.displayText}</td>
#for (countForSize <- counts.get(sv.svType).get.asInstanceOf[List[Long]])
<td>${countForSize}</td>
#end
#end
</tr>
#end #end
</tr>
#end #end
</tbody> </tbody>
</table> </table>
#end
</div> </div>
...@@ -14,11 +14,9 @@ ...@@ -14,11 +14,9 @@
*/ */
package nl.lumc.sasc.biopet.pipelines.shiva package nl.lumc.sasc.biopet.pipelines.shiva
import java.io.File
import htsjdk.variant.vcf.VCFFileReader import htsjdk.variant.vcf.VCFFileReader
import nl.lumc.sasc.biopet.core.summary.{ Summarizable, SummaryQScript } import nl.lumc.sasc.biopet.core.summary.{ Summarizable, SummaryQScript }
import nl.lumc.sasc.biopet.core.{ PipelineCommand, Reference, SampleLibraryTag } import nl.lumc.sasc.biopet.core.{ Reference, SampleLibraryTag }
import nl.lumc.sasc.biopet.extensions.Pysvtools import nl.lumc.sasc.biopet.extensions.Pysvtools
import nl.lumc.sasc.biopet.pipelines.shiva.svcallers._ import nl.lumc.sasc.biopet.pipelines.shiva.svcallers._
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
...@@ -100,7 +98,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript ...@@ -100,7 +98,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
// sample tagging is however not available within this pipeline // sample tagging is however not available within this pipeline
for ((sample, mergedResultFile) <- outputMergedVCFbySample) { for ((sample, mergedResultFile) <- outputMergedVCFbySample) {
lazy val counts = getVariantCounts(mergedResultFile, ShivaSvCalling.histogramBinBoundaries) lazy val counts = getVariantCounts(mergedResultFile, ShivaSvCallingReport.histogramBinBoundaries)
addSummarizable(new Summarizable { addSummarizable(new Summarizable {
def summaryFiles = Map.empty def summaryFiles = Map.empty
def summaryStats = counts def summaryStats = counts
...@@ -108,7 +106,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript ...@@ -108,7 +106,7 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
} }
addSummarizable(new Summarizable { addSummarizable(new Summarizable {
def summaryFiles = Map.empty def summaryFiles = Map.empty
def summaryStats = ShivaSvCalling.histogramBinBoundaries def summaryStats = ShivaSvCallingReport.histogramBinBoundaries
}, "histBreaksForCounts") }, "histBreaksForCounts")
addSummaryJobs() addSummaryJobs()
...@@ -164,13 +162,4 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript ...@@ -164,13 +162,4 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
true true
} }
}
object ShivaSvCalling extends PipelineCommand {
val histogramBinBoundaries: Array[Int] = Array(100, 1000, 10000, 100000, 1000000, 10000000)
}
object StructuralVariantType extends Enumeration {
val Deletion = Value("DEL")
val Inversion = Value("INV")
} }
\ No newline at end of file
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