From 6313aae2c4b7f2a8921cf80044cba3b2462396a3 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 9 Nov 2011 22:37:26 -0500 Subject: [PATCH] Adding checks for hasBasePileup() before calling getBasePileup() as per GS thread --- .../sting/gatk/walkers/annotator/AlleleBalance.java | 2 +- .../sting/gatk/walkers/annotator/AlleleBalanceBySample.java | 3 +++ .../gatk/walkers/validation/GenotypeAndValidateWalker.java | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java index e5f75f06d..3a21e97a4 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalance.java @@ -69,7 +69,7 @@ public class AlleleBalance extends InfoFieldAnnotation { if ( context == null ) continue; - if ( vc.isSNP() ) { + if ( vc.isSNP() && context.hasBasePileup() ) { final String bases = new String(context.getBasePileup().getBases()); if ( bases.length() == 0 ) return null; diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java index 820fd248a..06e91bf26 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/AlleleBalanceBySample.java @@ -51,6 +51,9 @@ public class AlleleBalanceBySample extends GenotypeAnnotation implements Experim if ( altAlleles.size() == 0 ) return null; + if ( !stratifiedContext.hasBasePileup() ) + return null; + final String bases = new String(stratifiedContext.getBasePileup().getBases()); if ( bases.length() == 0 ) return null; diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/GenotypeAndValidateWalker.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/GenotypeAndValidateWalker.java index fd55d78a0..e64d00bf5 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/GenotypeAndValidateWalker.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/GenotypeAndValidateWalker.java @@ -365,7 +365,7 @@ public class GenotypeAndValidateWalker extends RodWalker 0 && context.getBasePileup().getBases().length < minDepth)) { + if (!context.hasReads() || !context.hasBasePileup() || (minDepth > 0 && context.getBasePileup().getBases().length < minDepth)) { counter.nUncovered = 1L; if (vcComp.getAttribute("GV").equals("T")) counter.nAltNotCalled = 1L;