Commit af6b885e authored by rhpvorderman's avatar rhpvorderman

Prepare for further defuturing of bammetrics

parent 58c2b606
......@@ -74,7 +74,104 @@ object BammetricsReport extends ReportBuilder {
sampleId: Option[Int],
libId: Option[Int],
metricsTag: String = "bammetrics"): Map[String, Any] = {
Map("" -> "")
val wgsExecuted = summary.getStatsSize(runId,
metricsTag,
"wgs",
sample = sampleId.map(SampleId),
library = libId.map(LibraryId)) >= 1
val rnaExecuted = summary.getStatsSize(runId,
metricsTag,
"rna",
sample = sampleId.map(SampleId),
library = libId.map(LibraryId)) >= 1
val insertsizeMetrics = summary
.getStatKeys(
runId,
metricsTag,
"CollectInsertSizeMetrics",
sampleId.map(SampleId).getOrElse(NoSample),
libId.map(LibraryId).getOrElse(NoLibrary),
Map("metrics" -> List("metrics"))
)
.exists(_._2.isDefined)
val targetSettings = summary.getSettingKeys(
runId,
metricsTag,
NoModule,
sample = sampleId.map(SampleId).getOrElse(NoSample),
library = libId.map(LibraryId).getOrElse(NoLibrary),
Map("amplicon_name" -> List("amplicon_name"), "roi_name" -> List("roi_name"))
)
val targets = (
targetSettings("amplicon_name"),
targetSettings("roi_name")
) match {
case (Some(amplicon: String), Some(roi: List[_])) => amplicon :: roi.map(_.toString)
case (_, Some(roi: List[_])) => roi.map(_.toString)
case _ => Nil
}
val covstatsPlotValuesArray = ArrayBuffer[(String, Map[String,Any])]()
for (t <- targets) {
covstatsPlotValuesArray += Tuple2(t,BammetricsReportPage.covstatsPlotValues(summary, runId, sampleId, libId, Some(t)))
}
val covstatsPlotValuesList = covstatsPlotValuesArray.toList
val alignmentSummaryReportValues = BammetricsReportPage.alignmentSummaryValues(
summary,
runId,
samples,
libraries,
sampleId,
libId
)
val mappingQualityReportValues = BammetricsReportPage.mappingQualityValues(
summary,
runId,
samples,
libraries,
sampleId,
libId,
showPlot = true
)
val clippingReportValues = BammetricsReportPage.clippingValues(
summary,
runId,
samples,
libraries,
sampleId,
libId,
showPlot= true
)
val insertSizeReportValues = BammetricsReportPage.insertSizeValues(
summary,
runId,
samples,
libraries,
sampleId,
libId,
showPlot= true
)
val wgsHistogramReportValues = BammetricsReportPage.wgsHistogramValues(
summary,runId, samples, libraries, sampleId, libId, showPlot = true
)
val rnaHistogramReportValues = BammetricsReportPage.rnaHistogramValues(
summary,runId, samples, libraries, sampleId, libId, showPlot = true
)
Map("wgsExecuted" -> wgsExecuted,
"rnaExecuted" -> rnaExecuted,
"insertsizeMetrics" -> insertsizeMetrics,
"targetSettings" -> targetSettings,
"covstatsPlotValuesList" -> covstatsPlotValuesList,
"alignmentSummaryReportValues" -> alignmentSummaryReportValues,
"clippingReportValues" -> clippingReportValues,
"insertSizeReportValues" -> insertSizeReportValues,
"wgsHistogramReportValues" -> wgsHistogramReportValues,
"rnaHistogramReportValues" -> rnaHistogramReportValues
)
}
/** Generates a page with alignment stats */
......@@ -83,18 +180,18 @@ object BammetricsReport extends ReportBuilder {
libId: Option[Int],
metricsTag: String = "bammetrics"): Future[ReportPage] = {
val wgsExecuted = summary.getStatsSize(runId,
val wgsExecuted: Boolean = summary.getStatsSize(runId,
metricsTag,
"wgs",
sample = sampleId.map(SampleId),
library = libId.map(LibraryId)) >= 1
val rnaExecuted = summary.getStatsSize(runId,
val rnaExecuted: Boolean = summary.getStatsSize(runId,
metricsTag,
"rna",
sample = sampleId.map(SampleId),
library = libId.map(LibraryId)) >= 1
val insertsizeMetrics = summary
val insertsizeMetrics: Boolean = summary
.getStatKeys(
runId,
metricsTag,
......@@ -105,7 +202,7 @@ object BammetricsReport extends ReportBuilder {
)
.exists(_._2.isDefined)
val targetSettings = summary.getSettingKeys(
val targetSettings: Map[String, Option[Any]] = summary.getSettingKeys(
runId,
metricsTag,
NoModule,
......@@ -126,9 +223,9 @@ object BammetricsReport extends ReportBuilder {
for (t <- targets) {
covstatsPlotValuesArray += Tuple2(t,BammetricsReportPage.covstatsPlotValues(summary, runId, sampleId, libId, Some(t)))
}
val covstatsPlotValuesList = covstatsPlotValuesArray.toList
val covstatsPlotValuesList: List[(String, Map[String, Any])] = covstatsPlotValuesArray.toList
val alignmentSummaryReportValues = BammetricsReportPage.alignmentSummaryValues(
val alignmentSummaryReportValues: Map[String, Any] = BammetricsReportPage.alignmentSummaryValues(
summary,
runId,
samples,
......@@ -136,7 +233,7 @@ object BammetricsReport extends ReportBuilder {
sampleId,
libId
)
val mappingQualityReportValues = BammetricsReportPage.mappingQualityValues(
val mappingQualityReportValues: Map[String, Any] = BammetricsReportPage.mappingQualityValues(
summary,
runId,
samples,
......@@ -145,7 +242,7 @@ object BammetricsReport extends ReportBuilder {
libId,
showPlot = true
)
val clippingReportValues = BammetricsReportPage.clippingValues(
val clippingReportValues: Map[String, Any] = BammetricsReportPage.clippingValues(
summary,
runId,
samples,
......@@ -154,7 +251,7 @@ object BammetricsReport extends ReportBuilder {
libId,
showPlot= true
)
val insertSizeReportValues = BammetricsReportPage.insertSizeValues(
val insertSizeReportValues: Map[String, Any] = BammetricsReportPage.insertSizeValues(
summary,
runId,
samples,
......@@ -163,10 +260,10 @@ object BammetricsReport extends ReportBuilder {
libId,
showPlot= true
)
val wgsHistogramReportValues = BammetricsReportPage.wgsHistogramValues(
val wgsHistogramReportValues: Map[String, Any] = BammetricsReportPage.wgsHistogramValues(
summary,runId, samples, libraries, sampleId, libId, showPlot = true
)
val rnaHistogramReportValues = BammetricsReportPage.rnaHistogramValues(
val rnaHistogramReportValues: Map[String, Any] = BammetricsReportPage.rnaHistogramValues(
summary,runId, samples, libraries, sampleId, libId, showPlot = true
)
Future {
......
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