StringtieMerge.scala 1.56 KB
Newer Older
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)
Peter van 't Hof's avatar
Peter van 't Hof committed
12
13
14
    extends BiopetCommandLineFunction
    with Reference
    with Version {
15

Peter van 't Hof's avatar
Peter van 't Hof committed
16
  executable = config("exe", "stringtie")
17

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

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

Peter van 't Hof's avatar
Peter van 't Hof committed
24
25
  @Output
  var outputGtf: File = _
26

Peter van 't Hof's avatar
Peter van 't Hof 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)
35

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

Peter van 't Hof's avatar
Peter van 't Hof committed
39
  /** Regex to get version from version command output */
Peter van 't Hof's avatar
Peter van 't Hof committed
40
  def versionRegex: Regex = "(.*)".r
41

Peter van 't Hof's avatar
Peter van 't Hof committed
42
43
  def cmdLine: String =
    required(executable) +
Peter van 't Hof's avatar
Peter van 't Hof committed
44
45
46
47
48
49
50
51
52
53
54
55
      required("--merge") +
      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)
Peter van 't Hof's avatar
Peter van 't Hof committed
56
57

}