PindelVCF.scala 4.21 KB
Newer Older
Wai Yi Leung's avatar
Wai Yi Leung committed
1
2
3
4
5
6
7
8
9
package nl.lumc.sasc.biopet.extensions.pindel

import java.io.File

import nl.lumc.sasc.biopet.core.{ Version, Reference, BiopetCommandLineFunction }
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.{ Output, Input }

/**
10
11
 * Created by wyleung on 20-1-16.
 */
Wai Yi Leung's avatar
Wai Yi Leung committed
12
13
14
15
16
17
class PindelVCF(val root: Configurable) extends BiopetCommandLineFunction with Reference with Version {
  executable = config("exe", default = "pindel2vcf")

  override def defaultCoreMemory = 2.0
  override def defaultThreads = 1

18
19
  def versionRegex = """Version:?[ ]+(.*)""".r
  override def versionExitcode = List(0)
Wai Yi Leung's avatar
Wai Yi Leung committed
20
21
22
  def versionCommand = executable + " -h"

  /**
23
24
   * Required parameters
   */
Wai Yi Leung's avatar
Wai Yi Leung committed
25
26
27
28
29
30
  @Input
  var reference: File = referenceFasta

  @Output
  var outputVCF: File = _

31
  var rDate: String = config("rdate", freeVar = false)
Wai Yi Leung's avatar
Wai Yi Leung committed
32
33
34

  override def beforeGraph: Unit = {
    if (reference == null) reference = referenceFasta()
35
    println(pindelOutputInputHolder)
Wai Yi Leung's avatar
Wai Yi Leung committed
36
37
  }

38
  @Input(doc = "Make this file a dependency before pindel2vcf can run. Usually a file generated by Pindel such as a _D file")
39
40
  var pindelOutputInputHolder: File = _

Wai Yi Leung's avatar
Wai Yi Leung committed
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
  var pindelOutput: Option[File] = config("pindel_output")
  var pindelOutputRoot: Option[File] = config("pindel_output_root")
  var chromosome: Option[String] = config("chromosome")
  var windowSize: Option[Int] = config("window_size")
  var minCoverage: Option[Int] = config("min_coverage")
  var hetCutoff: Option[Float] = config("het_cutoff")
  var homCutoff: Option[Float] = config("hom_cutoff")
  var minSize: Option[Int] = config("min_size")
  var maxSize: Option[Int] = config("max_size")
  var bothStrandSupported: Boolean = config("both_strand_supported", default = false)
  var minSupportingSamples: Option[Int] = config("min_supporting_samples")
  var minSupportingReads: Option[Int] = config("min_supporting_reads")
  var maxSupportingReads: Option[Int] = config("max_supporting_reads")
  var regionStart: Option[Int] = config("region_start")
  var regionEnd: Option[Int] = config("region_end")
  var maxInternalRepeats: Option[Int] = config("max_internal_repeats")
  var compactOutLimit: Option[Int] = config("compact_output_limit")
  var maxInternalRepeatLength: Option[Int] = config("max_internal_repeatlength")
  var maxPostindelRepeats: Option[Int] = config("max_postindel_repeat")
  var maxPostindelRepeatLength: Option[Int] = config("max_postindel_repeatlength")
61
62
  var onlyBalancedSamples: Boolean = config("only_balanced_samples", default = false)
  var somaticP: Boolean = config("somatic_p", default = false)
Wai Yi Leung's avatar
Wai Yi Leung committed
63
  var minimumStrandSupport: Option[Int] = config("minimum_strand_support")
64
  var gatkCompatible: Boolean = config("gatk_compatible", default = false)
Wai Yi Leung's avatar
Wai Yi Leung committed
65
66

  def cmdLine = required(executable) +
67
    required("--reference", reference) +
Wai Yi Leung's avatar
Wai Yi Leung committed
68
    required("--reference_name", referenceSpecies) +
69
    required("--reference_date", rDate) +
70
    required("--fake_biopet_input_holder", pindelOutputInputHolder) +
Wai Yi Leung's avatar
Wai Yi Leung committed
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
    optional("--pindel_output", pindelOutput) +
    optional("--pindel_output_root", pindelOutputRoot) +
    required("--vcf", outputVCF) +
    optional("--chromosome", chromosome) +
    optional("--window_size", windowSize) +
    optional("--min_coverage", minCoverage) +
    optional("--het_cutoff", hetCutoff) +
    optional("--hom_cutoff", homCutoff) +
    optional("--min_size", minSize) +
    optional("--max_size", maxSize) +
    conditional(bothStrandSupported, "--both_strands_supported") +
    optional("--min_supporting_samples", minSupportingSamples) +
    optional("--min_supporting_reads", minSupportingReads) +
    optional("--max_supporting_reads", maxSupportingReads) +
    optional("--region_start", regionStart) +
    optional("--region_end", regionEnd) +
    optional("--max_internal_repeats", maxInternalRepeats) +
    optional("--compact_output_limit", compactOutLimit) +
    optional("--max_internal_repeatlength", maxInternalRepeatLength) +
    optional("--max_postindel_repeats", maxPostindelRepeats) +
    optional("--max_postindel_repeatlength", maxPostindelRepeatLength) +
    conditional(onlyBalancedSamples, "--only_balanced_samples") +
    conditional(somaticP, "--somatic_p") +
    optional("--minimum_strand_support", minimumStrandSupport) +
    conditional(gatkCompatible, "--gatk_compatible")
}