Removed the line that caused a null pointer, as the information it logged was not useful. Updated docs and added an integration test to ensure the code no longer throws the exception.

This commit is contained in:
Takuto Sato 2015-10-20 14:49:04 -04:00
parent 4fbcfc2e36
commit 33462c7b50
2 changed files with 22 additions and 4 deletions

View File

@ -690,4 +690,22 @@ public class VariantEvalIntegrationTest extends WalkerTest {
tests.add(new Object[]{"genotypes/genotypes", evalGenotypes, compGenotypes, "73790b530595fcbd467a88475ea9717f"});
return tests.toArray(new Object[][]{});
}
@Test
public void testPrintMissingComp() {
WalkerTestSpec spec = new WalkerTestSpec(
buildCommandLine(
"-T VariantEval",
"-R " + b37KGReference,
"-eval " + privateTestDir + "validationReportEval.noGenotypes.vcf",
"--comp " + privateTestDir + "validationReportComp.noGenotypes.vcf",
"-L 20",
"-EV PrintMissingComp"
),
0,
Arrays.asList("d41d8cd98f00b204e9800998ecf8427e")); // sato: make sure it doesn't throw a null pointer exception.
executeTest("testPrintMissingComp", spec);
}
}

View File

@ -25,6 +25,7 @@
package org.broadinstitute.gatk.tools.walkers.varianteval.evaluators;
import org.apache.commons.lang.ObjectUtils;
import org.broadinstitute.gatk.utils.contexts.AlignmentContext;
import org.broadinstitute.gatk.utils.contexts.ReferenceContext;
import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker;
@ -32,9 +33,9 @@ import org.broadinstitute.gatk.tools.walkers.varianteval.util.Analysis;
import org.broadinstitute.gatk.tools.walkers.varianteval.util.DataPoint;
import htsjdk.variant.variantcontext.VariantContext;
@Analysis(name = "PrintMissingComp", description = "the overlap between eval and comp sites")
@Analysis(name = "PrintMissingComp", description = "count the number of comp SNP sites that are not in eval")
public class PrintMissingComp extends VariantEvaluator {
@DataPoint(description = "number of eval sites outside of comp sites", format = "%d")
@DataPoint(description = "number of comp SNP sites outside of eval sites", format = "%d")
public long nMissing = 0;
public String getName() {
@ -49,9 +50,8 @@ public class PrintMissingComp extends VariantEvaluator {
final boolean compIsGood = comp != null && comp.isNotFiltered() && comp.isSNP();
final boolean evalIsGood = eval != null && eval.isSNP();
if ( compIsGood & ! evalIsGood ) {
if ( compIsGood && !evalIsGood ) {
nMissing++;
super.getWalker().getLogger().info("MissingFrom" + eval.toString() + " is missing from " + comp.getSource());
}
}
}