From 4c4053157c5f3c324a1d972e9d4b9cdd6c27d194 Mon Sep 17 00:00:00 2001 From: Wai Yi Leung <w.y.leung@lumc.nl> Date: Wed, 28 Oct 2015 12:57:33 +0100 Subject: [PATCH] Refactor the report generation a bit. Move pipeline specific report components into the pipeline itself (not hosted in core anymore) --- .../biopet/core/report/ReportBuilder.scala | 35 ++++++++++--------- .../biopet/pipelines/gears/gearsFront.ssp | 1 - .../pipelines/gears}/report/ext/js/gears.js | 0 .../biopet/pipelines/gears/GearsReport.scala | 4 +++ 4 files changed, 22 insertions(+), 18 deletions(-) rename public/{biopet-core/src/main/resources/nl/lumc/sasc/biopet/core => gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears}/report/ext/js/gears.js (100%) diff --git a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala index 311e3e928..cea0efcd3 100644 --- a/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala +++ b/public/biopet-core/src/main/scala/nl/lumc/sasc/biopet/core/report/ReportBuilder.scala @@ -16,11 +16,13 @@ package nl.lumc.sasc.biopet.core.report import java.io._ + import nl.lumc.sasc.biopet.core.ToolCommandFunction import nl.lumc.sasc.biopet.utils.summary.Summary -import nl.lumc.sasc.biopet.utils.{ ToolCommand, Logging, IoUtils } +import nl.lumc.sasc.biopet.utils.{IoUtils, Logging, ToolCommand} import org.broadinstitute.gatk.utils.commandline.Input -import org.fusesource.scalate.{ TemplateEngine, TemplateSource } +import org.fusesource.scalate.{TemplateEngine, TemplateSource} + import scala.collection.mutable /** @@ -95,6 +97,19 @@ trait ReportBuilder extends ToolCommand { private var _libId: Option[String] = None protected def libId = _libId + def extFiles = List( + "css/bootstrap_dashboard.css", + "css/bootstrap.min.css", + "css/bootstrap-theme.min.css", + "css/sortable-theme-bootstrap.css", + "js/jquery.min.js", + "js/sortable.min.js", + "js/bootstrap.min.js", + "fonts/glyphicons-halflings-regular.woff", + "fonts/glyphicons-halflings-regular.ttf", + "fonts/glyphicons-halflings-regular.woff2" + ).map("/nl/lumc/sasc/biopet/core/report/ext/" + _) + /** Main function to for building the report */ def main(args: Array[String]): Unit = { logger.info("Start") @@ -123,23 +138,9 @@ trait ReportBuilder extends ToolCommand { // Static files that will be copied to the output folder, then file is added to [resourceDir] it's need to be added here also val extOutputDir: File = new File(cmdArgs.outputDir, "ext") - val resourceDir: String = "/nl/lumc/sasc/biopet/core/report/ext/" - val extFiles = List( - "css/bootstrap_dashboard.css", - "css/bootstrap.min.css", - "css/bootstrap-theme.min.css", - "css/sortable-theme-bootstrap.css", - "js/jquery.min.js", - "js/sortable.min.js", - "js/bootstrap.min.js", - "js/gears.js", - "fonts/glyphicons-halflings-regular.woff", - "fonts/glyphicons-halflings-regular.ttf", - "fonts/glyphicons-halflings-regular.woff2" - ) for (resource <- extFiles.par) { - IoUtils.copyStreamToFile(getClass.getResourceAsStream(resourceDir + resource), new File(extOutputDir, resource), createDirs = true) + IoUtils.copyStreamToFile(getClass.getResourceAsStream(resource), new File(extOutputDir, resource), createDirs = true) } logger.info("Parsing summary") diff --git a/public/gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp b/public/gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp index 21feab6c9..67d011009 100644 --- a/public/gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp +++ b/public/gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp @@ -9,7 +9,6 @@ <tr><th>Version</th><td>${summary.getValue("meta", "pipeline_version")}</td></tr> <tr><th>Last commit hash</th><td>${summary.getValue("meta", "last_commit_hash")}</td></tr> <tr><th>Output directory</th><td>${summary.getValue("meta", "output_dir")}</td></tr> - <tr><th>Number of samples</th><td>${summary.samples.size}</td></tr> </tbody> </table> <br/> diff --git a/public/biopet-core/src/main/resources/nl/lumc/sasc/biopet/core/report/ext/js/gears.js b/public/gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/report/ext/js/gears.js similarity index 100% rename from public/biopet-core/src/main/resources/nl/lumc/sasc/biopet/core/report/ext/js/gears.js rename to public/gears/src/main/resources/nl/lumc/sasc/biopet/pipelines/gears/report/ext/js/gears.js diff --git a/public/gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsReport.scala b/public/gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsReport.scala index a04b89ec2..af2f17c25 100644 --- a/public/gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsReport.scala +++ b/public/gears/src/main/scala/nl/lumc/sasc/biopet/pipelines/gears/GearsReport.scala @@ -14,6 +14,10 @@ object GearsReport extends ReportBuilder { // TODO: Add dustbin analysis (aggregated) // TODO: Add alignment stats per sample for the dustbin analysis + override def extFiles = super.extFiles ++ List( + "js/gears.js" + ).map("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + _) + def indexPage = { ReportPage( List() ++ -- GitLab