diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java index f497d8dd1..c30e6e112 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/indels/IndelRealigner.java @@ -923,7 +923,11 @@ public class IndelRealigner extends ReadWalker { if ( indelCE.getOperator() == CigarOperator.I ) { // for reads that end in an insertion if ( myPosOnAlt + aRead.getReadLength() < endOfFirstBlock + indelCE.getLength() ) { - readCigar.add(new CigarElement(myPosOnAlt + aRead.getReadLength() - endOfFirstBlock, CigarOperator.I)); + int partialInsertionLength = myPosOnAlt + aRead.getReadLength() - endOfFirstBlock; + // if we also started inside the insertion, then we need to modify the length by 1 base + if ( !sawAlignmentStart ) + partialInsertionLength--; + readCigar.add(new CigarElement(partialInsertionLength, CigarOperator.I)); aRead.setCigar(readCigar); return true; }