Bgzip.scala 1.75 KB
Newer Older
bow's avatar
bow committed
1
/**
2
3
4
5
6
7
8
9
10
11
12
13
14
  * 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 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.
  */
bow's avatar
bow committed
15
16
17
18
19
package nl.lumc.sasc.biopet.extensions

import java.io.File

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

/** Wrapper for the bgzip command */
Peter van 't Hof's avatar
Peter van 't Hof committed
25
class Bgzip(val parent: Configurable) extends BiopetCommandLineFunction {
bow's avatar
bow committed
26

Peter van 't Hof's avatar
Peter van 't Hof committed
27
  @Input(doc = "Input files", required = false)
bow's avatar
bow committed
28
29
  var input: List[File] = Nil

Peter van 't Hof's avatar
Peter van 't Hof committed
30
  @Output(doc = "Compressed output file", required = false)
Peter van 't Hof's avatar
Peter van 't Hof committed
31
  var output: File = _
bow's avatar
bow committed
32
33

  var f: Boolean = config("f", default = false)
Peter van 't Hof's avatar
Peter van 't Hof committed
34
  executable = config("exe", default = "bgzip", freeVar = false)
bow's avatar
bow committed
35

Peter van 't Hof's avatar
Peter van 't Hof committed
36
37
  override def beforeGraph(): Unit = {
    super.beforeGraph()
Peter van 't Hof's avatar
Typo    
Peter van 't Hof committed
38
    if (input.isEmpty && !inputAsStdin) Logging.addError("Input is missing for Bgzip")
Sander Bollen's avatar
Sander Bollen committed
39
    if (output == null && !outputAsStdout) Logging.addError("Output is missing for Bgzip")
Peter van 't Hof's avatar
Peter van 't Hof committed
40
41
  }

Peter van 't Hof's avatar
Peter van 't Hof committed
42
  def cmdLine: String =
43
44
45
    required(executable) +
      conditional(f, "-f") +
      " -c " + repeat(input) +
Sander Bollen's avatar
Sander Bollen committed
46
      (if (outputAsStdout) "" else " > " + required(output))
bow's avatar
bow committed
47
}