BreakdancerCaller.scala 4.01 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/**
 * 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.
 */
16
package nl.lumc.sasc.biopet.extensions.breakdancer
17
18
19
20
21

import java.io.File

import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
22
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
23
24
25
26

class BreakdancerCaller(val root: Configurable) extends BiopetCommandLineFunction {
  executable = config("exe", default = "breakdancer-max", freeVar = false)

Peter van 't Hof's avatar
Peter van 't Hof committed
27
  override def defaultThreads = 1 // breakdancer can only work on 1 single thread
28

Peter van 't Hof's avatar
Peter van 't Hof committed
29
30
  override def versionRegex = """.*[Vv]ersion:? (.*)""".r
  override def versionExitcode = List(1)
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
56
57
58
59
60
61
62
63
64
65
66
67
68
  override def versionCommand = executable

  @Input(doc = "The breakdancer configuration file")
  var input: File = _

  //  @Argument(doc = "Work directory")
  //  var workdir: String = _

  @Output(doc = "Breakdancer TSV output")
  var output: File = _

  /*
   Options:
       -o STRING       operate on a single chromosome [all chromosome]
       -s INT          minimum length of a region [7]
       -c INT          cutoff in unit of standard deviation [3]
       -m INT          maximum SV size [1000000000]
       -q INT          minimum alternative mapping quality [35]
       -r INT          minimum number of read pairs required to establish a connection [2]
       -x INT          maximum threshold of haploid sequence coverage for regions to be ignored [1000]
       -b INT          buffer size for building connection [100]
       -t              only detect transchromosomal rearrangement, by default off
       -d STRING       prefix of fastq files that SV supporting reads will be saved by library
       -g STRING       dump SVs and supporting reads in BED format for GBrowse
       -l              analyze Illumina long insert (mate-pair) library
       -a              print out copy number and support reads per library rather than per bam, by default off
       -h              print out Allele Frequency column, by default off
       -y INT          output score filter [30]
   */

  var s: Option[Int] = config("s", default = 7)
  var c: Option[Int] = config("c", default = 3)
  var m: Option[Int] = config("m", default = 1000000000)
  var q: Option[Int] = config("qs", default = 35)
  var r: Option[Int] = config("r", default = 2)
  var x: Option[Int] = config("x", default = 1000)
  var b: Option[Int] = config("b", default = 100)
  var t: Boolean = config("t", default = false)
Peter van 't Hof's avatar
Peter van 't Hof committed
69
70
  var d: Option[String] = config("d")
  var g: Option[String] = config("g")
71
72
73
74
75
  var l: Boolean = config("l", default = false)
  var a: Boolean = config("a", default = false)
  var h: Boolean = config("h", default = false)
  var y: Option[Int] = config("y", default = 30)

Peter van 't Hof's avatar
Peter van 't Hof committed
76
  override def beforeCmd() {
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  }

  def cmdLine = required(executable) +
    optional("-s", s) +
    optional("-c", c) +
    optional("-m", m) +
    optional("-q", q) +
    optional("-r", r) +
    optional("-x", x) +
    optional("-b", b) +
    conditional(t, "-t") +
    optional("-d", d) +
    optional("-g", g) +
    conditional(l, "-l") +
    conditional(a, "-a") +
    conditional(h, "-h") +
    optional("-y", y) +
    required(input) +
    ">" +
    required(output)
}

object BreakdancerCaller {
  def apply(root: Configurable, input: File, output: File): BreakdancerCaller = {
    val bdcaller = new BreakdancerCaller(root)
    bdcaller.input = input
    bdcaller.output = output
Peter van 't Hof's avatar
Peter van 't Hof committed
104
    bdcaller
105
106
  }
}