Commit 21e0eede authored by Vorderman's avatar Vorderman

Defutured multi and single page

parent 6c753678
...@@ -14,14 +14,9 @@ ...@@ -14,14 +14,9 @@
*/ */
package nl.lumc.sasc.biopet.pipelines.mapping package nl.lumc.sasc.biopet.pipelines.mapping
import nl.lumc.sasc.biopet.core.report.{ import nl.lumc.sasc.biopet.core.report.{MultisampleReportBuilder, ReportBuilderExtension, ReportPage, ReportSection}
MultisampleReportBuilder,
ReportBuilderExtension,
ReportPage,
ReportSection
}
import nl.lumc.sasc.biopet.pipelines.bammetrics.{BammetricsReport, BammetricsReportPage} import nl.lumc.sasc.biopet.pipelines.bammetrics.{BammetricsReport, BammetricsReportPage}
import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport import nl.lumc.sasc.biopet.pipelines.flexiprep.{FlexiprepReadSummary,FlexiprepBaseSummary, FlexiprepReport}
import nl.lumc.sasc.biopet.pipelines.gears.GearsKronaPlot import nl.lumc.sasc.biopet.pipelines.gears.GearsKronaPlot
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._ import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._
...@@ -142,6 +137,16 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -142,6 +137,16 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
sampleLevel = true, sampleLevel = true,
showPlot = true, showPlot = true,
showTable = false) showTable = false)
val clippingReportValues = BammetricsReportPage.clippingValues(summary, runId, samples,
libraries, sampleId, libId,sampleLevel = true, showPlot = true, showTable = false)
val insertSizeReportValues = BammetricsReportPage.insertSizeValues(summary, runId, samples,
libraries, sampleId, libId,sampleLevel = true, showPlot = true, showTable = false)
val wgsHistogramReportValues = BammetricsReportPage.wgsHistogramValues(summary, runId, samples,
libraries, sampleId, libId,sampleLevel = true, showPlot = true, showTable = false)
val rnaHistogramReportValues = BammetricsReportPage.rnaHistogramValues(summary, runId, samples,
libraries, sampleId, libId,sampleLevel = true, showPlot = true, showTable = false)
val flexiprepReadSummary = FlexiprepReadSummary.values(summary, runId, samples, libraries,sampleId,libId,showPlot=true, showTable = false)
val flexiprepBaseSummary = FlexiprepBaseSummary.values(summary, runId, samples, libraries,sampleId,libId,showPlot=true, showTable = false)
Future { Future {
ReportPage( ReportPage(
List("Samples" -> generateSamplesPage(pageArgs)) ++ List("Samples" -> generateSamplesPage(pageArgs)) ++
...@@ -189,36 +194,34 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -189,36 +194,34 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
"/nl/lumc/sasc/biopet/pipelines/bammetrics/mappingQuality.ssp", "/nl/lumc/sasc/biopet/pipelines/bammetrics/mappingQuality.ssp",
mappingQualityReportValues), mappingQualityReportValues),
"Clipping" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/clipping.ssp", "Clipping" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/clipping.ssp",
Map("sampleLevel" -> true, clippingReportValues)
"showPlot" -> true,
"showTable" -> false))
) ++ ) ++
(if (pairedFound && insertsizeExecuted) (if (pairedFound && insertsizeExecuted)
List( List(
"Insert Size" -> ReportSection( "Insert Size" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/insertSize.ssp", "/nl/lumc/sasc/biopet/pipelines/bammetrics/insertSize.ssp",
Map("sampleLevel" -> true, "showPlot" -> true, "showTable" -> false))) insertSizeReportValues))
else Nil) ++ else Nil) ++
(if (wgsExecuted) (if (wgsExecuted)
List( List(
"Whole genome coverage" -> ReportSection( "Whole genome coverage" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/wgsHistogram.ssp", "/nl/lumc/sasc/biopet/pipelines/bammetrics/wgsHistogram.ssp",
Map("sampleLevel" -> true, "showPlot" -> true, "showTable" -> false))) wgsHistogramReportValues))
else Nil) ++ else Nil) ++
(if (rnaExecuted) (if (rnaExecuted)
List( List(
"Rna coverage" -> ReportSection( "Rna coverage" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/rnaHistogram.ssp", "/nl/lumc/sasc/biopet/pipelines/bammetrics/rnaHistogram.ssp",
Map("sampleLevel" -> true, "showPlot" -> true, "showTable" -> false))) rnaHistogramReportValues))
else Nil) ++ else Nil) ++
(if (flexiprepExecuted) (if (flexiprepExecuted)
List( List(
"QC reads" -> ReportSection( "QC reads" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp", "/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp",
Map("showPlot" -> true, "showTable" -> false)), flexiprepReadSummary),
"QC bases" -> ReportSection( "QC bases" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp", "/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp",
Map("showPlot" -> true, "showTable" -> false)) flexiprepBaseSummary)
) )
else Nil), else Nil),
pageArgs ++ Map("pipeline" -> pipelineName) pageArgs ++ Map("pipeline" -> pipelineName)
...@@ -227,131 +230,145 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -227,131 +230,145 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
} }
/** Single sample page */ /** Single sample page */
def samplePage(sampleId: Int, args: Map[String, Any]): Future[ReportPage] = Future { def samplePage(sampleId: Int, args: Map[String, Any]): Future[ReportPage] = {
val krakenExecuted = Await.result(summary.getStatsSize(runId, val krakenExecuted = Await.result(summary.getStatsSize(runId,
"gearskraken", "gearskraken",
"krakenreport", "krakenreport",
library = NoLibrary, library = NoLibrary,
sample = sampleId), sample = sampleId),
Duration.Inf) >= 1 Duration.Inf) >= 1
val centrifugeExecuted = Await.result(summary.getStatsSize(runId, val centrifugeExecuted = Await.result(summary.getStatsSize(runId,
"gearscentrifuge", "gearscentrifuge",
"centrifuge_report", "centrifuge_report",
library = NoLibrary, library = NoLibrary,
sample = sampleId, sample = sampleId,
mustHaveSample = true), mustHaveSample = true),
Duration.Inf) >= 1 Duration.Inf) >= 1
val flexiprepExecuted = Await.result( val flexiprepExecuted = Await.result(
summary.getStatsSize(runId, "flexiprep", sample = sampleId, mustHaveLibrary = true), summary.getStatsSize(runId, "flexiprep", sample = sampleId, mustHaveLibrary = true),
Duration.Inf) >= 1 Duration.Inf) >= 1
ReportPage( val centrifugeAllMappingsReportValues = GearsKronaPlot.values(summary, runId, "gearscentrifuge",
List("Libraries" -> generateLibraryPage(args), "centrifuge_report", samples, libraries, sampleId, libId, Some("centrifuge"))
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), None)) ++ val centrifugeUniqueMappingsReportValues = GearsKronaPlot.values(summary,runId,"gearscentrifuge",
(if (centrifugeExecuted) "centrifuge_unique_report", samples, libraries, sampleId, libId)
List( val dustbinAnalysisReportValues = GearsKronaPlot.values(summary,runId, "gearskraken", "krakenreport",
"Centrifuge analysis" -> Future.successful(ReportPage( samples,libraries,sampleId,libId)
List("Non-unique" -> Future.successful(ReportPage( val alignmentSummaryReportValues = BammetricsReportPage.alignmentSummaryValues(summary, runId,
List(), samples, libraries, sampleId, libId, showPlot = true)
List("All mappings" -> ReportSection( val preprocessingReportValues = BammetricsReportPage.alignmentSummaryValues(summary, runId,
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", samples, libraries, sampleId, libId, sampleLevel = true)
Map("summaryStatsTag" -> "centrifuge_report", val flexiprepReadSummary = FlexiprepReadSummary.values(summary,runId,samples,libraries,sampleId,libId)
"centrifugeTag" -> Some("centrifuge")))), val flexiprepBaseSummary = FlexiprepBaseSummary.values(summary,runId,samples,libraries,sampleId,libId)
Map()
))),
List("Unique mappings" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
Map("summaryStatsTag" -> "centrifuge_unique_report"))),
Map("summaryModuleTag" -> "gearscentrifuge")
)))
else
Nil) ::: (if (krakenExecuted)
List(
"Dustbin analysis" -> Future.successful(
ReportPage(List(),
List("Krona Plot" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp")),
Map())))
else Nil),
List(
"Alignment" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp",
Map("showPlot" -> true)),
"Preprocessing" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp",
Map("sampleLevel" -> true))
) ++
(if (flexiprepExecuted)
List(
"QC reads" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
)
else Nil),
args
)
}
/** Library page */ Future {
def libraryPage(sampleId: Int, libId: Int, args: Map[String, Any]): Future[ReportPage] = Future { ReportPage(
val krakenExecuted = Await.result(summary.getStatsSize(runId, List("Libraries" -> generateLibraryPage(args),
"gearskraken", "Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), None)) ++
"krakenreport", (if (centrifugeExecuted)
library = libId, List(
sample = sampleId), "Centrifuge analysis" -> Future.successful(ReportPage(
Duration.Inf) >= 1 List("Non-unique" -> Future.successful(ReportPage(
val centrifugeExecuted = Await.result(summary.getStatsSize(runId, List(),
"gearscentrifuge", List("All mappings" -> ReportSection(
"centrifuge_report", "/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
library = libId, centrifugeAllMappingsReportValues)),
sample = sampleId, Map()
mustHaveSample = true), ))),
Duration.Inf) >= 1 List("Unique mappings" -> ReportSection(
val flexiprepExecuted = Await.result(summary.getStatsSize(runId, "/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
"flexiprep", centrifugeUniqueMappingsReportValues)),
library = libId, Map("summaryPipelineName" -> "gearscentrifuge")
sample = sampleId, )))
mustHaveLibrary = true), else
Duration.Inf) >= 1 Nil) ::: (if (krakenExecuted)
List(
"Dustbin analysis" -> Future.successful(
ReportPage(List(),
List("Krona Plot" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",dustbinAnalysisReportValues)),
Map())))
else Nil),
List(
"Alignment" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp",
alignmentSummaryReportValues),
"Preprocessing" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp",
preprocessingReportValues)
) ++
(if (flexiprepExecuted)
List(
"QC reads" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp", flexiprepReadSummary),
"QC bases" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp", flexiprepBaseSummary)
)
else Nil),
args
)
}
/** Library page */
def libraryPage(sampleId: Int, libId: Int, args: Map[String, Any]): Future[ReportPage] = Future {
val krakenExecuted = Await.result(summary.getStatsSize(runId,
"gearskraken",
"krakenreport",
library = libId,
sample = sampleId),
Duration.Inf) >= 1
val centrifugeExecuted = Await.result(summary.getStatsSize(runId,
"gearscentrifuge",
"centrifuge_report",
library = libId,
sample = sampleId,
mustHaveSample = true),
Duration.Inf) >= 1
val flexiprepExecuted = Await.result(summary.getStatsSize(runId,
"flexiprep",
library = libId,
sample = sampleId,
mustHaveLibrary = true),
Duration.Inf) >= 1
ReportPage( ReportPage(
("Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId))) :: ("Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId))) ::
(if (flexiprepExecuted) (if (flexiprepExecuted)
List("QC" -> FlexiprepReport.flexiprepPage(summary, sampleId, libId)) List("QC" -> FlexiprepReport.flexiprepPage(summary, sampleId, libId))
else Nil) ::: else Nil) :::
(if (centrifugeExecuted) (if (centrifugeExecuted)
List("Centrifuge analysis" -> Future.successful(ReportPage( List("Centrifuge analysis" -> Future.successful(ReportPage(
List("Non-unique" -> Future.successful( List("Non-unique" -> Future.successful(
ReportPage(List(), ReportPage(List(),
List("All mappings" -> ReportSection( List("All mappings" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
Map("summaryStatsTag" -> "centrifuge_report"))), Map("summaryStatsTag" -> "centrifuge_report"))),
Map()))), Map()))),
List("Unique mappings" -> ReportSection( List("Unique mappings" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
Map("summaryStatsTag" -> "centrifuge_unique_report"))), Map("summaryStatsTag" -> "centrifuge_unique_report"))),
Map("summaryModuleTag" -> "gearscentrifuge", "centrifugeTag" -> Some("centrifuge")) Map("summaryModuleTag" -> "gearscentrifuge", "centrifugeTag" -> Some("centrifuge"))
))) )))
else Nil) ::: (if (krakenExecuted) else Nil) ::: (if (krakenExecuted)
List( List(
"Dustbin analysis" -> Future.successful( "Dustbin analysis" -> Future.successful(
ReportPage(List(), ReportPage(List(),
List("Krona Plot" -> ReportSection( List("Krona Plot" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp")), "/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp")),
Map()))) Map())))
else Nil), else Nil),
"Alignment" -> ReportSection( "Alignment" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp") :: "/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp") ::
(if (flexiprepExecuted) (if (flexiprepExecuted)
List( List(
"QC reads" -> ReportSection( "QC reads" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"), "/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection( "QC bases" -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp") "/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
) )
else Nil), else Nil),
args args
) )
}
}
} }
}
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