Commit c150b417 authored by Peter van 't Hof's avatar Peter van 't Hof

Added flexiprep report

parent 52e6c553
......@@ -7,6 +7,7 @@ import nl.lumc.sasc.biopet.core.summary.Summary
import org.broadinstitute.gatk.utils.commandline.Input
import org.fusesource.scalate.{ TemplateSource, TemplateEngine }
import nl.lumc.sasc.biopet.utils.IoUtils
import scala.collection.mutable
/**
* Created by pjvan_thof on 3/27/15.
......@@ -38,22 +39,22 @@ trait ReportBuilderExtension extends ToolCommandFuntion {
super.commandLine +
required("--summary", summaryFile) +
required("--outputDir", outputDir) +
args.map(x => required(x._1, x._2)).mkString
args.map(x => required("-a", x._1 + "=" + x._2)).mkString
}
}
trait ReportBuilder extends ToolCommand {
case class Args(summary: File = null, outputDir: File = null, pageArgs: Map[String, String] = Map()) extends AbstractArgs
case class Args(summary: File = null, outputDir: File = null, pageArgs: mutable.Map[String, Any] = mutable.Map()) extends AbstractArgs
class OptParser extends AbstractOptParser {
opt[File]('s', "summary") required () maxOccurs 1 valueName "<file>" action { (x, c) =>
opt[File]('s', "summary") unbounded () required () maxOccurs 1 valueName "<file>" action { (x, c) =>
c.copy(summary = x)
}
opt[File]('o', "outputDir") required () maxOccurs 1 valueName "<file>" action { (x, c) =>
opt[File]('o', "outputDir") unbounded () required () maxOccurs 1 valueName "<file>" action { (x, c) =>
c.copy(outputDir = x)
}
opt[Map[String, String]]('a', "args") action { (x, c) =>
opt[Map[String, String]]('a', "args") unbounded () action { (x, c) =>
c.copy(pageArgs = c.pageArgs ++ x)
}
}
......@@ -80,6 +81,16 @@ trait ReportBuilder extends ToolCommand {
require(cmdArgs.outputDir.exists(), "Output dir does not exist")
require(cmdArgs.outputDir.isDirectory, "Output dir is not a directory")
cmdArgs.pageArgs.get("sampleId") match {
case Some(s: String) => cmdArgs.pageArgs += "sampleId" -> Some(s)
case _ =>
}
cmdArgs.pageArgs.get("libId") match {
case Some(s: String) => cmdArgs.pageArgs += "libId" -> Some(s)
case _ =>
}
logger.info("Copy Base files")
// Static files that will be copied to the output folder, then file is added to [resourceDir] it's need to be added here also
......@@ -110,7 +121,7 @@ trait ReportBuilder extends ToolCommand {
logger.info("Generate pages")
val jobs = generatePage(summary, indexPage, cmdArgs.outputDir,
args = pageArgs ++ cmdArgs.pageArgs ++
args = pageArgs ++ cmdArgs.pageArgs.toMap ++
Map("summary" -> summary, "reportName" -> reportName, "indexPage" -> indexPage))
logger.info(jobs + " Done")
......
......@@ -10,6 +10,7 @@
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true %>
<%@ var multisample: Boolean = true %>
#{
val samples = sampleId match {
case Some(sample) => List(sample.toString)
......@@ -80,11 +81,23 @@
libs.count(summary.getLibraryValue(sample, _, "flexiprep", "settings", "paired").getOrElse(false) == true)
}
}#
<tr><td rowspan="${sampleRowspan}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
<tr><td rowspan="${sampleRowspan}">
#if (multisample)
<a href="${rootPath}Samples/${sample}/index.html">${sample}</a>
#else
${sample}
#end
</td>
#for (libId <- libs)
#if (libs.head != libId) <tr> #end
#{ val paired = summary.getLibraryValue(sample, libId, "flexiprep", "settings", "paired").getOrElse(false) }#
<td #if (paired == true) rowspan="2" #end><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td>
<td #if (paired == true) rowspan="2" #end>
#if (multisample)
<a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a>
#else
${libId}
#end
</td>
#{ val reads = if (paired == true) List("R1", "R2") else List("R1") }#
#for (read <- reads)
#if (read == "R2") </tr><tr> #end
......
#{ //TODO: Need content }#
#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] %>
<%@ var libId: Option[String] %>
Todo
\ No newline at end of file
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Flexiprep</td></tr>
<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>Sample ID</th><td>${sampleId}</td></tr>
<tr><th>Library ID</th><td>${libId}</td></tr>
</tbody>
</table>
<br/>
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-6">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc risus est, volutpat quis enim sit amet, lacinia posuere ante. Mauris eget massa efficitur, luctus nisl ut, placerat nibh. Pellentesque id nulla maximus, rutrum dui nec, lobortis odio. Fusce eu enim ac sem auctor congue. Ut ac ullamcorper quam, eget sollicitudin felis. Maecenas posuere sagittis blandit. Proin mollis magna lectus, id gravida est consectetur vitae. Nulla id risus at tellus laoreet finibus in id lacus. Duis lobortis commodo nisl viverra tempor. Curabitur sit amet pretium dui, sit amet tincidunt mauris. Duis volutpat eu purus ut molestie.
</p>
</div>
</div>
\ No newline at end of file
......@@ -10,6 +10,7 @@
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true %>
<%@ var multisample: Boolean = true %>
#{
val samples = sampleId match {
case Some(sample) => List(sample.toString)
......@@ -79,11 +80,23 @@
libs.count(summary.getLibraryValue(sample, _, "flexiprep", "settings", "paired").getOrElse(false) == true)
}
}#
<tr><td rowspan="${sampleRowspan}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
<tr><td rowspan="${sampleRowspan}">
#if (multisample)
<a href="${rootPath}Samples/${sample}/index.html">${sample}</a>
#else
${sample}
#end
</td>
#for (libId <- libs)
#if (libs.head != libId) <tr> #end
#{ val paired = summary.getLibraryValue(sample, libId, "flexiprep", "settings", "paired").getOrElse(false) }#
<td #if (paired == true) rowspan="2" #end><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td>
<td #if (paired == true) rowspan="2" #end>
#if (multisample)
<a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a>
#else
${libId}
#end
</td>
#{ val reads = if (paired == true) List("R1", "R2") else List("R1") }#
#for (read <- reads)
#if (read == "R2") </tr><tr> #end
......
......@@ -19,7 +19,7 @@ import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.utils.commandline.{ Input, Argument }
import nl.lumc.sasc.biopet.core.{ SampleLibraryTag, BiopetQScript, PipelineCommand }
import nl.lumc.sasc.biopet.core.{ SampleLibraryTag, PipelineCommand }
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions._
import nl.lumc.sasc.biopet.tools.Seqstat
......@@ -63,6 +63,16 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
var fastqc_R1_after: Fastqc = _
var fastqc_R2_after: Fastqc = _
override def reportClass = {
val flexiprepReport = new FlexiprepReport(this)
flexiprepReport.outputDir = new File(outputDir, "report")
flexiprepReport.summaryFile = summaryFile
flexiprepReport.args = Map(
"sampleId" -> sampleId.getOrElse("."),
"libId" -> libId.getOrElse("."))
Some(flexiprepReport)
}
/** Function that's need to be executed before the script is accessed */
def init() {
require(outputDir != null, "Missing output directory on flexiprep module")
......
......@@ -2,10 +2,15 @@ package nl.lumc.sasc.biopet.pipelines.flexiprep
import java.io.{ PrintWriter, File }
import nl.lumc.sasc.biopet.core.report.{ ReportSection, ReportPage, ReportBuilder }
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.core.report.{ ReportBuilderExtension, ReportSection, ReportPage, ReportBuilder }
import nl.lumc.sasc.biopet.core.summary.{ SummaryValue, Summary }
import nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot
class FlexiprepReport(val root: Configurable) extends ReportBuilderExtension {
val builder = FlexiprepReport
}
//TODO: add basic report to flexiprep as single pipeline
/**
* Created by pjvan_thof on 3/30/15.
......@@ -13,11 +18,18 @@ import nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot
object FlexiprepReport extends ReportBuilder {
val reportName = "Flexiprep"
override def pageArgs = Map("multisample" -> false)
/** Index page for a flexiprep report */
def indexPage = {
val flexiprepPage = this.flexiprepPage
ReportPage(List(
"QC" -> flexiprepPage
ReportPage(List("Versions" -> ReportPage(List(), List((
"Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"
))), Map()),
"Files" -> 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")
), Map())
), List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepFront.ssp")
) ::: flexiprepPage.sections,
......
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