From: tva Date: Mon, 10 Jun 2019 10:54:37 +0000 (+0100) Subject: JAL-3297 pad gaps in alignment to ensure hmmalign runs X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d5477e299373c07a2b1f92421dcf454b0fe40b56;p=jalview.git JAL-3297 pad gaps in alignment to ensure hmmalign runs --- 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());