ConiferAnalyze.scala 2.78 KB
Newer Older
Wai Yi Leung's avatar
Wai Yi Leung committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
 * 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.conifer

import java.io.File

import nl.lumc.sasc.biopet.core.config.Configurable
Wai Yi Leung's avatar
Wai Yi Leung committed
21
22
import nl.lumc.sasc.biopet.extensions.Ln
import org.broadinstitute.gatk.utils.commandline.{ Argument, Input, Output }
Wai Yi Leung's avatar
Wai Yi Leung committed
23
24
25
26
27
28

class ConiferAnalyze(val root: Configurable) extends Conifer {

  @Input(doc = "Probes / capture kit definition as bed file: chr,start,stop,gene-annot", required = true)
  var probes: File = _

Wai Yi Leung's avatar
Wai Yi Leung committed
29
30
  //  @Input(doc = "Path to Conifer RPKM files", required = true)
  var rpkmDir: File = _
Wai Yi Leung's avatar
Wai Yi Leung committed
31

Wai Yi Leung's avatar
Wai Yi Leung committed
32
  @Output(doc = "Output analyse.hdf5", shortName = "out")
Wai Yi Leung's avatar
Wai Yi Leung committed
33
34
35
  var output: File = _

  @Argument(doc = "SVD, number of components to remove", minRecommendedValue = 2, maxRecommendedValue = 5,
Wai Yi Leung's avatar
Wai Yi Leung committed
36
37
    minValue = 2, maxValue = 20, required = false)
  var svd: Option[Int] = config("svd", default = 1)
Wai Yi Leung's avatar
Wai Yi Leung committed
38

Wai Yi Leung's avatar
Wai Yi Leung committed
39
  @Argument(doc = "Minimum population median RPKM per probe", required = false)
Wai Yi Leung's avatar
Wai Yi Leung committed
40
41
  var min_rpkm: Option[Double] = config("min_rpkm")

Wai Yi Leung's avatar
Wai Yi Leung committed
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  override def afterGraph: Unit = {
    super.afterGraph
    //
    //    // create new RPKM_dir with the controls in it together with the subject
    //    new_rpkm_dir = new File(this.output.getParent() + File.separator + "rpkm_tmp")
    //    logger.info("Creating " + new_rpkm_dir.getAbsolutePath)
    //    new_rpkm_dir.mkdir()
    //
    //    for (f <- rpkm_dir.listFiles()) {
    //      var target = new File(new_rpkm_dir + File.separator + f.getName)
    //      if (!target.exists()) {
    //        logger.info("Creating " + target.getAbsolutePath)
    //        Ln(this, f, target, true).run
    //      }
    //    }
    //    for (f <- rpkm_refdir.listFiles()) {
    //      var target = new File(new_rpkm_dir + File.separator + f.getName)
    //      if (!target.exists()) {
    //        logger.info("Creating " + target.getAbsolutePath)
    //        Ln(this, f, target, true).run
    //      }
    //    }
Wai Yi Leung's avatar
Wai Yi Leung committed
64
65
  }

Wai Yi Leung's avatar
Wai Yi Leung committed
66
67
  override def cmdLine = super.cmdLine +
    " analyze " +
Wai Yi Leung's avatar
Wai Yi Leung committed
68
    " --probes" + required(probes) +
Wai Yi Leung's avatar
Wai Yi Leung committed
69
    " --rpkm_dir" + required(rpkmDir) +
Wai Yi Leung's avatar
Wai Yi Leung committed
70
    " --output" + required(output) +
Wai Yi Leung's avatar
Wai Yi Leung committed
71
    optional("--svd", svd) +
Wai Yi Leung's avatar
Wai Yi Leung committed
72
73
    optional("--min_rpkm", min_rpkm)
}