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

Add gatk variantcalling with haplotypecaller

parent 05273365
......@@ -3,15 +3,27 @@ package nl.lumc.sasc.biopet.pipelines.gatk
import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions.gatk.broad._
import nl.lumc.sasc.biopet.pipelines.shiva.ShivaTrait
import nl.lumc.sasc.biopet.pipelines.shiva.{ShivaVariantcallingTrait, ShivaVariantcalling, ShivaTrait}
import org.broadinstitute.gatk.queue.QScript
/**
* Created by pjvan_thof on 2/26/15.
*/
class ShivaGatk(val root: Configurable) extends QScript with ShivaTrait {
qscript =>
def this() = this(null)
override def makeVariantcalling(multisample: Boolean = false): ShivaVariantcallingTrait = {
if (multisample) new ShivaVariantcallingGatk(qscript) {
override def namePrefix = "multisample."
override def configName = "shivavariantcalling"
override def configPath: List[String] = super.configPath ::: "multisample" :: Nil
}
else new ShivaVariantcallingGatk(qscript) {
override def configName = "shivavariantcalling"
}
}
override def makeSample(id: String) = new this.Sample(id)
class Sample(sampleId: String) extends super.Sample(sampleId) {
override def makeLibrary(id: String) = new this.Library(id)
......
package nl.lumc.sasc.biopet.pipelines.gatk
import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions.gatk.broad.HaplotypeCaller
import nl.lumc.sasc.biopet.pipelines.shiva.ShivaVariantcallingTrait
import org.broadinstitute.gatk.queue.QScript
/**
* Created by pjvan_thof on 2/26/15.
*/
class ShivaVariantcallingGatk(val root: Configurable) extends QScript with ShivaVariantcallingTrait {
qscript =>
def this() = this(null)
override def callers = new Haplotypecaller :: super.callers
class Haplotypecaller extends Variantcaller {
val name = "haplotypecaller"
protected val defaultPrio = 1
protected val defaultUse = true
def outputFile = new File(outputDir, namePrefix + "haplotypecaller.vcf.gz")
def addJobs() {
val hc = new HaplotypeCaller(qscript)
hc.input_file = inputBams
hc.out = outputFile
add(hc)
}
}
}
object ShivaVariantcallingGatk extends PipelineCommand
\ No newline at end of file
......@@ -26,7 +26,7 @@ trait ShivaTrait extends MultiSampleQScript with SummaryQScript {
addSummaryJobs
}
def makeVariantcalling(multisample: Boolean = false) = {
def makeVariantcalling(multisample: Boolean = false): ShivaVariantcallingTrait = {
if (multisample) new ShivaVariantcalling(qscript) {
override def namePrefix = "multisample."
override def configName = "shivavariantcalling"
......
......@@ -29,13 +29,15 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
}
def init: Unit = {
if (!namePrefix.isEmpty && !namePrefix.endsWith(".")) namePrefix += "."
}
def finalFile = new File(outputDir, namePrefix + "final.vcf.gz")
def biopetScript: Unit = {
val cv = new CombineVariants(qscript)
cv.outputFile = new File(outputDir, namePrefix + ".final.vcf.gz")
for (caller <- callers) {
cv.outputFile = finalFile
cv.setKey = "VariantCaller"
for (caller <- usedCallers) {
caller.addJobs()
cv.addInput(caller.outputFile, caller.name)
}
......@@ -44,7 +46,9 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
addSummaryJobs
}
def callers = List(new RawVcf).filter(_.use)
def callers: List[Variantcaller] = List(new RawVcf)
def usedCallers: List[Variantcaller] = callers.filter(_.use)
trait Variantcaller {
val name: String
......@@ -96,5 +100,5 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag {
def summarySettings = Map()
def summaryFiles = Map()
def summaryFiles: Map[String, File] = usedCallers.map(x => (x.name -> x.outputFile)).toMap + ("final" -> finalFile)
}
\ No newline at end of file
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