XhmmMatrix.scala 3.32 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
/**
 * 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 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.
 */
Sander Bollen's avatar
Sander Bollen committed
15 16 17 18 19
package nl.lumc.sasc.biopet.extensions.xhmm

import java.io.File

import nl.lumc.sasc.biopet.utils.config.Configurable
Sander Bollen's avatar
Sander Bollen committed
20
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
Sander Bollen's avatar
Sander Bollen committed
21 22

/**
Sander Bollen's avatar
Sander Bollen committed
23 24
 * Created by Sander Bollen on 23-11-16.
 */
Sander Bollen's avatar
Sander Bollen committed
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
class XhmmMatrix(val root: Configurable) extends Xhmm {

  @Input
  var inputMatrix: File = _

  @Output
  var outputMatrix: File = _

  @Output(required = false)
  var outputExcludedTargets: Option[File] = None

  @Output(required = false)
  var outputExcludedSamples: Option[File] = None

  @Input(required = false)
  var inputExcludeTargets: List[File] = Nil

  @Input(required = false)
  var inputExcludeSamples: List[File] = Nil

45
  var minTargetSize: Int = config("min_target_size", namespace = "xhmm_matrix", default = 10)
Sander Bollen's avatar
Sander Bollen committed
46

47
  var maxTargetSize: Int = config("max_target_size", namespace = "xhmm_matrix", default = 10000)
Sander Bollen's avatar
Sander Bollen committed
48

49
  var minMeanTargetRD: Int = config("min_mean_target_rd", namespace = "xhmm_matrix", default = 10)
Sander Bollen's avatar
Sander Bollen committed
50

51
  var maxMeanTargetRD: Int = config("max_mean_target_rd", namespace = "xhmm_matrix", default = 500)
Sander Bollen's avatar
Sander Bollen committed
52

53
  var minMeanSampleRD: Int = config("min_mean_sample_rd", namespace = "xhmm_matrix", default = 25)
Sander Bollen's avatar
Sander Bollen committed
54

55
  var maxMeanSampleRD: Int = config("max_mean_sample_rd", namespace = "xhmm_matrix", default = 200)
Sander Bollen's avatar
Sander Bollen committed
56

57
  var maxSdSampleRD: Int = config("max_sd_sample_rd", namespace = "xhmm_matrix", default = 150)
Sander Bollen's avatar
Sander Bollen committed
58

59
  var maxsdTargetRD: Int = config("max_sd_target_rd", namespace = "xhmm_matrix", default = 30)
Sander Bollen's avatar
Sander Bollen committed
60 61 62 63 64 65 66 67 68 69 70

  var centerData: Boolean = false

  var centerType: String = "sample"

  var zScoreData: Boolean = false

  private def subCmdLine = {
    if (inputExcludeSamples.nonEmpty && inputExcludeTargets.nonEmpty) {
      repeat("--excludeTargets", inputExcludeTargets) + repeat("--excludeSamples", inputExcludeSamples)
    } else if (centerData && zScoreData) {
Sander Bollen's avatar
Sander Bollen committed
71 72 73 74
      conditional(centerData, "--centerData") +
        required("--centerType", centerType) +
        conditional(zScoreData, "--zScoreData") +
        required("--maxSdTargetRD", maxsdTargetRD)
Sander Bollen's avatar
Sander Bollen committed
75 76 77 78 79
    } else {
      required("--minTargetSize", minTargetSize) +
        required("--maxTargetSize", maxTargetSize) +
        required("--minMeanTargetRD", minMeanTargetRD) +
        required("--maxMeanTargetRD", maxMeanTargetRD) +
Sander Bollen's avatar
Sander Bollen committed
80 81
        required("--minMeanSampleRD", minMeanSampleRD) +
        required("--maxMeanSampleRD", maxMeanSampleRD) +
Sander Bollen's avatar
Sander Bollen committed
82 83 84 85 86 87 88 89 90
        required("--maxSdSampleRD", maxSdSampleRD)
    }

  }

  def cmdLine = {
    executable + required("--matrix") +
      required("-r", inputMatrix) +
      required("-o", outputMatrix) +
Sander Bollen's avatar
Sander Bollen committed
91 92
      optional("--outputExcludedTargets", outputExcludedTargets) +
      optional("--outputExcludedSamples", outputExcludedSamples) + subCmdLine
Sander Bollen's avatar
Sander Bollen committed
93 94 95
  }

}