method added: getEventStringsWithCounts()
Returns list of Pairs <String,Integer>, where each pair consists of a unique indel event observed at the site and the total number of observations of that event. String representation for insertions is verbose (e.g. +ACT), while deletions are represented as "5D" (since read backed pileup has no reference information, so we can not get actual sequence of deleted bases) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2479 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
cf3e59eb4a
commit
8330058216
|
|
@ -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<ExtendedEventPile
|
|||
return v;
|
||||
}
|
||||
|
||||
public List<Pair<String,Integer>> getEventStringsWithCounts() {
|
||||
Map<String, Integer> events = new HashMap<String,Integer>();
|
||||
|
||||
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<Pair<String,Integer>> eventList = new ArrayList<Pair<String,Integer>>(events.size());
|
||||
for ( Map.Entry<String,Integer> m : events.entrySet() ) {
|
||||
eventList.add( new Pair<String,Integer>(m.getKey(),m.getValue()));
|
||||
}
|
||||
return eventList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get an array of the mapping qualities
|
||||
|
|
|
|||
Loading…
Reference in New Issue