gatk-3.8/scala/src/org/broadinstitute/sting/queue/QCommandLine.scala

54 lines
1.5 KiB
Scala
Raw Normal View History

package org.broadinstitute.sting.queue
import tools.nsc.MainGenericRunner
import org.broadinstitute.sting.queue.util.ClasspathUtils
import collection.mutable.ListBuffer
import org.broadinstitute.sting.queue.util.Logging
object QCommandLine extends Application with Logging {
var usage = """usage: java -jar Queue.jar [ -P name=value ] [ -P file.properties ] [ -I input.file ] [ -I input_files.list ] [ -bsub ] [ -dry ] [ -debug ] -S pipeline.scala"""
override def main(args: Array[String]) = {
val qArgs: QArguments = try {
new QArguments(args)
} catch {
case exception => {
println(usage)
System.exit(-1)
}
null
}
logger.debug("starting")
if (qArgs.scripts.size == 0) {
println("Error: Missing script")
println(usage)
System.exit(-1)
}
// NOTE: Something in MainGenericRunner is exiting the VM.
if (qArgs.scripts.size != 1) {
println("Error: Only one script can be run at a time")
println(usage)
System.exit(-1)
}
if (qArgs.inputPaths.size == 0) {
println("Error: No inputs specified")
println(usage)
System.exit(-1)
}
val newArgs = new ListBuffer[String]
newArgs.appendAll(args)
QArguments.strip(newArgs, "-S")
newArgs.prepend("-nocompdaemon", "-classpath", ClasspathUtils.manifestAwareClassPath, qArgs.scripts.head)
MainGenericRunner.main(newArgs.toArray)
// NOTE: This line is not reached because something in MainGenericRunner is exiting the VM.
logger.debug("exiting")
}
}