Commit 19a8db89 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fixing compile errors

parent 84c05fce
...@@ -24,8 +24,7 @@ import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb ...@@ -24,8 +24,7 @@ import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._ import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._ import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.{ Await, Future }
import scala.concurrent.Await
import scala.concurrent.duration.Duration import scala.concurrent.duration.Duration
class BammetricsReport(val parent: Configurable) extends ReportBuilderExtension { class BammetricsReport(val parent: Configurable) extends ReportBuilderExtension {
...@@ -43,12 +42,12 @@ object BammetricsReport extends ReportBuilder { ...@@ -43,12 +42,12 @@ object BammetricsReport extends ReportBuilder {
val reportName = "Bam Metrics" val reportName = "Bam Metrics"
/** Root page for single BamMetrcis report */ /** Root page for single BamMetrcis report */
def indexPage = { def indexPage: Future[ReportPage] = Future {
val bamMetricsPage = this.bamMetricsPage(summary, sampleId, libId) val bamMetricsPage = Await.result(this.bamMetricsPage(summary, sampleId, libId), Duration.Inf)
ReportPage(bamMetricsPage.subPages ::: List( ReportPage(bamMetricsPage.subPages ::: List(
"Versions" -> ReportPage(List(), List("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp" "Versions" -> Future(ReportPage(List(), List("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"
)), Map()), )), Map())),
"Files" -> ReportPage(List(), List(), Map()) "Files" -> Future(ReportPage(List(), List(), Map()))
), List( ), List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/bamMetricsFront.ssp") "Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/bamMetricsFront.ssp")
) ::: bamMetricsPage.sections, ) ::: bamMetricsPage.sections,
...@@ -60,7 +59,7 @@ object BammetricsReport extends ReportBuilder { ...@@ -60,7 +59,7 @@ object BammetricsReport extends ReportBuilder {
def bamMetricsPage(summary: SummaryDb, def bamMetricsPage(summary: SummaryDb,
sampleId: Option[Int], sampleId: Option[Int],
libId: Option[Int], libId: Option[Int],
metricsTag: String = "bammetrics") = { metricsTag: String = "bammetrics"): Future[ReportPage] = Future {
//val pipelineId: Int = summary.getPipelineId(runId, metricsTag).map(_.get) //val pipelineId: Int = summary.getPipelineId(runId, metricsTag).map(_.get)
...@@ -85,10 +84,10 @@ object BammetricsReport extends ReportBuilder { ...@@ -85,10 +84,10 @@ object BammetricsReport extends ReportBuilder {
ReportPage( ReportPage(
if (targets.isEmpty) List() if (targets.isEmpty) List()
else List("Targets" -> ReportPage( else List("Targets" -> Future(ReportPage(
List(), List(),
targets.map(t => t -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsPlot.ssp", Map("target" -> Some(t)))), targets.map(t => t -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsPlot.ssp", Map("target" -> Some(t)))),
Map())), Map()))),
List( List(
"Summary" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp"), "Summary" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp"),
"Mapping Quality" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/mappingQuality.ssp", Map("showPlot" -> true)), "Mapping Quality" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/mappingQuality.ssp", Map("showPlot" -> true)),
......
...@@ -24,11 +24,10 @@ import org.broadinstitute.gatk.utils.commandline.Input ...@@ -24,11 +24,10 @@ import org.broadinstitute.gatk.utils.commandline.Input
import org.fusesource.scalate.TemplateEngine import org.fusesource.scalate.TemplateEngine
import scala.collection.mutable import scala.collection.mutable
import scala.concurrent.{ Await, Future } import scala.concurrent.{ Await, ExecutionContextExecutor, Future }
import scala.concurrent.duration.Duration import scala.concurrent.duration.Duration
import scala.language.postfixOps import scala.language.postfixOps
import scala.language.implicitConversions import scala.language.implicitConversions
import scala.concurrent.ExecutionContext.Implicits.global
/** /**
* This trait is meant to make an extension for a report object * This trait is meant to make an extension for a report object
...@@ -74,8 +73,9 @@ trait ReportBuilderExtension extends ToolCommandFunction { ...@@ -74,8 +73,9 @@ trait ReportBuilderExtension extends ToolCommandFunction {
trait ReportBuilder extends ToolCommand { trait ReportBuilder extends ToolCommand {
implicit lazy val global: ExecutionContextExecutor = scala.concurrent.ExecutionContext.global
implicit def toOption[T](x: T): Option[T] = Option(x) implicit def toOption[T](x: T): Option[T] = Option(x)
// implicit def autoWait[T](x: Future[T]): T = Await.result(x, Duration.Inf) implicit def autoWait[T](x: Future[T]): T = Await.result(x, Duration.Inf)
case class Args(summaryDbFile: File = null, case class Args(summaryDbFile: File = null,
outputDir: File = null, outputDir: File = null,
......
...@@ -22,7 +22,7 @@ import nl.lumc.sasc.biopet.utils.config.Configurable ...@@ -22,7 +22,7 @@ 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._
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.{ NoLibrary, NoModule, SampleId } import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.{ NoLibrary, NoModule, SampleId }
import scala.concurrent.Await import scala.concurrent.{ Await, Future }
import scala.concurrent.duration.Duration import scala.concurrent.duration.Duration
import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.ExecutionContext.Implicits.global
...@@ -42,7 +42,7 @@ object GearsReport extends MultisampleReportBuilder { ...@@ -42,7 +42,7 @@ object GearsReport extends MultisampleReportBuilder {
override def extFiles = super.extFiles ++ List("js/gears.js", "js/krona-2.0.js", "img/krona/loading.gif", "img/krona/hidden.png", "img/krona/favicon.ico") override def extFiles = super.extFiles ++ List("js/gears.js", "js/krona-2.0.js", "img/krona/loading.gif", "img/krona/hidden.png", "img/krona/favicon.ico")
.map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x)) .map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x))
def indexPage = { def indexPage: Future[ReportPage] = Future {
val run = Await.result(summary.getRuns(runId).map(_.head), Duration.Inf) val run = Await.result(summary.getRuns(runId).map(_.head), Duration.Inf)
val krakenExecuted = summary.getStatsSize(runId = runId, pipeline = "gearskraken", module = "krakenreport", library = NoLibrary, mustHaveSample = true) >= samples.size val krakenExecuted = summary.getStatsSize(runId = runId, pipeline = "gearskraken", module = "krakenreport", library = NoLibrary, mustHaveSample = true) >= samples.size
...@@ -51,26 +51,27 @@ object GearsReport extends MultisampleReportBuilder { ...@@ -51,26 +51,27 @@ object GearsReport extends MultisampleReportBuilder {
val qiimeOpenOtuTable = summary.getFile(runId, "gears", key = "qiime_open_otu_table") val qiimeOpenOtuTable = summary.getFile(runId, "gears", key = "qiime_open_otu_table")
ReportPage( ReportPage(
(if (centrifugeExecuted) List("Centriguge analysis" -> ReportPage(List("Non-unique" -> ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", (if (centrifugeExecuted) List("Centriguge analysis" -> Future(ReportPage(List("Non-unique" ->
Map("summaryStatsTag" -> "centrifuge_report") Future(ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
)), Map())), List( Map("summaryStatsTag" -> "centrifuge_report")
)), Map()))), List(
"Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "Unique mappings" -> ReportSection("/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) List("Kraken analysis" -> ReportPage(List(), List( else Nil) ::: (if (krakenExecuted) List("Kraken analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp" "Krona plot" -> Future(ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)), Map())) ))), Map())))
else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> ReportPage(List(), List( else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp" "Krona plot" -> Future(ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeClosesOtuTable.get.path)))) ))), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeClosesOtuTable.get.path)))))
else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> ReportPage(List(), List( else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeOpenOtuTable.get.path)))) )), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeOpenOtuTable.get.path)))))
else Nil) ::: List("Samples" -> generateSamplesPage(pageArgs)) ++ else Nil) ::: List("Samples" -> generateSamplesPage(pageArgs)) ++
Map( Map(
"Versions" -> ReportPage(List(), List( "Versions" -> Future(ReportPage(List(), List(
"Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp") "Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp")
), Map()) ), Map()))
), ),
List( List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp")) ++ "Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp")) ++
...@@ -85,28 +86,29 @@ object GearsReport extends MultisampleReportBuilder { ...@@ -85,28 +86,29 @@ object GearsReport extends MultisampleReportBuilder {
} }
/** Single sample page */ /** Single sample page */
def samplePage(sampleId: Int, args: Map[String, Any]): ReportPage = { def samplePage(sampleId: Int, args: Map[String, Any]): Future[ReportPage] = Future {
val run = Await.result(summary.getRuns(runId).map(_.head), Duration.Inf) val run = Await.result(summary.getRuns(runId).map(_.head), Duration.Inf)
val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport", sample = sampleId, library = NoLibrary), Duration.Inf) == 1 val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport", sample = sampleId, library = NoLibrary), Duration.Inf) == 1
val centrifugeExecuted = Await.result(summary.getStatsSize(runId, "gearscentrifuge", "centrifuge_report", sample = sampleId, library = None), Duration.Inf) == 1 val centrifugeExecuted = Await.result(summary.getStatsSize(runId, "gearscentrifuge", "centrifuge_report", sample = sampleId, library = None), Duration.Inf) == 1
val qiimeClosesOtuTable = Await.result(summary.getFile(runId, "gearssingle", NoModule, sampleId, NoLibrary, "qiime_closed_otu_table"), Duration.Inf) val qiimeClosesOtuTable = Await.result(summary.getFile(runId, "gearssingle", NoModule, sampleId, NoLibrary, "qiime_closed_otu_table"), Duration.Inf)
val qiimeOpenOtuTable = Await.result(summary.getFile(runId, "gearssingle", NoModule, sampleId, NoLibrary, "qiime_open_otu_table"), Duration.Inf) val qiimeOpenOtuTable = Await.result(summary.getFile(runId, "gearssingle", NoModule, sampleId, NoLibrary, "qiime_open_otu_table"), Duration.Inf)
ReportPage((if (centrifugeExecuted) List("Centriguge analysis" -> ReportPage(List("Non-unique" -> ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", ReportPage((if (centrifugeExecuted) List("Centriguge analysis" -> Future(ReportPage(List(
Map("summaryStatsTag" -> "centrifuge_report") "Non-unique" -> Future(ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
)), Map())), List( Map("summaryStatsTag" -> "centrifuge_report")
)), Map()))), List(
"Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "Unique mappings" -> ReportSection("/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) List("Kraken analysis" -> ReportPage(List(), List( else Nil) ::: (if (krakenExecuted) List("Kraken analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)), Map())) )), Map())))
else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> ReportPage(List(), List( else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeClosesOtuTable.get.path)))) )), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeClosesOtuTable.get.path)))))
else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> ReportPage(List(), List( else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeOpenOtuTable.get.path)))) )), Map("biomFile" -> new File(run.outputDir + File.separator + qiimeOpenOtuTable.get.path)))))
else Nil) ::: List( else Nil) ::: List(
"Libraries" -> generateLibraryPage(args) "Libraries" -> generateLibraryPage(args)
), List("QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"), ), List("QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
...@@ -115,7 +117,7 @@ object GearsReport extends MultisampleReportBuilder { ...@@ -115,7 +117,7 @@ object GearsReport extends MultisampleReportBuilder {
} }
/** Library page */ /** Library page */
def libraryPage(sampleId: Int, libId: Int, args: Map[String, Any]): ReportPage = { def libraryPage(sampleId: Int, libId: Int, args: Map[String, Any]): Future[ReportPage] = Future {
val sName = Await.result(summary.getSampleName(sampleId), Duration.Inf) val sName = Await.result(summary.getSampleName(sampleId), Duration.Inf)
val lName = Await.result(summary.getLibraryName(libId), Duration.Inf) val lName = Await.result(summary.getLibraryName(libId), Duration.Inf)
...@@ -128,21 +130,22 @@ object GearsReport extends MultisampleReportBuilder { ...@@ -128,21 +130,22 @@ object GearsReport extends MultisampleReportBuilder {
ReportPage( ReportPage(
(if (flexiprepExecuted) List("QC" -> FlexiprepReport.flexiprepPage) else Nil (if (flexiprepExecuted) List("QC" -> FlexiprepReport.flexiprepPage) else Nil
) ::: (if (centrifugeExecuted) List("Centriguge analysis" -> ReportPage(List("Non-unique" -> ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", ) ::: (if (centrifugeExecuted) List("Centriguge analysis" -> Future(ReportPage(List(
Map("summaryStatsTag" -> "centrifuge_report") "Non-unique" -> Future(ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
)), Map())), List( Map("summaryStatsTag" -> "centrifuge_report")
)), Map()))), List(
"Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "Unique mappings" -> ReportSection("/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) List("Kraken analysis" -> ReportPage(List(), List( else Nil) ::: (if (krakenExecuted) List("Kraken analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)), Map())) )), Map())))
else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> ReportPage(List(), List( else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> new File(qiimeClosesOtuTable.get.path)))) )), Map("biomFile" -> new File(qiimeClosesOtuTable.get.path)))))
else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> ReportPage(List(), List( else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> new File(qiimeOpenOtuTable.get.path)))) )), Map("biomFile" -> new File(qiimeOpenOtuTable.get.path)))))
else Nil), List( else Nil), List(
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"), "QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp") "QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
......
...@@ -19,7 +19,7 @@ import nl.lumc.sasc.biopet.utils.config.Configurable ...@@ -19,7 +19,7 @@ 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._
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.{ LibraryId, SampleId } import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.{ LibraryId, SampleId }
import scala.concurrent.Await import scala.concurrent.{ Await, Future }
import scala.concurrent.duration.Duration import scala.concurrent.duration.Duration
class GearsSingleReport(val parent: Configurable) extends ReportBuilderExtension { class GearsSingleReport(val parent: Configurable) extends ReportBuilderExtension {
...@@ -31,7 +31,7 @@ object GearsSingleReport extends ReportBuilder { ...@@ -31,7 +31,7 @@ object GearsSingleReport extends ReportBuilder {
override def extFiles = super.extFiles ++ List("js/gears.js", "js/krona-2.0.js", "img/krona/loading.gif", "img/krona/hidden.png", "img/krona/favicon.ico") override def extFiles = super.extFiles ++ List("js/gears.js", "js/krona-2.0.js", "img/krona/loading.gif", "img/krona/hidden.png", "img/krona/favicon.ico")
.map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x)) .map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x))
def indexPage = { def indexPage: Future[ReportPage] = Future {
val sampleName = sampleId.flatMap(x => Await.result(summary.getSampleName(x), Duration.Inf)) val sampleName = sampleId.flatMap(x => Await.result(summary.getSampleName(x), Duration.Inf))
val libraryName = libId.flatMap(x => Await.result(summary.getLibraryName(x), Duration.Inf)) val libraryName = libId.flatMap(x => Await.result(summary.getLibraryName(x), Duration.Inf))
...@@ -40,8 +40,8 @@ object GearsSingleReport extends ReportBuilder { ...@@ -40,8 +40,8 @@ object GearsSingleReport extends ReportBuilder {
ReportPage( ReportPage(
List( List(
"Versions" -> ReportPage(List(), "Versions" -> Future(ReportPage(List(),
List(("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"))), Map()) List(("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"))), Map()))
), ),
List("Gears intro" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSingleFront.ssp")) ++ List("Gears intro" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSingleFront.ssp")) ++
(if (krakenExecuted) List("Kraken analysis" -> (if (krakenExecuted) List("Kraken analysis" ->
......
...@@ -21,7 +21,7 @@ import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport ...@@ -21,7 +21,7 @@ import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._ import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._ import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._
import scala.concurrent.Await import scala.concurrent.{ Await, Future }
import scala.concurrent.duration.Duration import scala.concurrent.duration.Duration
class MappingReport(val parent: Configurable) extends ReportBuilderExtension { class MappingReport(val parent: Configurable) extends ReportBuilderExtension {
...@@ -44,7 +44,7 @@ object MappingReport extends ReportBuilder { ...@@ -44,7 +44,7 @@ object MappingReport extends ReportBuilder {
sample = sampleId.map(SampleId), library = libId.map(LibraryId)), Duration.Inf) >= 1 sample = sampleId.map(SampleId), library = libId.map(LibraryId)), Duration.Inf) >= 1
/** Root page for single BamMetrcis report */ /** Root page for single BamMetrcis report */
def indexPage = { def indexPage: Future[ReportPage] = Future {
val mappingSettings = summary.getSettingKeys(runId, "mapping", NoModule, val mappingSettings = summary.getSettingKeys(runId, "mapping", NoModule,
sample = sampleId.map(SampleId).getOrElse(NoSample), library = libId.map(LibraryId).getOrElse(NoLibrary), sample = sampleId.map(SampleId).getOrElse(NoSample), library = libId.map(LibraryId).getOrElse(NoLibrary),
keyValues = Map("skip_flexiprep" -> List("skip_flexiprep"), "skip_metrics" -> List("skip_metrics"))) keyValues = Map("skip_flexiprep" -> List("skip_flexiprep"), "skip_metrics" -> List("skip_metrics")))
...@@ -54,13 +54,13 @@ object MappingReport extends ReportBuilder { ...@@ -54,13 +54,13 @@ object MappingReport extends ReportBuilder {
} else None } else None
ReportPage((if (skipFlexiprep) Nil else List("QC" -> FlexiprepReport.flexiprepPage)) ::: ReportPage((if (skipFlexiprep) Nil else List("QC" -> FlexiprepReport.flexiprepPage)) :::
bamMetricsPage.map(_.subPages).getOrElse(Nil) ::: List( bamMetricsPage.map(_.subPages).getOrElse(Nil) ::: List(
"Versions" -> ReportPage(List(), List("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp" "Versions" -> Future(ReportPage(List(), List("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"
)), Map()), )), Map())),
"Files" -> ReportPage(List(), Nil, Map()) "Files" -> Future(ReportPage(List(), Nil, Map()))
) ::: ) :::
(if (krakenExecuted) List("Gears - Metagenomics" -> ReportPage(List(), List( (if (krakenExecuted) List("Gears - Metagenomics" -> Future(ReportPage(List(), List(
"Sunburst analysis" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSunburst.ssp" "Sunburst analysis" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSunburst.ssp"
)), Map())) )), Map())))
else Nil), List( else Nil), List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/mapping/mappingFront.ssp") "Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/mapping/mappingFront.ssp")
) ::: bamMetricsPage.map(_.sections).getOrElse(Nil), ) ::: bamMetricsPage.map(_.sections).getOrElse(Nil),
......
...@@ -49,7 +49,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -49,7 +49,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
.map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x)) .map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x))
/** Root page for the carp report */ /** Root page for the carp report */
def indexPage = { def indexPage: Future[ReportPage] = Future {
val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport", val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport",
library = NoLibrary, mustHaveSample = true), Duration.Inf) >= 1 library = NoLibrary, mustHaveSample = true), Duration.Inf) >= 1
...@@ -67,22 +67,23 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -67,22 +67,23 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
ReportPage( ReportPage(
List("Samples" -> generateSamplesPage(pageArgs)) ++ List("Samples" -> generateSamplesPage(pageArgs)) ++
(if (krakenExecuted) List("Dustbin analysis - Kraken" -> ReportPage(List(), List( (if (krakenExecuted) List("Dustbin analysis - Kraken" -> Future(ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp" "Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)), Map())) )), Map())))
else Nil) ++ (if (centrifugeExecuted) List("Centriguge analysis" -> ReportPage(List("Non-unique" -> ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", else Nil) ++ (if (centrifugeExecuted) List("Centriguge analysis" -> Future(ReportPage(List(
Map("summaryStatsTag" -> "centrifuge_report") "Non-unique" -> Future(ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
)), Map())), List( Map("summaryStatsTag" -> "centrifuge_report")
)), Map()))), List(
"Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "Unique mappings" -> ReportSection("/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) ++ else Nil) ++
List("Reference" -> ReportPage(List(), List( List("Reference" -> Future(ReportPage(List(), List(
"Reference" -> ReportSection("/nl/lumc/sasc/biopet/core/report/reference.ssp", Map("pipeline" -> pipelineName)) "Reference" -> ReportSection("/nl/lumc/sasc/biopet/core/report/reference.ssp", Map("pipeline" -> pipelineName))
), Map()), ), Map())),
"Files" -> Await.result(filesPage(), Duration.Inf), "Files" -> filesPage(),
"Versions" -> ReportPage(List(), List("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp" "Versions" -> Future(ReportPage(List(), List("Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"
)), Map()) )), Map()))
), ),
List( List(
"Report" -> frontSection) ++ "Report" -> frontSection) ++
...@@ -129,7 +130,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -129,7 +130,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
moduleName.map(_ -> ReportSection("/nl/lumc/sasc/biopet/core/report/files.ssp", Map("files" -> files))) moduleName.map(_ -> ReportSection("/nl/lumc/sasc/biopet/core/report/files.ssp", Map("files" -> files)))
} }
val moduleSectionsSorted = moduleSections.find(_._1 == "Pipeline") ++ moduleSections.filter(_._1 != "Pipeline") val moduleSectionsSorted = moduleSections.find(_._1 == "Pipeline") ++ moduleSections.filter(_._1 != "Pipeline")
summary.getPipelineName(pipelineId = pipelineId).map(_.get -> ReportPage(Nil, Await.result(Future.sequence(moduleSectionsSorted), Duration.Inf).toList, Map())) summary.getPipelineName(pipelineId = pipelineId).map(_.get -> Future(ReportPage(Nil, Await.result(Future.sequence(moduleSectionsSorted), Duration.Inf).toList, Map())))
}) })
val pipelineFiles = summary.getPipelineId(runId, pipelineName).flatMap(pipelinelineId => dbFiles.map(x => x(pipelinelineId.get).filter(_.moduleId.isEmpty))) val pipelineFiles = summary.getPipelineId(runId, pipelineName).flatMap(pipelinelineId => dbFiles.map(x => x(pipelinelineId.get).filter(_.moduleId.isEmpty)))
...@@ -140,7 +141,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -140,7 +141,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
} }
/** Single sample page */ /** Single sample page */
def samplePage(sampleId: Int, args: Map[String, Any]): ReportPage = { def samplePage(sampleId: Int, args: Map[String, Any]): Future[ReportPage] = Future {
val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport", val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport",
library = NoLibrary, sample = sampleId), Duration.Inf) >= 1 library = NoLibrary, sample = sampleId), Duration.Inf) >= 1
val centrifugeExecuted = Await.result(summary.getStatsSize(runId, "gearscentrifuge", "centrifuge_report", val centrifugeExecuted = Await.result(summary.getStatsSize(runId, "gearscentrifuge", "centrifuge_report",
...@@ -151,17 +152,18 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -151,17 +152,18 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
ReportPage(List( ReportPage(List(
"Libraries" -> generateLibraryPage(args), "Libraries" -> generateLibraryPage(args),
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), None)) ++ "Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), None)) ++
(if (centrifugeExecuted) List("Centriguge analysis" -> ReportPage(List("Non-unique" -> ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", (if (centrifugeExecuted) List("Centriguge analysis" -> Future(ReportPage(List(
Map("summaryStatsTag" -> "centrifuge_report", "centrifugeTag" -> Some("centrifuge")) "Non-unique" -> Future(ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
)), Map())), List( Map("summaryStatsTag" -> "centrifuge_report", "centrifugeTag" -> Some("centrifuge"))
)), Map()))), List(
"Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
Map("summaryStatsTag" -> "centrifuge_unique_report") Map("summaryStatsTag" -> "centrifuge_unique_report")
)), Map("summaryModuleTag" -> "gearscentrifuge"))) )), Map("summaryModuleTag" -> "gearscentrifuge"))))
else Nil) ::: (if (krakenExecuted) List("Dustbin analysis" -> ReportPage(List(), List( else Nil) ::: (if (krakenExecuted) List("Dustbin analysis" -> Future(ReportPage(List(), List(
"Krona Plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp" "Krona Plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp"
)), Map())) )), Map())))
else Nil) ++ else Nil) ++
List("Files" -> Await.result(filesPage(sampleId = sampleId), Duration.Inf) List("Files" -> filesPage(sampleId = sampleId)
), List( ), List(
"Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", "Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp",
Map("showPlot" -> true)), Map("showPlot" -> true)),
...@@ -173,7 +175,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -173,7 +175,7 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
} }
/** Library page */ /** Library page */
def libraryPage(sampleId: Int, libId: Int, args: Map[String, Any]): ReportPage = { def libraryPage(sampleId: Int, libId: Int, args: Map[String, Any]): Future[ReportPage] = Future {
val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport", val krakenExecuted = Await.result(summary.getStatsSize(runId, "gearskraken", "krakenreport",
library = libId, sample = sampleId), Duration.Inf) >= 1 library = libId, sample = sampleId), Duration.Inf) >= 1
val centrifugeExecuted = Await.result(summary.getStatsSize(runId, "gearscentrifuge", "centrifuge_report", val centrifugeExecuted = Await.result(summary.getStatsSize(runId, "gearscentrifuge", "centrifuge_report",
...@@ -184,16 +186,17 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder { ...@@ -184,16 +186,17 @@ trait MultisampleMappingReportTrait extends MultisampleReportBuilder {
ReportPage( ReportPage(
("Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId))) :: ("Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId))) ::
(if (flexiprepExecuted) List("QC" -> FlexiprepReport.flexiprepPage) else Nil) ::: (if (flexiprepExecuted) List("QC" -> FlexiprepReport.flexiprepPage) else Nil) :::
(if (centrifugeExecuted) List("Centriguge analysis" -> ReportPage(List("Non-unique" -> ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", (if (centrifugeExecuted) List("Centriguge analysis" -> Future(ReportPage(List(
Map("summaryStatsTag" -> "centrifuge_report") "Non-unique" -> Future(ReportPage(List(), List("All mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp",
)), Map())), List( Map("summaryStatsTag" -> "centrifuge_report")
)), Map()))), List(
"Unique mappings" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/krakenKrona.ssp", "Unique mappings" -> ReportSection("/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")))))