Commit a10513a4 authored by Peter van 't Hof's avatar Peter van 't Hof

Change get to as

parent 70c19e12
......@@ -4,14 +4,14 @@ import java.io.File
import nl.lumc.sasc.biopet.utils.ConfigUtils._
class ConfigValue(val requestIndex: ConfigValueIndex, val foundIndex: ConfigValueIndex, val value: Any, val default: Boolean) {
def getString = any2string(value)
def getInt = any2int(value)
def getDouble = any2double(value)
def getList = any2list(value)
def getFileList: List[File] = for (file <- any2stringList(value)) yield new File(file)
def getStringList: List[String] = any2stringList(value)
def getMap = any2map(value)
def getBoolean = any2boolean(value)
def asString = any2string(value)
def asInt = any2int(value)
def asDouble = any2double(value)
def asList = any2list(value)
def asFileList: List[File] = for (file <- any2stringList(value)) yield new File(file)
def asStringList: List[String] = any2stringList(value)
def asMap = any2map(value)
def asBoolean = any2boolean(value)
override def toString: String = {
var output = "key = " + requestIndex.key
......
......@@ -21,11 +21,11 @@ class Cutadapt(val root: Configurable) extends BiopetCommandLineFunction {
var default_clip_mode: String = config("default_clip_mode", default = "3")
var opt_adapter: Set[String] = Set()
if (config.contains("adapter")) for (adapter <- config("adapter").getList) opt_adapter += adapter.toString
if (config.contains("adapter")) for (adapter <- config("adapter").asList) opt_adapter += adapter.toString
var opt_anywhere: Set[String] = Set()
if (config.contains("anywhere")) for (adapter <- config("anywhere").getList) opt_anywhere += adapter.toString
if (config.contains("anywhere")) for (adapter <- config("anywhere").asList) opt_anywhere += adapter.toString
var opt_front: Set[String] = Set()
if (config.contains("front")) for (adapter <- config("front").getList) opt_front += adapter.toString
if (config.contains("front")) for (adapter <- config("front").asList) opt_front += adapter.toString
var opt_discard: Boolean = config("discard")
var opt_minimum_length: String = config("minimum_length", 1)
......
......@@ -8,8 +8,8 @@ class BaseRecalibrator(val root: Configurable) extends org.broadinstitute.gatk.q
override val defaultVmem = "8G"
if (config.contains("scattercount")) scatterCount = config("scattercount")
if (config.contains("dbsnp")) knownSites :+= new File(config("dbsnp").getString)
if (config.contains("known_sites")) knownSites :+= new File(config("known_sites").getString)
if (config.contains("dbsnp")) knownSites :+= new File(config("dbsnp").asString)
if (config.contains("known_sites")) knownSites :+= new File(config("known_sites").asString)
}
object BaseRecalibrator {
......
......@@ -10,9 +10,9 @@ trait GatkGeneral extends CommandLineGATK with BiopetJavaCommandLineFunction {
override val defaultVmem = "7G"
if (config.contains("intervals", submodule = "gatk")) intervals = config("intervals", submodule = "gatk").getFileList
if (config.contains("exclude_intervals", submodule = "gatk")) excludeIntervals = config("exclude_intervals", submodule = "gatk").getFileList
if (config.contains("intervals", submodule = "gatk")) intervals = config("intervals", submodule = "gatk").asFileList
if (config.contains("exclude_intervals", submodule = "gatk")) excludeIntervals = config("exclude_intervals", submodule = "gatk").asFileList
reference_sequence = config("reference", submodule = "gatk")
gatk_key = config("gatk_key", submodule = "gatk")
if (config.contains("pedigree", submodule = "gatk")) pedigree = config("pedigree", submodule = "gatk").getFileList
if (config.contains("pedigree", submodule = "gatk")) pedigree = config("pedigree", submodule = "gatk").asFileList
}
......@@ -4,12 +4,12 @@ import java.io.File
import nl.lumc.sasc.biopet.core.config.Configurable
class GenotypeGVCFs(val root: Configurable) extends org.broadinstitute.gatk.queue.extensions.gatk.GenotypeGVCFs with GatkGeneral {
annotation ++= config("annotation", default = Seq("FisherStrand", "QualByDepth", "ChromosomeCounts")).getStringList
annotation ++= config("annotation", default = Seq("FisherStrand", "QualByDepth", "ChromosomeCounts")).asStringList
if (config.contains("dbsnp")) dbsnp = config("dbsnp")
if (config.contains("scattercount", "genotypegvcfs")) scatterCount = config("scattercount")
if (config("inputtype", default = "dna").getString == "rna") {
if (config("inputtype", default = "dna").asString == "rna") {
stand_call_conf = config("stand_call_conf", default = 20)
stand_emit_conf = config("stand_emit_conf", default = 0)
} else {
......
......@@ -17,7 +17,7 @@ class HaplotypeCaller(val root: Configurable) extends org.broadinstitute.gatk.qu
if (config.contains("allSitePLs")) this.allSitePLs = config("allSitePLs")
if (config.contains("output_mode")) {
import org.broadinstitute.gatk.tools.walkers.genotyper.OutputMode._
config("output_mode").getString match {
config("output_mode").asString match {
case "EMIT_ALL_CONFIDENT_SITES" => output_mode = EMIT_ALL_CONFIDENT_SITES
case "EMIT_ALL_SITES" => output_mode = EMIT_ALL_SITES
case "EMIT_VARIANTS_ONLY" => output_mode = EMIT_VARIANTS_ONLY
......@@ -25,7 +25,7 @@ class HaplotypeCaller(val root: Configurable) extends org.broadinstitute.gatk.qu
}
}
if (config("inputtype", default = "dna").getString == "rna") {
if (config("inputtype", default = "dna").asString == "rna") {
dontUseSoftClippedBases = config("dontusesoftclippedbases", default = true)
stand_call_conf = config("stand_call_conf", default = 5)
stand_emit_conf = config("stand_emit_conf", default = 0)
......
......@@ -9,7 +9,7 @@ class RealignerTargetCreator(val root: Configurable) extends org.broadinstitute.
if (config.contains("scattercount")) scatterCount = config("scattercount")
if (config.contains("known")) known ++= config("known").getFileList
if (config.contains("known")) known ++= config("known").asFileList
}
object RealignerTargetCreator {
......
......@@ -15,7 +15,7 @@ class UnifiedGenotyper(val root: Configurable) extends org.broadinstitute.gatk.q
if (config.contains("allSitePLs")) this.allSitePLs = config("allSitePLs")
if (config.contains("output_mode")) {
import org.broadinstitute.gatk.tools.walkers.genotyper.OutputMode._
config("output_mode").getString match {
config("output_mode").asString match {
case "EMIT_ALL_CONFIDENT_SITES" => output_mode = EMIT_ALL_CONFIDENT_SITES
case "EMIT_ALL_SITES" => output_mode = EMIT_ALL_SITES
case "EMIT_VARIANTS_ONLY" => output_mode = EMIT_VARIANTS_ONLY
......@@ -23,7 +23,7 @@ class UnifiedGenotyper(val root: Configurable) extends org.broadinstitute.gatk.q
}
}
if (config("inputtype", default = "dna").getString == "rna") {
if (config("inputtype", default = "dna").asString == "rna") {
stand_call_conf = config("stand_call_conf", default = 5)
stand_emit_conf = config("stand_emit_conf", default = 0)
} else {
......
......@@ -8,9 +8,9 @@ class VariantRecalibrator(val root: Configurable) extends org.broadinstitute.gat
nt = Option(getThreads(4))
memoryLimit = Option(nt.getOrElse(1) * 2)
if (config.contains("dbsnp")) resource :+= new TaggedFile(config("dbsnp").getString, "known=true,training=false,truth=false,prior=2.0")
if (config.contains("dbsnp")) resource :+= new TaggedFile(config("dbsnp").asString, "known=true,training=false,truth=false,prior=2.0")
an = config("annotation", default = List("QD", "DP", "FS", "ReadPosRankSum", "MQRankSum")).getStringList
an = config("annotation", default = List("QD", "DP", "FS", "ReadPosRankSum", "MQRankSum")).asStringList
minNumBadVariants = config("minnumbadvariants")
maxGaussians = config("maxgaussians")
}
......@@ -23,13 +23,13 @@ object VariantRecalibrator {
if (indel) {
mode = org.broadinstitute.gatk.tools.walkers.variantrecalibration.VariantRecalibratorArgumentCollection.Mode.INDEL
defaults ++= Map("ts_filter_level" -> 99.0)
if (config.contains("mills")) resource :+= new TaggedFile(config("mills").getString, "known=false,training=true,truth=true,prior=12.0")
if (config.contains("mills")) resource :+= new TaggedFile(config("mills").asString, "known=false,training=true,truth=true,prior=12.0")
} else {
mode = org.broadinstitute.gatk.tools.walkers.variantrecalibration.VariantRecalibratorArgumentCollection.Mode.SNP
defaults ++= Map("ts_filter_level" -> 99.5)
if (config.contains("hapmap")) resource +:= new TaggedFile(config("hapmap").getString, "known=false,training=true,truth=true,prior=15.0")
if (config.contains("omni")) resource +:= new TaggedFile(config("omni").getString, "known=false,training=true,truth=true,prior=12.0")
if (config.contains("1000G")) resource +:= new TaggedFile(config("1000G").getString, "known=false,training=true,truth=false,prior=10.0")
if (config.contains("hapmap")) resource +:= new TaggedFile(config("hapmap").asString, "known=false,training=true,truth=true,prior=15.0")
if (config.contains("omni")) resource +:= new TaggedFile(config("omni").asString, "known=false,training=true,truth=true,prior=12.0")
if (config.contains("1000G")) resource +:= new TaggedFile(config("1000G").asString, "known=false,training=true,truth=false,prior=10.0")
}
}
vr.input :+= input
......
......@@ -29,7 +29,7 @@ class BamMetrics(val root: Configurable) extends QScript with BiopetQScript {
if (outputDir == null) throw new IllegalStateException("Missing Output directory on BamMetrics module")
else if (!outputDir.endsWith("/")) outputDir += "/"
if (config.contains("target_bed")) {
for (file <- config("target_bed").getList) {
for (file <- config("target_bed").asList) {
bedFiles +:= new File(file.toString)
}
}
......
......@@ -68,7 +68,7 @@ class Basty(val root: Configurable) extends QScript with MultiSampleQScript {
add(raxmlMl)
val r = new scala.util.Random(seed)
val numBoot = config("boot_runs", default = 100, submodule = "raxml").getInt
val numBoot = config("boot_runs", default = 100, submodule = "raxml").asInt
val bootList = for (t <- 0 until numBoot) yield {
val raxmlBoot = new Raxml(this)
raxmlBoot.threads = 1
......
......@@ -24,7 +24,7 @@ class GatkBenchmarkGenotyping(val root: Configurable) extends QScript with Biope
var dbsnp: File = config("dbsnp")
def init() {
if (config.contains("gvcffiles")) for (file <- config("gvcffiles").getList) {
if (config.contains("gvcffiles")) for (file <- config("gvcffiles").asList) {
gvcfFiles ::= file.toString
}
if (outputDir == null) throw new IllegalStateException("Missing Output directory on gatk module")
......
......@@ -50,10 +50,10 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
def init() {
if (config.contains("target_bed")) {
defaults ++= Map("gatk" -> Map(("intervals" -> config("target_bed").getStringList)))
defaults ++= Map("gatk" -> Map(("intervals" -> config("target_bed").asStringList)))
}
if (config.contains("gvcfFiles"))
for (file <- config("gvcfFiles").getList)
for (file <- config("gvcfFiles").asList)
gvcfFiles :+= file.toString
if (outputDir == null) throw new IllegalStateException("Missing Output directory on gatk module")
else if (!outputDir.endsWith("/")) outputDir += "/"
......@@ -114,7 +114,7 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
multisampleVariantcalling.biopetScript
addAll(multisampleVariantcalling.functions)
if (config("inputtype", default = "dna").getString != "rna" && config("recalibration", default = false).getBoolean) {
if (config("inputtype", default = "dna").asString != "rna" && config("recalibration", default = false).asBoolean) {
val recalibration = new GatkVariantRecalibration(this)
recalibration.inputVcf = multisampleVariantcalling.scriptOutput.finalVcfFile
recalibration.bamFiles = finalBamFiles
......@@ -174,7 +174,7 @@ class GatkPipeline(val root: Configurable) extends QScript with MultiSampleQScri
var bamFile = new File(runConfig("bam").toString)
if (!bamFile.exists) throw new IllegalStateException("Bam in config does not exist, file: " + bamFile)
if (config("bam_to_fastq", default = false).getBoolean) {
if (config("bam_to_fastq", default = false).asBoolean) {
val samToFastq = SamToFastq(this, bamFile, runDir + sampleID + "-" + runID + ".R1.fastq",
runDir + sampleID + "-" + runID + ".R2.fastq")
add(samToFastq, isIntermediate = true)
......
......@@ -93,7 +93,7 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
var mergBuffer: SortedMap[String, File] = SortedMap()
def mergeList = mergBuffer map { case (key, file) => TaggedFile(removeNoneVariants(file), "name=" + key) }
if (sampleID != null && (useHaplotypecaller.get || config("joint_genotyping", default = false).getBoolean)) {
if (sampleID != null && (useHaplotypecaller.get || config("joint_genotyping", default = false).asBoolean)) {
val hcGvcf = new HaplotypeCaller(this)
hcGvcf.useGvcf
hcGvcf.input_file = scriptOutput.bamFiles
......@@ -213,7 +213,7 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
}
add(baseRecalibrator)
if (config("use_analyze_covariates", default = false).getBoolean) {
if (config("use_analyze_covariates", default = false).asBoolean) {
val baseRecalibratorAfter = BaseRecalibrator(this, inputBam, swapExt(dir, inputBam, ".bam", ".baserecal.after"))
baseRecalibratorAfter.BQSR = baseRecalibrator.o
add(baseRecalibratorAfter)
......
......@@ -30,7 +30,7 @@ class GatkVcfSampleCompare(val root: Configurable) extends QScript with BiopetQS
def init() {
if (config.contains("target_bed"))
for (bed <- config("target_bed").getList)
for (bed <- config("target_bed").asList)
targetBed :+= bed.toString
if (outputDir == null) throw new IllegalStateException("Missing Output directory on gatk module")
else if (!outputDir.endsWith("/")) outputDir += "/"
......
......@@ -148,7 +148,7 @@ class Sage(val root: Configurable) extends QScript with MultiSampleQScript {
mapping.biopetScript
addAll(mapping.functions)
if (config("library_counts", default = false).getBoolean) {
if (config("library_counts", default = false).asBoolean) {
addBedtoolsCounts(mapping.outputFiles("finalBamFile"), sampleID + "-" + runID, runDir)
addTablibCounts(prefixFastq.output, sampleID + "-" + runID, runDir)
}
......
......@@ -35,7 +35,7 @@ class MpileupToVcf(val root: Configurable) extends BiopetJavaCommandLineFunction
override val defaultVmem = "6G"
memoryLimit = Option(2.0)
if (config.contains("target_bed")) defaults ++= Map("samtoolsmpileup" -> Map("interval_bed" -> config("target_bed").getStringList.head,
if (config.contains("target_bed")) defaults ++= Map("samtoolsmpileup" -> Map("interval_bed" -> config("target_bed").asStringList.head,
"disable_baq" -> true, "min_map_quality" -> 1))
override def afterGraph {
......
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