X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAppVarna.java;h=5273aaa703cc5006913525d2f6c60a749478049d;hb=0590202f01c201d5e0dc0be25024b0a9ad2dd3de;hp=1bbe8d80ac6e21a17bd2f8b7e4fc9227cb5a930c;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index 1bbe8d8..5273aaa 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -20,23 +20,6 @@ */ package jalview.gui; -import jalview.analysis.AlignSeq; -import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.ColumnSelection; -import jalview.datamodel.HiddenColumns; -import jalview.datamodel.RnaViewerModel; -import jalview.datamodel.SequenceGroup; -import jalview.datamodel.SequenceI; -import jalview.ext.varna.RnaModel; -import jalview.structure.SecondaryStructureListener; -import jalview.structure.SelectionListener; -import jalview.structure.SelectionSource; -import jalview.structure.StructureSelectionManager; -import jalview.structure.VamsasSource; -import jalview.util.Comparison; -import jalview.util.MessageManager; -import jalview.util.ShiftList; - import java.awt.BorderLayout; import java.awt.Color; import java.util.Collection; @@ -60,6 +43,22 @@ import fr.orsay.lri.varna.models.FullBackup; import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation; import fr.orsay.lri.varna.models.rna.ModeleBase; import fr.orsay.lri.varna.models.rna.RNA; +import jalview.analysis.AlignSeq; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.ColumnSelection; +import jalview.datamodel.HiddenColumns; +import jalview.datamodel.RnaViewerModel; +import jalview.datamodel.SequenceGroup; +import jalview.datamodel.SequenceI; +import jalview.ext.varna.RnaModel; +import jalview.structure.SecondaryStructureListener; +import jalview.structure.SelectionListener; +import jalview.structure.SelectionSource; +import jalview.structure.StructureSelectionManager; +import jalview.structure.VamsasSource; +import jalview.util.Comparison; +import jalview.util.MessageManager; +import jalview.util.ShiftList; public class AppVarna extends JInternalFrame implements SelectionListener, SecondaryStructureListener, @@ -120,6 +119,15 @@ public class AppVarna extends JInternalFrame } } + /** + * highlight a region from start to end (inclusive) on rna + * + * @param rna + * @param start + * - first base pair index (from 0) + * @param end + * - last base pair index (from 0) + */ public void highlightRegion(RNA rna, int start, int end) { clearLastSelection(); @@ -207,6 +215,7 @@ public class AppVarna extends JInternalFrame */ protected AppVarna(AlignmentPanel ap) { + this.setFrameIcon(null); this.ap = ap; this.viewId = System.currentTimeMillis() + "." + this.hashCode(); vab = new AppVarnaBinding(); @@ -397,7 +406,8 @@ public class AppVarna extends JInternalFrame RnaModel rnaModel = models.get(rna); if (rnaModel.seq == sequence) { - int highlightPos = rnaModel.gapped ? index : position - 1; + int highlightPos = rnaModel.gapped ? index + : position - sequence.getStart(); mouseOverHighlighter.highlightRegion(rna, highlightPos, highlightPos); vab.updateSelectedRNA(rna); } @@ -418,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()); @@ -628,11 +651,10 @@ public class AppVarna extends JInternalFrame ShiftList offset = new ShiftList(); int ofstart = -1; int sleng = seq.getLength(); - char[] seqChars = seq.getSequence(); for (int i = 0; i < sleng; i++) { - if (Comparison.isGap(seqChars[i])) + if (Comparison.isGap(seq.getCharAt(i))) { if (ofstart == -1) { @@ -740,8 +762,9 @@ public class AppVarna extends JInternalFrame for (int i = 0; i < bytes.length; i++) { boolean ok = false; - // todo check for ((b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z')) if - // wanted also + + ok = (bytes[i] >= 'a' && bytes[i] <= 'z') || (bytes[i]>= 'A' && bytes[i] <= 'Z'); + for (int j = 0; !ok && (j < PAIRS.length); j++) { if (bytes[i] == PAIRS[j])