Commit 5fda5828 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added default sample and library lists

parent 6f77b5f3
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
<%@ var summary: Summary %>
<%@ var rootPath: String %>
<%@ var sampleId: Option[String] = None %>
<table>
<thead><tr></tr><th>Libraries</th></thead></tr>
<tbody>
#for (lib <- summary.libraries(sampleId.get))
<tr><td><a href="${rootPath}Samples/${sampleId.get}/Libraries/${lib}/index.html">${lib}</a></td></tr>
#end
</tbody>
</table>
\ No newline at end of file
...@@ -6,9 +6,9 @@ ...@@ -6,9 +6,9 @@
<%@ var page: ReportPage %> <%@ var page: ReportPage %>
<%@ var path: List[String] %> <%@ var path: List[String] %>
<%@ var args: Map[String, Any] %> <%@ var args: Map[String, Any] %>
#{ <%@ var rootPath: String %>
val rootPath = "./" + Array.fill(path.size)("../").mkString("")
#{
def createMenu(page: ReportPage, path: List[String] = Nil): String = { def createMenu(page: ReportPage, path: List[String] = Nil): String = {
val buffer: StringBuffer = new StringBuffer() val buffer: StringBuffer = new StringBuffer()
buffer.append("<ul>") buffer.append("<ul>")
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${reportName}</title>
<link rel="stylesheet" type="text/css" href="${rootPath}css/biopet.css"> <link rel="stylesheet" type="text/css" href="${rootPath}css/biopet.css">
</head> </head>
<body> <body>
......
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
<%@ var summary: Summary %>
<%@ var rootPath: String %>
<table>
<thead><tr></tr><th>Sample</th></thead></tr>
<tbody>
#for (sample <- summary.samples)
<tr><td><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td></tr>
#end
</tbody>
</table>
\ No newline at end of file
package nl.lumc.sasc.biopet.core.report package nl.lumc.sasc.biopet.core.report
import nl.lumc.sasc.biopet.core.summary.Summary
/** /**
* Created by pjvan_thof on 3/30/15. * Created by pjvan_thof on 3/30/15.
*/ */
trait MultisampleReportBuilder extends ReportBuilder { trait MultisampleReportBuilder extends ReportBuilder {
def generalPage: ReportPage
def samplePage(sampleId: String, args: Map[String, Any]): ReportPage def samplePage(sampleId: String, args: Map[String, Any]): ReportPage
def samplesSections: List[(String, ReportSection)] = {
List(
("Samples", ReportSection("/nl/lumc/sasc/biopet/core/report/samplesList.ssp"))
)
}
def libraryPage(libraryId: String, args: Map[String, Any]): ReportPage def libraryPage(libraryId: String, args: Map[String, Any]): ReportPage
def libririesSections: List[(String, ReportSection)] = {
List(
("Libraries", ReportSection("/nl/lumc/sasc/biopet/core/report/librariesList.ssp"))
)
}
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 .toMap
ReportPage(samplePages, List(), args) ReportPage(samplePages, samplesSections, args)
} }
def generateLibraryPage(args: Map[String, Any]): ReportPage = { def generateLibraryPage(args: Map[String, Any]): ReportPage = {
...@@ -26,8 +34,6 @@ trait MultisampleReportBuilder extends ReportBuilder { ...@@ -26,8 +34,6 @@ trait MultisampleReportBuilder extends ReportBuilder {
}) })
.map(libId => (libId -> libraryPage(libId, args ++ Map("libId" -> Some(libId))))) .map(libId => (libId -> libraryPage(libId, args ++ Map("libId" -> Some(libId)))))
.toMap .toMap
ReportPage(libPages, List(), args) ReportPage(libPages, libririesSections, args)
} }
def indexPage = ReportPage(Map("General" -> generalPage, "Samples" -> generateSamplesPage(pageArgs)), List(), pageArgs)
} }
...@@ -73,7 +73,13 @@ trait ReportBuilder extends ToolCommand { ...@@ -73,7 +73,13 @@ trait ReportBuilder extends ToolCommand {
val pageOutputDir = new File(outputDir, path.mkString(File.separator)) val pageOutputDir = new File(outputDir, path.mkString(File.separator))
pageOutputDir.mkdirs() pageOutputDir.mkdirs()
val pageArgs = args ++ page.args ++ Map("page" -> page, "path" -> path, "outputDir" -> pageOutputDir) val rootPath = "./" + Array.fill(path.size)("../").mkString("")
val pageArgs = args ++ page.args ++
Map("page" -> page,
"path" -> path,
"outputDir" -> pageOutputDir,
"rootPath" -> rootPath
)
val output = ReportBuilder.renderTemplate("/nl/lumc/sasc/biopet/core/report/main.ssp", val output = ReportBuilder.renderTemplate("/nl/lumc/sasc/biopet/core/report/main.ssp",
pageArgs ++ Map("args" -> pageArgs)) pageArgs ++ Map("args" -> pageArgs))
...@@ -94,7 +100,7 @@ object ReportBuilder { ...@@ -94,7 +100,7 @@ object ReportBuilder {
protected val engine = new TemplateEngine() protected val engine = new TemplateEngine()
def renderTemplate(location: String, args:Map[String, Any]) : String = { def renderTemplate(location: String, args: Map[String, Any]): String = {
val templateText = Source.fromInputStream(getClass.getResourceAsStream(location)).getLines().mkString("\n") val templateText = Source.fromInputStream(getClass.getResourceAsStream(location)).getLines().mkString("\n")
val template = engine.compileText("ssp", templateText) val template = engine.compileText("ssp", templateText)
......
package nl.lumc.sasc.biopet.pipelines.flexiprep package nl.lumc.sasc.biopet.pipelines.flexiprep
import nl.lumc.sasc.biopet.core.report.{ReportSection, ReportPage, ReportBuilder} import nl.lumc.sasc.biopet.core.report.{ ReportSection, ReportPage, ReportBuilder }
/** /**
* Created by pjvan_thof on 3/30/15. * Created by pjvan_thof on 3/30/15.
...@@ -23,7 +23,7 @@ object FlexiprepReport extends ReportBuilder { ...@@ -23,7 +23,7 @@ object FlexiprepReport extends ReportBuilder {
), Map()) ), Map())
} }
protected def fastqcPlotSection(name:String, tag: String) = { protected def fastqcPlotSection(name: String, tag: String) = {
name -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepFastaqcPlot.ssp", Map("plot" -> tag)) name -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepFastaqcPlot.ssp", Map("plot" -> tag))
} }
......
package nl.lumc.sasc.biopet.pipelines.shiva package nl.lumc.sasc.biopet.pipelines.shiva
import nl.lumc.sasc.biopet.core.report.{ReportSection, MultisampleReportBuilder, ReportPage} import nl.lumc.sasc.biopet.core.report.{ ReportSection, MultisampleReportBuilder, ReportPage }
import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
/** /**
* Created by pjvan_thof on 3/30/15. * Created by pjvan_thof on 3/30/15.
*/ */
object ShivaReport extends MultisampleReportBuilder { object ShivaReport extends MultisampleReportBuilder {
def indexPage = ReportPage(
Map(
"General" -> ReportPage(Map(), List(
"Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/core/report/ShivaVariantcalling.ssp"),
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
), Map()),
"Samples" -> generateSamplesPage(pageArgs)
),
Nil,
pageArgs
)
def samplePage(sampleId: String, args: Map[String, Any]) = { def samplePage(sampleId: String, args: Map[String, Any]) = {
ReportPage(Map("Libraries" -> generateLibraryPage(args)), List( ReportPage(Map("Libraries" -> generateLibraryPage(args)), List(
"Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/core/report/ShivaVariantcalling.ssp"), "Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/core/report/ShivaVariantcalling.ssp"),
...@@ -16,7 +29,7 @@ object ShivaReport extends MultisampleReportBuilder { ...@@ -16,7 +29,7 @@ object ShivaReport extends MultisampleReportBuilder {
} }
def libraryPage(libId: String, args: Map[String, Any]) = { def libraryPage(libId: String, args: Map[String, Any]) = {
ReportPage(Map("Flexiprep" -> FlexiprepReport.indexPage), List( ReportPage(Map("QC" -> FlexiprepReport.indexPage), 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")
), args) ), args)
...@@ -24,11 +37,5 @@ object ShivaReport extends MultisampleReportBuilder { ...@@ -24,11 +37,5 @@ object ShivaReport extends MultisampleReportBuilder {
def reportName = "Title Test" def reportName = "Title Test"
def generalPage = ReportPage(Map(), List(
"Variantcalling" -> ReportSection("/nl/lumc/sasc/biopet/core/report/ShivaVariantcalling.ssp"),
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
), Map())
// FIXME: Not yet finished // FIXME: Not yet finished
} }
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