Commit 7d824f77 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Switch map the list for subpages

parent fc6efaf7
......@@ -14,7 +14,7 @@ object BammetricsReport extends ReportBuilder {
val reportName = "Bam Metrics"
def indexPage = ReportPage(Map(), List(), Map())
def indexPage = ReportPage(List(), List(), Map())
def bamMetricsPage(summary: Summary, sampleId: Option[String], libId: Option[String]) = {
val targets = (
......@@ -27,8 +27,8 @@ object BammetricsReport extends ReportBuilder {
}
ReportPage(
(if (targets.isEmpty) Map() else Map("Targets" -> ReportPage(
Map(),
(if (targets.isEmpty) List() else List("Targets" -> ReportPage(
List(),
targets.map(t => (t -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsPlot.ssp", Map("target" -> t)))),
Map()))),
List(
......
......@@ -36,7 +36,11 @@
}
def getSubPage(path:List[String]): ReportPage = {
path.foldLeft(indexPage)(_.subPages(_))
path.foldLeft(indexPage)((c, p) => {
val foundPages = c.subPages.filter(_._1 == p)
require(foundPages.size == 1, "Name of page not found or duplicate is found, page:: " + p + " in path: " + path)
foundPages.head._2
})
}
}#
<!DOCTYPE html>
......
......@@ -23,7 +23,7 @@ trait MultisampleReportBuilder extends ReportBuilder {
def generateSamplesPage(args: Map[String, Any]): ReportPage = {
val samplePages = summary.samples
.map(sampleId => (sampleId -> samplePage(sampleId, args ++ Map("sampleId" -> Some(sampleId)))))
.toMap
.toList
ReportPage(samplePages, samplesSections, args)
}
......@@ -35,7 +35,7 @@ trait MultisampleReportBuilder extends ReportBuilder {
val libPages = summary.libraries(sampleId)
.map(libId => (libId -> libraryPage(sampleId, libId, args ++ Map("libId" -> Some(libId)))))
.toMap
.toList
ReportPage(libPages, libririesSections, args)
}
}
......@@ -3,6 +3,6 @@ package nl.lumc.sasc.biopet.core.report
/**
* Created by pjvan_thof on 3/27/15.
*/
case class ReportPage(subPages: Map[String, ReportPage],
case class ReportPage(subPages: List[(String, ReportPage)],
sections: List[(String, ReportSection)],
args: Map[String, Any])
......@@ -12,7 +12,7 @@ import nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot
object FlexiprepReport extends ReportBuilder {
val reportName = "Flexiprep"
def indexPage = ReportPage(Map(
def indexPage = ReportPage(List(
"QC" -> flexiprepPage
), List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepFront.ssp")
......@@ -21,7 +21,7 @@ object FlexiprepReport extends ReportBuilder {
)
def flexiprepPage = ReportPage(
Map(),
List(),
List(
"Read Summary" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"Base Summary" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp"),
......
......@@ -25,10 +25,10 @@ object ShivaReport extends MultisampleReportBuilder {
def indexPage = {
val regions = regionsPage
ReportPage(
Map("Samples" -> generateSamplesPage(pageArgs)) ++
List("Samples" -> generateSamplesPage(pageArgs)) ++
(if (regions.isDefined) Map(regions.get) else Map()) ++
Map("Files" -> filesPage,
"Versions" -> ReportPage(Map(), List((
"Versions" -> ReportPage(List(), List((
"Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"
))), Map())
),
......@@ -58,7 +58,7 @@ object ShivaReport extends MultisampleReportBuilder {
def createPage(name: String, amplicon: Boolean = false): ReportPage = {
ReportPage(
Map(),
List(),
List("Coverage" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsMultiTable.ssp")),
Map("target" -> name)
)
......@@ -76,16 +76,17 @@ object ShivaReport extends MultisampleReportBuilder {
}
if (regionPages.nonEmpty) Some("Regions" -> ReportPage(
Map(),
List(),
regionPages.map(p => (p._1 -> ReportSection(
"/nl/lumc/sasc/biopet/pipelines/bammetrics/covstatsMultiTable.ssp",
Map("target" -> p._1.stripSuffix(" (Amplicon)"))
))).toList.sortBy(_._1),
Map())
) else None
)
else None
}
def filesPage = ReportPage(Map(), List(
def filesPage = ReportPage(List(), List(
"Input fastq files" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepInputfiles.ssp"),
"After QC fastq files" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepOutputfiles.ssp"),
"Bam files per lib" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/mapping/outputBamfiles.ssp", Map("sampleLevel" -> false)),
......@@ -95,7 +96,7 @@ object ShivaReport extends MultisampleReportBuilder {
), Map())
def samplePage(sampleId: String, args: Map[String, Any]) = {
ReportPage(Map(
ReportPage(List(
"Libraries" -> generateLibraryPage(args),
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), None),
"Files" -> filesPage
......@@ -110,7 +111,7 @@ object ShivaReport extends MultisampleReportBuilder {
}
def libraryPage(sampleId: String, libId: String, args: Map[String, Any]) = {
ReportPage(Map(
ReportPage(List(
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId)),
"QC" -> FlexiprepReport.flexiprepPage
), List(
......
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