Pindel.scala 2.37 KB
Newer Older
Wai Yi Leung's avatar
Wai Yi Leung committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * Biopet is built on top of GATK Queue for building bioinformatic
 * pipelines. It is mainly intended to support LUMC SHARK cluster which is running
 * SGE. But other types of HPC that are supported by GATK Queue (such as PBS)
 * should also be able to execute Biopet tools and pipelines.
 *
 * Copyright 2014 Sequencing Analysis Support Core - Leiden University Medical Center
 *
 * Contact us at: sasc@lumc.nl
 *
 * A dual licensing mode is applied. The source code within this project that are
 * not part of GATK Queue is freely available for non-commercial use under an AGPL
 * license; For commercial users or users who do not want to follow the AGPL
 * license, please contact us to obtain a separate license.
 */
package nl.lumc.sasc.biopet.pipelines.shiva.svcallers

Wai Yi Leung's avatar
Wai Yi Leung committed
18
19
import java.text.SimpleDateFormat
import java.util.Calendar
Wai Yi Leung's avatar
Wai Yi Leung committed
20

Wai Yi Leung's avatar
Wai Yi Leung committed
21
import nl.lumc.sasc.biopet.extensions.pindel._
22
import nl.lumc.sasc.biopet.utils.BamUtils
Wai Yi Leung's avatar
Wai Yi Leung committed
23
24
25
26
27
28
29
30
import nl.lumc.sasc.biopet.utils.config.Configurable

/// Pindel is actually a mini pipeline executing binaries from the pindel package
class Pindel(val root: Configurable) extends SvCaller {
  val name = "pindel"

  def this() = this(null)

31
  /** Default pipeline config */
32
33
  override def defaults = Map(
    "pindelvcf" -> Map(
34
35
      "rdate" -> new SimpleDateFormat("yyyyMMdd").format(Calendar.getInstance().getTime()),
      "compact_output_limit" -> 10
36
    ))
37

Wai Yi Leung's avatar
Wai Yi Leung committed
38
39
40
41
  def biopetScript() {
    for ((sample, bamFile) <- inputBams) {
      val pindelDir = new File(outputDir, sample)

Wai Yi Leung's avatar
Wai Yi Leung committed
42
      val config_file: File = new File(pindelDir, sample + ".pindel.cfg")
Wai Yi Leung's avatar
Wai Yi Leung committed
43
44
45
      val cfg = new PindelConfig(this)
      cfg.input = bamFile

46
47
      val insertSize: Int = BamUtils.sampleBamInsertSize(bamFile)
      cfg.insertsize = insertSize
Wai Yi Leung's avatar
Wai Yi Leung committed
48
49
50
51
52
53
      cfg.sampleName = sample
      cfg.output = config_file
      add(cfg)

      val pindel = PindelCaller(this, cfg.output, pindelDir)
      add(pindel)
Wai Yi Leung's avatar
Wai Yi Leung committed
54
55
56
57
58
59

      // Current date
      val today = Calendar.getInstance().getTime()
      val todayformat = new SimpleDateFormat("yyyyMMdd")

      val pindelVcf = new PindelVCF(this)
60
61
62
      pindelVcf.pindelOutputInputHolder = pindel.outputFile
      pindelVcf.pindelOutputRoot = Some(new File(pindelDir, "sample"))
      pindelVcf.rDate = todayformat.format(today) // officially, we should enter the date of the genome here
Wai Yi Leung's avatar
Wai Yi Leung committed
63
64
      pindelVcf.outputVCF = new File(pindelDir, s"${sample}.pindel.vcf")
      add(pindelVcf)
Wai Yi Leung's avatar
Wai Yi Leung committed
65
66
67
68
    }

  }
}