CollectWgsMetrics.scala 2.04 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
3
4
5
package nl.lumc.sasc.biopet.extensions.picard

import java.io.File

import nl.lumc.sasc.biopet.core.config.Configurable
6
import nl.lumc.sasc.biopet.core.summary.Summarizable
Peter van 't Hof's avatar
Peter van 't Hof committed
7
8
9
10
11
import org.broadinstitute.gatk.utils.commandline.{ Argument, Output, Input }

/**
 * Created by pjvan_thof on 4/16/15.
 */
12
class CollectWgsMetrics(val root: Configurable) extends Picard with Summarizable {
Peter van 't Hof's avatar
Peter van 't Hof committed
13
14
15
16
17
18
19
20
21
22
23
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

  javaMainClass = new picard.analysis.CollectWgsMetrics().getClass.getName

  @Input(doc = "The input SAM or BAM files to analyze", required = true)
  var input: File = null

  @Output(doc = "Metrics file", required = true)
  var output: File = null

  @Input(doc = "Reference", required = true)
  var reference: File = config("reference")

  @Argument(doc = "MINIMUM_MAPPING_QUALITY", required = false)
  var minMapQ: Option[Int] = config("minimum_mapping_quality")

  @Argument(doc = "MINIMUM_BASE_QUALITY", required = false)
  var minBaseQ: Option[Int] = config("minimum_base_quality")

  @Argument(doc = "COVERAGE_CAP", required = false)
  var covCap: Option[Int] = config("coverage_cap")

  @Argument(doc = "STOP_AFTER", required = false)
  var stopAfter: Option[Long] = config("stop_after")

  @Argument(doc = "INCLUDE_BQ_HISTOGRAM", required = false)
  var includeBqHistogram: Boolean = config("include_bq_histogram", default = false)

  override def commandLine = super.commandLine +
    required("INPUT=", input, spaceSeparated = false) +
    required("OUTPUT=", output, spaceSeparated = false) +
    required("REFERENCE_SEQUENCE=", reference, spaceSeparated = false) +
    optional("MINIMUM_MAPPING_QUALITY=", minMapQ, spaceSeparated = false) +
    optional("MINIMUM_BASE_QUALITY=", minBaseQ, spaceSeparated = false) +
    optional("COVERAGE_CAP=", covCap, spaceSeparated = false) +
    optional("STOP_AFTER=", stopAfter, spaceSeparated = false) +
    conditional(includeBqHistogram, "INCLUDE_BQ_HISTOGRAM=true")
49
50
51
52
53

  /** Returns files for summary */
  def summaryFiles: Map[String, File] = Map()

  /** Returns stats for summary */
Peter van 't Hof's avatar
Peter van 't Hof committed
54
  def summaryStats = Picard.getMetrics(output).getOrElse(Map())
Peter van 't Hof's avatar
Peter van 't Hof committed
55
}