From 03f7ae1897aba3a6fc6b091b78eec39a08706222 Mon Sep 17 00:00:00 2001 From: TZVanaalten Date: Mon, 14 Aug 2017 11:41:04 +0100 Subject: [PATCH] JAL-2629 fix incorrect gap insertions on HMM sequence --- src/jalview/datamodel/HiddenMarkovModel.java | 7 ++++--- src/jalview/io/FileLoader.java | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/jalview/datamodel/HiddenMarkovModel.java b/src/jalview/datamodel/HiddenMarkovModel.java index e74d826..d5e93e3 100644 --- a/src/jalview/datamodel/HiddenMarkovModel.java +++ b/src/jalview/datamodel/HiddenMarkovModel.java @@ -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; } diff --git a/src/jalview/io/FileLoader.java b/src/jalview/io/FileLoader.java index 4f3d026..9f46494 100755 --- a/src/jalview/io/FileLoader.java +++ b/src/jalview/io/FileLoader.java @@ -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); -- 1.7.10.2