fix for DiagnoseTargets multiple filter output

Problem
-------
Diagnose targets is outputting both LOW_MEDIAN_COVERAGE and NO_READS when no reads are covering the interval

Solution
--------
Only allow low median coverage check if there are reads

[fixes #48442675]
This commit is contained in:
Mauricio Carneiro 2013-04-20 13:05:14 -04:00
parent cf7afc1ad4
commit 2b923f1568
3 changed files with 18 additions and 8 deletions

View File

@ -148,24 +148,34 @@ class IntervalStatistics {
votes.put(status, votes.get(status) + 1);
// output tall values above the threshold
final double minVotesNeeded = thresholds.getVotePercentageThreshold() * samples.size();
for (CallableStatus status : votes.keySet()) {
if (votes.get(status) > (samples.size() * thresholds.getVotePercentageThreshold()) && !(status.equals(CallableStatus.PASS)))
if (!status.equals((CallableStatus.PASS)) && votes.get(status) > minVotesNeeded)
output.add(status);
}
if (hasNref)
output.add(CallableStatus.REF_N);
// get median DP of each sample
final double minMedianDepth = thresholds.getLowMedianDepthThreshold() * samples.size();
final int nSamples = samples.size();
int nLowMedianDepth = 0;
int samplesSeen = 0;
for (SampleStatistics sample : samples.values()) {
if (sample.getQuantileDepth(0.5) < thresholds.getMinimumMedianDepth())
samplesSeen++;
final double medianDepth = sample.getQuantileDepth(0.5);
if (medianDepth > 0 && medianDepth < thresholds.getMinimumMedianDepth()) {
nLowMedianDepth++;
}
if (nLowMedianDepth > minMedianDepth) {
output.add(CallableStatus.LOW_MEDIAN_DEPTH);
break;
}
if (nSamples - samplesSeen + nLowMedianDepth < minMedianDepth)
break;
}
if (nLowMedianDepth > (samples.size() * thresholds.getLowMedianDepthThreshold()))
output.add(CallableStatus.LOW_MEDIAN_DEPTH);
return output;
}

View File

@ -101,7 +101,7 @@ class SampleStatistics {
* @return the callable statuses of the entire sample
*/
public Set<CallableStatus> getCallableStatuses(ThresHolder thresholds) {
// We check if reads are present ot prevent div / 0 exceptions
// We check if reads are present to prevent div / 0 exceptions
if (nReads == 0) {
return Collections.singleton(CallableStatus.NO_READS);
}

View File

@ -66,11 +66,11 @@ public class DiagnoseTargetsIntegrationTest extends WalkerTest {
@Test(enabled = true)
public void testSingleSample() {
DTTest("testSingleSample ", "-I " + singleSample + " -max 75", "9b51561bcf248da70a4d711380b04f7b");
DTTest("testSingleSample ", "-I " + singleSample + " -max 75", "bd614643284a849724bf8ee6bc4df8bf");
}
@Test(enabled = true)
public void testMultiSample() {
DTTest("testMultiSample ", "-I " + multiSample, "925f88f0c41c6a9ac479be34e052dc5d");
DTTest("testMultiSample ", "-I " + multiSample, "145f5d4641abfdeadbc59ee74ce1560f");
}
}