CollectWgsMetrics.scala 3.04 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
15
/**
 * 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 that are
 * not part of GATK Queue 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.
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
16
17
18
19
package nl.lumc.sasc.biopet.extensions.picard

import java.io.File

20
import nl.lumc.sasc.biopet.core.Reference
Peter van 't Hof's avatar
Peter van 't Hof committed
21
import nl.lumc.sasc.biopet.core.config.Configurable
22
import nl.lumc.sasc.biopet.core.summary.Summarizable
Peter van 't Hof's avatar
Peter van 't Hof committed
23
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
Peter van 't Hof's avatar
Peter van 't Hof committed
24
25

/**
Peter van 't Hof's avatar
Peter van 't Hof committed
26
27
 * Extension for piacrda's CollectWgsMetrics
 *
Peter van 't Hof's avatar
Peter van 't Hof committed
28
29
 * Created by pjvan_thof on 4/16/15.
 */
30
class CollectWgsMetrics(val root: Configurable) extends Picard with Summarizable with Reference {
Peter van 't Hof's avatar
Peter van 't Hof committed
31
32
33
34
35
36
37
38
39
40

  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)
41
  var reference: File = null
Peter van 't Hof's avatar
Peter van 't Hof committed
42
43
44
45
46
47
48
49

  @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)
Peter van 't Hof's avatar
Peter van 't Hof committed
50
  var covCap: Option[Int] = config("coverage_cap")
Peter van 't Hof's avatar
Peter van 't Hof committed
51
52
53
54
55
56
57

  @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)

Peter van 't Hof's avatar
Peter van 't Hof committed
58
59
  override def defaultCoreMemory = 6.0

Peter van 't Hof's avatar
Peter van 't Hof committed
60
61
  override def beforeGraph() {
    super.beforeGraph()
62
63
64
    if (reference == null) reference = referenceFasta()
  }

Peter van 't Hof's avatar
Peter van 't Hof committed
65
66
67
68
69
70
71
72
73
  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")
74
75
76
77
78

  /** 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
79
80
81
82
  def summaryStats = Map(
    "metrics" -> Picard.getMetrics(output),
    "histogram" -> Picard.getHistogram(output)
  )
Peter van 't Hof's avatar
Peter van 't Hof committed
83
}