Merge pull request #1197 from broadinstitute/ts_ve_nullPointer
Prevent null pointer exception in PrintMissingComp module
This commit is contained in:
commit
3d1dc303b3
|
|
@ -701,4 +701,22 @@ public class VariantEvalIntegrationTest extends WalkerTest {
|
||||||
tests.add(new Object[]{"genotypes/genotypes", evalGenotypes, compGenotypes, "73790b530595fcbd467a88475ea9717f"});
|
tests.add(new Object[]{"genotypes/genotypes", evalGenotypes, compGenotypes, "73790b530595fcbd467a88475ea9717f"});
|
||||||
return tests.toArray(new Object[][]{});
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
package org.broadinstitute.gatk.tools.walkers.varianteval.evaluators;
|
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.AlignmentContext;
|
||||||
import org.broadinstitute.gatk.utils.contexts.ReferenceContext;
|
import org.broadinstitute.gatk.utils.contexts.ReferenceContext;
|
||||||
import org.broadinstitute.gatk.utils.refdata.RefMetaDataTracker;
|
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 org.broadinstitute.gatk.tools.walkers.varianteval.util.DataPoint;
|
||||||
import htsjdk.variant.variantcontext.VariantContext;
|
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 {
|
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 long nMissing = 0;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
@ -49,9 +50,8 @@ public class PrintMissingComp extends VariantEvaluator {
|
||||||
final boolean compIsGood = comp != null && comp.isNotFiltered() && comp.isSNP();
|
final boolean compIsGood = comp != null && comp.isNotFiltered() && comp.isSNP();
|
||||||
final boolean evalIsGood = eval != null && eval.isSNP();
|
final boolean evalIsGood = eval != null && eval.isSNP();
|
||||||
|
|
||||||
if ( compIsGood & ! evalIsGood ) {
|
if ( compIsGood && !evalIsGood ) {
|
||||||
nMissing++;
|
nMissing++;
|
||||||
super.getWalker().getLogger().info("MissingFrom" + eval.toString() + " is missing from " + comp.getSource());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue