diff --git a/java/src/org/broadinstitute/sting/playground/gatk/walkers/BaseTransitionTableCalculatorJavaWalker.java b/java/src/org/broadinstitute/sting/playground/gatk/walkers/BaseTransitionTableCalculatorJavaWalker.java index 746d4cbbd..8f396c7b4 100644 --- a/java/src/org/broadinstitute/sting/playground/gatk/walkers/BaseTransitionTableCalculatorJavaWalker.java +++ b/java/src/org/broadinstitute/sting/playground/gatk/walkers/BaseTransitionTableCalculatorJavaWalker.java @@ -246,7 +246,7 @@ public class BaseTransitionTableCalculatorJavaWalker extends LocusWalker { + + public Integer reduceInit() { + return 0; + } + + public Integer reduce( Integer prevReduce, Integer map ) { + return map + prevReduce; + } + + public Integer treeReduce( Integer reduce1, Integer reduce2 ) { + return reduce(reduce1,reduce2); + } + + public Integer map ( RefMetaDataTracker tracker, ReferenceContext ref, AlignmentContext context ) { + if (BaseUtils.isRegularBase(ref.getBase()) ) { + return numIndels(context); + } else { + return 0; + } + } + + public Integer numIndels ( AlignmentContext context ) { + String[] indelPileup = BasicPileup.indelPileup(context.getReads(),context.getOffsets()); + // number of indels is the number of non-"null" indeces + int nIndel = 0; + for( String indel : indelPileup ) { + if ( ! indel.equals("null") ) { // currently how non-indel bases are represented in pileup + nIndel ++; + } + } + + return nIndel; + } +}