BiopetQScript.scala 1.32 KB
Newer Older
1
2
3
package nl.lumc.sasc.biopet.core

import java.io.File
Peter van 't Hof's avatar
Peter van 't Hof committed
4
import java.io.PrintWriter
Peter van 't Hof's avatar
Peter van 't Hof committed
5
import nl.lumc.sasc.biopet.core.config._
Peter van 't Hof's avatar
Peter van 't Hof committed
6
7
8
import org.broadinstitute.gatk.utils.commandline._
import org.broadinstitute.gatk.queue.QSettings
import org.broadinstitute.gatk.queue.function.QFunction
9

10
11
12
trait BiopetQScript extends Configurable {
  @Argument(doc="Config Json file",shortName="config", required=false)
  val configfiles: List[File] = Nil
13
  
14
15
  @Argument(doc="Output directory", shortName="outputDir", required=true)
  var outputDir: String = _
16
  
17
  var outputFiles:Map[String,File] = Map()
18
  
Peter van 't Hof's avatar
Peter van 't Hof committed
19
20
  var qSettings: QSettings
  
21
22
23
24
  def init
  def biopetScript
  
  final def script() {
Peter van 't Hof's avatar
Peter van 't Hof committed
25
26
    for (file <- configfiles) globalConfig.loadConfigFile(file)
    if (!outputDir.endsWith("/")) outputDir += "/"
27
28
    init
    biopetScript
Peter van 't Hof's avatar
Peter van 't Hof committed
29
30
31
32
33
34
    val configReport = globalConfig.getReport
    val configReportFile = new File(outputDir + qSettings.runName + ".configreport.txt")
    val writer = new PrintWriter(configReportFile)
    writer.write(configReport)
    writer.close()
    for (line <- configReport.split("\n")) logger.debug(line)
35
  }
36
37
38
39
40
41
42
43
  
  def add(functions: QFunction*) // Gets implemeted at org.broadinstitute.sting.queue.QScript
  def add(function: QFunction, isIntermediate:Boolean = false) {
    function.isIntermediate = isIntermediate
    add(function)
  }
  
  
44
}