VarscanMpileup2cns.scala 2.79 KB
Newer Older
bow's avatar
bow committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * 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.
 */
package nl.lumc.sasc.biopet.extensions.varscan

import java.io.File

Peter van 't Hof's avatar
Peter van 't Hof committed
20
import nl.lumc.sasc.biopet.utils.config.Configurable
Peter van 't Hof's avatar
Peter van 't Hof committed
21
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
bow's avatar
bow committed
22

23
class VarscanMpileup2cns(val root: Configurable) extends Varscan {
bow's avatar
bow committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

  @Input(doc = "Input mpileup file", required = false) // if not defined, input is stdin
  var input: Option[File] = None

  @Output(doc = "Output file", required = false) // if not defined, output is stdout
  var output: Option[File] = None

  var minCoverage: Option[Int] = config("min_coverage")
  var minReads2: Option[Int] = config("min_reads_2")
  var minAvgQual: Option[Int] = config("min_avg_qual")
  var minVarFreq: Option[Double] = config("min_var_freq")
  var minFreqForHom: Option[Double] = config("min_freq_for_hom")
  var pValue: Option[Double] = config("p_value")
  var strandFilter: Option[Int] = config("strand_filter")
  var outputVcf: Option[Int] = config("output_vcf")
  var vcfSampleList: Option[File] = config("vcf_sample_list")
  var variants: Option[Int] = config("variants")

Peter van 't Hof's avatar
Peter van 't Hof committed
42
  override def beforeGraph(): Unit = {
bow's avatar
bow committed
43
44
45
46
47
48
49
    val validValues: Set[Int] = Set(0, 1)
    // check for boolean vars that are passed as ints
    strandFilter.foreach { case v => require(validValues.contains(v), "strand_filter value must be either 0 or 1") }
    outputVcf.foreach { case v => require(validValues.contains(v), "output_vcf value must be either 0 or 1") }
    variants.foreach { case v => require(validValues.contains(v), "variants value must be either 0 or 1") }
  }

50
51
52
53
54
55
56
57
58
59
60
61
62
  override def cmdLine = super.cmdLine + required("mpileup2cns") +
    required(input) +
    optional("--min-coverage", minCoverage) +
    optional("--min-reads2", minReads2) +
    optional("--min-avg-qual", minAvgQual) +
    optional("--min-var-freq", minVarFreq) +
    optional("--min-freq-for-hom", minFreqForHom) +
    optional("--p-value", pValue) +
    optional("--strand-filter", strandFilter) +
    optional("--output-vcf", outputVcf) +
    optional("--vcf-sample-list", vcfSampleList) +
    optional("--variants", variants) +
    (if (outputAsStsout) "" else " > " + required(output))
bow's avatar
bow committed
63
}