SquishBed.scala 1.51 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/**
 * 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.
 */
Peter van 't Hof's avatar
Peter van 't Hof committed
16 17
package nl.lumc.sasc.biopet.scripts

Peter van 't Hof's avatar
Peter van 't Hof committed
18 19
import java.io.File

Peter van 't Hof's avatar
Peter van 't Hof committed
20 21 22 23 24 25 26 27 28 29 30 31
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions.PythonCommandLineFunction
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }

class SquishBed(val root: Configurable) extends PythonCommandLineFunction {
  setPythonScript("bed_squish.py")

  @Input(doc = "Input file")
  var input: File = _

  @Output(doc = "output File")
  var output: File = _
Peter van 't Hof's avatar
Peter van 't Hof committed
32

Peter van 't Hof's avatar
Peter van 't Hof committed
33
  def cmdLine = getPythonCommand +
Peter van 't Hof's avatar
Peter van 't Hof committed
34
    required(input) +
Peter van 't Hof's avatar
Peter van 't Hof committed
35 36 37 38
    required(output)
}

object SquishBed {
Peter van 't Hof's avatar
Peter van 't Hof committed
39
  def apply(root: Configurable, input: File, outputDir: File): SquishBed = {
Peter van 't Hof's avatar
Peter van 't Hof committed
40 41 42
    val squishBed = new SquishBed(root)
    squishBed.input = input
    squishBed.output = new File(outputDir, input.getName.stripSuffix(".bed") + ".squish.bed")
Peter van 't Hof's avatar
Peter van 't Hof committed
43
    squishBed
Peter van 't Hof's avatar
Peter van 't Hof committed
44 45
  }
}