Delly.scala 2 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
package nl.lumc.sasc.biopet.pipelines.shiva.svcallers

Peter van 't Hof's avatar
Peter van 't Hof committed
3
4
import nl.lumc.sasc.biopet.extensions.delly.DellyCaller
import nl.lumc.sasc.biopet.extensions.gatk.CatVariants
Peter van 't Hof's avatar
Peter van 't Hof committed
5
6
import nl.lumc.sasc.biopet.utils.config.Configurable

7
/** Script for sv caller delly */
Peter van 't Hof's avatar
Peter van 't Hof committed
8
9
10
class Delly(val root: Configurable) extends SvCaller {
  def name = "delly"

Peter van 't Hof's avatar
Peter van 't Hof committed
11
12
13
14
15
  val del: Boolean = config("DEL", default = true)
  val dup: Boolean = config("DUP", default = true)
  val inv: Boolean = config("INV", default = true)
  val tra: Boolean = config("TRA", default = true)

Peter van 't Hof's avatar
Peter van 't Hof committed
16
17
18
  def biopetScript() {
    for ((sample, bamFile) <- inputBams) {
      val dellyDir = new File(outputDir, sample)
Peter van 't Hof's avatar
Peter van 't Hof committed
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

      val catVariants = new CatVariants(this)
      catVariants.outputFile = new File(dellyDir, sample + ".delly.vcf.gz")

      if (del) {
        val delly = new DellyCaller(this)
        delly.input = bamFile
        delly.analysistype = "DEL"
        delly.outputvcf = new File(dellyDir, sample + ".delly.del.vcf")
        add(delly)
        catVariants.inputFiles :+= delly.outputvcf
      }
      if (dup) {
        val delly = new DellyCaller(this)
        delly.input = bamFile
        delly.analysistype = "DUP"
        delly.outputvcf = new File(dellyDir, sample + ".delly.dup.vcf")
        add(delly)
        catVariants.inputFiles :+= delly.outputvcf
      }
      if (inv) {
        val delly = new DellyCaller(this)
        delly.input = bamFile
        delly.analysistype = "INV"
        delly.outputvcf = new File(dellyDir, sample + ".delly.inv.vcf")
        add(delly)
        catVariants.inputFiles :+= delly.outputvcf
      }
      if (tra) {
        val delly = new DellyCaller(this)
        delly.input = bamFile
        delly.analysistype = "TRA"
        delly.outputvcf = new File(dellyDir, sample + ".delly.tra.vcf")
        catVariants.inputFiles :+= delly.outputvcf
        add(delly)
      }

56
57
      require(catVariants.inputFiles.nonEmpty, "Must atleast 1 SV-type be selected for Delly")

Peter van 't Hof's avatar
Peter van 't Hof committed
58
      add(catVariants)
59
      addVCF(sample, catVariants.outputFile)
Peter van 't Hof's avatar
Peter van 't Hof committed
60
61
62
    }
  }
}