Merge pull request #1426 from broadinstitute/ms_excessHetSmallP

Changes max value output for ExcessHet
This commit is contained in:
meganshand 2016-06-30 08:26:01 -04:00 committed by GitHub
commit 6471bda0cd
2 changed files with 5 additions and 1 deletions

View File

@ -139,8 +139,9 @@ public class ExcessHet extends InfoFieldAnnotation implements StandardAnnotation
double pval = exactTest(genotypeCounts); double pval = exactTest(genotypeCounts);
//If the actual phredPval would be infinity we will probably still filter out just a very large number //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) { if (pval == 0) {
return Integer.MAX_VALUE; return -10.0 * Math.log10(minNeededValue);
} }
double phredPval = -10.0 * Math.log10(pval); double phredPval = -10.0 * Math.log10(pval);

View File

@ -223,6 +223,9 @@ public class ExcessHetUnitTest {
final double EHHets = new ExcessHet().calculateEH(allHet, allHet.getGenotypes()); 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)); 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") @DataProvider(name = "smallSets")