Commit 978b8381 authored by Peter van 't Hof's avatar Peter van 't Hof

Added more scala docs

parent ba287a2d
......@@ -17,16 +17,28 @@ package nl.lumc.sasc.biopet.core
import org.broadinstitute.gatk.queue.function.JavaCommandLineFunction
/**
* Biopet commandline class for java based programs
*/
trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetCommandLineFunctionTrait {
executable = "java"
executable = config("java", default = "java", submodule = "java", freeVar = false)
javaGCThreads = config("java_gc_threads")
javaGCHeapFreeLimit = config("java_gc_heap_freelimit")
javaGCTimeLimit = config("java_gc_timelimit")
override def javaOpts = super.javaOpts + optional("-Dscala.concurrent.context.numThreads=", threads, spaceSeparated = false, escape = false)
/**
* Constructs java opts, this adds scala threads
* @return
*/
override def javaOpts = super.javaOpts +
optional("-Dscala.concurrent.context.numThreads=", threads, spaceSeparated = false, escape = false)
/**
* Sets memory limit
*/
override def afterGraph {
super.afterGraph
memoryLimit = config("memory_limit")
}
......@@ -38,7 +50,6 @@ trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetC
preCmdInternal
val cmd = super.commandLine
val finalCmd = executable + cmd.substring(cmd.indexOf(" "))
// addJobReportBinding("command", cmd)
return cmd
}
}
......@@ -24,6 +24,9 @@ import org.broadinstitute.gatk.queue.function.QFunction
import org.broadinstitute.gatk.queue.function.scattergather.ScatterGatherableFunction
import org.broadinstitute.gatk.queue.util.{ Logging => GatkLogging }
/**
* Base for biopet pipeline
*/
trait BiopetQScript extends Configurable with GatkLogging {
@Argument(doc = "JSON config file(s)", fullName = "config_file", shortName = "config", required = false)
......@@ -43,13 +46,21 @@ trait BiopetQScript extends Configurable with GatkLogging {
var outputFiles: Map[String, File] = Map()
/** Get implemented from org.broadinstitute.gatk.queue.QScript */
var qSettings: QSettings
/** Get implemented from org.broadinstitute.gatk.queue.QScript */
var functions: Seq[QFunction]
/** Init for pipeline */
def init
def biopetScript
var functions: Seq[QFunction]
/** Pipeline itself */
def biopetScript
/**
* Script from queue itself, final to force some checks for each pipeline and write report
*/
final def script() {
outputDir = config("output_dir", required = true)
if (!outputDir.endsWith("/")) outputDir += "/"
......@@ -68,10 +79,16 @@ trait BiopetQScript extends Configurable with GatkLogging {
Config.global.writeReport(qSettings.runName, outputDir + ".log/" + qSettings.runName)
}
def add(functions: QFunction*) // Gets implemeted at org.broadinstitute.sting.queue.QScript
/** Get implemented from org.broadinstitute.gatk.queue.QScript */
def add(functions: QFunction*)
/**
* Function to set isIntermediate and add in 1 line
* @param function
* @param isIntermediate
*/
def add(function: QFunction, isIntermediate: Boolean = false) {
function.isIntermediate = isIntermediate
add(function)
}
}
......@@ -15,6 +15,9 @@
*/
package nl.lumc.sasc.biopet.core
/**
* This trait is used in the biopet executable
*/
trait MainCommand {
lazy val commandName = this.getClass.getSimpleName
......
......@@ -20,10 +20,21 @@ import java.io.File
import nl.lumc.sasc.biopet.core.config.Config
import nl.lumc.sasc.biopet.core.workaround.BiopetQCommandLine
/**
* Wrapper around executable from Queue
*/
trait PipelineCommand extends MainCommand with GatkLogging {
/**
* Gets location of compiled class of pipeline
* @return path from classPath to class file
*/
def pipeline = "/" + getClass.getName.stripSuffix("$").replaceAll("\\.", "/") + ".class"
/**
* Class can be used directly from java with -cp option
* @param args
*/
def main(args: Array[String]): Unit = {
val argsSize = args.size
for (t <- 0 until argsSize) {
......
......@@ -15,10 +15,16 @@
*/
package nl.lumc.sasc.biopet.core
/**
* Trait for biopet tools, sets some default args
*/
trait ToolCommand extends MainCommand with Logging {
protected abstract class AbstractArgs {
}
/** Placeholder for args */
protected abstract class AbstractArgs { }
/**
* Abstract opt parser to add efault args to each biopet tool
*/
protected abstract class AbstractOptParser extends scopt.OptionParser[Args](commandName) {
opt[String]('l', "log_level") foreach { x =>
x.toLowerCase match {
......
......@@ -39,14 +39,16 @@
* THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* This is a modifed version of org.broadinstitute.gatk.queue.QCommandLine, works without compiling a scala files but used build in class files to skip compile step
*/
package nl.lumc.sasc.biopet.core.workaround
import java.io.File
import org.broadinstitute.gatk.utils.commandline._
import org.broadinstitute.gatk.queue.util._
import org.broadinstitute.gatk.queue.QCommandPlugin
import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.queue.QScriptManager
import org.broadinstitute.gatk.queue.{ QCommandPlugin, QScript, QScriptManager}
import org.broadinstitute.gatk.queue.util.{ Logging => GatkLogging }
import org.broadinstitute.gatk.queue.engine.{ QStatusMessenger, QGraphSettings, QGraph }
import collection.JavaConversions._
......
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