CatVariants.scala 1.83 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * 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.
 */
package nl.lumc.sasc.biopet.extensions.gatk

import java.io.File

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

Peter van 't Hof's avatar
Peter van 't Hof committed
24
class CatVariants(val root: Configurable) extends BiopetJavaCommandLineFunction with Reference {
25

Peter van 't Hof's avatar
Peter van 't Hof committed
26
  javaMainClass = classOf[org.broadinstitute.gatk.tools.CatVariants].getName
Peter van 't Hof's avatar
Peter van 't Hof committed
27
28

  @Input(required = true)
29
30
  var inputFiles: List[File] = Nil

Peter van 't Hof's avatar
Peter van 't Hof committed
31
  @Output(required = true)
32
33
  var outputFile: File = null

Peter van 't Hof's avatar
Peter van 't Hof committed
34
35
  @Input
  var reference: File = null
36

Peter van 't Hof's avatar
Peter van 't Hof committed
37
38
  var assumeSorted = false

Peter van 't Hof's avatar
Peter van 't Hof committed
39
40
41
42
43
44
45
46
  override def beforeGraph(): Unit = {
    super.beforeGraph()
    if (reference == null) reference = referenceFasta()
  }

  override def cmdLine = super.cmdLine +
    repeat("-V", inputFiles) +
    required("-out", outputFile) +
Peter van 't Hof's avatar
Peter van 't Hof committed
47
48
    required("-R", reference) +
    conditional(assumeSorted, "--assumeSorted")
49
50
51
52
53
54
55
56
57
58
}

object CatVariants {
  def apply(root: Configurable, input: List[File], output: File): CatVariants = {
    val cv = new CatVariants(root)
    cv.inputFiles = input
    cv.outputFile = output
    cv
  }
}