diff --git a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/VcfFilterTest.scala b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/VcfFilterTest.scala index 150e3eea3bbf953838754679c6e0404c0acf760c..2f4709a9c1dc78c66f1e28a21bb439db219644bf 100644 --- a/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/VcfFilterTest.scala +++ b/public/biopet-framework/src/test/scala/nl/lumc/sasc/biopet/tools/VcfFilterTest.scala @@ -15,8 +15,10 @@ */ package nl.lumc.sasc.biopet.tools +import java.io.File import java.nio.file.Paths +import htsjdk.variant.vcf.VCFFileReader import org.scalatest.Matchers import org.scalatest.mock.MockitoSugar import org.scalatest.testng.TestNGSuite @@ -37,6 +39,7 @@ class VcfFilterTest extends TestNGSuite with MockitoSugar with Matchers { } val vepped_path = resourcePath("/VEP_oneline.vcf") + val vepped = new File(vepped_path) val rand = new Random() @Test def testOutputTypeVcf() = { @@ -57,4 +60,24 @@ class VcfFilterTest extends TestNGSuite with MockitoSugar with Matchers { main(arguments) } + @Test def testHasGenotype() = { + val reader = new VCFFileReader(vepped, false) + val record = reader.iterator().next() + + hasGenotype(record, List("Child_7006504:HET")) shouldBe true + hasGenotype(record, List("Child_7006504:HOM_VAR")) shouldBe false + hasGenotype(record, List("Child_7006504:HOM_REF")) shouldBe false + hasGenotype(record, List("Child_7006504:NO_CALL")) shouldBe false + hasGenotype(record, List("Child_7006504:MIXED")) shouldBe false + + hasGenotype(record, List("Mother_7006508:HET")) shouldBe false + hasGenotype(record, List("Mother_7006508:HOM_VAR")) shouldBe false + hasGenotype(record, List("Mother_7006508:HOM_REF")) shouldBe true + hasGenotype(record, List("Mother_7006508:NO_CALL")) shouldBe false + hasGenotype(record, List("Mother_7006508:MIXED")) shouldBe false + + hasGenotype(record, List("Mother_7006508:HOM_REF", "Child_7006504:HET")) shouldBe true + hasGenotype(record, List("Mother_7006508:HET", "Child_7006504:HOM_HET")) shouldBe false + } + }