Bowtie.scala 2.9 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.
 */
16
17
18
package nl.lumc.sasc.biopet.extensions

import java.io.File
19
20
21
22
23

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

Peter van 't Hof's avatar
Peter van 't Hof committed
24
25
26
27
28
/**
 * Extension for bowtie 1
 *
 * Based on version 1.1.1
 */
29
30
class Bowtie(val root: Configurable) extends BiopetCommandLineFunction {
  @Input(doc = "Fastq file R1", shortName = "R1")
31
  var R1: File = null
32
33

  @Input(doc = "Fastq file R2", shortName = "R2", required = false)
34
  var R2: Option[File] = None
35

36
  @Input(doc = "The reference file for the bam files.", shortName = "R", required = true)
37
  var reference: File = config("reference")
38

39
40
  @Output(doc = "Output file SAM", shortName = "output", required = true)
  var output: File = null
41
42

  executable = config("exe", default = "bowtie", freeVar = false)
Peter van 't Hof's avatar
Peter van 't Hof committed
43
  override val versionRegex = """.*[Vv]ersion:? (.*)""".r
44
45
  override val versionExitcode = List(0, 1)
  override def versionCommand = executable + " --version"
Peter van 't Hof's avatar
Peter van 't Hof committed
46

47
48
49
50
  override val defaultVmem = "6G"
  override val defaultThreads = 8

  var sam: Boolean = config("sam", default = true)
Peter van 't Hof's avatar
Peter van 't Hof committed
51
  var sam_RG: Option[String] = config("sam-RG")
52
  var seedlen: Option[Int] = config("seedlen")
Peter van 't Hof's avatar
Peter van 't Hof committed
53
  var seedmms: Option[Int] = config("seedmms")
54
55
  var k: Option[Int] = config("k")
  var m: Option[Int] = config("m")
Peter van 't Hof's avatar
Peter van 't Hof committed
56
  var best: Boolean = config("best", default = false)
57
  var maxbts: Option[Int] = config("maxbts")
Peter van 't Hof's avatar
Peter van 't Hof committed
58
  var strata: Boolean = config("strata", default = false)
59
  var maqerr: Option[Int] = config("maqerr")
Peter van 't Hof's avatar
Peter van 't Hof committed
60

Peter van 't Hof's avatar
Peter van 't Hof committed
61
  /** return commandline to execute */
62
63
64
65
  def cmdLine = {
    required(executable) +
      optional("--threads", nCoresRequest) +
      conditional(sam, "--sam") +
66
67
68
69
      conditional(best, "--best") +
      conditional(strata, "--strata") +
      optional("--sam-RG", sam_RG) +
      optional("--seedlen", seedlen) +
Peter van 't Hof's avatar
Peter van 't Hof committed
70
71
72
      optional("--seedmms", seedmms) +
      optional("-k", k) +
      optional("-m", m) +
73
74
      optional("--maxbts", maxbts) +
      optional("--maqerr", maqerr) +
75
      required(reference) +
76
77
78
79
80
81
82
      (R2 match {
        case Some(r2) => {
          required("-1", R1) +
            optional("-2", r2)
        }
        case _ => required(R1)
      }) +
83
84
85
      " > " + required(output)
  }
}