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)
<%@ var summary: Summary %>
<%@ var rootPath: String %>
<table class="table">
<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>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>
......
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport)
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
......@@ -19,63 +17,42 @@
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)
<div class="row">
<div class="col-md-1"></div>
<%--<div class="col-md-6">--%>
<p>
#if (sampleId.isDefined && libId.isDefined)
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.
#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 class="col-md-1"></div>
<div class="col-md-10">
Here we show a sunburst visualisation of the analysis of the metagenome in sample: ${sampleId}
</div>
<div class="col-md-1"></div>
</div>
#end
#if (showPlot)
#{
// FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R1","R1", summary, sampleId = sampleId)
// FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R2","R2", summary, sampleId = sampleId)
}#
<div class="panel-body">
</div>
</div>
<div class="panel-footer">
</div>
<div class="row">
<!--
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>
<h3 id='currentlevel'>Root</h3>
<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>
</div>
#end
......@@ -25,8 +25,7 @@ import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
/**
* This is a trait for the Gears pipeline
* The ShivaTrait is used as template for this pipeline
* Created by wyleung
*/
class Gears(val root: Configurable) extends QScript with SummaryQScript {
qscript =>
......@@ -44,7 +43,7 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
@Argument(required = false)
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 */
def init(): Unit = {
......@@ -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 */
def biopetScript(): Unit = {
......@@ -96,9 +101,9 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
fastqSync.outputStats = new File(outputDir, s"$outputName.sync.stats.json")
add(fastqSync)
GearsOutputFiles ++ Map("fastqsync_stats" -> fastqSync.outputStats)
GearsOutputFiles ++ Map("fastqsync_R1" -> fastqSync.outputFastq1)
GearsOutputFiles ++ Map("fastqsync_R2" -> fastqSync.outputFastq2)
GearsOutputFiles += ("fastqsync_stats" -> fastqSync.outputStats)
GearsOutputFiles += ("fastqsync_R1" -> fastqSync.outputFastq1)
GearsOutputFiles += ("fastqsync_R2" -> fastqSync.outputFastq2)
List(fastqSync.outputFastq1, fastqSync.outputFastq2)
}.getOrElse(List(fastqFileR1, fastqFileR2).flatten)
......@@ -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"))
add(krakenAnalysis)
GearsOutputFiles ++ Map("kraken_output_raw" -> krakenAnalysis.output)
GearsOutputFiles ++ Map("kraken_classified_out" -> krakenAnalysis.classified_out)
GearsOutputFiles ++ Map("kraken_unclassified_out" -> krakenAnalysis.unclassified_out)
GearsOutputFiles += ("kraken_output_raw" -> krakenAnalysis.output)
GearsOutputFiles += ("kraken_classified_out" -> krakenAnalysis.classified_out.getOrElse(""))
GearsOutputFiles += ("kraken_unclassified_out" -> krakenAnalysis.unclassified_out.getOrElse(""))
// create kraken summary file
......@@ -126,8 +131,8 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
krakenReport.output = new File(outputDir, s"$outputName.krkn.full")
add(krakenReport)
GearsOutputFiles ++ Map("kraken_report_input" -> krakenReport.input)
GearsOutputFiles ++ Map("kraken_report_output" -> krakenReport.output)
GearsOutputFiles += ("kraken_report_input" -> krakenReport.input)
GearsOutputFiles += ("kraken_report_output" -> krakenReport.output)
val krakenReportJSON = new KrakenReportToJson(qscript)
krakenReportJSON.inputReport = krakenReport.output
......@@ -135,10 +140,10 @@ class Gears(val root: Configurable) extends QScript with SummaryQScript {
krakenReportJSON.skipNames = config("skipNames", default = false)
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)
GearsOutputFiles ++ Map("kraken_report_json_output" -> krakenReportJSON.output)
addSummaryJobs()
}
/** Location of summary file */
......
......@@ -2,16 +2,11 @@ package nl.lumc.sasc.biopet.pipelines.gears
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.ReportBuilderExtension
import nl.lumc.sasc.biopet.core.report.ReportPage
import nl.lumc.sasc.biopet.core.report.ReportSection
import nl.lumc.sasc.biopet.core.report._
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
import nl.lumc.sasc.biopet.utils.config.Configurable
class GearsReport(val root: Configurable) extends ReportBuilderExtension {
val builder = GearsReport
......@@ -30,58 +25,29 @@ object GearsReport extends MultisampleReportBuilder {
def indexPage = {
ReportPage(
List("Samples" -> generateSamplesPage(pageArgs)) ++
Map("Files" -> filesPage,
Map(
"Versions" -> ReportPage(List(), List((
"Executables" -> ReportSection("/nl/lumc/sasc/biopet/core/report/executables.ssp"
))), Map())
),
List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp"),
"Alignment" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/bammetrics/alignmentSummary.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))
"Gears intro" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsFront.ssp"),
"Sunburst analysis" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSunburst.ssp")
),
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]) = {
ReportPage(List(
"Libraries" -> generateLibraryPage(args),
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), None),
"Files" -> filesPage
), 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")
), args)
}
def libraryPage(sampleId: String, libId: String, args: Map[String, Any]) = {
ReportPage(List(
"Alignment" -> BammetricsReport.bamMetricsPage(summary, Some(sampleId), Some(libId)),
"QC" -> FlexiprepReport.flexiprepPage
), 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)
}
......
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