From d5477e299373c07a2b1f92421dcf454b0fe40b56 Mon Sep 17 00:00:00 2001 From: tva Date: Mon, 10 Jun 2019 11:54:37 +0100 Subject: [PATCH] JAL-3297 pad gaps in alignment to ensure hmmalign runs --- src/jalview/datamodel/HiddenMarkovModel.java | 5 +++-- src/jalview/hmmer/HMMAlign.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/jalview/datamodel/HiddenMarkovModel.java b/src/jalview/datamodel/HiddenMarkovModel.java index e917474..975bacb 100644 --- a/src/jalview/datamodel/HiddenMarkovModel.java +++ b/src/jalview/datamodel/HiddenMarkovModel.java @@ -520,18 +520,19 @@ public class HiddenMarkovModel int start = hasMap ? getNode(1).getResidueNumber() : 1; int endResNo = hasMap ? getNode(nodes.size() - 1).getResidueNumber() : (start + getLength() - 1); - char[] sequence = new char[endResNo + 1]; + char[] sequence = new char[endResNo]; int lastResNo = start - 1; int seqOffset = -1; int gapCount = 0; + for (int seqN = 0; seqN < start; seqN++) { sequence[seqN] = GAP_DASH; seqOffset++; } - + for (int nodeNo = 1; nodeNo < nodes.size(); nodeNo++) { HMMNode node = nodes.get(nodeNo); diff --git a/src/jalview/hmmer/HMMAlign.java b/src/jalview/hmmer/HMMAlign.java index 57e35e7..4642034 100644 --- a/src/jalview/hmmer/HMMAlign.java +++ b/src/jalview/hmmer/HMMAlign.java @@ -70,6 +70,9 @@ public class HMMAlign extends HmmerCommand af.setProgressBar(MessageManager.getString("status.running_hmmalign"), msgId); + // ensure alignments are the same length + alignment.padGaps(); + AlignmentView msa = af.gatherSequencesForAlignment(); SequenceI[][] subAlignments = msa.getVisibleContigs(alignment.getGapCharacter()); -- 1.7.10.2