Commit 71ee4cab authored by Sander Bollen's avatar Sander Bollen
Browse files

extra safeguards. potential genotype 1/. is still a call.

 Tests in VcfUtils
parent 90ad4035
...@@ -142,11 +142,11 @@ object VcfUtils { ...@@ -142,11 +142,11 @@ object VcfUtils {
} }
/** /**
* Check whether genotype is of the from 0/. * Check whether genotype is of the form 0/.
* @param genotype genotype * @param genotype genotype
* @return boolean * @return boolean
*/ */
def isCompoundNoCall(genotype: Genotype): Boolean = { def isCompoundNoCall(genotype: Genotype): Boolean = {
genotype.isCalled && genotype.getAlleles.exists(_.isNoCall) genotype.isCalled && genotype.getAlleles.exists(_.isNoCall) && genotype.getAlleles.exists(_.isReference)
} }
} }
import htsjdk.variant.variantcontext.{Allele, Genotype, GenotypeBuilder}
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test
import scala.collection.JavaConversions._
import nl.lumc.sasc.biopet.utils.VcfUtils
/**
* Created by Sander Bollen on 4-10-16.
*/
class VcfUtilsTest extends TestNGSuite with Matchers {
@Test
def testCompoundNoCall(): Unit = {
val noAllele = Allele.NO_CALL
val refAllele = Allele.create("A", true)
val compoundNoCall = GenotypeBuilder.create("sample_01", List(noAllele, refAllele))
VcfUtils.isCompoundNoCall(compoundNoCall) shouldBe true
val altAllele = Allele.create("G", false)
val normalGenotype = GenotypeBuilder.create("sample_01", List(refAllele, altAllele))
VcfUtils.isCompoundNoCall(normalGenotype) shouldBe false
val completeNoCall = GenotypeBuilder.create("sample_01", List(noAllele, noAllele))
VcfUtils.isCompoundNoCall(completeNoCall) shouldBe false
}
}
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