diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java index a80ebc3f8..75d8e05b7 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/annotator/RankSumTest.java @@ -72,7 +72,7 @@ public abstract class RankSumTest implements InfoFieldAnnotation, ExperimentalAn } final Map map = new HashMap(); - map.put(getKeyNames().get(0), String.format("%.3f", QualityUtils.phredScaleErrorRate(pvalue))); + map.put(getKeyNames().get(0), String.format("%.3f", Math.abs(QualityUtils.phredScaleErrorRate(pvalue)))); return map; } diff --git a/java/src/org/broadinstitute/sting/utils/WilcoxonRankSum.java b/java/src/org/broadinstitute/sting/utils/WilcoxonRankSum.java index bb925104c..5ba70e9a7 100755 --- a/java/src/org/broadinstitute/sting/utils/WilcoxonRankSum.java +++ b/java/src/org/broadinstitute/sting/utils/WilcoxonRankSum.java @@ -124,8 +124,9 @@ public class WilcoxonRankSum { // calculate normal approximation of the p-value // returns -1 when unable to calculate it (too few data points) public double getPValue(WILCOXON_H0 h0) { - if ( observations.size() == 0 ) + if ( observations.size() == 0 ) { return -1.0; + } // dither to break rank ties dither(); @@ -144,6 +145,11 @@ public class WilcoxonRankSum { } int n2 = observations.size() - n1; + if ( n1 == 0 || n2 == 0 ) { + // one of the sets is empty so there is no information + return -1.0; + } + // todo -- these are actually integers // we want the smaller of U1 and U2 double U1 = sum - (n1 * (n1 + 1.0) / 2.0);