Fixes / TODOs for meaningful results with AFCalculationResult

-- Right now the state of the AFCaclulationResult can be corrupt (ie, log10 likelihoods can be -Infinity).  Forced me to disable reasonable contracts.  Needs to be thought through
-- exactCallsLog should be optional
-- Update UG integration tests as the calculation of the normalized posteriors is done in a marginally different way so the output is rounded slightly differently.
This commit is contained in:
Mark DePristo 2012-10-03 19:54:27 -07:00
parent 50e4a832ea
commit f6a2ca6e7f
3 changed files with 17 additions and 7 deletions

View File

@ -60,6 +60,6 @@ public class StandardCallerArgumentCollection {
public int MAX_ALTERNATE_ALLELES = 3;
@Hidden
@Argument(shortName = "logExactCalls", doc="x")
@Argument(shortName = "logExactCalls", doc="x", required=false)
public File exactCallsLog = null;
}

View File

@ -84,7 +84,7 @@ public class AlleleFrequencyCalculationResult {
*
* @return a log10 prob
*/
@Ensures("result < 0")
@Ensures("goodLog10Value(result)")
public double getLog10MLE() {
return log10MLE;
}
@ -94,7 +94,7 @@ public class AlleleFrequencyCalculationResult {
*
* @return a log10 prob
*/
@Ensures("result < 0")
@Ensures("goodLog10Value(result)")
public double getLog10MAP() {
return log10MAP;
}
@ -185,7 +185,10 @@ public class AlleleFrequencyCalculationResult {
* Get the normalized -- across all AFs -- of AC == 0, NOT LOG10
* @return
*/
@Ensures({"result >= 0.0", "result <= 1.0"})
// TODO -- this ensure cannot be enabled right now because the log10 inputs can be infinity, etc.
// TODO -- we should own these values in a more meaningful way and return good values in the case
// TODO -- where this happens, or instead thrown an error and have a function to say "was this calculation successful
// @Ensures({"result >= 0.0", "result <= 1.0"})
public double getNormalizedPosteriorOfAFzero() {
return getNormalizedPosteriors()[0];
}
@ -194,7 +197,10 @@ public class AlleleFrequencyCalculationResult {
* Get the normalized -- across all AFs -- of AC > 0, NOT LOG10
* @return
*/
@Ensures({"result >= 0.0", "result <= 1.0"})
// TODO -- this ensure cannot be enabled right now because the log10 inputs can be infinity, etc.
// TODO -- we should own these values in a more meaningful way and return good values in the case
// TODO -- where this happens, or instead thrown an error and have a function to say "was this calculation successful
//@Ensures({"result >= 0.0", "result <= 1.0"})
public double getNormalizedPosteriorOfAFGTZero() {
return getNormalizedPosteriors()[1];
}
@ -285,4 +291,8 @@ public class AlleleFrequencyCalculationResult {
this.allelesUsedInGenotyping = allelesUsedInGenotyping;
}
private static boolean goodLog10Value(final double result) {
return result <= 0.0 || Double.isInfinite(result) || Double.isNaN(result);
}
}

View File

@ -182,12 +182,12 @@ public class UnifiedGenotyperIntegrationTest extends WalkerTest {
@Test
public void testOutputParameterAllConfident() {
testOutputParameters("--output_mode EMIT_ALL_CONFIDENT_SITES", "da318257d25a02abd26a3348421c3c69");
testOutputParameters("--output_mode EMIT_ALL_CONFIDENT_SITES", "7bb6375fddc461c72d44f261f6d4b3c7");
}
@Test
public void testOutputParameterAllSites() {
testOutputParameters("--output_mode EMIT_ALL_SITES", "13c4f01cffbbfac600318be95b3ca02f");
testOutputParameters("--output_mode EMIT_ALL_SITES", "2104dac76fa2a58a92c72b331c7f2095");
}
private void testOutputParameters(final String args, final String md5) {