Commit a5ecd049 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Update breakdancer

parent 3c2f4a07
......@@ -18,38 +18,36 @@ package nl.lumc.sasc.biopet.extensions.breakdancer
import java.io.File
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.core.{ BiopetQScript, PipelineCommand }
import nl.lumc.sasc.biopet.core.{Reference, BiopetQScript, PipelineCommand}
import org.broadinstitute.gatk.queue.QScript
/// Breakdancer is actually a mini pipeline executing binaries from the breakdancer package
class Breakdancer(val root: Configurable) extends QScript with BiopetQScript {
class Breakdancer(val root: Configurable) extends QScript with BiopetQScript with Reference {
def this() = this(null)
@Input(doc = "Input file (bam)")
var input: File = _
@Input(doc = "Reference Fasta file")
var reference: File = _
@Argument(doc = "Work directory")
var workdir: String = _
var workDir: File = _
var deps: List[File] = Nil
@Output(doc = "Breakdancer config")
lazy val configfile: File = {
new File(workdir + "/" + input.getName.substring(0, input.getName.lastIndexOf(".bam")) + ".breakdancer.cfg")
new File(workDir, input.getName.substring(0, input.getName.lastIndexOf(".bam")) + ".breakdancer.cfg")
}
@Output(doc = "Breakdancer raw output")
lazy val outputraw: File = {
new File(workdir + "/" + input.getName.substring(0, input.getName.lastIndexOf(".bam")) + ".breakdancer.tsv")
new File(workDir, input.getName.substring(0, input.getName.lastIndexOf(".bam")) + ".breakdancer.tsv")
}
@Output(doc = "Breakdancer VCF output")
lazy val outputvcf: File = {
new File(workdir + "/" + input.getName.substring(0, input.getName.lastIndexOf(".bam")) + ".breakdancer.vcf")
new File(workDir, input.getName.substring(0, input.getName.lastIndexOf(".bam")) + ".breakdancer.vcf")
}
override def init() {
override def init(): Unit = {
}
def biopetScript() {
......@@ -72,11 +70,10 @@ class Breakdancer(val root: Configurable) extends QScript with BiopetQScript {
}
object Breakdancer extends PipelineCommand {
def apply(root: Configurable, input: File, reference: File, runDir: String): Breakdancer = {
def apply(root: Configurable, input: File, runDir: File): Breakdancer = {
val breakdancer = new Breakdancer(root)
breakdancer.input = input
breakdancer.reference = reference
breakdancer.workdir = runDir
breakdancer.workDir = runDir
breakdancer.init()
breakdancer.biopetScript()
breakdancer
......
......@@ -24,7 +24,7 @@ class CleverCaller(val root: Configurable) extends BiopetCommandLineFunction {
var reference: File = _
@Argument(doc = "Work directory")
var workdir: String = _
var workDir: String = _
var cwd: String = _
......@@ -35,7 +35,7 @@ class CleverCaller(val root: Configurable) extends BiopetCommandLineFunction {
@Output(doc = "Clever raw output")
lazy val outputraw: File = {
new File(workdir + "predictions.raw.txt")
new File(workDir + "predictions.raw.txt")
}
// var T: Option[Int] = config("T", default = defaultThreads)
......@@ -46,7 +46,7 @@ class CleverCaller(val root: Configurable) extends BiopetCommandLineFunction {
var r: Boolean = config("r", default = false) // take read groups into account
override def beforeCmd() {
if (workdir == null) throw new Exception("Clever :: Workdirectory is not defined")
if (workDir == null) throw new Exception("Clever :: Workdirectory is not defined")
// if (input.getName.endsWith(".sort.bam")) sorted = true
}
......@@ -58,9 +58,9 @@ class CleverCaller(val root: Configurable) extends BiopetCommandLineFunction {
conditional(a, "-a") +
conditional(k, "-k") +
conditional(r, "-r") +
required(this.input) +
required(this.reference) +
required(this.workdir)
required(input) +
required(reference) +
required(workDir)
}
object CleverCaller {
......@@ -69,7 +69,7 @@ object CleverCaller {
clever.input = input
clever.reference = reference
clever.cwd = svDir
clever.workdir = runDir
clever.workDir = runDir
clever
}
}
\ No newline at end of file
......@@ -19,7 +19,7 @@ import java.io.File
import htsjdk.samtools.SamReaderFactory
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{PipelineCommand, BiopetQScript, Reference, SampleLibraryTag}
import nl.lumc.sasc.biopet.core.{ PipelineCommand, BiopetQScript, Reference, SampleLibraryTag }
import nl.lumc.sasc.biopet.extensions.breakdancer.Breakdancer
import nl.lumc.sasc.biopet.extensions.clever.CleverCaller
import nl.lumc.sasc.biopet.extensions.delly.Delly
......@@ -41,7 +41,7 @@ class ShivaSvCalling extends SummaryQScript with SampleLibraryTag with Reference
protected def addBamFile(file: File, sampleId: Option[String] = None): Unit = {
sampleId match {
case Some(sample) => inputBams += sample -> file
case Some(sample) => inputBams += sample -> file
case _ if !file.exists() => throw new IllegalArgumentException("Bam file does not exits: " + file)
case _ => {
val inputSam = SamReaderFactory.makeDefault.open(file)
......@@ -68,7 +68,7 @@ class ShivaSvCalling extends SummaryQScript with SampleLibraryTag with Reference
BiopetQScript.addError("variantcaller '" + cal + "' does not exist, possible to use: " + callersList.map(_.name).mkString(", "))
}
val callers = callersList.filter(x => configCallers.contains(x.name)).sortBy(_.prio)
val callers = callersList.filter(x => configCallers.contains(x.name))
require(inputBams.nonEmpty, "No input bams found")
require(callers.nonEmpty, "must select at least 1 SV caller, choices are: " + callersList.map(_.name).mkString(", "))
......@@ -99,7 +99,7 @@ class ShivaSvCalling extends SummaryQScript with SampleLibraryTag with Reference
//TODO: move minipipeline of breakdancer to here
for ((sample, bamFile) <- inputBams) {
val breakdancerDir = new File(outputDir, sample)
val breakdancer = Breakdancer(qscript, bamFile, qscript.reference, breakdancerDir)
val breakdancer = Breakdancer(qscript, bamFile, breakdancerDir)
addAll(breakdancer.functions)
}
}
......@@ -112,7 +112,7 @@ class ShivaSvCalling extends SummaryQScript with SampleLibraryTag with Reference
def addJobs() {
//TODO: check double directories
for ((sample, bamFile) <- inputBams) {
val cleverDir = new File(outputDir, sampleId)
val cleverDir = new File(outputDir, sample)
val clever = CleverCaller(qscript, bamFile, qscript.reference, cleverDir, cleverDir)
add(clever)
}
......@@ -126,7 +126,7 @@ class ShivaSvCalling extends SummaryQScript with SampleLibraryTag with Reference
def addJobs() {
//TODO: Move mini delly pipeline to here
for ((sample, bamFile) <- inputBams) {
val dellyDir = new File(outputDir, sampleId)
val dellyDir = new File(outputDir, sample)
val delly = Delly(qscript, bamFile, dellyDir)
addAll(delly.functions)
}
......@@ -142,7 +142,8 @@ class ShivaSvCalling extends SummaryQScript with SampleLibraryTag with Reference
/** Files for the summary */
def summaryFiles: Map[String, File] = {
val callers: Set[String] = config("sv_callers")
callersList.filter(x => callers.contains(x.name)).map(x => x.name -> x.outputFile).toMap + ("final" -> finalFile)
//callersList.filter(x => callers.contains(x.name)).map(x => x.name -> x.outputFile).toMap + ("final" -> finalFile)
Map()
}
}
......
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