Permalink
Browse files

Apparently CIGAR elements can have 0 length according to the spec, bu…

…t 0Ms were causing left alignment of indels to fail. Fixed.
  • Loading branch information...
1 parent 63dddfb commit 1774b660fb00d5bb72991475030b8b3c863c79d3 @eitanbanks eitanbanks committed Nov 7, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 public/java/src/org/broadinstitute/sting/utils/sam/AlignmentUtils.java
@@ -646,7 +646,7 @@ private static Cigar moveCigarLeft(Cigar cigar, int indexOfIndel) {
// get the indel element and move it left one base
CigarElement ce = cigar.getCigarElement(indexOfIndel - 1);
- elements.add(new CigarElement(ce.getLength() - 1, ce.getOperator()));
+ elements.add(new CigarElement(Math.max(ce.getLength() - 1, 0), ce.getOperator()));
elements.add(cigar.getCigarElement(indexOfIndel));
if (indexOfIndel + 1 < cigar.numCigarElements()) {
ce = cigar.getCigarElement(indexOfIndel + 1);

0 comments on commit 1774b66

Please sign in to comment.