CentrifugeKreport.scala 2.25 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof 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.
 */
15
16
17
18
19
20
package nl.lumc.sasc.biopet.extensions.centrifuge

import java.io.File

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

/**
24
25
 * Created by pjvanthof on 19/09/16.
 */
26
27
28
29
30
31
32
class CentrifugeKreport(val root: Configurable) extends BiopetCommandLineFunction {
  @Input(doc = "Output files centrifuge", required = true)
  var centrifugeOutputFiles: List[File] = Nil

  @Output(doc = "Output report")
  var output: File = _

33
  var index: File = config("centrifuge_index", namespace = "centrifuge")
34

Peter van 't Hof's avatar
Peter van 't Hof committed
35
36
37
  var onlyUnique: Boolean = config("only_unique", default = false)
  var showZeros: Boolean = config("show_zeros", default = false)
  var isCounts: Boolean = config("is_counts", default = false)
38
39
40
41

  var minScore: Option[Double] = config("min_score")
  var minLength: Option[Int] = config("min_length")

Peter van 't Hof's avatar
Peter van 't Hof committed
42
43
  override def defaultCoreMemory = 4.0

44
45
  executable = config("exe", default = "centrifuge-kreport", freeVar = false)

Peter van 't Hof's avatar
Peter van 't Hof committed
46
47
  override def beforeGraph(): Unit = {
    super.beforeGraph()
Peter van 't Hof's avatar
Peter van 't Hof committed
48
49
50
    deps :+= new File(index + ".1.cf")
    deps :+= new File(index + ".2.cf")
    deps :+= new File(index + ".3.cf")
Peter van 't Hof's avatar
Peter van 't Hof committed
51
52
  }

53
  def cmdLine = executable +
54
55
    conditional(onlyUnique, "--only-unique") +
    conditional(showZeros, "--show-zeros") +
Peter van 't Hof's avatar
Peter van 't Hof committed
56
    conditional(isCounts, "--is-counts") +
57
58
    optional("--min-score=", minScore, spaceSeparated = false) +
    optional("--min-length=", minLength, spaceSeparated = false) +
59
    required("-x", index) +
Peter van 't Hof's avatar
Peter van 't Hof committed
60
61
    repeat(centrifugeOutputFiles) +
    " > " + required(output)
62
}