#import(nl.lumc.sasc.biopet.utils.summary.db.Schema._)
#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.SummaryDb.Implicts._)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
<%@ var summary: SummaryDb %>
<%@ var sampleId: Option[Int] = None %>
<%@ var libId: Option[Int] = None %>
<%@ var sampleLevel: Boolean = false %>
<%@ var rootPath: String %>
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true%>
<%@ var runId: Int %>
<%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %>
#{
val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList
case _ => allSamples.toList
}
}#
#if (showIntro)
#if (sampleId.isDefined && libId.isDefined) Here we show basic alignment statistics for this run for sample ${sampleId} with library ${libId}. Total number of reads, number of alignments reads and number of duplicate reads are given, and the percentages thereof as a percentage of total. #elseif(sampleId.isDefined && showPlot) The following plot shows basic alignment statistics for this run for sample ${sampleId}. Every library is represented by a multi-color bar. Red represents the total number of properly mapped reads for this sample. Green represents the total number of duplicates reads, which is usually caused by PCR duplicates. Blue denotes the number of unmapped reads, and purple denotes reads flagged secondary (this depends on the aligner used). A table showing similar statistics, including values represented as percent of total, can be downloaded as a tab-delimited file. #elseif(sampleId.isDefined && !showPlot) Here we show basic alignment statistics for this run for every library of sample ${sampleId}. Total number of reads, number of alignments reads and number of duplicate reads are given, and the percentages thereof as a percentage of total. #else The following plot shows basic alignment statistics for this run. Every sample is represented by a multi-color bar. Red represents the total number of properly mapped reads for this sample. Green represents the total number of duplicates reads, which is usually caused by PCR duplicates. Blue denotes the number of unmapped reads, and purple denotes reads flagged secondary (this is dependent on the aligner used). A table showing similar statistics, including values represented as percent of total, can be downloaded as a tab-delimited file. #end
Sample | #if (!sampleLevel)Library | #endTotal | Mapped | Secondary | (%) | Duplicates | (%) |
---|---|---|---|---|---|---|---|
${sample.name} | #for (libId <- libs) #{ val libName = libId.map(l => allLibraries.find(_.id == l).get.name) }# #if (libs.head != libId)|||||||
${libName} | #end #{ val statsPaths = Map( "All" -> List("flagstats", "All"), "Mapped" -> List("flagstats", "Mapped"), "Duplicates" -> List("flagstats", "Duplicates"), "NotPrimaryAlignment" -> List("flagstats", "NotPrimaryAlignment") ) val results = summary.getStatKeys(runId, "bammetrics", "bamstats", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths) val total = results("All").getOrElse(0L).asInstanceOf[Long] val mapped = results("Mapped").getOrElse(0L).asInstanceOf[Long] val duplicates = results("Duplicates").getOrElse(0L).asInstanceOf[Long] val secondary = results("NotPrimaryAlignment").getOrElse(0L).asInstanceOf[Long] }#${total} | ${mapped} | ${secondary} | ${(mapped - secondary).toDouble / (total - secondary) * 100}% | ${duplicates} | ${duplicates.toDouble / (total - secondary) * 100}% |