/** * If a read ends in INSERTION, returns the last element length. * * <p>Warning: If the read has Hard or Soft clips after the insertion this function will return 0. * * @param read * @return the length of the last insertion, or 0 if there is none (see warning). */ public static final int getLastInsertionOffset(SAMRecord read) { CigarElement e = read.getCigar().getCigarElement(read.getCigarLength() - 1); if (e.getOperator() == CigarOperator.I) return e.getLength(); else return 0; }