Commit 36f70f66 authored by Wai Yi Leung's avatar Wai Yi Leung

Report update

parent 01ba9578
#import(nl.lumc.sasc.biopet.core.summary.Summary) #import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage) #import(nl.lumc.sasc.biopet.core.report.ReportPage)
<%@ var summary: Summary %> <%@ var summary: Summary %>
<%@ var rootPath: String %> <%@ var rootPath: String %>
<table class="table"> <table class="table">
<tbody> <tbody>
<tr><th>Pipeline</th><td>Shiva</td></tr> <tr><th>Pipeline</th><td>Gears</td></tr>
<tr><th>Version</th><td>${summary.getValue("meta", "pipeline_version")}</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>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>Output directory</th><td>${summary.getValue("meta", "output_dir")}</td></tr>
......
#import(nl.lumc.sasc.biopet.core.summary.Summary) #import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport)
#import(java.io.File) #import(java.io.File)
<%@ var summary: Summary %> <%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %> <%@ var sampleId: Option[String] = None %>
...@@ -19,63 +17,42 @@ ...@@ -19,63 +17,42 @@
val librariesCount = summary.samples.foldLeft(0)(_ + summary.libraries(_).size) val librariesCount = summary.samples.foldLeft(0)(_ + summary.libraries(_).size)
}# }#
<!--
Javascript required for showing the sunburst plot
//-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<!-- Gears specific javascript -->
<script src="${rootPath}ext/js/gears.js"></script>
<h2 id='currentlevel'>Root</h2>
<div>
<span id="selection_name"></span> -
<span id="selection_size"></span> -
<span id="selection_value"></span>
</div>
<form>
<label><input type="radio" name="mode" value="size"> Size</label>
<label><input type="radio" name="mode" value="count" checked> Count</label>
</form>
<div id="sequence"></div>
<div id="datatable"></div>
#if (showIntro) #if (showIntro)
<div class="row"> <div class="row">
<div class="col-md-1"></div> <div class="col-md-1"></div>
<%--<div class="col-md-6">--%> <div class="col-md-10">
<p> Here we show a sunburst visualisation of the analysis of the metagenome in sample: ${sampleId}
#if (sampleId.isDefined && libId.isDefined) </div>
Here we show aggregated quality statistics sequencing library ${libId} for sample ${sampleId}. It shows the total number of bases used after quality control, and the total number of bases discarded during quality control. This is done for both forward and reverse reads. <div class="col-md-1"></div>
#elseif (sampleId.isDefined)
Here we show aggregated quality statistics for every sequencing library for sample ${sampleId}. It shows the total number of bases used after quality control, and the total number of bases discarded during quality control. This is done for both forward and reverse reads.
#else
Here we show aggregated quality statistics for every sequencing library. It shows the total number of bases used after quality control, and the total number of bases discarded during quality control. This is done for both forward and reverse reads.
#end
</p>
</div>
</div> </div>
#end #end
#if (showPlot) #if (showPlot)
#{ <div class="row">
<!--
// FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R1","R1", summary, sampleId = sampleId) Javascript required for showing the sunburst plot
// FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R2","R2", summary, sampleId = sampleId) //-->
}# <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js" charset="utf-8"></script>
<div class="panel-body"> <!-- Gears specific javascript -->
<script src="${rootPath}ext/js/gears.js"></script>
</div>
<h3 id='currentlevel'>Root</h3>
</div> <div>
<div class="panel-footer"> <span id="selection_name"></span> -
<span id="selection_size"></span> -
</div> <span id="selection_value"></span>
</div>
<form>
<label><input type="radio" name="mode" value="size"> Size</label>
<label><input type="radio" name="mode" value="count" checked> Count</label>
</form>
<div id="sequence"></div>
<div id="datatable"></div>
</div>
#end #end
...@@ -25,8 +25,7 @@ import nl.lumc.sasc.biopet.utils.config.Configurable ...@@ -25,8 +25,7 @@ import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
/** /**
* This is a trait for the Gears pipeline * Created by wyleung
* The ShivaTrait is used as template for this pipeline
*/ */
class Gears(val root: Configurable) extends QScript with SummaryQScript { class Gears(val root: Configurable) extends QScript with SummaryQScript {
qscript => qscript =>
...@@ -44,7 +43,7 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript { ...@@ -44,7 +43,7 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
@Argument(required = false) @Argument(required = false)
var outputName: String = _ var outputName: String = _
var GearsOutputFiles: Map[String, File] = Map.empty var GearsOutputFiles: scala.collection.mutable.Map[String, File] = scala.collection.mutable.Map.empty
/** Executed before running the script */ /** Executed before running the script */
def init(): Unit = { def init(): Unit = {
...@@ -61,6 +60,12 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript { ...@@ -61,6 +60,12 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
} }
} }
override def reportClass = {
val gears = new GearsReport(this)
gears.outputDir = new File(outputDir, "report")
gears.summaryFile = summaryFile
Some(gears)
}
/** Method to add jobs */ /** Method to add jobs */
def biopetScript(): Unit = { def biopetScript(): Unit = {
...@@ -96,9 +101,9 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript { ...@@ -96,9 +101,9 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
fastqSync.outputStats = new File(outputDir, s"$outputName.sync.stats.json") fastqSync.outputStats = new File(outputDir, s"$outputName.sync.stats.json")
add(fastqSync) add(fastqSync)
GearsOutputFiles ++ Map("fastqsync_stats" -> fastqSync.outputStats) GearsOutputFiles += ("fastqsync_stats" -> fastqSync.outputStats)
GearsOutputFiles ++ Map("fastqsync_R1" -> fastqSync.outputFastq1) GearsOutputFiles += ("fastqsync_R1" -> fastqSync.outputFastq1)
GearsOutputFiles ++ Map("fastqsync_R2" -> fastqSync.outputFastq2) GearsOutputFiles += ("fastqsync_R2" -> fastqSync.outputFastq2)
List(fastqSync.outputFastq1, fastqSync.outputFastq2) List(fastqSync.outputFastq1, fastqSync.outputFastq2)
}.getOrElse(List(fastqFileR1, fastqFileR2).flatten) }.getOrElse(List(fastqFileR1, fastqFileR2).flatten)
...@@ -114,9 +119,9 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript { ...@@ -114,9 +119,9 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
krakenAnalysis.unclassified_out = Option(new File(outputDir, s"$outputName.krkn.unclassified.fastq")) krakenAnalysis.unclassified_out = Option(new File(outputDir, s"$outputName.krkn.unclassified.fastq"))
add(krakenAnalysis) add(krakenAnalysis)
GearsOutputFiles ++ Map("kraken_output_raw" -> krakenAnalysis.output) GearsOutputFiles += ("kraken_output_raw" -> krakenAnalysis.output)
GearsOutputFiles ++ Map("kraken_classified_out" -> krakenAnalysis.classified_out) GearsOutputFiles += ("kraken_classified_out" -> krakenAnalysis.classified_out.getOrElse(""))
GearsOutputFiles ++ Map("kraken_unclassified_out" -> krakenAnalysis.unclassified_out) GearsOutputFiles += ("kraken_unclassified_out" -> krakenAnalysis.unclassified_out.getOrElse(""))
// create kraken summary file // create kraken summary file
...@@ -126,8 +131,8 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript { ...@@ -126,8 +131,8 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
krakenReport.output = new File(outputDir, s"$outputName.krkn.full") krakenReport.output = new File(outputDir, s"$outputName.krkn.full")
add(krakenReport) add(krakenReport)
GearsOutputFiles ++ Map("kraken_report_input" -> krakenReport.input) GearsOutputFiles += ("kraken_report_input" -> krakenReport.input)
GearsOutputFiles ++ Map("kraken_report_output" -> krakenReport.output) GearsOutputFiles += ("kraken_report_output" -> krakenReport.output)
val krakenReportJSON = new KrakenReportToJson(qscript) val krakenReportJSON = new KrakenReportToJson(qscript)
krakenReportJSON.inputReport = krakenReport.output krakenReportJSON.inputReport = krakenReport.output
...@@ -135,10 +140,10 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript { ...@@ -135,10 +140,10 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
krakenReportJSON.skipNames = config("skipNames", default = false) krakenReportJSON.skipNames = config("skipNames", default = false)
add(krakenReportJSON) add(krakenReportJSON)
addSummaryJobs() GearsOutputFiles += ("kraken_report_json_input" -> krakenReportJSON.inputReport)
GearsOutputFiles += ("kraken_report_json_output" -> krakenReportJSON.output)
GearsOutputFiles ++ Map("kraken_report_json_input" -> krakenReportJSON.inputReport) addSummaryJobs()
GearsOutputFiles ++ Map("kraken_report_json_output" -> krakenReportJSON.output)
} }
/** Location of summary file */ /** Location of summary file */
......
...@@ -2,16 +2,11 @@ package nl.lumc.sasc.biopet.pipelines.gears ...@@ -2,16 +2,11 @@ package nl.lumc.sasc.biopet.pipelines.gears
import java.io.{ PrintWriter, File } import java.io.{ PrintWriter, File }
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.core.report.MultisampleReportBuilder import nl.lumc.sasc.biopet.core.report.MultisampleReportBuilder
import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension
import nl.lumc.sasc.biopet.core.report.ReportPage import nl.lumc.sasc.biopet.core.report.ReportPage
import nl.lumc.sasc.biopet.core.report.ReportSection import nl.lumc.sasc.biopet.core.report.ReportSection
import nl.lumc.sasc.biopet.core.report._ import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.summary.{ SummaryValue, Summary }
import nl.lumc.sasc.biopet.extensions.rscript.StackedBarPlot
import nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport
import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
class GearsReport(val root: Configurable) extends ReportBuilderExtension { class GearsReport(val root: Configurable) extends ReportBuilderExtension {
val builder = GearsReport val builder = GearsReport
...@@ -30,58 +25,29 @@ object GearsReport extends MultisampleReportBuilder { ...@@ -30,58 +25,29 @@ object GearsReport extends MultisampleReportBuilder {
def indexPage = { def indexPage = {
ReportPage( ReportPage(
List("Samples" -> generateSamplesPage(pageArgs)) ++ List("Samples" -> generateSamplesPage(pageArgs)) ++
Map("Files" -> filesPage, Map(
"Versions" -> ReportPage(List(), 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())
), ),
List( List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp"), "Gears intro" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp"),
"Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", "Sunburst analysis" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSunburst.ssp")
Map("sampleLevel" -> true, "showPlot" -> true, "showTable" -> false)
),
"Insert Size" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/insertSize.ssp",
Map("sampleLevel" -> true, "showPlot" -> true, "showTable" -> false)),
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp",
Map("showPlot" -> true, "showTable" -> false)),
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp",
Map("showPlot" -> true, "showTable" -> false))
), ),
pageArgs pageArgs
) )
} }
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)),
"Preprocessed bam files" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/mapping/outputBamfiles.ssp",
Map("pipelineName" -> "gears", "fileTag" -> "preProcessBam"))
), Map())
def samplePage(sampleId: String, args: Map[String, Any]) = { def samplePage(sampleId: String, args: Map[String, Any]) = {
ReportPage(List( ReportPage(List(
"Libraries" -> generateLibraryPage(args),
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), None),
"Files" -> filesPage
), List( ), List(
"Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp",
if (summary.libraries(sampleId).size > 1) Map("showPlot" -> true) else Map()),
"Preprocessing" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp", Map("sampleLevel" -> true)),
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp"),
"Sunburst analysis" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSunburst.ssp") "Sunburst analysis" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSunburst.ssp")
), args) ), args)
} }
def libraryPage(sampleId: String, libId: String, args: Map[String, Any]) = { def libraryPage(sampleId: String, libId: String, args: Map[String, Any]) = {
ReportPage(List( ReportPage(List(
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId)),
"QC" -> FlexiprepReport.flexiprepPage
), List( ), List(
"Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.ssp"),
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
), args) ), args)
} }
......
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