Commit 6f6a76e7 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added target variants to report

parent 27813378
......@@ -10,7 +10,7 @@
<%@ var rootPath: String %>
<%@ var outputDir: File %>
<%@ var metricsTag: String = "bammetrics" %>
<%@ var target: String %>
<%@ var target: Option[String] %>
#{
val samples = sampleId match {
case Some(sample) => List(sample.toString)
......@@ -46,7 +46,7 @@
#if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td> #end
#{
val prefixPath = List("samples", sample) ::: (if (libId.isEmpty) Nil else List("libraries", libId)) ::: List(metricsTag, "stats", target + "_cov_stats", "coverage", "_all")
val prefixPath = List("samples", sample) ::: (if (libId.isEmpty) Nil else List("libraries", libId)) ::: List(metricsTag, "stats", target.get + "_cov_stats", "coverage", "_all")
val total = summary.getValue((prefixPath ::: List("biopet_flagstat", "All")):_*).getOrElse(0L).asInstanceOf[Long]
val mapped = summary.getValue((prefixPath ::: List("biopet_flagstat", "Mapped")):_*).getOrElse(0L).asInstanceOf[Long]
val duplicates = summary.getValue((prefixPath ::: List("biopet_flagstat", "Duplicates")):_*).getOrElse(0L).asInstanceOf[Long]
......
......@@ -70,7 +70,7 @@ object BammetricsReport extends ReportBuilder {
if (targets.isEmpty) List()
else List("Targets" -> ReportPage(
List(),
targets.map(t => t -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsPlot.ssp", Map("target" -> t))),
targets.map(t => t -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsPlot.ssp", Map("target" -> Some(t)))),
Map())),
List(
"Summary" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp"),
......
......@@ -8,13 +8,20 @@
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true%>
<%@ var showIntro: Boolean = true %>
<%@ var target: Option[String] = None %>
<%@ var caller: String = "final" %>
#{
val fields = List("Hom", "HomVar", "Het", "HomRef", "NoCall", "Variant", "Total")
val samples = sampleId match {
case Some(sample) => List(sample.toString)
case _ => summary.samples.toList
}
val vcfstatsKey = target match {
case Some(t) => s"multisample-vcfstats-$caller-$t"
case _ => s"multisample-vcfstats-$caller"
}
}#
#if (showIntro)
......@@ -70,7 +77,7 @@
#for (sample <- samples.toList.sorted)
<tr><td><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
#for (field <- fields)
<td>${summary.getSampleValue(sample, "shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", field)}</td>
<td>${summary.getSampleValue(sample, "shivavariantcalling", "stats", vcfstatsKey, "genotype", field)}</td>
#end
</tr>
#end
......
......@@ -107,14 +107,16 @@ object ShivaReport extends MultisampleReportBuilder {
}
if (regionPages.nonEmpty) Some("Regions" -> ReportPage(
List(),
regionPages.map(p => p._1 -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsMultiTable.ssp",
Map("target" -> p._1.stripSuffix(" (Amplicon)"))
regionPages.map(p => p._1 -> ReportPage(Nil,
List(
"Variants" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/shiva/sampleVariants.ssp"),
"Coverage" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsMultiTable.ssp")
),
Map("target" -> Some(p._1.stripSuffix(" (Amplicon)")))
)).toList.sortBy(_._1),
List(),
Map())
)
else None
) else None
}
/** Files page, can be used general or at sample level */
......@@ -178,7 +180,9 @@ object ShivaReport extends MultisampleReportBuilder {
prefix: String,
summary: Summary,
libraryLevel: Boolean = false,
sampleId: Option[String] = None): Unit = {
sampleId: Option[String] = None,
caller: String = "final",
target: Option[String] = None): Unit = {
val tsvFile = new File(outputDir, prefix + ".tsv")
val pngFile = new File(outputDir, prefix + ".png")
val tsvWriter = new PrintWriter(tsvFile)
......@@ -186,14 +190,14 @@ object ShivaReport extends MultisampleReportBuilder {
tsvWriter.println("\tHomVar\tHet\tHomRef\tNoCall")
def getLine(summary: Summary, sample: String, lib: Option[String] = None): String = {
val homVar = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "HomVar"),
summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val homRef = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "HomRef"),
summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val noCall = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "NoCall"),
summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val het = new SummaryValue(List("shivavariantcalling", "stats", "multisample-vcfstats-final", "genotype", "Het"),
summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val path = target match {
case Some(t) => List("shivavariantcalling", "stats", s"multisample-vcfstats-$caller-$t", "genotype")
case _ => List("shivavariantcalling", "stats", s"multisample-vcfstats-$caller", "genotype")
}
val homVar = new SummaryValue(path :+ "HomVar", summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val homRef = new SummaryValue(path :+ "HomRef", summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val noCall = new SummaryValue(path :+ "NoCall", summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val het = new SummaryValue(path :+ "Het", summary, Some(sample), lib).value.getOrElse(0).toString.toLong
val sb = new StringBuffer()
if (lib.isDefined) sb.append(sample + "-" + lib.get + "\t") else sb.append(sample + "\t")
sb.append(homVar + "\t")
......
......@@ -19,7 +19,7 @@ import htsjdk.samtools.SamReaderFactory
import nl.lumc.sasc.biopet.core.{ MultiSampleQScript, Reference }
import nl.lumc.sasc.biopet.extensions.Ln
import nl.lumc.sasc.biopet.extensions.picard.{ AddOrReplaceReadGroups, MarkDuplicates, SamToFastq }
import nl.lumc.sasc.biopet.pipelines.bammetrics.BamMetrics
import nl.lumc.sasc.biopet.pipelines.bammetrics.{TargetRegions, BamMetrics}
import nl.lumc.sasc.biopet.pipelines.mapping.Mapping
import nl.lumc.sasc.biopet.pipelines.toucan.Toucan
import nl.lumc.sasc.biopet.utils.Logging
......@@ -32,7 +32,7 @@ import scala.collection.JavaConversions._
*
* Created by pjvan_thof on 2/26/15.
*/
trait ShivaTrait extends MultiSampleQScript with Reference { qscript: QScript =>
trait ShivaTrait extends MultiSampleQScript with Reference with TargetRegions { qscript: QScript =>
/** Executed before running the script */
def init(): Unit = {
......@@ -355,11 +355,13 @@ trait ShivaTrait extends MultiSampleQScript with Reference { qscript: QScript =>
/** Settings of pipeline for summary */
def summarySettings = Map(
"reference" -> referenceSummary,
"annotation" -> annotation.isDefined,
"multisample_variantcalling" -> multisampleVariantCalling.isDefined,
"sv_calling" -> svCalling.isDefined
)
"reference" -> referenceSummary,
"annotation" -> annotation.isDefined,
"multisample_variantcalling" -> multisampleVariantCalling.isDefined,
"sv_calling" -> svCalling.isDefined,
"regions_of_interest" -> roiBedFiles.map(_.getName.stripSuffix(".bed")),
"amplicon_bed" -> ampliconBedFile.map(_.getName.stripSuffix(".bed"))
)
/** Files for the summary */
def summaryFiles = Map("referenceFasta" -> referenceFasta())
......
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