Commit f072f096 authored by Peter van 't Hof's avatar Peter van 't Hof

Adding precommands

parent ca6efa52
...@@ -18,7 +18,7 @@ import java.io.{ File, FileInputStream, PrintWriter } ...@@ -18,7 +18,7 @@ import java.io.{ File, FileInputStream, PrintWriter }
import java.security.MessageDigest import java.security.MessageDigest
import nl.lumc.sasc.biopet.utils.Logging import nl.lumc.sasc.biopet.utils.Logging
import org.broadinstitute.gatk.utils.commandline.{ Gather, Input, Output } import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
import org.broadinstitute.gatk.utils.runtime.ProcessSettings import org.broadinstitute.gatk.utils.runtime.ProcessSettings
import org.ggf.drmaa.JobTemplate import org.ggf.drmaa.JobTemplate
...@@ -40,6 +40,8 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction => ...@@ -40,6 +40,8 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
def defaultRemoteCommand = "bash" def defaultRemoteCommand = "bash"
private val remoteCommand: String = config("remote_command", default = defaultRemoteCommand) private val remoteCommand: String = config("remote_command", default = defaultRemoteCommand)
val preCommands: List[String] = config("pre_commands", default = Nil)
private def changeScript(file: File): Unit = { private def changeScript(file: File): Unit = {
val lines = Source.fromFile(file).getLines().toList val lines = Source.fromFile(file).getLines().toList
val writer = new PrintWriter(file) val writer = new PrintWriter(file)
...@@ -219,7 +221,8 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction => ...@@ -219,7 +221,8 @@ trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
*/ */
override final def commandLine: String = { override final def commandLine: String = {
preCmdInternal() preCmdInternal()
val cmd = cmdLine + val cmd = preCommands.mkString("\n", "\n", "\n") +
cmdLine +
stdinFile.map(file => " < " + required(file.getAbsoluteFile)).getOrElse("") + stdinFile.map(file => " < " + required(file.getAbsoluteFile)).getOrElse("") +
stdoutFile.map(file => " > " + required(file.getAbsoluteFile)).getOrElse("") stdoutFile.map(file => " > " + required(file.getAbsoluteFile)).getOrElse("")
addJobReportBinding("command", cmd) addJobReportBinding("command", cmd)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment