gatk-3.8/scala/qscript/oneoffs/kshakir/linearindexbintests/LinearIndexBinTests.scala

69 lines
2.4 KiB
Scala
Raw Normal View History

import org.broadinstitute.sting.queue.QScript
import org.broadinstitute.sting.utils.text._
import org.broadinstitute.sting.queue.extensions.gatk._
import collection.JavaConversions._
class LinearIndexBinTests extends QScript {
qscript =>
@Input(doc="The path to the GenomeAnalysisTK.jar file.", shortName="gatk")
var gatkJar: File = null
@Argument(doc="Rod list to test. The first line in the list is the reference.", shortName="BL")
var rodLists: List[File] = Nil
@Argument(doc="Number of times to run the test.", shortName="numRuns", required=false)
var numRuns = 1
@Input(doc="memory limits", shortName="mem", required=true)
var memoryLimits: List[Int] = Nil
@Input(doc="max bin size", shortName="maxBin", required=false)
var maxBinSize = 512
def script = {
var maxFeaturesPerBin = List.empty[String]
var currMaxFeatures = maxBinSize
while (currMaxFeatures > 1) {
maxFeaturesPerBin +:= currMaxFeatures.toString
currMaxFeatures /= 2
}
maxFeaturesPerBin :::= List("0.001", "0.01", "0.1", "1")
for (run <- 1 to numRuns) {
for (rodList <- rodLists) {
val rodListName = rodList.getName
val lines = new XReadLines(rodList).iterator
val reference = new File(lines.next)
val rodFiles = lines.map(path => new File(path)).toList
for (memoryLimit <- memoryLimits) {
for (maxFeatures <- maxFeaturesPerBin) {
val dir = "%s_%smfpb_%02dg_run%02d".format(rodListName, "00000".take(5-maxFeatures.length) + maxFeatures, memoryLimit, run)
val countRod = new CountRod {
override def javaOpts = super.javaOpts + " -DMAX_FEATURES_PER_BIN=" + maxFeatures
}
countRod.jobOutputFile = new File(dir, "CountRod.out")
countRod.out = new File(dir, "CountRod.txt")
countRod.jarFile = qscript.gatkJar
countRod.reference_sequence = reference
Walkers can now specify a class extending from Gatherer to merge custom output formats. Add @Gather(MyGatherer.class) to the walker @Output. JavaCommandLineFunctions can now specify the classpath+mainclass as an alternative to specifying a path to an executable jar. JCLF by default pass on the current classpath and only require the mainclass be specified by the developer extending the JCLF, relieving the QScript author from having to explicitly specify the jar. Like the Picard MergeSamFiles, GATK engine by default is now run from the current classpath. The GATK can still be overridden via .jarFile or .javaClasspath. Walkers from the GATK package are now also embedded into the Queue package. Updated AnalyzeCovariates to make it easier to guess the main class, AnalyzeCovariates instead of AnalyzeCovariatesCLP. Removed the GATK jar argument from the example QScripts. Removed one of the most FAQ when getting started with Scala/Queue, the use of Option[_] in QScripts: 1) Fixed mistaken assumption with java enums. In java enums can be null so they don't need nullable wrappers. 2) Added syntactic sugar for Nullable primitives to the QScript trait. Any variable defined as Option[Int] can just be assigned an Int value or None, ex: myFunc.memoryLimit = 3 Removed other unused code. Re-fixed dry run function ordering. Re-ordered the QCommandline companion object so that IntelliJ doesn't complain about missing main methods. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5504 348d0f76-0448-11de-a6fe-93d51630548a
2011-03-24 22:03:51 +08:00
countRod.memoryLimit = memoryLimit
// Some of the BED files don't have a chrM, which makes the GATK angry. Run unsafe.
Walkers can now specify a class extending from Gatherer to merge custom output formats. Add @Gather(MyGatherer.class) to the walker @Output. JavaCommandLineFunctions can now specify the classpath+mainclass as an alternative to specifying a path to an executable jar. JCLF by default pass on the current classpath and only require the mainclass be specified by the developer extending the JCLF, relieving the QScript author from having to explicitly specify the jar. Like the Picard MergeSamFiles, GATK engine by default is now run from the current classpath. The GATK can still be overridden via .jarFile or .javaClasspath. Walkers from the GATK package are now also embedded into the Queue package. Updated AnalyzeCovariates to make it easier to guess the main class, AnalyzeCovariates instead of AnalyzeCovariatesCLP. Removed the GATK jar argument from the example QScripts. Removed one of the most FAQ when getting started with Scala/Queue, the use of Option[_] in QScripts: 1) Fixed mistaken assumption with java enums. In java enums can be null so they don't need nullable wrappers. 2) Added syntactic sugar for Nullable primitives to the QScript trait. Any variable defined as Option[Int] can just be assigned an Int value or None, ex: myFunc.memoryLimit = 3 Removed other unused code. Re-fixed dry run function ordering. Re-ordered the QCommandline companion object so that IntelliJ doesn't complain about missing main methods. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5504 348d0f76-0448-11de-a6fe-93d51630548a
2011-03-24 22:03:51 +08:00
countRod.U = org.broadinstitute.sting.gatk.arguments.ValidationExclusion.TYPE.ALL
for ((rodFile, index) <- rodFiles.zipWithIndex) {
val rodType = rodFile.getName.split("\\.").last
countRod.rodBind :+= new RodBind(rodType + (index+1), rodType.toUpperCase, rodFile.getAbsolutePath)
}
add(countRod)
}
}
}
}
}
}