Commit 83c9a8e5 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added a general biopet trait for gatk extensions

parent e323ae4c
......@@ -4,5 +4,6 @@
"haplotypecaller": {
"stand_call_conf": 20,
"stand_emit_conf": 20
}
},
"scattercount": 10
}
......@@ -2,7 +2,7 @@ package nl.lumc.sasc.biopet.core
import org.broadinstitute.gatk.queue.function.JavaCommandLineFunction
abstract class BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetCommandLineFunctionTrait {
trait BiopetJavaCommandLineFunction extends JavaCommandLineFunction with BiopetCommandLineFunctionTrait {
executable = "java"
override def commandLine: String = {
......
package nl.lumc.sasc.biopet.extensions.gatk
import nl.lumc.sasc.biopet.core.BiopetJavaCommandLineFunction
import org.broadinstitute.gatk.queue.extensions.gatk.CommandLineGATK
trait GatkGeneral extends CommandLineGATK with BiopetJavaCommandLineFunction {
memoryLimit = Option(2)
override val defaultVmem = "4G"
if (config.contains("intervals")) intervals = config("intervals").getFileList
if (config.contains("exclude_intervals")) excludeIntervals = config("exclude_intervals").getFileList
reference_sequence = config("reference")
gatk_key = config("gatk_key")
if (config.contains("pedigree")) pedigree = config("pedigree").getFileList
}
package nl.lumc.sasc.biopet.extensions.gatk
import nl.lumc.sasc.biopet.core.config.Configurable
import org.broadinstitute.gatk.utils.variant.GATKVCFIndexType
class HaplotypeCaller(val root: Configurable) extends org.broadinstitute.gatk.queue.extensions.gatk.HaplotypeCaller with GatkGeneral {
min_mapping_quality_score = config("minMappingQualityScore", default = 20)
if (config.contains("scattercount", "haplotypecaller")) scatterCount = config("scattercount")
if (config.contains("dbsnp")) this.dbsnp = config("dbsnp")
nct = config("threads", default = 3)
bamOutput = config("bamOutput")
memoryLimit = Option(nct.getOrElse(1) * 2)
if (config.contains("allSitePLs")) this.allSitePLs = config("allSitePLs")
// GVCF options
if (config("emitRefConfidence", default = "GVCF").getString == "GVCF") {
emitRefConfidence = org.broadinstitute.gatk.tools.walkers.haplotypecaller.ReferenceConfidenceMode.GVCF
variant_index_type = GATKVCFIndexType.LINEAR
variant_index_parameter = Option(128000)
}
if (config("inputtype", default = "dna").getString == "rna") {
dontUseSoftClippedBases = config("dontusesoftclippedbases", default = true)
recoverDanglingHeads = config("recoverdanglingheads", default = true)
stand_call_conf = config("stand_call_conf", default = 20)
stand_emit_conf = config("stand_emit_conf", default = 0)
} else {
dontUseSoftClippedBases = config("dontusesoftclippedbases", default = false)
recoverDanglingHeads = config("recoverdanglingheads", default = false)
stand_call_conf = config("stand_call_conf", default = 30)
stand_emit_conf = config("stand_emit_conf", default = 0)
}
override def beforeCmd {
super.beforeCmd
if (bamOutput != null && nct.getOrElse(1) > 1) {
nct = Option(1)
logger.warn("BamOutput is on, nct/threads is forced to set on 1, this option is only for debug")
}
}
}
......@@ -3,8 +3,9 @@ package nl.lumc.sasc.biopet.pipelines.gatk
import nl.lumc.sasc.biopet.core.{ BiopetQScript, PipelineCommand }
import nl.lumc.sasc.biopet.core.config.Configurable
import nl.lumc.sasc.biopet.extensions._
import nl.lumc.sasc.biopet.extensions.gatk.HaplotypeCaller
import org.broadinstitute.gatk.queue.QScript
import org.broadinstitute.gatk.queue.extensions.gatk.{ BaseRecalibrator, CommandLineGATK, HaplotypeCaller, IndelRealigner, PrintReads, RealignerTargetCreator, GenotypeGVCFs, AnalyzeCovariates }
import org.broadinstitute.gatk.queue.extensions.gatk.{ BaseRecalibrator, CommandLineGATK, IndelRealigner, PrintReads, RealignerTargetCreator, GenotypeGVCFs, AnalyzeCovariates }
import org.broadinstitute.gatk.queue.function._
import org.broadinstitute.gatk.utils.commandline.{ Input, Output, Argument }
import org.broadinstitute.gatk.utils.variant.GATKVCFIndexType
......@@ -120,42 +121,9 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
}
def addHaplotypeCaller(bamfiles: List[File], outputfile: File): File = {
val haplotypeCaller = new HaplotypeCaller with gatkArguments {
this.min_mapping_quality_score = config("minMappingQualityScore", 20, "haplotypecaller")
if (config.contains("scattercount", "haplotypecaller")) this.scatterCount = config("scattercount", 1, "haplotypecaller")
this.input_file = bamfiles
this.out = outputfile
if (config.contains("dbsnp")) this.dbsnp = config("dbsnp")
this.nct = config("threads", default = 3, submodule = "haplotypecaller")
if (config("outputToBam", default = false, submodule = "haplotypecaller").getBoolean) {
this.bamOutput = outputfile.getAbsolutePath + ".bam"
nct = 1
logger.warn("BamOutput is on, nct/threads is forced to set on 1, this option is only for debug")
}
this.memoryLimit = this.nct * 2
if (config.contains("allSitePLs")) this.allSitePLs = config("allSitePLs")
// GVCF options
if (gvcfMode) {
this.emitRefConfidence = org.broadinstitute.gatk.tools.walkers.haplotypecaller.ReferenceConfidenceMode.GVCF
this.variant_index_type = GATKVCFIndexType.LINEAR
this.variant_index_parameter = 128000
}
val inputType: String = config("inputtype", "dna")
if (inputType == "rna") {
this.dontUseSoftClippedBases = config("dontusesoftclippedbases", true, "haplotypecaller")
this.recoverDanglingHeads = config("recoverdanglingheads", true, "haplotypecaller")
this.stand_call_conf = config("stand_call_conf", 20, "haplotypecaller")
this.stand_emit_conf = config("stand_emit_conf", 20, "haplotypecaller")
} else {
this.dontUseSoftClippedBases = config("dontusesoftclippedbases", false, "haplotypecaller")
this.recoverDanglingHeads = config("recoverdanglingheads", false, "haplotypecaller")
this.stand_call_conf = config("stand_call_conf", 30, "haplotypecaller")
this.stand_emit_conf = config("stand_emit_conf", 30, "haplotypecaller")
}
}
val haplotypeCaller = new HaplotypeCaller(this)
haplotypeCaller.input_file = bamfiles
haplotypeCaller.out = outputfile
add(haplotypeCaller)
return haplotypeCaller.out
......
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