BwaMem.scala 3.44 KB
Newer Older
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.
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
16
17
18
package nl.lumc.sasc.biopet.extensions.bwa

import java.io.File
Peter van 't Hof's avatar
Peter van 't Hof committed
19

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

Peter van 't Hof's avatar
Peter van 't Hof committed
24
class BwaMem(val root: Configurable) extends Bwa {
bow's avatar
bow committed
25
  @Input(doc = "Fastq file R1", shortName = "R1")
26
  var R1: File = _
bow's avatar
bow committed
27
28

  @Input(doc = "Fastq file R2", shortName = "R2", required = false)
29
  var R2: File = _
bow's avatar
bow committed
30
31

  @Input(doc = "The reference file for the bam files.", shortName = "R")
32
  var reference: File = config("reference")
bow's avatar
bow committed
33
34

  @Output(doc = "Output file SAM", shortName = "output")
35
  var output: File = _
bow's avatar
bow committed
36

Peter van 't Hof's avatar
Peter van 't Hof committed
37
  var R: Option[String] = config("R")
sajvanderzeeuw's avatar
sajvanderzeeuw committed
38
39
  var k: Option[Int] = config("k")
  var r: Option[Float] = config("r")
Peter van 't Hof's avatar
Peter van 't Hof committed
40
  var S: Boolean = config("S", default = false)
bow's avatar
bow committed
41
  var M: Boolean = config("M", default = true)
sajvanderzeeuw's avatar
sajvanderzeeuw committed
42
43
44
45
46
47
  var w: Option[Int] = config("w")
  var d: Option[Int] = config("d")
  var c: Option[Int] = config("c")
  var D: Option[Float] = config("D")
  var W: Option[Int] = config("W")
  var m: Option[Int] = config("m")
Peter van 't Hof's avatar
Peter van 't Hof committed
48
49
  var P: Boolean = config("P", default = false)
  var e: Boolean = config("e", default = false)
sajvanderzeeuw's avatar
sajvanderzeeuw committed
50
51
  var A: Option[Int] = config("A")
  var B: Option[Int] = config("B")
Peter van 't Hof's avatar
Peter van 't Hof committed
52
53
54
  var O: Option[String] = config("O")
  var E: Option[String] = config("E")
  var L: Option[String] = config("L")
sajvanderzeeuw's avatar
sajvanderzeeuw committed
55
  var U: Option[Int] = config("U")
Peter van 't Hof's avatar
Peter van 't Hof committed
56
  var x: Option[String] = config("x")
Peter van 't Hof's avatar
Peter van 't Hof committed
57
  var p: Boolean = config("p", default = false)
sajvanderzeeuw's avatar
sajvanderzeeuw committed
58
59
60
  var v: Option[Int] = config("v")
  var T: Option[Int] = config("T")
  var h: Option[Int] = config("h")
Peter van 't Hof's avatar
Peter van 't Hof committed
61
62
63
  var a: Boolean = config("a", default = false)
  var C: Boolean = config("C", default = false)
  var Y: Boolean = config("Y", default = false)
Peter van 't Hof's avatar
Peter van 't Hof committed
64
  var I: Option[String] = config("I")
bow's avatar
bow committed
65

66
67
  override val defaultVmem = "6G"
  override val defaultThreads = 8
bow's avatar
bow committed
68

69
  def cmdLine = {
bow's avatar
bow committed
70
71
    required(executable) +
      required("mem") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
72
73
      optional("-k", k) +
      optional("-r", r) +
bow's avatar
bow committed
74
      optional("-t", nCoresRequest) +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
75
      optional("-R", R) +
bow's avatar
bow committed
76
      conditional(M, "-M") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
77
      conditional(S, "-S") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
      optional("-w", w) +
      optional("-d", d) +
      optional("-c", c) +
      optional("-D", D) +
      optional("-W", W) +
      optional("-m", m) +
      conditional(P, "-P") +
      conditional(e, "-e") +
      optional("-A", A) +
      optional("-B", B) +
      optional("-O", O) +
      optional("-E", E) +
      optional("-L", L) +
      optional("-U", U) +
      optional("-x", x) +
93
      conditional(p, "-p") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
94
95
96
97
98
99
      optional("-v", v) +
      optional("-T", T) +
      optional("-h", h) +
      conditional(a, "-a") +
      conditional(C, "-C") +
      conditional(Y, "-Y") +
100
      optional("-I", I) +
Peter van 't Hof's avatar
Peter van 't Hof committed
101
102
103
      required(reference) +
      required(R1) +
      optional(R2) +
bow's avatar
bow committed
104
      " > " + required(output)
Peter van 't Hof's avatar
Peter van 't Hof committed
105
  }
Peter van 't Hof's avatar
Peter van 't Hof committed
106
}