diff --git a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java index 7885681db..c0d660975 100644 --- a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java +++ b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java @@ -2,8 +2,7 @@ package org.broadinstitute.sting.utils.pileup; import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.StingException; -import org.broadinstitute.sting.utils.BaseUtils; -import org.broadinstitute.sting.gatk.iterators.IterableIterator; +import org.broadinstitute.sting.utils.Pair; import java.util.*; @@ -290,6 +289,35 @@ public class ReadBackedExtendedEventPileup implements Iterable> getEventStringsWithCounts() { + Map events = new HashMap(); + + for ( ExtendedEventPileupElement e : this ) { + Integer cnt; + String indel = null; + switch ( e.getType() ) { + case INSERTION: + indel = "+"+e.getEventBases(); + break; + case DELETION: + indel = Integer.toString(e.getEventLength())+"D"; + break; + case NOEVENT: continue; + default: throw new StingException("Unknown event type encountered: "+e.getType()); + } + + cnt = events.get(indel); + if ( cnt == null ) events.put(indel,1); + else events.put(indel,cnt.intValue()+1); + } + + List> eventList = new ArrayList>(events.size()); + for ( Map.Entry m : events.entrySet() ) { + eventList.add( new Pair(m.getKey(),m.getValue())); + } + return eventList; + } + /** * Get an array of the mapping qualities