Commit 55629dcb authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fixed vcf index files

parent 0929d425
......@@ -5,9 +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
class UnifiedGenotyper(val root: Configurable) extends org.broadinstitute.gatk.queue.extensions.gatk.UnifiedGenotyper with GatkGeneral {
@Output(required = false)
protected var vcfIndex: File = _
if (config.contains("scattercount")) scatterCount = config("scattercount")
if (config.contains("dbsnp")) this.dbsnp = config("dbsnp")
sample_ploidy = config("ploidy")
......@@ -36,3 +44,14 @@ class UnifiedGenotyper(val root: Configurable) extends org.broadinstitute.gatk.q
memoryLimit = Option(nct.getOrElse(1) * memoryLimit.getOrElse(2.0))
}
}
object UnifiedGenotyper {
def apply(root: Configurable, inputFiles: List[File], outputFile: File): UnifiedGenotyper = {
val ug = new UnifiedGenotyper(root)
ug.input_file = inputFiles
ug.out = outputFile
if (ug.out.getName.endsWith(".vcf.gz")) ug.vcfIndex = new File(ug.out.getAbsolutePath + ".tbi")
ug
}
}
\ No newline at end of file
......@@ -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 UnifiedGenotyper */
class UnifiedGenotyper(val root: Configurable) extends Variantcaller {
......@@ -9,9 +10,7 @@ class UnifiedGenotyper(val root: Configurable) extends Variantcaller {
protected def defaultPrio = 20
def biopetScript() {
val ug = new nl.lumc.sasc.biopet.extensions.gatk.broad.UnifiedGenotyper(this)
ug.input_file = inputBams.values.toList
ug.out = outputFile
val ug = broad.UnifiedGenotyper(this, inputBams.values.toList, outputFile)
add(ug)
}
}
......@@ -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 GenotyperAllele */
class UnifiedGenotyperAllele(val root: Configurable) extends Variantcaller {
......@@ -9,9 +10,7 @@ class UnifiedGenotyperAllele(val root: Configurable) extends Variantcaller {
protected def defaultPrio = 9
def biopetScript() {
val ug = new nl.lumc.sasc.biopet.extensions.gatk.broad.UnifiedGenotyper(this)
ug.input_file = inputBams.values.toList
ug.out = outputFile
val ug = broad.UnifiedGenotyper(this, inputBams.values.toList, outputFile)
ug.alleles = config("input_alleles")
ug.genotyping_mode = org.broadinstitute.gatk.tools.walkers.genotyper.GenotypingOutputMode.GENOTYPE_GIVEN_ALLELES
add(ug)
......
......@@ -38,6 +38,9 @@ class MpileupToVcf(val root: Configurable) extends ToolCommandFunction with Refe
@Output(doc = "Output tag library", shortName = "output", required = true)
var output: File = _
@Output
private var outputIndex: File = _
var minDP: Option[Int] = config("min_dp")
var minAP: Option[Int] = config("min_ap")
var homoFraction: Option[Double] = config("homoFraction")
......@@ -50,6 +53,7 @@ class MpileupToVcf(val root: Configurable) extends ToolCommandFunction with Refe
override def beforeGraph() {
super.beforeGraph()
if (reference == null) reference = referenceFasta().getAbsolutePath
if (output.getName.endsWith(".vcf.gz")) outputIndex = new File(output.getAbsolutePath + ".tbi")
val samtoolsMpileup = new SamtoolsMpileup(this)
}
......
......@@ -30,6 +30,9 @@ class VcfFilter(val root: Configurable) extends ToolCommandFunction {
@Output(doc = "Output vcf", shortName = "o", required = false)
var outputVcf: File = _
@Output
var outputVcfIndex: File = _
var minSampleDepth: Option[Int] = config("min_sample_depth")
var minTotalDepth: Option[Int] = config("min_total_depth")
var minAlternateDepth: Option[Int] = config("min_alternate_depth")
......@@ -38,6 +41,11 @@ class VcfFilter(val root: Configurable) extends ToolCommandFunction {
override def defaultCoreMemory = 3.0
override def beforeGraph(): Unit = {
super.beforeGraph()
if (outputVcf.getName.endsWith("vcf.gz")) outputVcfIndex = new File(outputVcf.getAbsolutePath + ".tbi")
}
override def cmdLine = super.cmdLine +
required("-I", inputVcf) +
required("-o", outputVcf) +
......
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