From 1b921666a7f92b971a47b5021b6526cd8c82230e Mon Sep 17 00:00:00 2001 From: meganshand Date: Tue, 28 Jun 2016 14:23:39 -0400 Subject: [PATCH] Change to max value of ExcessHet --- .../broadinstitute/gatk/tools/walkers/annotator/ExcessHet.java | 3 ++- .../gatk/tools/walkers/annotator/ExcessHetUnitTest.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHet.java b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHet.java index 063e63560..b4dd52447 100644 --- a/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHet.java +++ b/protected/gatk-tools-protected/src/main/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHet.java @@ -139,8 +139,9 @@ public class ExcessHet extends InfoFieldAnnotation implements StandardAnnotation double pval = exactTest(genotypeCounts); //If the actual phredPval would be infinity we will probably still filter out just a very large number + //Since the method does not guarantee precision for any p-value smaller than 1e-16, we can return the phred scaled version if (pval == 0) { - return Integer.MAX_VALUE; + return -10.0 * Math.log10(minNeededValue); } double phredPval = -10.0 * Math.log10(pval); diff --git a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHetUnitTest.java b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHetUnitTest.java index a28ce0337..ee0d2da8d 100644 --- a/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHetUnitTest.java +++ b/protected/gatk-tools-protected/src/test/java/org/broadinstitute/gatk/tools/walkers/annotator/ExcessHetUnitTest.java @@ -223,6 +223,9 @@ public class ExcessHetUnitTest { final double EHHets = new ExcessHet().calculateEH(allHet, allHet.getGenotypes()); Assert.assertTrue(Math.abs(EHsingleton) < Math.abs(EHHets), String.format("singleton=%f allHets=%f", EHsingleton, EHHets)); + + //Since all hets is such an extreme case and the sample size is large here, we know that the p-value should be 0 + Assert.assertTrue(EHHets == 160.0, String.format("P-value of 0 should be phred scaled to 160.0")); } @DataProvider(name = "smallSets")