diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java index 25871b0ed..285be39c1 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/FisherStrand.java @@ -49,42 +49,30 @@ public class FisherStrand implements InfoFieldAnnotation, WorkInProgressAnnotati private static final String ALTFWD = "ALTFWD"; private static final String ALTREV = "ALTREV"; private static final String FS = "FS"; + private static final double MIN_PVALUE = 1E-320; public Map annotate(RefMetaDataTracker tracker, ReferenceContext ref, Map stratifiedContexts, VariantContext vc) { if ( ! vc.isVariant() || vc.isFiltered() || ! vc.isBiallelic() || ! vc.isSNP() ) return null; int[][] table = getContingencyTable(stratifiedContexts, vc.getReference(), vc.getAlternateAllele(0)); - Double pvalue = pValueForContingencyTable(table); + Double pvalue = Math.max(pValueForContingencyTable(table), MIN_PVALUE); if ( pvalue == null ) return null; // use Math.abs to prevent -0's Map map = new HashMap(); - int phredPValue = (int)Math.round(QualityUtils.phredScaleErrorRate(pvalue)); - addInt(map, REFFWD, table[0][0]); - addInt(map, REFREV, table[0][1]); - addInt(map, ALTFWD, table[1][0]); - addInt(map, ALTREV, table[1][1]); - addInt(map, FS, phredPValue); + map.put(FS, String.format("%.3f", QualityUtils.phredScaleErrorRate(pvalue))); return map; } - private static void addInt(Map map, String key, int value) { - map.put(key, String.format("%d", value)); - } - public List getKeyNames() { return Arrays.asList(REFFWD,REFREV,ALTFWD,ALTREV,FS); } public List getDescriptions() { return Arrays.asList( - new VCFInfoHeaderLine(REFFWD, 1, VCFHeaderLineType.Integer, "Count of bases with REF allele, forward strand"), - new VCFInfoHeaderLine(REFREV, 1, VCFHeaderLineType.Integer, "Count of bases with REF allele, reverse strand"), - new VCFInfoHeaderLine(ALTFWD, 1, VCFHeaderLineType.Integer, "Count of bases with ALT allele, forward strand"), - new VCFInfoHeaderLine(ALTREV, 1, VCFHeaderLineType.Integer, "Count of bases with ALT allele, reverse strand"), - new VCFInfoHeaderLine(FS, 1, VCFHeaderLineType.Integer, "Integer-rounded Phred-scaled p-value using Fisher's exact test to detect strand bias")); + new VCFInfoHeaderLine(FS, 1, VCFHeaderLineType.Float, "Phred-scaled p-value using Fisher's exact test to detect strand bias")); } private Double pValueForContingencyTable(int[][] originalTable) { diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java index 801de6704..202742a5d 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java @@ -214,7 +214,7 @@ public class VariantDataManager { } else { value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) ); if( Double.isInfinite(value) ) { value = Double.NaN; } - if( jitter && ( annotationKey.equalsIgnoreCase("HRUN") || annotationKey.equalsIgnoreCase("FS") ) ) { // Integer valued annotations must be jittered a bit to work in this GMM + if( jitter && ( annotationKey.equalsIgnoreCase("HRUN") ) ) { // Integer valued annotations must be jittered a bit to work in this GMM value += -0.25 + 0.5 * GenomeAnalysisEngine.getRandomGenerator().nextDouble(); } if( annotationKey.equals("HaplotypeScore") && MathUtils.compareDoubles(value, 0.0, 0.0001) == 0 ) { value = -0.2 + 0.4*GenomeAnalysisEngine.getRandomGenerator().nextDouble(); } diff --git a/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java b/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java index 9267276fd..052f4ce4b 100755 --- a/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java +++ b/java/test/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantRecalibrationWalkersIntegrationTest.java @@ -25,9 +25,9 @@ public class VariantRecalibrationWalkersIntegrationTest extends WalkerTest { } VRTest lowPass = new VRTest("phase1.projectConsensus.chr20.raw.snps.vcf", - "920b12d7765eb4f6f4a1bab045679b31", // tranches - "41bbc5f07c8a9573d5bb638f01808bba", // recal file - "d9aa7a0f8fb886df4394f1636605adca"); // cut VCF + "d33212a84368e821cbedecd4f59756d6", // tranches + "a35cd067f378442eee8cd5edeea92be0", // recal file + "7259b7daefe57b11ae9e537e38569160"); // cut VCF @DataProvider(name = "VRTest") public Object[][] createData1() {