Skip to content

Instantly share code, notes, and snippets.

@chapmanb
Created August 27, 2012 10:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chapmanb/3487411 to your computer and use it in GitHub Desktop.
Save chapmanb/3487411 to your computer and use it in GitHub Desktop.
Fix GATK null allele error when calculating DepthPerAlleleBySample for indels
diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
index 5d83ddd..928d836 100755
--- a/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
+++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/annotator/DepthPerAlleleBySample.java
@@ -87,12 +87,12 @@ public class DepthPerAlleleBySample extends GenotypeAnnotation implements Standa
for ( PileupElement p : pileup ) {
if ( p.isBeforeInsertion() ) {
-
- final Allele insertion = Allele.create((char)refBase + p.getEventBases(), false);
- if ( alleleCounts.containsKey(insertion) ) {
- alleleCounts.put(insertion, alleleCounts.get(insertion)+1);
+ if ( p.getEventBases() != null ) {
+ final Allele insertion = Allele.create((char)refBase + p.getEventBases(), false);
+ if ( alleleCounts.containsKey(insertion) ) {
+ alleleCounts.put(insertion, alleleCounts.get(insertion)+1);
+ }
}
-
} else if ( p.isBeforeDeletionStart() ) {
if ( p.getEventLength() == refAllele.length() - 1 ) {
// this is indeed the deletion allele recorded in VC
@@ -120,4 +120,4 @@ public class DepthPerAlleleBySample extends GenotypeAnnotation implements Standa
public List<VCFFormatHeaderLine> getDescriptions() {
return Arrays.asList(VCFStandardHeaderLines.getFormatLine(getKeyNames().get(0)));
}
-}
\ No newline at end of file
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment