Commit f8558f74 authored by Peter van 't Hof's avatar Peter van 't Hof

Updated some comments

parent 2129bb4f
...@@ -44,27 +44,24 @@ object BammetricsReport extends ReportBuilder { ...@@ -44,27 +44,24 @@ object BammetricsReport extends ReportBuilder {
def pipelineName = "bammetrics" def pipelineName = "bammetrics"
/** Root page for single BamMetrcis report */ /** Root page for single BamMetrcis report */
def indexPage: Future[ReportPage] = Future { def indexPage: Future[ReportPage] =
val bamMetricsPage = Await.result(this.bamMetricsPage(summary, sampleId, libId), Duration.Inf) bamMetricsPage(summary, sampleId, libId).map { bamMetricsPage =>
ReportPage(bamMetricsPage.subPages ::: List( ReportPage(bamMetricsPage.subPages ::: List(
"Versions" -> Future(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" -> filesPage(sampleId, libId) "Files" -> filesPage(sampleId, libId)
), 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,
Map() Map()
) )
} }
/** Generates a page with alignment stats */ /** Generates a page with alignment stats */
def bamMetricsPage(summary: SummaryDb, def bamMetricsPage(summary: SummaryDb,
sampleId: Option[Int], sampleId: Option[Int],
libId: Option[Int], libId: Option[Int],
metricsTag: String = "bammetrics"): Future[ReportPage] = Future { metricsTag: String = "bammetrics"): Future[ReportPage] = Future {
//val pipelineId: Int = summary.getPipelineId(runId, metricsTag).map(_.get)
val wgsExecuted = summary.getStatsSize(runId, metricsTag, "wgs", sample = sampleId.map(SampleId), library = libId.map(LibraryId)) >= 1 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 rnaExecuted = summary.getStatsSize(runId, metricsTag, "rna", sample = sampleId.map(SampleId), library = libId.map(LibraryId)) >= 1
...@@ -86,7 +83,7 @@ object BammetricsReport extends ReportBuilder { ...@@ -86,7 +83,7 @@ object BammetricsReport extends ReportBuilder {
ReportPage( ReportPage(
if (targets.isEmpty) List() if (targets.isEmpty) List()
else List("Targets" -> Future(ReportPage( else List("Targets" -> Future.successful(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()))),
......
...@@ -41,28 +41,28 @@ trait MultisampleReportBuilder extends ReportBuilder { ...@@ -41,28 +41,28 @@ trait MultisampleReportBuilder extends ReportBuilder {
} }
/** Generate the samples page including a single sample page for each sample in the summary */ /** Generate the samples page including a single sample page for each sample in the summary */
def generateSamplesPage(args: Map[String, Any]): Future[ReportPage] = Future { def generateSamplesPage(args: Map[String, Any]): Future[ReportPage] =
val samples = Await.result(summary.getSamples(runId = Some(runId)), Duration.Inf) summary.getSamples(runId = Some(runId)).map { samples =>
val samplePages = samples.map(_.id) val samplePages = samples.map(_.id)
.map(sampleId => sampleId -> samplePage(sampleId, args ++ Map("sampleId" -> Some(sampleId))) .map(sampleId => sampleId -> samplePage(sampleId, args ++ Map("sampleId" -> Some(sampleId)))
.map(x => x.copy(subPages = x.subPages ::: "Files" -> filesPage(sampleId, None) :: Nil))) .map(x => x.copy(subPages = x.subPages ::: "Files" -> filesPage(sampleId, None) :: Nil)))
.toList .toList
ReportPage(samplePages.map(x => samples.find(_.id == x._1).get.name -> x._2), samplesSections, args) ReportPage(samplePages.map(x => samples.find(_.id == x._1).get.name -> x._2), samplesSections, args)
} }
/** Generate the libraries page for a single sample with a subpage for eacht library */ /** Generate the libraries page for a single sample with a subpage for eacht library */
def generateLibraryPage(args: Map[String, Any]): Future[ReportPage] = Future { def generateLibraryPage(args: Map[String, Any]): Future[ReportPage] = {
val sampleId = args("sampleId") match { val sampleId = args("sampleId") match {
case Some(x: Int) => x case Some(x: Int) => x
case None => throw new IllegalStateException("Sample not found") case None => throw new IllegalStateException("Sample not found")
} }
val libraries = Await.result(summary.getLibraries(runId = Some(runId), sampleId = Some(sampleId)), Duration.Inf) summary.getLibraries(runId = Some(runId), sampleId = Some(sampleId)).map { libraries =>
val libPages = libraries.map(_.id)
val libPages = libraries.map(_.id) .map(libId => libId -> libraryPage(sampleId, libId, args ++ Map("libId" -> Some(libId)))
.map(libId => libId -> libraryPage(sampleId, libId, args ++ Map("libId" -> Some(libId))) .map(x => x.copy(subPages = x.subPages ::: "Files" -> filesPage(sampleId, libId) :: Nil)))
.map(x => x.copy(subPages = x.subPages ::: "Files" -> filesPage(sampleId, libId) :: Nil))) .toList
.toList ReportPage(libPages.map(x => libraries.find(_.id == x._1).get.name -> x._2), librariesSections, args)
ReportPage(libPages.map(x => libraries.find(_.id == x._1).get.name -> x._2), librariesSections, args) }
} }
} }
...@@ -313,12 +313,14 @@ trait ReportBuilder extends ToolCommand { ...@@ -313,12 +313,14 @@ trait ReportBuilder extends ToolCommand {
case (moduleId, files) => case (moduleId, files) =>
val moduleName: Future[String] = moduleId match { val moduleName: Future[String] = moduleId match {
case Some(id) => summary.getModuleName(pipelineId, id).map(_.getOrElse("Pipeline")) case Some(id) => summary.getModuleName(pipelineId, id).map(_.getOrElse("Pipeline"))
case _ => Future("Pipeline") case _ => Future.successful("Pipeline")
} }
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 -> Future(ReportPage(Nil, Await.result(Future.sequence(moduleSectionsSorted), Duration.Inf).toList, Map()))) summary.getPipelineName(pipelineId = pipelineId)
.map(_.get -> Future.sequence(moduleSectionsSorted)
.map(sections => ReportPage(Nil, sections.toList, Map())))
}) })
val pipelineFiles = summary.getPipelineId(runId, pipelineName) val pipelineFiles = summary.getPipelineId(runId, pipelineName)
......
...@@ -42,11 +42,10 @@ object FlexiprepReport extends ReportBuilder { ...@@ -42,11 +42,10 @@ object FlexiprepReport extends ReportBuilder {
override def pageArgs = Map("multisample" -> false) override def pageArgs = Map("multisample" -> false)
/** Index page for a flexiprep report */ /** Index page for a flexiprep report */
def indexPage: Future[ReportPage] = Future { def indexPage: Future[ReportPage] = this.flexiprepPage.map { flexiprepPage =>
val flexiprepPage = this.flexiprepPage
ReportPage(Nil, List( ReportPage(Nil, List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepFront.ssp") "Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepFront.ssp")
) ::: Await.result(flexiprepPage, Duration.Inf).sections, ) ::: flexiprepPage.sections,
Map() Map()
) )
} }
......
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