Skip to content
Snippets Groups Projects
Commit f1599432 authored by Sander van der Zeeuw's avatar Sander van der Zeeuw
Browse files

added tabix to bcftools output

parent d9f7d56f
No related branches found
No related tags found
No related merge requests found
......@@ -35,10 +35,9 @@ class Tabix(val root: Configurable) extends BiopetCommandLineFunction {
@Output(doc = "Output (for region query)", required = false)
var outputQuery: File = null
@Output(doc = "Output (for indexing)", required = false) // NOTE: it's a def since we can't change the index name ~ it's always input_name + .tbi
lazy val outputIndex: File = {
require(input != null, "Input must be defined")
new File(input.toString + ".tbi")
def outputIndex: File = {
require(input != null, "Input should be defined")
new File(input.getAbsolutePath + ".tbi")
}
@Argument(doc = "Regions to query", required = false)
......@@ -70,7 +69,8 @@ class Tabix(val root: Configurable) extends BiopetCommandLineFunction {
p match {
case Some(fmt) =>
require(validFormats.contains(fmt), "-p flag must be one of " + validFormats.mkString(", "))
case None => ;
outputFiles :+= outputIndex
case None =>
}
}
......@@ -96,3 +96,19 @@ class Tabix(val root: Configurable) extends BiopetCommandLineFunction {
else baseCommand
}
}
object Tabix {
def apply(root: Configurable, input: File) = {
val tabix = new Tabix(root)
tabix.input = input
tabix.p = tabix.input.getName match {
case s if s.endsWith(".vcf.gz") => Some("vcf")
case s if s.endsWith(".bed.gz") => Some("bed")
case s if s.endsWith(".sam.gz") => Some("sam")
case s if s.endsWith(".gff.gz") => Some("gff")
case s if s.endsWith(".psltbl.gz") => Some("psltbl")
case _ => throw new IllegalArgumentException("Unknown file type")
}
tabix
}
}
\ No newline at end of file
......@@ -163,7 +163,6 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag with
val mp = new SamtoolsMpileup(qscript)
mp.input = inputBams
mp.u = true
//TODO: proper piping should be implemented
mp.reference = referenceFasta()
val bt = new BcftoolsCall(qscript)
......@@ -172,6 +171,7 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag with
bt.c = true
add(mp | bt > outputFile)
add(Tabix(qscript, outputFile))
}
}
......@@ -197,6 +197,7 @@ trait ShivaVariantcallingTrait extends SummaryQScript with SampleLibraryTag with
bt.output = new File(outputDir, inputBam.getName + ".vcf.gz")
add(mp | bt)
add(Tabix(qscript, bt.output))
bt.output
}
......
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