BreakdancerCaller.scala 3.29 KB
Newer Older
1
package nl.lumc.sasc.biopet.extensions.breakdancer
2
3
4
5
6

import java.io.File

import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import nl.lumc.sasc.biopet.core.config.Configurable
7
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
8
9
10
11

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
12
  override def defaultThreads = 1 // breakdancer can only work on 1 single thread
13

Peter van 't Hof's avatar
Peter van 't Hof committed
14
15
  override def versionRegex = """.*[Vv]ersion:? (.*)""".r
  override def versionExitcode = List(1)
16
17
18
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
  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)
  var d: String = config("d")
  var g: String = config("g")
  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)

  override def beforeCmd {
  }

  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
    return bdcaller
  }
}