Commit 0aad3827 authored by rhpvorderman's avatar rhpvorderman

Merge remote-tracking branch 'origin' into fix-BIOPET-649

parents 07c78a35 abeeb845
......@@ -17,7 +17,7 @@ package nl.lumc.sasc.biopet.core.report
import java.io._
import nl.lumc.sasc.biopet.core.ToolCommandFunction
import nl.lumc.sasc.biopet.utils.summary.db.Schema.{ Library, Module, Pipeline, Sample }
import nl.lumc.sasc.biopet.utils.summary.db.Schema.{ Library, Module, Pipeline, Sample, Run }
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.{ LibraryId, SampleId }
import nl.lumc.sasc.biopet.utils.{ IoUtils, Logging, ToolCommand }
......@@ -40,7 +40,7 @@ trait ReportBuilderExtension extends ToolCommandFunction {
/** Report builder object */
def builder: ReportBuilder
def toolObject = builder
def toolObject: ReportBuilder = builder
@Input(required = true)
var summaryDbFile: File = _
......@@ -114,20 +114,24 @@ trait ReportBuilder extends ToolCommand {
private var setSummary: SummaryDb = _
/** Retrival of summary, read only */
final def summary = setSummary
final def summary: SummaryDb = setSummary
private var setRunId: Int = 0
final def runId = setRunId
final def runId: Int = setRunId
private var _setRun: Run = _
final def run: Run = _setRun
private var _setPipelines = Seq[Pipeline]()
final def pipelines = _setPipelines
final def pipelines: Seq[Pipeline] = _setPipelines
private var _setModules = Seq[Module]()
final def modules = _setModules
final def modules: Seq[Module] = _setModules
private var _setSamples = Seq[Sample]()
final def samples = _setSamples
final def samples: Seq[Sample] = _setSamples
private var _setLibraries = Seq[Library]()
final def libraries = _setLibraries
final def libraries: Seq[Library] = _setLibraries
/** default args that are passed to all page withing the report */
def pageArgs: Map[String, Any] = Map()
......@@ -136,13 +140,13 @@ trait ReportBuilder extends ToolCommand {
private var total = 0
private var _sampleId: Option[Int] = None
protected[report] def sampleId = _sampleId
protected[report] def sampleId: Option[Int] = _sampleId
private var _libId: Option[Int] = None
protected[report] def libId = _libId
protected[report] def libId: Option[Int] = _libId
case class ExtFile(resourcePath: String, targetPath: String)
def extFiles = List(
def extFiles: List[ExtFile] = List(
"css/bootstrap_dashboard.css",
"css/bootstrap.min.css",
"css/bootstrap-theme.min.css",
......@@ -183,6 +187,7 @@ trait ReportBuilder extends ToolCommand {
case _ =>
}
_setRun = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
_setPipelines = Await.result(summary.getPipelines(runId = Some(runId)), Duration.Inf)
_setModules = Await.result(summary.getModules(runId = Some(runId)), Duration.Inf)
_setSamples = Await.result(summary.getSamples(runId = Some(runId), sampleId = sampleId), Duration.Inf)
......@@ -264,6 +269,7 @@ trait ReportBuilder extends ToolCommand {
val rootPath = "./" + Array.fill(path.size)("../").mkString
args ++ page.args ++
Map("page" -> page,
"run" -> run,
"path" -> path,
"outputDir" -> pageOutputDir,
"rootPath" -> rootPath,
......
......@@ -114,6 +114,7 @@ object CleverFixVCF extends ToolCommand {
##INFO=<ID=DPADJ,Number=.,Type=Integer,Description="Read Depth of adjacency">
##INFO=<ID=CN,Number=1,Type=Integer,Description="Copy number of segment containing breakend">
##INFO=<ID=CNADJ,Number=.,Type=Integer,Description="Copy number of adjacency">
##INFO=<ID=ESUPPORT,Number=1,Type=Float,Description="Support of event, see into clever python script for more: scripts/postprocess-predictions">
##INFO=<ID=CICN,Number=2,Type=Integer,Description="Confidence interval around copy number for the segment">
##INFO=<ID=CICNADJ,Number=.,Type=Integer,Description="Confidence interval around copy number for the adjacency">
##FORMAT=<ID=CN,Number=1,Type=Integer,Description="Copy number genotype for imprecise events">
......
......@@ -28,6 +28,7 @@
##INFO=<ID=DPADJ,Number=.,Type=Integer,Description="Read Depth of adjacency">
##INFO=<ID=CN,Number=1,Type=Integer,Description="Copy number of segment containing breakend">
##INFO=<ID=CNADJ,Number=.,Type=Integer,Description="Copy number of adjacency">
##INFO=<ID=ESUPPORT,Number=1,Type=Float,Description="Support of event, see into clever python script for more: scripts/postprocess-predictions">
##INFO=<ID=CICN,Number=2,Type=Integer,Description="Confidence interval around copy number for the segment">
##INFO=<ID=CICNADJ,Number=.,Type=Integer,Description="Confidence interval around copy number for the adjacency">
##FORMAT=<ID=CN,Number=1,Type=Integer,Description="Copy number genotype for imprecise events">
......
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
......@@ -10,6 +11,7 @@
#import(nl.lumc.sasc.biopet.core.report.ReportBuilder.ec)
<%@ var summary: SummaryDb %>
<%@ var runId: Int %>
<%@ var run: Run %>
<%@ var sampleId: Option[Int] %>
<%@ var libId: Option[Int] %>
<%@ var plot: String %>
......
......@@ -22,7 +22,7 @@ import nl.lumc.sasc.biopet.extensions.gatk._
import nl.lumc.sasc.biopet.extensions.tools.ValidateVcf
import nl.lumc.sasc.biopet.pipelines.bammetrics.TargetRegions
import nl.lumc.sasc.biopet.pipelines.kopisu.Kopisu
import nl.lumc.sasc.biopet.pipelines.mapping.MultisampleMappingTrait
import nl.lumc.sasc.biopet.pipelines.mapping.{ Mapping, MultisampleMappingTrait }
import nl.lumc.sasc.biopet.pipelines.toucan.Toucan
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
......@@ -77,13 +77,13 @@ class Shiva(val parent: Configurable) extends QScript with MultisampleMappingTra
override def makeLibrary(id: String) = new this.Library(id)
/** Sample specific settings */
override def summarySettings = super.summarySettings ++
override def summarySettings: Map[String, Any] = super.summarySettings ++
Map("single_sample_variantcalling" -> variantcalling.isDefined, "use_indel_realigner" -> useIndelRealigner)
/** Class to generate jobs for a library */
class Library(libId: String) extends super.Library(libId) {
override def summaryFiles = super.summaryFiles ++
override def summaryFiles: Map[String, File] = super.summaryFiles ++
variantcalling.map("final" -> _.finalFile) ++
bqsrFile.map("baserecal" -> _) ++
bqsrAfterFile.map("baserecal_after" -> _)
......@@ -101,31 +101,31 @@ class Shiva(val parent: Configurable) extends QScript with MultisampleMappingTra
lazy val bqsrFile: Option[File] = if (useBaseRecalibration) Some(createFile("baserecal")) else None
lazy val bqsrAfterFile: Option[File] = if (useAnalyzeCovariates) Some(createFile("baserecal.after")) else None
override def keepFinalBamfile = super.keepFinalBamfile && !useIndelRealigner && !useBaseRecalibration
override def keepFinalBamfile: Boolean = super.keepFinalBamfile && !useIndelRealigner && !useBaseRecalibration
override def bamFile = mapping.map(_.mergedBamFile)
override def bamFile: Option[Mapping#File] = mapping.map(_.mergedBamFile)
override def preProcessBam = if (useIndelRealigner && usePrintReads)
override def preProcessBam: Option[Mapping#File] = if (useIndelRealigner && usePrintReads && useBaseRecalibration)
bamFile.map(swapExt(libDir, _, ".bam", ".realign.baserecal.bam"))
else if (useIndelRealigner) bamFile.map(swapExt(libDir, _, ".bam", ".realign.bam"))
else if (usePrintReads) bamFile.map(swapExt(libDir, _, ".bam", ".baserecal.bam"))
else if (usePrintReads && useBaseRecalibration) bamFile.map(swapExt(libDir, _, ".bam", ".baserecal.bam"))
else bamFile
/** Library specific settings */
override def summarySettings = super.summarySettings ++ Map(
override def summarySettings: Map[String, Any] = super.summarySettings ++ Map(
"library_variantcalling" -> variantcalling.isDefined,
"use_indel_realigner" -> useIndelRealigner,
"use_base_recalibration" -> useBaseRecalibration,
"useAnalyze_covariates" -> useAnalyzeCovariates
)
lazy val variantcalling = if (config("library_variantcalling", default = false).asBoolean &&
lazy val variantcalling: Option[ShivaVariantcalling with QScript] = if (config("library_variantcalling", default = false).asBoolean &&
(bamFile.isDefined || preProcessBam.isDefined)) {
Some(makeVariantcalling(multisample = false, sample = Some(sampleId), library = Some(libId)))
} else None
/** This will add jobs for this library */
override def addJobs() = {
override def addJobs(): Unit = {
super.addJobs()
if (useIndelRealigner && useBaseRecalibration) {
......@@ -183,7 +183,7 @@ class Shiva(val parent: Configurable) extends QScript with MultisampleMappingTra
}
}
lazy val variantcalling = if (config("single_sample_variantcalling", default = false).asBoolean) {
lazy val variantcalling: Option[ShivaVariantcalling with QScript] = if (config("single_sample_variantcalling", default = false).asBoolean) {
Some(makeVariantcalling(multisample = false, sample = Some(sampleId)))
} else None
......@@ -191,18 +191,18 @@ class Shiva(val parent: Configurable) extends QScript with MultisampleMappingTra
lazy val useIndelRealigner: Boolean = config("use_indel_realigner", default = true)
override def preProcessBam = if (useIndelRealigner && libraries.values.flatMap(_.preProcessBam).size > 1) {
override def preProcessBam: Option[File] = if (useIndelRealigner && libraries.values.flatMap(_.preProcessBam).size > 1) {
bamFile.map(swapExt(sampleDir, _, ".bam", ".realign.bam"))
} else bamFile
override def summaryFiles = super.summaryFiles ++ variantcalling.map("final" -> _.finalFile)
override def summaryFiles: Map[String, File] = super.summaryFiles ++ variantcalling.map("final" -> _.finalFile)
/** This will add sample jobs */
override def addJobs(): Unit = {
super.addJobs()
if (useIndelRealigner && libraries.values.flatMap(_.preProcessBam).size > 1) {
addIndelRealign(bamFile.get, sampleDir, false)
addIndelRealign(bamFile.get, sampleDir, isIntermediate = false)
}
preProcessBam.foreach { bam =>
......@@ -216,25 +216,25 @@ class Shiva(val parent: Configurable) extends QScript with MultisampleMappingTra
}
} // End of sample
lazy val multisampleVariantCalling = if (config("multisample_variantcalling", default = true).asBoolean) {
lazy val multisampleVariantCalling: Option[ShivaVariantcalling with QScript] = if (config("multisample_variantcalling", default = true).asBoolean) {
Some(makeVariantcalling(multisample = true))
} else None
lazy val svCalling = if (config("sv_calling", default = false).asBoolean) {
lazy val svCalling: Option[ShivaSvCalling] = if (config("sv_calling", default = false).asBoolean) {
Some(new ShivaSvCalling(this))
} else None
lazy val cnvCalling = if (config("cnv_calling", default = false).asBoolean) {
lazy val cnvCalling: Option[Kopisu] = if (config("cnv_calling", default = false).asBoolean) {
Some(new Kopisu(this))
} else None
lazy val annotation = if (multisampleVariantCalling.isDefined &&
lazy val annotation: Option[Toucan] = if (multisampleVariantCalling.isDefined &&
config("annotation", default = false).asBoolean) {
Some(new Toucan(this))
} else None
/** This will add the mutisample variantcalling */
override def addMultiSampleJobs() = {
override def addMultiSampleJobs(): Unit = {
super.addMultiSampleJobs()
addAll(dbsnpVcfFile.map(Shiva.makeValidateVcfJobs(this, _, referenceFasta(), new File(outputDir, ".validate"))).getOrElse(Nil))
......@@ -247,11 +247,11 @@ class Shiva(val parent: Configurable) extends QScript with MultisampleMappingTra
add(vc)
if (!usePrintReads) {
import variantcallers._
if (vc.callers.exists(_ match {
if (vc.callers.exists {
case _: HaplotypeCaller | _: HaplotypeCallerAllele | _: HaplotypeCallerGvcf => false
case _: UnifiedGenotyper | _: UnifiedGenotyperAllele => false
case _ => true
})) logger.warn("Not all variantcallers chosen can read BQSR files, All non-GATK")
}) logger.warn("Not all variantcallers chosen can read BQSR files, All non-GATK")
}
annotation.foreach { toucan =>
......@@ -275,7 +275,7 @@ class Shiva(val parent: Configurable) extends QScript with MultisampleMappingTra
}
/** Settings of pipeline for summary */
override def summarySettings = super.summarySettings ++ Map(
override def summarySettings: Map[String, Any] = super.summarySettings ++ Map(
"annotation" -> annotation.isDefined,
"multisample_variantcalling" -> multisampleVariantCalling.isDefined,
"sv_calling" -> svCalling.isDefined,
......
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