Commit 2adc9bde authored by rhpvorderman's avatar rhpvorderman

Insertsize.ssp defutured

parent 544d0585
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
<%@ var sampleId: Option[Int] = None %> <%@ var sampleId: Option[Int] = None %>
<%@ var libId: Option[Int] = None %> <%@ var libId: Option[Int] = None %>
<%@ var rootPath: String %> <%@ var rootPath: String %>
<%@ var metricsTag: String = "bammetrics" %>
<%@ var sampleLevel: Boolean = false %> <%@ var sampleLevel: Boolean = false %>
<%@ var outputDir: File %> <%@ var outputDir: File %>
<%@ var fields: List[String] = List("mean_insert_size", "standard_deviation", "median_insert_size")%> <%@ var fields: List[String] = List("mean_insert_size", "standard_deviation", "median_insert_size")%>
...@@ -19,8 +18,8 @@ ...@@ -19,8 +18,8 @@
<%@ var runId: Int %> <%@ var runId: Int %>
<%@ var allSamples: Seq[Sample] %> <%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %> <%@ var allLibraries: Seq[Library] %>
<%@ var insertSizePlotLines: Option[Seq[String]] %> <%@ var insertSizePlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var alignmentSummaryResults: Map[(Int, Int), Map[String, Option[Any]]] %> <%@ var insertSizeTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
#{ #{
val samples = sampleId match { val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList case Some(id) => allSamples.filter(_.id == id).toList
...@@ -47,7 +46,7 @@ ...@@ -47,7 +46,7 @@
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.insertSizePlot(outputDir, "insertsize", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }# #{ BammetricsReport.insertSizePlot(outputDir, "insertsize", insertSizePlotTables.getOrElse(Array(Map("x" -> Array(""))))) }#
<div class="panel-body"> <div class="panel-body">
<img src="insertsize.png" class="img-responsive" /> <img src="insertsize.png" class="img-responsive" />
...@@ -90,8 +89,7 @@ ...@@ -90,8 +89,7 @@
#if (libs.head != libId) <tr> #end #if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
#{ #{
val statsPaths = fields.map(x => x -> List("metrics", x.toUpperCase)).toMap val results: Map[String, Option[Any]] = insertSizeTableResults(sample.id, libId)
val results = summary.getStatKeys(runId, "bammetrics", "CollectInsertSizeMetrics", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths)
}# }#
#for (field <- fields) #for (field <- fields)
<td>${results(field)}</td> <td>${results(field)}</td>
......
...@@ -95,11 +95,11 @@ object BammetricsReportPage { ...@@ -95,11 +95,11 @@ object BammetricsReportPage {
} }
val clippingPlotTables: Option[Array[Map[String, Array[Any]]]] = val clippingPlotTables: Option[Array[Map[String, Array[Any]]]] =
if (showPlot) if (showPlot)
Some(BammetricsReport.clippingPlotTables(summary,!sampleLevel, sampleId, libId)) Some(BammetricsReport.clippingPlotTables(summary, !sampleLevel, sampleId, libId))
else None else None
val statsPaths = fields.map(x => x -> List("clipping", "general", x)).toMap val statsPaths = fields.map(x => x -> List("clipping", "general", x)).toMap
val clippingTableResults = summary.getStatsForLibraries(runId, "bammetrics", "bamstats",sampleId, statsPaths) val clippingTableResults = summary.getStatsForLibraries(runId, "bammetrics", "bamstats", sampleId, statsPaths)
Map( Map(
"clippingPlotTables" -> clippingPlotTables, "clippingPlotTables" -> clippingPlotTables,
"clippingTableResults" -> clippingTableResults, "clippingTableResults" -> clippingTableResults,
...@@ -110,4 +110,39 @@ object BammetricsReportPage { ...@@ -110,4 +110,39 @@ object BammetricsReportPage {
"libId" -> libId "libId" -> libId
) )
} }
def insertSizeValues(summary: SummaryDb,
runId: Int,
allSamples: Seq[Sample],
allLibraries: Seq[Library],
sampleId: Option[Int],
libId: Option[Int],
fields: List[String] = List("mean_insert_size", "standard_deviation", "median_insert_size"),
sampleLevel: Boolean = false,
showPlot: Boolean = false,
showIntro: Boolean = true,
showTable: Boolean = true): Map[String, Any] = {
val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id).toList
case _ => allSamples.toList
}
val insertSizePlotTables: Option[Array[Map[String, Array[Any]]]] =
if (showPlot)
Some(BammetricsReport.clippingPlotTables(summary, !sampleLevel, sampleId, libId))
else None
val statsPaths = fields.map(x => x -> List("metrics", x.toUpperCase)).toMap
val insertSizeTableResults = summary.getStatsForLibraries(runId, "bammetrics", "CollectInsertSizeMetrics", sampleId, statsPaths)
Map(
"insertSizePlotTables" -> insertSizePlotTables,
"insertSizeTableResults" -> insertSizeTableResults,
"showIntro" -> showIntro,
"showTable" -> showTable,
"showPlot" -> showPlot,
"sampleId" -> sampleId,
"libId" -> libId
)
}
} }
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