Commit 0586cbc2 authored by Peter van 't Hof's avatar Peter van 't Hof

Remove the need of merging the defaults anymore

parent b20abfad
......@@ -153,11 +153,11 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
scriptOutput.rawVcfFile = m2v.output
val vcfFilter = new VcfFilter(this) {
override def defaults = ConfigUtils.mergeMaps(Map("min_sample_depth" -> 8,
override def defaults = Map("min_sample_depth" -> 8,
"min_alternate_depth" -> 2,
"min_samples_pass" -> 1,
"filter_ref_calls" -> true
), super.defaults)
)
}
vcfFilter.inputVcf = m2v.output
vcfFilter.outputVcf = swapExt(outputDir, m2v.output, ".vcf", ".filter.vcf.gz")
......
......@@ -35,10 +35,10 @@ trait BastyTrait extends MultiSampleQScript {
def variantcallers = List("freebayes")
override def defaults = ConfigUtils.mergeMaps(Map(
override def defaults = Map(
"ploidy" -> 1,
"variantcallers" -> variantcallers
), super.defaults)
)
lazy val shiva: ShivaTrait = new Shiva(qscript)
......
......@@ -15,6 +15,7 @@
*/
package nl.lumc.sasc.biopet.core.config
import nl.lumc.sasc.biopet.utils.ConfigUtils
import nl.lumc.sasc.biopet.utils.ConfigUtils.ImplicitConversions
trait Configurable extends ImplicitConversions {
......@@ -35,9 +36,15 @@ trait Configurable extends ImplicitConversions {
protected[core] def configFullPath: List[String] = configPath ::: configName :: Nil
/** Map to store defaults for config */
def defaults: Map[String, Any] = {
if (root != null) root.defaults
else globalConfig.defaults
def defaults: Map[String, Any] = Map()
protected def internalDefaults: Map[String, Any] = {
(root != null, defaults.isEmpty) match {
case (true, true) => root.defaults
case (true, false) => ConfigUtils.mergeMaps(defaults, root.defaults)
case (false, true) => globalConfig.defaults
case (false, false) => ConfigUtils.mergeMaps(defaults, globalConfig.defaults)
}
}
/** All values found in this map will be skipped from the user config */
......@@ -96,7 +103,7 @@ trait Configurable extends ImplicitConversions {
val m = if (submodule != null) submodule else configName
val p = if (path == null) getConfigPath(s, l, submodule) ::: subPath else path
val d = {
val value = Config.getValueFromMap(defaults, ConfigValueIndex(m, p, key, freeVar))
val value = Config.getValueFromMap(internalDefaults, ConfigValueIndex(m, p, key, freeVar))
if (value.isDefined) value.get.value else default
}
if (d == null) globalConfig(m, p, key, freeVar = freeVar, fixedValues = fixedValues)
......@@ -123,7 +130,7 @@ trait Configurable extends ImplicitConversions {
val m = if (submodule != null) submodule else configName
val p = if (path == null) getConfigPath(s, l, submodule) ::: subPath else path
globalConfig.contains(m, p, key, freeVar, fixedValues) || Config.getValueFromMap(defaults, ConfigValueIndex(m, p, key, freeVar)).isDefined
globalConfig.contains(m, p, key, freeVar, fixedValues) || Config.getValueFromMap(internalDefaults, ConfigValueIndex(m, p, key, freeVar)).isDefined
}
}
}
......@@ -51,8 +51,7 @@ class MpileupToVcf(val root: Configurable) extends ToolCommandFuntion with Refer
override def defaultCoreMemory = 3.0
override def defaults = ConfigUtils.mergeMaps(Map("samtoolsmpileup" -> Map("disable_baq" -> true, "min_map_quality" -> 1)),
super.defaults)
override def defaults = Map("samtoolsmpileup" -> Map("disable_baq" -> true, "min_map_quality" -> 1))
override def beforeGraph() {
super.beforeGraph()
......
......@@ -38,12 +38,12 @@ class Carp(val root: Configurable) extends QScript with MultiSampleQScript with
qscript =>
def this() = this(null)
override def defaults = ConfigUtils.mergeMaps(Map(
override def defaults = Map(
"mapping" -> Map(
"skip_markduplicates" -> true,
"aligner" -> "bwa-mem"
)
), super.defaults)
)
def summaryFile = new File(outputDir, "Carp.summary.json")
......
......@@ -100,8 +100,7 @@ class Gentrap(val root: Configurable) extends QScript
})
/** Default pipeline config */
override def defaults = ConfigUtils.mergeMaps(
Map(
override def defaults = Map(
"gsnap" -> Map(
"novelsplicing" -> 1,
"batch" -> 4,
......@@ -117,7 +116,7 @@ class Gentrap(val root: Configurable) extends QScript
"skip_markduplicates" -> true,
"skip_metrics" -> true
)
), super.defaults)
)
/** Adds output merge jobs for the given expression mode */
// TODO: can we combine the enum with the file extension (to reduce duplication and potential errors)
......
......@@ -97,13 +97,12 @@ class Mapping(val root: Configurable) extends QScript with SummaryQScript with S
/** location of summary file */
def summaryFile = new File(outputDir, sampleId.getOrElse("x") + "-" + libId.getOrElse("x") + ".summary.json")
override def defaults = ConfigUtils.mergeMaps(
Map(
override def defaults = Map(
"gsnap" -> Map(
"batch" -> 4,
"format" -> "sam"
)
), super.defaults)
)
/** File to add to the summary */
def summaryFiles: Map[String, File] = Map("output_bamfile" -> finalBamFile, "input_R1" -> input_R1,
......
......@@ -36,7 +36,8 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
var transcriptome: Option[File] = config("transcriptome")
var tagsLibrary: Option[File] = config("tags_library")
override def defaults = ConfigUtils.mergeMaps(Map("bowtie" -> Map(
override def defaults = Map(
"bowtie" -> Map(
"m" -> 1,
"k" -> 1,
"best" -> true,
......@@ -50,7 +51,7 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
"skip_clip" -> true,
"skip_trim" -> true
), "strandSensitive" -> true
), super.defaults)
)
def summaryFile: File = new File(outputDir, "Sage.summary.json")
......
......@@ -199,11 +199,11 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag with
val vcfFilter = new VcfFilter(qscript) {
override def configName = "vcffilter"
override def defaults = ConfigUtils.mergeMaps(Map("min_sample_depth" -> 8,
override def defaults = Map("min_sample_depth" -> 8,
"min_alternate_depth" -> 2,
"min_samples_pass" -> 1,
"filter_ref_calls" -> true
), super.defaults)
)
}
vcfFilter.inputVcf = m2v.output
vcfFilter.outputVcf = new File(outputDir, bamFile.getName.stripSuffix(".bam") + ".raw.filter.vcf.gz")
......
......@@ -37,9 +37,9 @@ class Toucan(val root: Configurable) extends QScript with BiopetQScript with Sum
def init(): Unit = {
}
override def defaults = ConfigUtils.mergeMaps(Map(
override def defaults = Map(
"varianteffectpredictor" -> Map("everything" -> true)
), super.defaults)
)
//defaults ++= Map("varianteffectpredictor" -> Map("everything" -> true))
......
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