Stringtie.scala 2.28 KB
Newer Older
pjvan_thof's avatar
pjvan_thof committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
package nl.lumc.sasc.biopet.extensions.stringtie

import java.io.File

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

import scala.util.matching.Regex

class Stringtie(val parent: Configurable)
  extends BiopetCommandLineFunction
    with Reference
    with Version {

  executable = config("exe", "stringtie")

  @Input(required = true)
  var inputBam: File = _

21 22 23
  @Input(required = false)
  var referenceGtf: Option[File] = None

pjvan_thof's avatar
pjvan_thof committed
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
  @Output
  var outputGtf: File = _

  @Output
  var geneAbundances: Option[File] = None

  @Output
  var referenceCoverage: Option[File] = None

  var rf: Boolean = config("rf", default = false)
  var fr: Boolean = config("fr", default = false)

  var v: Boolean = config("v", default = logger.isDebugEnabled)
  var l: Option[String] = None
  var f: Option[Double] = config("f")
  var m: Option[Int] = config("m")
  var a: Option[Int] = config("a")
  var j: Option[Float] = config("j")
  var t: Boolean = config("t", default = false)
  var c: Option[Float] = config("c")
  var g: Option[Int] = config("g")
  var B: Boolean = config("B", default = false)
  var b: Option[String] = config("b")
  var e: Boolean = config("e", default = false)
  var M: Option[Float] = config("M")
  var x: List[String] = config("x", default = Nil)

  /** Command to get version of executable */
  def versionCommand: String = executable + " --version"

  /** Regex to get version from version command output */
  def versionRegex: Regex = ".*".r

  def cmdLine: String = required(executable) +
58
    required(inputBam) +
pjvan_thof's avatar
pjvan_thof committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    conditional(v, "-v") +
    required("-p", threads) +
    conditional(rf, "--rf") +
    conditional(fr, "--fr") +
    optional("-l", l) +
    optional("-f", f) +
    optional("-m", m) +
    optional("-A", geneAbundances) +
    optional("-C", referenceCoverage) +
    optional("-a", a) +
    optional("-j", j) +
    conditional(t, "-t") +
    optional("-c", c) +
    optional("-g", g) +
    conditional(B, "-B") +
    optional("-b", b) +
    conditional(e, "-e") +
    optional("-M", M) +
77
    optional("-G", referenceGtf) +
pjvan_thof's avatar
pjvan_thof committed
78 79 80 81
    (if (x.nonEmpty) optional("-x", x.mkString(",")) else "") +
    (if (outputAsStdout) "" else required("-o", outputGtf))

}