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

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

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

Peter van 't Hof's avatar
Peter van 't Hof committed
23
24
25
26
27
/**
 * Extension for bwa mem
 *
 * Based on version 0.7.12-r1039
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
28
class BwaMem(val parent: Configurable) extends Bwa with Reference {
bow's avatar
bow committed
29
  @Input(doc = "Fastq file R1", shortName = "R1")
30
  var R1: File = _
bow's avatar
bow committed
31
32

  @Input(doc = "Fastq file R2", shortName = "R2", required = false)
33
  var R2: File = _
bow's avatar
bow committed
34
35

  @Input(doc = "The reference file for the bam files.", shortName = "R")
Ruben Vorderman's avatar
Ruben Vorderman committed
36
  var reference: File = _
bow's avatar
bow committed
37
38

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

Peter van 't Hof's avatar
Peter van 't Hof committed
41
  var R: Option[String] = config("R")
sajvanderzeeuw's avatar
sajvanderzeeuw committed
42
43
  var k: Option[Int] = config("k")
  var r: Option[Float] = config("r")
Peter van 't Hof's avatar
Peter van 't Hof committed
44
  var S: Boolean = config("S", default = false)
Ruben Vorderman's avatar
Ruben Vorderman committed
45
  var M: Boolean = config("M", default = false)
sajvanderzeeuw's avatar
sajvanderzeeuw committed
46
47
48
49
50
51
  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
52
53
  var P: Boolean = config("P", default = false)
  var e: Boolean = config("e", default = false)
sajvanderzeeuw's avatar
sajvanderzeeuw committed
54
55
  var A: Option[Int] = config("A")
  var B: Option[Int] = config("B")
Peter van 't Hof's avatar
Peter van 't Hof committed
56
57
58
  var O: Option[String] = config("O")
  var E: Option[String] = config("E")
  var L: Option[String] = config("L")
sajvanderzeeuw's avatar
sajvanderzeeuw committed
59
  var U: Option[Int] = config("U")
Peter van 't Hof's avatar
Peter van 't Hof committed
60
  var x: Option[String] = config("x")
Peter van 't Hof's avatar
Peter van 't Hof committed
61
  var p: Boolean = config("p", default = false)
sajvanderzeeuw's avatar
sajvanderzeeuw committed
62
63
64
  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
65
66
67
  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
68
  var I: Option[String] = config("I")
bow's avatar
bow committed
69

Peter van 't Hof's avatar
Peter van 't Hof committed
70
71
  override def defaultCoreMemory = 4.0
  override def defaultThreads = 8
bow's avatar
bow committed
72

Peter van 't Hof's avatar
Peter van 't Hof committed
73
74
  override def beforeGraph() {
    super.beforeGraph()
75
76
77
    if (reference == null) reference = referenceFasta()
  }

Ruben Vorderman's avatar
Ruben Vorderman committed
78
  def cmdLine: String = {
bow's avatar
bow committed
79
80
    required(executable) +
      required("mem") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
81
82
      optional("-k", k) +
      optional("-r", r) +
83
      optional("-t", threads) +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
84
      optional("-R", R) +
bow's avatar
bow committed
85
      conditional(M, "-M") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
86
      conditional(S, "-S") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
      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) +
102
      conditional(p, "-p") +
sajvanderzeeuw's avatar
sajvanderzeeuw committed
103
104
105
106
107
108
      optional("-v", v) +
      optional("-T", T) +
      optional("-h", h) +
      conditional(a, "-a") +
      conditional(C, "-C") +
      conditional(Y, "-Y") +
109
      optional("-I", I) +
Peter van 't Hof's avatar
Peter van 't Hof committed
110
111
112
      required(reference) +
      required(R1) +
      optional(R2) +
113
      (if (outputAsStsout) "" else " > " + required(output))
Peter van 't Hof's avatar
Peter van 't Hof committed
114
  }
Peter van 't Hof's avatar
Peter van 't Hof committed
115
}