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

Split sv callers into separated classes

parent 6f6a76e7
......@@ -17,9 +17,7 @@ package nl.lumc.sasc.biopet.pipelines.shiva
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.{ PipelineCommand, 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
import nl.lumc.sasc.biopet.pipelines.shiva.svcallers.{Delly, Breakdancer, Clever, SvCaller}
import nl.lumc.sasc.biopet.utils.{ BamUtils, Logging }
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
......@@ -59,68 +57,13 @@ class ShivaSvCalling(val root: Configurable) extends QScript with SummaryQScript
require(inputBams.nonEmpty, "No input bams found")
require(callers.nonEmpty, "must select at least 1 SV caller, choices are: " + callersList.map(_.name).mkString(", "))
callers.foreach(_.addJobs())
callers.foreach(add)
addSummaryJobs()
}
/** Will generate all available variantcallers */
protected def callersList: List[SvCaller] = List(new Breakdancer, new Clever, new Delly)
/** General trait for a variantcaller mode */
trait SvCaller {
/** Name of mode, this should also be used in the config */
val name: String
/** Output dir for this mode */
def outputDir = new File(qscript.outputDir, name)
/** This should add the variantcaller jobs */
def addJobs()
}
/** default mode of freebayes */
class Breakdancer extends SvCaller {
val name = "breakdancer"
def addJobs() {
//TODO: move minipipeline of breakdancer to here
for ((sample, bamFile) <- inputBams) {
val breakdancerDir = new File(outputDir, sample)
val breakdancer = Breakdancer(qscript, bamFile, breakdancerDir)
addAll(breakdancer.functions)
}
}
}
/** default mode of bcftools */
class Clever extends SvCaller {
val name = "clever"
def addJobs() {
//TODO: check double directories
for ((sample, bamFile) <- inputBams) {
val cleverDir = new File(outputDir, sample)
val clever = CleverCaller(qscript, bamFile, cleverDir)
add(clever)
}
}
}
/** Makes a vcf file from a mpileup without statistics */
class Delly extends SvCaller {
val name = "delly"
def addJobs() {
//TODO: Move mini delly pipeline to here
for ((sample, bamFile) <- inputBams) {
val dellyDir = new File(outputDir, sample)
val delly = Delly(qscript, bamFile, dellyDir)
delly.outputName = sample
addAll(delly.functions)
}
}
}
protected def callersList: List[SvCaller] = List(new Breakdancer(this), new Clever(this), new Delly(this))
/** Location of summary file */
def summaryFile = new File(outputDir, "ShivaSvCalling.summary.json")
......
package nl.lumc.sasc.biopet.pipelines.shiva.svcallers
import java.io.File
import nl.lumc.sasc.biopet.core.{Reference, BiopetQScript}
import nl.lumc.sasc.biopet.extensions.breakdancer.Breakdancer
import nl.lumc.sasc.biopet.extensions.clever.CleverCaller
import nl.lumc.sasc.biopet.extensions.delly.Delly
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
/**
* Created by pjvanthof on 23/11/15.
*/
trait SvCaller extends QScript with BiopetQScript with Reference {
/** Name of mode, this should also be used in the config */
def name: String
var namePrefix: String = _
var inputBams: Map[String, File] = _
def init() = {}
}
class Breakdancer(val root: Configurable) extends SvCaller {
def name = "breakdancer"
def biopetScript() {
//TODO: move minipipeline of breakdancer to here
for ((sample, bamFile) <- inputBams) {
val breakdancerDir = new File(outputDir, sample)
val breakdancer = Breakdancer(this, bamFile, breakdancerDir)
addAll(breakdancer.functions)
}
}
}
/** default mode of bcftools */
class Clever(val root: Configurable) extends SvCaller {
def name = "clever"
def biopetScript() {
//TODO: check double directories
for ((sample, bamFile) <- inputBams) {
val cleverDir = new File(outputDir, sample)
val clever = CleverCaller(this, bamFile, cleverDir)
add(clever)
}
}
}
/** Makes a vcf file from a mpileup without statistics */
class Delly(val root: Configurable) extends SvCaller {
def name = "delly"
def biopetScript() {
//TODO: Move mini delly pipeline to here
for ((sample, bamFile) <- inputBams) {
val dellyDir = new File(outputDir, sample)
val delly = Delly(this, bamFile, dellyDir)
delly.outputName = sample
addAll(delly.functions)
}
}
}
......@@ -23,9 +23,6 @@ trait Variantcaller extends QScript with BiopetQScript with Reference {
/** Prio from the config */
lazy val prio: Int = config("prio_" + name, default = defaultPrio)
/** This should add the variantcaller jobs */
def script
/** Final output file of this mode */
def outputFile: File = new File(outputDir, namePrefix + s".$name.vcf.gz")
}
......
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