Commit 16311041 authored by Sander Bollen's avatar Sander Bollen
Browse files

Add output tests to gvcf2bed.

Fixes #282.
Also fixes previously unseen bug in the GvcfToBed extension.
parent 8b471bb1
......@@ -25,7 +25,7 @@ class GvcfToBed(val root: Configurable) extends ToolCommandFunction {
var minQuality: Int = 0
@Argument(doc = "inverse", required = false)
var inverse: Boolean = false
var inverse: Option[File] = None
override def defaultCoreMemory = 4.0
......@@ -35,7 +35,7 @@ class GvcfToBed(val root: Configurable) extends ToolCommandFunction {
required("-O", outputBed) +
optional("-S", sample) +
optional("--minGenomeQuality", minQuality) +
conditional(inverse, "--inverted")
optional("--invertedOutputBed", inverse)
}
}
......@@ -12,6 +12,8 @@ import org.scalatest.testng.TestNGSuite
import GvcfToBed._
import org.testng.annotations.Test
import scala.io.Source
/**
* Created by ahbbollen on 13-10-15.
*/
......@@ -39,4 +41,46 @@ class GvcfToBedTest extends TestNGSuite with Matchers with MockitoSugar {
VcfUtils.hasMinGenomeQuality(record2, "Sample_102", 3) shouldBe true
VcfUtils.hasMinGenomeQuality(record2, "Sample_102", 99) shouldBe false
}
@Test
def testGvcfToBedOutput = {
val tmp = File.createTempFile("gvcf2bedtest", ".bed")
tmp.deleteOnExit()
val args: Array[String] = Array("-I", unvepped.getAbsolutePath, "-O", tmp.getAbsolutePath, "-S", "Sample_101",
"--minGenomeQuality", "99")
main(args)
Source.fromFile(tmp).getLines().size shouldBe 0
val tmp2 = File.createTempFile("gvcf2bedtest", ".bed")
tmp2.deleteOnExit()
val args2: Array[String] = Array("-I", unvepped.getAbsolutePath, "-O", tmp2.getAbsolutePath, "-S", "Sample_102",
"--minGenomeQuality", "2")
main(args2)
Source.fromFile(tmp2).getLines().size shouldBe 1
}
@Test
def testGvcfToBedInvertedOutput = {
val tmp = File.createTempFile("gvcf2bedtest", ".bed")
val tmp_inv = File.createTempFile("gvcf2bedtest", ".bed")
tmp.deleteOnExit()
tmp_inv.deleteOnExit()
val args: Array[String] = Array("-I", unvepped.getAbsolutePath, "-O", tmp.getAbsolutePath, "-S", "Sample_101",
"--minGenomeQuality", "99", "--invertedOutputBed", tmp_inv.getAbsolutePath)
main(args)
Source.fromFile(tmp_inv).getLines().size shouldBe 1
val tmp2 = File.createTempFile("gvcf2bedtest", ".bed")
val tmp2_inv = File.createTempFile("gvcf2bedtest", ".bed")
tmp2.deleteOnExit()
tmp2_inv.deleteOnExit()
val args2: Array[String] = Array("-I", unvepped.getAbsolutePath, "-O", tmp.getAbsolutePath, "-S", "Sample_102",
"--minGenomeQuality", "3", "--invertedOutputBed", tmp2_inv.getAbsolutePath)
main(args2)
Source.fromFile(tmp2_inv).getLines().size shouldBe 0
}
}
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