Skip to content
Snippets Groups Projects
Commit 9e565c2f authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added useIndelRealigner and useBaseRecalibration option

parent 1f294e54
No related branches found
No related tags found
No related merge requests found
......@@ -41,12 +41,20 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
var useHaplotypecaller: Option[Boolean] = config("use_haplotypecaller", default = true)
var useUnifiedGenotyper: Option[Boolean] = config("use_unifiedgenotyper", default = false)
var useAllelesOption: Option[Boolean] = config("use_alleles_option", default = false)
var useIndelRealigner: Boolean = config("use_indel_realign", default = true)
var useBaseRecalibration: Boolean = config("use_base_recalibration", default = true)
def init() {
if (outputName == null && sampleID != null) outputName = sampleID
else if (outputName == null) outputName = "noname"
if (outputDir == null) throw new IllegalStateException("Missing Output directory on gatk module")
else if (!outputDir.endsWith("/")) outputDir += "/"
val baseRecalibrator = new BaseRecalibrator(this)
if (useBaseRecalibration && baseRecalibrator.knownSites.isEmpty) {
logger.warn("No Known site found, skipping base recalibration")
useBaseRecalibration = false
}
}
private def doublePreProces(files: List[File]): List[File] = {
......@@ -54,11 +62,10 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
if (files.isEmpty) throw new IllegalStateException("Files can't be empty")
if (!doublePreProces.get) return files
val markDub = MarkDuplicates(this, files, new File(outputDir + outputName + ".dedup.bam"))
if (dbsnp != null) {
add(markDub, isIntermediate = true)
add(markDub, isIntermediate = useIndelRealigner)
if (useIndelRealigner) {
List(addIndelRealign(markDub.output, outputDir, isIntermediate = false))
} else {
add(markDub, isIntermediate = true)
List(markDub.output)
}
}
......@@ -67,8 +74,14 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
scriptOutput.bamFiles = if (preProcesBams.get) {
var bamFiles: List[File] = Nil
for (inputBam <- inputBams) {
var bamFile = addIndelRealign(inputBam, outputDir)
bamFiles :+= addBaseRecalibrator(bamFile, outputDir, isIntermediate = bamFiles.size > 1)
var bamFile = inputBam
if (useIndelRealigner) {
bamFile = addIndelRealign(bamFile, outputDir, isIntermediate = useBaseRecalibration)
}
if (useBaseRecalibration) {
bamFile = addBaseRecalibrator(bamFile, outputDir, isIntermediate = bamFiles.size > 1)
}
bamFiles :+= bamFile
}
doublePreProces(bamFiles)
} else if (inputBams.size > 1 && doublePreProces.get) {
......@@ -188,7 +201,7 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
}
def addBaseRecalibrator(inputBam: File, dir: String, isIntermediate: Boolean = false): File = {
val baseRecalibrator = BaseRecalibrator(this, inputBam, swapExt(dir, inputBam, ".bam", ".baserecal")) //with gatkArguments {
val baseRecalibrator = BaseRecalibrator(this, inputBam, swapExt(dir, inputBam, ".bam", ".baserecal"))
if (baseRecalibrator.knownSites.isEmpty) {
logger.warn("No Known site found, skipping base recalibration, file: " + inputBam)
......@@ -196,7 +209,7 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
}
add(baseRecalibrator)
val baseRecalibratorAfter = BaseRecalibrator(this, inputBam, swapExt(dir, inputBam, ".bam", ".baserecal.after")) //with gatkArguments {
val baseRecalibratorAfter = BaseRecalibrator(this, inputBam, swapExt(dir, inputBam, ".bam", ".baserecal.after"))
baseRecalibratorAfter.BQSR = baseRecalibrator.o
add(baseRecalibratorAfter)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment