leftReadStop -= trimLength;
int alignmentGap = rightAlignmentStart - leftAlignmentStop - 1;
int readGap = rightReadStart - leftReadStop - 1;
CigarElement indelElement;
if ((alignmentGap > 0) && (readGap == 0)) {
// Deletion
indelElement = new CigarElement(alignmentGap, CigarOperator.DELETION);
} else {
int totalLength = this.getTotalLength(leftElements, rightElements);
// int insertLen = read1.getReadLength() - totalLength;
int insertLen = read1.getReadLength() - totalLength - alignmentGap;
int insertLen2 = readGap - alignmentGap;
if (insertLen != insertLen2) {
// Not really an insert
return null;
}
//TODO: Take a closer look at this
if (insertLen < 1) {
return null;
}
// Right side may have skipped SNPs, so pad it.
if (alignmentGap > 0) {
this.padLeftmostElement(rightElements, alignmentGap);
}
//TODO: Necessary for mismatches?
/*
if ((readGap > 0) && ((totalLength + insertLen) < read1.getReadLength())) {
if (readGap != read1.getReadLength() - totalLength - insertLen) {
System.out.println("WARNING: Invalid read gap padding: " + read1.getSAMString());
}
this.padLeftmostElement(rightElements, readGap);
}
*/
indelElement = new CigarElement(insertLen, CigarOperator.INSERTION);
}
// Check to see if the indel is surrounded by non-clipped bases
if (minIndelBuffer > 0) {
if ((getNonSoftClippedLength(leftElements) < minIndelBuffer) ||