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