DellyCaller.scala 2.16 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
3
4
5
6
7
8
9
10
/**
 * 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
 *
11
 * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
Peter van 't Hof's avatar
Peter van 't Hof committed
12
13
14
 * license; For commercial users or users who do not want to follow the AGPL
 * license, please contact us to obtain a separate license.
 */
15
package nl.lumc.sasc.biopet.extensions.delly
16
17
18

import java.io.File

19
import nl.lumc.sasc.biopet.core.{ Version, BiopetCommandLineFunction }
Peter van 't Hof's avatar
Peter van 't Hof committed
20
import nl.lumc.sasc.biopet.utils.config.Configurable
Peter van 't Hof's avatar
Peter van 't Hof committed
21
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
22

Peter van 't Hof's avatar
Peter van 't Hof committed
23
class DellyCaller(val parent: Configurable) extends BiopetCommandLineFunction with Version {
24
25
26
27
  executable = config("exe", default = "delly")

  private lazy val versionexecutable: File = new File(executable)

Peter van 't Hof's avatar
Peter van 't Hof committed
28
  override def defaultThreads = 1
Peter van 't Hof's avatar
Peter van 't Hof committed
29
  override def defaultCoreMemory = 4.0
30

31
32
  def versionCommand = versionexecutable.getAbsolutePath
  def versionRegex = """DELLY \(Version: (.*)\)""".r
Peter van 't Hof's avatar
Peter van 't Hof committed
33
  override def versionExitcode = List(0, 1)
34
35
36
37
38
39
40
41
42
43
44

  @Input(doc = "Input file (bam)")
  var input: File = _

  @Output(doc = "Delly VCF output")
  var outputvcf: File = _

  @Argument(doc = "What kind of analysis to run: DEL,DUP,INV,TRA")
  var analysistype: String = _

  def cmdLine = required(executable) +
45
46
    required("-t", analysistype) +
    required("-o", outputvcf) +
47
48
49
    required(input) +
    createEmptyOutputIfNeeded

akaljuvee's avatar
akaljuvee committed
50
  // when no variants are found then the tool doesn't generate the output file either, in Biopet it's needed that the empty file would be there
51
52
53
54
55
56
57
58
  private def createEmptyOutputIfNeeded =
    s"""
       |c=$$?
       |if [ $$c -eq 0 ] && [ ! -f $outputvcf ]; then
       |  echo '##fileformat=VCFv4.2' > $outputvcf
       |  echo '#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO' >> $outputvcf
       |fi
       |exit $$c""".stripMargin
59
60

}