StringtieMerge.scala 1.53 KB
Newer Older
pjvan_thof's avatar
pjvan_thof committed
1 2 3 4 5 6 7 8 9 10 11
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 StringtieMerge(val parent: Configurable)
pjvan_thof's avatar
pjvan_thof committed
12 13 14
    extends BiopetCommandLineFunction
    with Reference
    with Version {
pjvan_thof's avatar
pjvan_thof committed
15

pjvan_thof's avatar
pjvan_thof committed
16
  executable = config("exe", "stringtie")
pjvan_thof's avatar
pjvan_thof committed
17

pjvan_thof's avatar
pjvan_thof committed
18 19
  @Input(required = true)
  var inputGtfs: List[File] = Nil
20

pjvan_thof's avatar
pjvan_thof committed
21 22
  @Input(required = false)
  var referenceGtf: Option[File] = None
pjvan_thof's avatar
pjvan_thof committed
23

pjvan_thof's avatar
pjvan_thof committed
24 25
  @Output
  var outputGtf: File = _
pjvan_thof's avatar
pjvan_thof committed
26

pjvan_thof's avatar
pjvan_thof committed
27 28 29 30 31 32 33 34
  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 c: Option[Float] = config("c")
  var F: Option[Double] = config("F")
  var T: Option[Double] = config("T")
  var i: Boolean = config("i", default = false)
pjvan_thof's avatar
pjvan_thof committed
35

pjvan_thof's avatar
pjvan_thof committed
36 37
  /** Command to get version of executable */
  def versionCommand: String = executable + " --version"
pjvan_thof's avatar
pjvan_thof committed
38

pjvan_thof's avatar
pjvan_thof committed
39 40
  /** Regex to get version from version command output */
  def versionRegex: Regex = ".*".r
pjvan_thof's avatar
pjvan_thof committed
41

pjvan_thof's avatar
pjvan_thof committed
42 43
  def cmdLine: String =
    required(executable) +
44
      required("--merge")
pjvan_thof's avatar
pjvan_thof committed
45 46 47 48 49 50 51 52 53 54 55 56 57
  conditional(v, "-v") +
    required("-p", threads) +
    optional("-l", l) +
    optional("-f", f) +
    optional("-m", m) +
    optional("-c", c) +
    optional("-F", F) +
    conditional(i, "-i") +
    optional("-G", referenceGtf) +
    (if (outputAsStdout) "" else required("-o", outputGtf)) +
    repeat(inputGtfs)

}