JAL-2629 fix incorrect gap insertions on HMM sequence
authorTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Mon, 14 Aug 2017 10:41:04 +0000 (11:41 +0100)
committerTZVanaalten <TZVanaalten@LS30916.ad.lifesci.dundee.ac.uk>
Mon, 14 Aug 2017 10:44:00 +0000 (11:44 +0100)
src/jalview/datamodel/HiddenMarkovModel.java
src/jalview/io/FileLoader.java

index e74d826..d5e93e3 100644 (file)
@@ -993,8 +993,8 @@ public class HiddenMarkovModel
     start = getNodeAlignmentColumn(1);
     modelLength = getLength();
     end = getNodeAlignmentColumn(modelLength);
-    char[] sequence = new char[end];
-    for (int index = 0; index < end; index++)
+    char[] sequence = new char[end + 1];
+    for (int index = 0; index < end + 1; index++)
     {
       Character character;
 
@@ -1011,7 +1011,8 @@ public class HiddenMarkovModel
       }
 
 
-    Sequence seq = new Sequence(getName() + "_HMM", sequence, start, end);
+    Sequence seq = new Sequence(getName() + "_HMM", sequence, start,
+            end);
     return seq;
   }
 
index 4f3d026..9f46494 100755 (executable)
@@ -403,7 +403,7 @@ public class FileLoader implements Runnable
               if (sg != null)
               {
                 seq.insertCharAt(0, sg.getStartRes(), '-');
-                seq.insertCharAt(sg.getEndRes(),
+                seq.insertCharAt(sg.getEndRes() + 1,
                         alignment.getWidth() - sg.getEndRes(), '-');
                 SequenceI topSeq = sg.getSequencesInOrder(alignment)[0];
                 int topIndex = alignment.findIndex(topSeq);