Skip to content
Snippets Groups Projects
Commit 326a21e5 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

switch to core rscript extension

parent 33aa9cd8
No related branches found
No related tags found
No related merge requests found
/**
* 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.pipelines.gentrap.extensions
import java.io.{ File, FileOutputStream }
import nl.lumc.sasc.biopet.core.BiopetCommandLineFunction
import org.broadinstitute.gatk.utils.commandline.Input
/**
* Trait for RScript wrappers
*/
trait RScriptCommandLineFunction extends BiopetCommandLineFunction {
@Input(doc = "R script file", required = false)
var RScript: File = _
executable = config("exe", default = "Rscript", submodule = "rscript")
protected var RScriptName: String = _
def setRScript(script: String) {
setRScript(script, "")
}
def setRScript(script: String, subpackage: String) {
RScriptName = script
// TODO: set .queue/tmp as a library-wide constant
RScript = new File(".queue/tmp/" + subpackage + RScriptName)
if (!RScript.getParentFile.exists)
RScript.getParentFile.mkdirs
val is = getClass.getResourceAsStream(subpackage + RScriptName)
val os = new FileOutputStream(RScript)
org.apache.commons.io.IOUtils.copy(is, os)
os.close()
}
def RScriptCommand: String = {
required(executable) + required(RScript)
}
}
......@@ -17,16 +17,16 @@ package nl.lumc.sasc.biopet.pipelines.gentrap.scripts
import java.io.File
import nl.lumc.sasc.biopet.core.extensions.RscriptCommandLineFunction
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.pipelines.gentrap.extensions.RScriptCommandLineFunction
import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
/**
* Wrapper for the plot_heatmap.R script, used internally in Gentrap
*/
class PlotHeatmap(val root: Configurable) extends RScriptCommandLineFunction {
class PlotHeatmap(val root: Configurable) extends RscriptCommandLineFunction {
setRScript("plot_heatmap.R", "/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/")
protected var script: File = config("script", default = "plot_heatmap.R")
@Input(doc = "Input table", required = true)
var input: File = null
......@@ -38,12 +38,12 @@ class PlotHeatmap(val root: Configurable) extends RScriptCommandLineFunction {
var useLog: Boolean = config("use_log", default = false)
var tmmNormalize: Boolean = config("tmm_normalize", default = false)
def cmdLine = {
RScriptCommand +
conditional(tmmNormalize, "-T") +
conditional(useLog, "-L") +
required("-C", countType) +
required("-I", input) +
required("-O", output)
}
override def cmd = super.cmd ++
(if (tmmNormalize) Seq("-T") else Seq()) ++
(if (useLog) Seq("-L") else Seq()) ++
(countType match {
case Some(t) => Seq("-C", t)
case _ => Seq()
}) ++
Seq("-I", input.getAbsolutePath, "-O", output.getAbsolutePath)
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment