From 1cb2e57ec271b4a6747471c9f4eaf03a982230c6 Mon Sep 17 00:00:00 2001 From: kiramt Date: Wed, 28 Feb 2018 19:43:55 +0000 Subject: [PATCH] JAL-2909 Fixed a bug in the insertions code --- src/jalview/datamodel/CigarParser.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/jalview/datamodel/CigarParser.java b/src/jalview/datamodel/CigarParser.java index 786896b..fd5694c 100644 --- a/src/jalview/datamodel/CigarParser.java +++ b/src/jalview/datamodel/CigarParser.java @@ -194,11 +194,12 @@ public class CigarParser 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 @@ -220,6 +221,11 @@ public class CigarParser { 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; -- 1.7.10.2