Commit 1e8b3c2f authored by Peter van 't Hof's avatar Peter van 't Hof Committed by GitHub

Merge pull request #163 from biopet/fix-BIOPET-753

Fixing summary in Basty
parents 5d3b5448 6bda10a5
...@@ -21,9 +21,10 @@ package nl.lumc.sasc.biopet.pipelines.basty ...@@ -21,9 +21,10 @@ package nl.lumc.sasc.biopet.pipelines.basty
import java.io.File import java.io.File
import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension
import nl.lumc.sasc.biopet.core.{MultiSampleQScript, PipelineCommand} import nl.lumc.sasc.biopet.core.{MultiSampleQScript, PipelineCommand}
import nl.lumc.sasc.biopet.extensions.{Cat, Raxml, RunGubbins} import nl.lumc.sasc.biopet.extensions.{Cat, Raxml, RunGubbins}
import nl.lumc.sasc.biopet.pipelines.shiva.Shiva import nl.lumc.sasc.biopet.pipelines.shiva.{Shiva, ShivaReport}
import nl.lumc.sasc.biopet.extensions.tools.BastyGenerateFasta import nl.lumc.sasc.biopet.extensions.tools.BastyGenerateFasta
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
...@@ -44,6 +45,8 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript { ...@@ -44,6 +45,8 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
val numBoot: Int = config("boot_runs", default = 100, namespace = "raxml").asInt val numBoot: Int = config("boot_runs", default = 100, namespace = "raxml").asInt
val executeGubbins: Boolean = config("execute_gubbins", default = true)
override def defaults = Map( override def defaults = Map(
"ploidy" -> 1, "ploidy" -> 1,
"variantcallers" -> variantcallers "variantcallers" -> variantcallers
...@@ -51,6 +54,13 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript { ...@@ -51,6 +54,13 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
lazy val shiva = new Shiva(qscript) lazy val shiva = new Shiva(qscript)
override def reportClass: Option[ReportBuilderExtension] = {
val shiva = new ShivaReport(this)
shiva.outputDir = new File(outputDir, "report")
shiva.summaryDbFile = summaryDbFile
Some(shiva)
}
def summaryFiles: Map[String, File] = Map() def summaryFiles: Map[String, File] = Map()
def summarySettings: Map[String, Any] = Map("boot_runs" -> numBoot) def summarySettings: Map[String, Any] = Map("boot_runs" -> numBoot)
...@@ -87,17 +97,15 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript { ...@@ -87,17 +97,15 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
def init() { def init() {
shiva.outputDir = outputDir shiva.outputDir = outputDir
shiva.init()
} }
def biopetScript() { def biopetScript() {
shiva.biopetScript() add(shiva)
addAll(shiva.functions)
addSummaryQScript(shiva)
inputFiles :::= shiva.inputFiles inputFiles :::= shiva.inputFiles
addSamplesJobs() addSamplesJobs()
addSummaryJobs()
} }
def addMultiSampleJobs(): Unit = { def addMultiSampleJobs(): Unit = {
...@@ -186,11 +194,13 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript { ...@@ -186,11 +194,13 @@ class Basty(val parent: Configurable) extends QScript with MultiSampleQScript {
raxmlBi.w = dirSufixRaxml raxmlBi.w = dirSufixRaxml
add(raxmlBi) add(raxmlBi)
val gubbins = new RunGubbins(this) if (executeGubbins) {
gubbins.fastafile = concensusVariants val gubbins = new RunGubbins(this)
gubbins.startingTree = raxmlBi.getBipartitionsFile gubbins.fastafile = concensusVariants
gubbins.outputDirectory = dirSufixGubbins gubbins.startingTree = raxmlBi.getBipartitionsFile
add(gubbins) gubbins.outputDirectory = dirSufixGubbins
add(gubbins)
}
} }
addTreeJobs(catVariantsSnps.output, addTreeJobs(catVariantsSnps.output,
......
...@@ -207,15 +207,18 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript => ...@@ -207,15 +207,18 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
for (inputFile <- inputFiles) { for (inputFile <- inputFiles) {
inputFile.md5 match { inputFile.md5 match {
case Some(checksum) => case Some(checksum) =>
val checkMd5 = new CheckChecksum if (!SummaryQScript.checkChecksumCache.contains(inputFile.file)) {
checkMd5.inputFile = inputFile.file val checkMd5 = new CheckChecksum
if (!SummaryQScript.md5sumCache.contains(inputFile.file)) checkMd5.inputFile = inputFile.file
addChecksum(inputFile.file) if (!SummaryQScript.md5sumCache.contains(inputFile.file))
checkMd5.checksumFile = SummaryQScript.md5sumCache(inputFile.file) addChecksum(inputFile.file)
checkMd5.checksum = checksum checkMd5.checksumFile = SummaryQScript.md5sumCache(inputFile.file)
checkMd5.jobOutputFile = new File(checkMd5.checksumFile.getParentFile, checkMd5.checksum = checksum
checkMd5.checksumFile.getName + ".check.out") checkMd5.jobOutputFile = new File(checkMd5.checksumFile.getParentFile,
add(checkMd5) checkMd5.checksumFile.getName + ".check.out")
add(checkMd5)
SummaryQScript.checkChecksumCache.add(inputFile.file)
}
case _ => case _ =>
} }
} }
...@@ -238,4 +241,5 @@ object SummaryQScript { ...@@ -238,4 +241,5 @@ object SummaryQScript {
/** Cache to have no duplicate jobs */ /** Cache to have no duplicate jobs */
protected[summary] val md5sumCache: mutable.Map[File, File] = mutable.Map() protected[summary] val md5sumCache: mutable.Map[File, File] = mutable.Map()
protected[summary] val checkChecksumCache: mutable.Set[File] = mutable.Set()
} }
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