Commit 73e27f7d authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fixed haplotypecaller index files

parent 3f7a6044
......@@ -8,8 +8,13 @@ package nl.lumc.sasc.biopet.extensions.gatk.broad
import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.Output
class GenotypeGVCFs(val root: Configurable) extends org.broadinstitute.gatk.queue.extensions.gatk.GenotypeGVCFs with GatkGeneral {
@Output(required = false)
protected var vcfIndex: File = _
annotation ++= config("annotation", default = Seq(), freeVar = false).asStringList
if (config.contains("dbsnp")) dbsnp = config("dbsnp")
......@@ -22,6 +27,11 @@ class GenotypeGVCFs(val root: Configurable) extends org.broadinstitute.gatk.queu
stand_call_conf = config("stand_call_conf", default = 30)
stand_emit_conf = config("stand_emit_conf", default = 0)
}
override def freezeFieldValues(): Unit = {
super.freezeFieldValues()
if (out.getName.endsWith(".vcf.gz")) vcfIndex = new File(out.getAbsolutePath + ".tbi")
}
}
object GenotypeGVCFs {
......@@ -29,6 +39,7 @@ object GenotypeGVCFs {
val gg = new GenotypeGVCFs(root)
gg.variant = gvcfFiles
gg.out = output
if (gg.out.getName.endsWith(".vcf.gz")) gg.vcfIndex = new File(gg.out.getAbsolutePath + ".tbi")
gg
}
}
\ No newline at end of file
......@@ -5,11 +5,17 @@
*/
package nl.lumc.sasc.biopet.extensions.gatk.broad
import java.io.File
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.utils.commandline.Output
import org.broadinstitute.gatk.utils.variant.GATKVCFIndexType
class HaplotypeCaller(val root: Configurable) extends org.broadinstitute.gatk.queue.extensions.gatk.HaplotypeCaller with GatkGeneral {
@Output(required = false)
protected var vcfIndex: File = _
override val defaultThreads = 1
min_mapping_quality_score = config("minMappingQualityScore", default = 20)
......@@ -40,6 +46,7 @@ class HaplotypeCaller(val root: Configurable) extends org.broadinstitute.gatk.qu
override def freezeFieldValues() {
super.freezeFieldValues()
if (out.getName.endsWith(".vcf.gz")) vcfIndex = new File(out.getAbsolutePath + ".tbi")
if (bamOutput != null && nct.getOrElse(1) > 1) {
logger.warn("BamOutput is on, nct/threads is forced to set on 1, this option is only for debug")
nCoresRequest = Some(1)
......@@ -47,10 +54,22 @@ class HaplotypeCaller(val root: Configurable) extends org.broadinstitute.gatk.qu
nct = Some(getThreads)
memoryLimit = Option(memoryLimit.getOrElse(2.0) * nct.getOrElse(1))
}
}
object HaplotypeCaller {
def apply(root: Configurable, inputFiles: List[File], outputFile: File): HaplotypeCaller = {
val hc = new HaplotypeCaller(root)
hc.input_file = inputFiles
hc.out = outputFile
if (hc.out.getName.endsWith(".vcf.gz")) hc.vcfIndex = new File(hc.out.getAbsolutePath + ".tbi")
hc
}
def useGvcf() {
emitRefConfidence = org.broadinstitute.gatk.tools.walkers.haplotypecaller.ReferenceConfidenceMode.GVCF
variant_index_type = GATKVCFIndexType.LINEAR
variant_index_parameter = config("variant_index_parameter", default = 128000)
def gvcf(root: Configurable, inputFile: File, outputFile: File): HaplotypeCaller = {
val hc = apply(root, List(inputFile), outputFile)
hc.emitRefConfidence = org.broadinstitute.gatk.tools.walkers.haplotypecaller.ReferenceConfidenceMode.GVCF
hc.variant_index_type = GATKVCFIndexType.LINEAR
hc.variant_index_parameter = Some(hc.config("variant_index_parameter", default = 128000).asInt)
hc
}
}
}
\ No newline at end of file
......@@ -111,7 +111,7 @@ class GatkVariantcalling(val root: Configurable) extends QScript with BiopetQScr
if (sampleID != null && (useHaplotypecaller || config("joint_genotyping", default = false).asBoolean)) {
val hcGvcf = new HaplotypeCaller(this)
hcGvcf.useGvcf()
//hcGvcf.useGvcf()
hcGvcf.input_file = scriptOutput.bamFiles
hcGvcf.out = new File(outputDir, outputName + ".hc.discovery.gvcf.vcf.gz")
add(hcGvcf)
......
......@@ -2,6 +2,7 @@ package nl.lumc.sasc.biopet.pipelines.gatk.variantcallers
import nl.lumc.sasc.biopet.pipelines.shiva.variantcallers.Variantcaller
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.extensions.gatk.broad
/** Default mode for the haplotypecaller */
class HaplotypeCaller(val root: Configurable) extends Variantcaller {
......@@ -9,9 +10,7 @@ class HaplotypeCaller(val root: Configurable) extends Variantcaller {
protected def defaultPrio = 1
def biopetScript() {
val hc = new nl.lumc.sasc.biopet.extensions.gatk.broad.HaplotypeCaller(this)
hc.input_file = inputBams.values.toList
hc.out = outputFile
val hc = broad.HaplotypeCaller(this, inputBams.values.toList, outputFile)
add(hc)
}
}
......
......@@ -2,6 +2,7 @@ package nl.lumc.sasc.biopet.pipelines.gatk.variantcallers
import nl.lumc.sasc.biopet.pipelines.shiva.variantcallers.Variantcaller
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.extensions.gatk.broad
/** Allele mode for Haplotypecaller */
class HaplotypeCallerAllele(val root: Configurable) extends Variantcaller {
......@@ -9,9 +10,7 @@ class HaplotypeCallerAllele(val root: Configurable) extends Variantcaller {
protected def defaultPrio = 5
def biopetScript() {
val hc = new nl.lumc.sasc.biopet.extensions.gatk.broad.HaplotypeCaller(this)
hc.input_file = inputBams.values.toList
hc.out = outputFile
val hc = broad.HaplotypeCaller(this, inputBams.values.toList, outputFile)
hc.alleles = config("input_alleles")
hc.genotyping_mode = org.broadinstitute.gatk.tools.walkers.genotyper.GenotypingOutputMode.GENOTYPE_GIVEN_ALLELES
add(hc)
......
package nl.lumc.sasc.biopet.pipelines.gatk.variantcallers
import nl.lumc.sasc.biopet.extensions.gatk.broad.GenotypeGVCFs
import nl.lumc.sasc.biopet.pipelines.shiva.variantcallers.Variantcaller
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.extensions.gatk.broad
/** Gvcf mode for haplotypecaller */
class HaplotypeCallerGvcf(val root: Configurable) extends Variantcaller {
......@@ -11,15 +11,12 @@ class HaplotypeCallerGvcf(val root: Configurable) extends Variantcaller {
def biopetScript() {
val gvcfFiles = for ((sample, inputBam) <- inputBams) yield {
val hc = new nl.lumc.sasc.biopet.extensions.gatk.broad.HaplotypeCaller(this)
hc.input_file = List(inputBam)
hc.out = new File(outputDir, sample + ".gvcf.vcf.gz")
hc.useGvcf()
val hc = broad.HaplotypeCaller.gvcf(this, inputBam, new File(outputDir, sample + ".gvcf.vcf.gz"))
add(hc)
hc.out
}
val genotypeGVCFs = GenotypeGVCFs(this, gvcfFiles.toList, outputFile)
val genotypeGVCFs = broad.GenotypeGVCFs(this, gvcfFiles.toList, outputFile)
add(genotypeGVCFs)
}
}
Supports Markdown
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