diff --git a/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java b/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java index a0faab08b..fc946c9a1 100755 --- a/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java +++ b/java/src/org/broadinstitute/sting/gatk/iterators/LocusIteratorByState.java @@ -320,15 +320,21 @@ public class LocusIteratorByState extends LocusIterator { if ( readInfo.generateExtendedEvents() && hasExtendedEvents ) { ArrayList indelPile = new ArrayList(readStates.size()); + int maxDeletionLength = 0; + for ( SAMRecordState state : readStates ) { if ( state.hadIndel() ) { size++; - if ( state.getEventBases() == null ) nDeletions++; + if ( state.getEventBases() == null ) { + nDeletions++; + maxDeletionLength = Math.max(maxDeletionLength,state.getEventLength()); + } else nInsertions++; indelPile.add ( new ExtendedEventPileupElement(state.getRead(), state.getReadEventStartOffset(), state.getEventLength(), state.getEventBases()) ); + } else { if ( state.getCurrentCigarOperator() != CigarOperator.N ) { // this read has no indel associated with the previous position on the ref; @@ -358,7 +364,7 @@ public class LocusIteratorByState extends LocusIterator { GenomeLoc loc = GenomeLocParser.incPos(our1stState.getLocation(),-1); // System.out.println("Indel(s) at "+loc); // for ( ExtendedEventPileupElement pe : indelPile ) { if ( pe.isIndel() ) System.out.println(" "+pe.toString()); } - return new AlignmentContext(loc, new ReadBackedExtendedEventPileup(loc, indelPile, size, nInsertions, nDeletions, nMQ0Reads)); + return new AlignmentContext(loc, new ReadBackedExtendedEventPileup(loc, indelPile, size, maxDeletionLength, nInsertions, nDeletions, nMQ0Reads)); } else { ArrayList pile = new ArrayList(readStates.size()); diff --git a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java index c0d660975..64575f98a 100644 --- a/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java +++ b/java/src/org/broadinstitute/sting/utils/pileup/ReadBackedExtendedEventPileup.java @@ -20,6 +20,7 @@ public class ReadBackedExtendedEventPileup implements Iterable pileup = null; private int size = 0; // cached value of the size of the pileup + private int maxDeletionLength = 0; // cached value of the length of the longest deletion observed at the site private int nDeletions = 0; // cached value of the number of deletions private int nInsertions = 0; private int nMQ0Reads = 0; // cached value of the number of MQ0 reads @@ -53,13 +54,15 @@ public class ReadBackedExtendedEventPileup implements Iterable pileup, int size, int nInsertions, int nDeletions, int nMQ0Reads ) { + public ReadBackedExtendedEventPileup(GenomeLoc loc, ArrayList pileup, int size, + int maxDeletionLength, int nInsertions, int nDeletions, int nMQ0Reads ) { if ( loc == null ) throw new StingException("Illegal null genomeloc in ReadBackedExtendedEventPileup"); if ( pileup == null ) throw new StingException("Illegal null pileup in ReadBackedExtendedEventPileup"); this.loc = loc; this.pileup = pileup; this.size = size; + this.maxDeletionLength = maxDeletionLength; this.nDeletions = nDeletions; this.nInsertions = nInsertions; this.nMQ0Reads = nMQ0Reads; @@ -78,9 +81,11 @@ public class ReadBackedExtendedEventPileup implements Iterable