StringBuilder newRead = new StringBuilder();
String read = rec.getReadString();
- int nextPos = next;
+ int nextPos = next; // location of next position in read
while (nextPos < next + length)
{
- int insertPos = next + length;
- int insertLen = 0;
+ int insertPos = next + length; // location of next insert in read (or end
+ // of read)
+ int insertLen = 0; // no of gaps to insert after insertPos
if (it.hasNext())
{
// account for sequence already having insertion
{
insertPos = rec.getReadPositionAtReferencePosition(key) - 1;
}
+ else
+ {
+ insertPos = nextPos; // bugfix - trigger by override + insertions in
+ // same M stretch
+ }
}
newRead.append(read.substring(nextPos, insertPos));
nextPos = insertPos;