Commit e043fab8 authored by Sander Bollen's avatar Sander Bollen
Browse files

refactor to `configNamespace`

parent 00034b55
......@@ -26,7 +26,7 @@ class VariantRecalibrator(val root: Configurable) extends org.broadinstitute.gat
object VariantRecalibrator {
def apply(root: Configurable, input: File, recal_file: File, tranches_file: File, indel: Boolean = false): VariantRecalibrator = {
val vr = new VariantRecalibrator(root) {
override lazy val configName = "variantrecalibrator"
override lazy val configNamespace = "variantrecalibrator"
override def configPath: List[String] = (if (indel) "indel" else "snp") :: super.configPath
if (indel) {
mode = org.broadinstitute.gatk.tools.walkers.variantrecalibration.VariantRecalibratorArgumentCollection.Mode.INDEL
......
......@@ -20,15 +20,15 @@ class Shiva(val root: Configurable) extends QScript with ShivaTrait {
qscript =>
def this() = this(null)
/** Make variantcalling submodule, this with the gatk modes in there */
/** Make variantcalling configNamespace, this with the gatk modes in there */
override def makeVariantcalling(multisample: Boolean = false) = {
if (multisample) new ShivaVariantcalling(qscript) {
override def namePrefix = "multisample"
override def configName = "shivavariantcalling"
override def configNamespace = "shivavariantcalling"
override def configPath: List[String] = super.configPath ::: "multisample" :: Nil
}
else new ShivaVariantcalling(qscript) {
override def configName = "shivavariantcalling"
override def configNamespace = "shivavariantcalling"
}
}
......
......@@ -27,7 +27,7 @@ import org.testng.annotations.{ DataProvider, Test }
class ShivaTest extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any]): Shiva = {
new Shiva() {
override def configName = "shiva"
override def configNamespace = "shiva"
override def globalConfig = new Config(ConfigUtils.mergeMaps(map, ShivaTest.config))
qSettings = new QSettings
qSettings.runName = "test"
......
......@@ -29,7 +29,7 @@ import scala.collection.mutable.ListBuffer
class ShivaVariantcallingTest extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any]): ShivaVariantcalling = {
new ShivaVariantcalling() {
override def configName = "shivavariantcalling"
override def configNamespace = "shivavariantcalling"
override def globalConfig = new Config(ConfigUtils.mergeMaps(map, ShivaVariantcallingTest.config))
qSettings = new QSettings
qSettings.runName = "test"
......
......@@ -40,7 +40,7 @@ class BamMetricsTest extends TestNGSuite with Matchers {
def initPipeline(map: Map[String, Any]): BamMetrics = {
new BamMetrics() {
override def configName = "bammetrics"
override def configNamespace = "bammetrics"
override def globalConfig = new Config(map)
qSettings = new QSettings
qSettings.runName = "test"
......
......@@ -131,11 +131,11 @@ trait BastyTrait extends MultiSampleQScript {
raxmlMl.p = Some(seed)
raxmlMl.n = outputName + "_ml"
raxmlMl.w = dirSufixRaxml
raxmlMl.N = config("ml_runs", default = 20, submodule = "raxml")
raxmlMl.N = config("ml_runs", default = 20, configNamespace = "raxml")
add(raxmlMl)
val r = new scala.util.Random(seed)
val numBoot = config("boot_runs", default = 100, submodule = "raxml").asInt
val numBoot = config("boot_runs", default = 100, configNamespace = "raxml").asInt
val bootList = for (t <- 0 until numBoot) yield {
val raxmlBoot = new Raxml(this)
raxmlBoot.input = variants
......
......@@ -30,7 +30,7 @@ import scala.collection.JavaConversions._
/** Biopet command line trait to auto check executable and cluster values */
trait BiopetCommandLineFunction extends CommandLineResources { biopetFunction =>
analysisName = configName
analysisName = configNamespace
@Input(doc = "deps", required = false)
var deps: List[File] = Nil
......
......@@ -19,7 +19,7 @@ import org.broadinstitute.gatk.queue.function.JavaCommandLineFunction
/** Biopet commandline class for java based programs */
trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetCommandLineFunction {
executable = config("java", default = "java", submodule = "java", freeVar = false)
executable = config("java", default = "java", configNamespace = "java", freeVar = false)
javaGCThreads = config("java_gc_threads", default = 4)
javaGCHeapFreeLimit = config("java_gc_heap_freelimit", default = 10)
......
......@@ -74,7 +74,7 @@ class BiopetPipe(val commands: List[BiopetCommandLineFunction]) extends BiopetCo
override def defaultThreads = 0
val root: Configurable = commands.head.root
override def configName = commands.map(_.configName).mkString("-")
override def configNamespace = commands.map(_.configNamespace).mkString("-")
def cmdLine: String = {
"(" + commands.head.cmdLine + (if (commands.head.stdinFile.isDefined) {
" < " + required(commands.head.stdinFile.map(_.getAbsoluteFile))
......
......@@ -31,7 +31,7 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
@Argument(doc = "JSON / YAML config file(s)", fullName = "config_file", shortName = "config", required = false)
val configfiles: List[File] = Nil
@Argument(doc = "Config values, value should be formatted like 'key=value' or 'path:path:key=value'", fullName = "config_value", shortName = "cv", required = false)
@Argument(doc = "Config values, value should be formatted like 'key=value' or 'configNamespace:configNamespace:key=value'", fullName = "config_value", shortName = "cv", required = false)
val configValues: List[String] = Nil
/** Output directory of pipeline */
......
......@@ -88,7 +88,7 @@ trait CommandLineResources extends CommandLineFunction with Configurable {
else residentLimit = Some((_coreMemory + (0.5 * retryMultipler)) * residentFactor)
if (!config.contains("vmem")) vmem = Some((_coreMemory * (vmemFactor + (0.5 * retryMultipler))) + "G")
jobName = configName + ":" + (if (firstOutput != null) firstOutput.getName else jobOutputFile)
jobName = configNamespace + ":" + (if (firstOutput != null) firstOutput.getName else jobOutputFile)
}
override def setupRetry(): Unit = {
......
......@@ -70,7 +70,7 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
def libDir = new File(sampleDir, "lib_" + libId)
lazy val libTags: Map[String, Any] =
config("tags", default = Map(), freeVar = false, submodule = libId, path = List("samples", sampleId, "libraries"))
config("tags", default = Map(), freeVar = false, configNamespace = libId, path = List("samples", sampleId, "libraries"))
def sampleId = sample.sampleId
......@@ -91,7 +91,7 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
val libraries: Map[String, Library] = libIds.map(id => id -> makeLibrary(id)).toMap
lazy val sampleTags: Map[String, Any] =
config("tags", default = Map(), freeVar = false, submodule = sampleId, path = List("samples"))
config("tags", default = Map(), freeVar = false, configNamespace = sampleId, path = List("samples"))
lazy val gender = {
val g: Option[String] = sampleTags.get("gender").map(_.toString)
......
......@@ -36,7 +36,7 @@ object WriteDependencies extends Logging with Configurable {
val cache: mutable.Map[String, Int] = mutable.Map()
for (function <- functions) {
val baseName = function match {
case f: Configurable => f.configName
case f: Configurable => f.configNamespace
case f => f.getClass.getSimpleName
}
cache += baseName -> (cache.getOrElse(baseName, 0) + 1)
......
......@@ -24,7 +24,7 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
@Input(doc = "Python script", required = false)
var python_script: File = _
executable = config("exe", default = "python", submodule = "python", freeVar = false)
executable = config("exe", default = "python", configNamespace = "python", freeVar = false)
protected var python_script_name: String = _
......
......@@ -37,7 +37,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
private[summary] var summaryQScripts: List[SummaryQScript] = Nil
/** Name of the pipeline in the summary */
var summaryName = configName
var summaryName = configNamespace
/** Must return a map with used settings for this pipeline */
def summarySettings: Map[String, Any]
......@@ -103,7 +103,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
if (writeSummary.md5sum) {
if (!SummaryQScript.md5sumCache.contains(file)) {
val md5sum = new Md5sum(this) {
override def configName = "md5sum"
override def configNamespace = "md5sum"
override def cmdLine: String = super.cmdLine + " || " +
required("echo") + required("error_on_capture " + input.toString) + " > " + required(output)
......
......@@ -75,16 +75,16 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
def fetchVersion(f: QFunction): Option[(String, Any)] = {
f match {
case f: BiopetJavaCommandLineFunction with Version =>
Some(f.configName -> Map("version" -> f.getVersion.getOrElse(None),
Some(f.configNamespace -> Map("version" -> f.getVersion.getOrElse(None),
"java_md5" -> BiopetCommandLineFunction.executableMd5Cache.getOrElse(f.executable, None),
"java_version" -> f.getJavaVersion,
"jar_path" -> f.jarFile))
case f: BiopetCommandLineFunction with Version =>
Some(f.configName -> Map("version" -> f.getVersion.getOrElse(None),
Some(f.configNamespace -> Map("version" -> f.getVersion.getOrElse(None),
"md5" -> BiopetCommandLineFunction.executableMd5Cache.getOrElse(f.executable, None),
"path" -> f.executable))
case f: Configurable with Version =>
Some(f.configName -> Map("version" -> f.getVersion.getOrElse(None)))
Some(f.configNamespace -> Map("version" -> f.getVersion.getOrElse(None)))
case _ => None
}
}
......
......@@ -295,7 +295,7 @@ object WriteSummaryTest {
stats: Map[String, Any] = Map(),
c: Map[String, Any] = Map()) = new BiopetJavaCommandLineFunction with Summarizable with Version {
override def globalConfig = new Config(c)
override def configName = "java_command"
override def configNamespace = "java_command"
def root: Configurable = null
def summaryStats: Map[String, Any] = stats
def summaryFiles: Map[String, File] = files
......@@ -320,7 +320,7 @@ object WriteSummaryTest {
c: Map[String, Any] = Map()) =
new CommandLineFunction with Configurable with Summarizable with Version {
override def globalConfig = new Config(c)
override def configName = "version_command"
override def configNamespace = "version_command"
def root: Configurable = null
def summaryFiles: Map[String, File] = files
......
......@@ -40,7 +40,7 @@ class Fastqc(val root: Configurable) extends BiopetCommandLineFunction with Vers
var output: File = null
executable = config("exe", default = "fastqc")
var java_exe: String = config("exe", default = "java", submodule = "java", freeVar = false)
var java_exe: String = config("exe", default = "java", configNamespace = "java", freeVar = false)
var kmers: Option[Int] = config("kmers")
var quiet: Boolean = config("quiet", default = false)
var noextract: Boolean = config("noextract", default = false)
......
......@@ -28,7 +28,7 @@ import org.broadinstitute.gatk.utils.commandline.{ Input, Output }
*/
class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFunction with Reference with Version {
executable = config("exe", submodule = "perl", default = "perl")
executable = config("exe", configNamespace = "perl", default = "perl")
var vepScript: String = config("vep_script")
@Input(doc = "input VCF", required = true)
......
......@@ -19,7 +19,7 @@ import nl.lumc.sasc.biopet.core.{ Version, BiopetCommandLineFunction }
abstract class Bcftools extends BiopetCommandLineFunction with Version {
override def subPath = "bcftools" :: super.subPath
executable = config("exe", default = "bcftools", submodule = "bcftools", freeVar = false)
executable = config("exe", default = "bcftools", configNamespace = "bcftools", freeVar = false)
def versionCommand = executable
def versionRegex = """Version: (.*)""".r
override def versionExitcode = List(0, 1)
......
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