From 24b87a0d78ade5dfd8c0e040d12482cbcd9ea297 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 31 Aug 2018 16:08:32 +0100 Subject: [PATCH] JAL-3095 account for sequence start when highlighting selections in trimmed VARNA model --- src/jalview/gui/AppVarna.java | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index aad4a96..3a64716 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -428,15 +428,28 @@ public class AppVarna extends JInternalFrame { return; } - if (seqsel != null && seqsel.getSize() > 0) + + RnaModel rnaModel = models.get(rna); + + if (seqsel != null && seqsel.getSize() > 0 + && seqsel.contains(rnaModel.seq)) { int start = seqsel.getStartRes(), end = seqsel.getEndRes(); - ShiftList shift = offsets.get(rna); - if (shift != null) + if (rnaModel.gapped) + { + ShiftList shift = offsets.get(rna); + if (shift != null) + { + start = shift.shift(start); + end = shift.shift(end); + } + } + else { - start = shift.shift(start); - end = shift.shift(end); + start = rnaModel.seq.findPosition(start) - rnaModel.seq.getStart(); + end = rnaModel.seq.findPosition(end) - rnaModel.seq.getStart(); } + selectionHighlighter.highlightRegion(rna, start, end); selectionHighlighter.getLastHighlight() .setOutlineColor(seqsel.getOutlineColour()); -- 1.7.10.2