diff --git a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/extensions/RScriptCommandLineFunction.scala b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/extensions/RScriptCommandLineFunction.scala deleted file mode 100644 index 3f44845bcc1c5c39fe498b496c573a7f3109f2b4..0000000000000000000000000000000000000000 --- a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/extensions/RScriptCommandLineFunction.scala +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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) - } -} diff --git a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/PlotHeatmap.scala b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/PlotHeatmap.scala index e93049732b32bfe4451fdb6d18a122d070f98c13..998ece67c01d447da59661b919f5e4222010ed39 100644 --- a/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/PlotHeatmap.scala +++ b/public/gentrap/src/main/scala/nl/lumc/sasc/biopet/pipelines/gentrap/scripts/PlotHeatmap.scala @@ -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) }