Skip to content

Commit

Permalink
[AVOCADO-247] Don't apply max AF filter to hetalts.
Browse files Browse the repository at this point in the history
Resolves #247.
  • Loading branch information
fnothaft committed Jun 4, 2017
1 parent c3e48f5 commit 664ee45
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,10 @@ private[avocado] object HardFilterGenotypes extends Serializable {
private[util] def hardFilterMaxAllelicFraction(genotype: Genotype,
maxAlleleFraction: Float,
msg: String): Option[String] = {
val gtIsHom = genotype.getAlleles.forall(_ == GenotypeAllele.ALT)
// treat het-alt as hom
val gtIsHom = genotype.getAlleles.forall(ga => {
ga == GenotypeAllele.ALT || ga == GenotypeAllele.OTHER_ALT
})
if (gtIsHom) {
None
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class HardFilterGenotypesSuite extends AvocadoFunSuite {
.setAlleles(Seq(GenotypeAllele.ALT, GenotypeAllele.ALT))
}

def hetAlt: Genotype.Builder = {
Genotype.newBuilder
.setAlleles(Seq(GenotypeAllele.ALT, GenotypeAllele.OTHER_ALT))
}

def altWithAnn: Genotype.Builder = {
alt
.setVariantCallingAnnotations(VariantCallingAnnotations.newBuilder
Expand Down Expand Up @@ -405,5 +410,11 @@ class HardFilterGenotypesSuite extends AvocadoFunSuite {
.setAlternateReadDepth(45)
.build, 0.666f, "MAXAF")
assert(hom.isEmpty)

val het = HardFilterGenotypes.hardFilterMaxAllelicFraction(hetAlt.setGenotypeQuality(50)
.setReadDepth(50)
.setAlternateReadDepth(40)
.build, 0.666f, "MAXAF")
assert(het.isEmpty)
}
}

0 comments on commit 664ee45

Please sign in to comment.