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