From: gmungoc Date: Thu, 18 May 2017 14:51:10 +0000 (+0100) Subject: JAL-2490 lookup features at each column position X-Git-Tag: Release_2_10_3b1~264 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fcb68d2ebaf7ebdde2bf6e857de856dc7f46a8da;p=jalview.git JAL-2490 lookup features at each column position --- diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 0c052d9..2f6e3e4 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -34,6 +34,7 @@ import jalview.jbgui.GAlignmentPanel; import jalview.math.AlignmentDimension; import jalview.schemes.ResidueProperties; import jalview.structure.StructureSelectionManager; +import jalview.util.Comparison; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.viewmodel.ViewportRanges; @@ -1495,11 +1496,10 @@ public class AlignmentPanel extends GAlignmentPanel implements sy = s * av.getCharHeight() + scaleHeight; SequenceI seq = av.getAlignment().getSequenceAt(s); - SequenceFeature[] features = seq.getSequenceFeatures(); SequenceGroup[] groups = av.getAlignment().findAllGroups(seq); for (res = 0; res < alwidth; res++) { - StringBuilder text = new StringBuilder(); + StringBuilder text = new StringBuilder(512); String triplet = null; if (av.getAlignment().isNucleotide()) { @@ -1517,7 +1517,7 @@ public class AlignmentPanel extends GAlignmentPanel implements continue; } - int alIndex = seq.findPosition(res); + int seqPos = seq.findPosition(res); gSize = groups.length; for (g = 0; g < gSize; g++) { @@ -1529,7 +1529,7 @@ public class AlignmentPanel extends GAlignmentPanel implements .append((idWidth + (res + 1) * av.getCharWidth())) .append(",").append((av.getCharHeight() + sy)) .append("\"").append(" onMouseOver=\"toolTip('") - .append(alIndex).append(" ").append(triplet); + .append(seqPos).append(" ").append(triplet); } if (groups[g].getStartRes() < res @@ -1540,63 +1540,51 @@ public class AlignmentPanel extends GAlignmentPanel implements } } - if (features != null) + if (text.length() < 1) { - if (text.length() < 1) - { - text.append(" features = seq.getFeatures() + .findFeatures(seqPos, seqPos); + for (SequenceFeature sf : features) { - - SequenceFeature sf = features[f]; - if ((sf.getBegin() <= seq.findPosition(res)) - && (sf.getEnd() >= seq.findPosition(res))) + if (sf.isContactFeature()) { - if (sf.isContactFeature()) - { - if (sf.getBegin() == seq.findPosition(res) - || sf.getEnd() == seq - .findPosition(res)) - { - text.append("
").append(sf.getType()) - .append(" ").append(sf.getBegin()) - .append(":").append(sf.getEnd()); - } - } - else + text.append("
").append(sf.getType()).append(" ") + .append(sf.getBegin()).append(":") + .append(sf.getEnd()); + } + else + { + text.append("
"); + text.append(sf.getType()); + String description = sf.getDescription(); + if (description != null + && !sf.getType().equals(description)) { - text.append("
"); - text.append(sf.getType()); - String description = sf.getDescription(); - if (description != null - && !sf.getType().equals(description)) - { - description = description.replace("\"", """); - text.append(" ").append(description); - } - - String status = sf.getStatus(); - if (status != null && !"".equals(status)) - { - text.append(" (").append(status).append(")"); - } + description = description.replace("\"", """); + text.append(" ").append(description); } } - + String status = sf.getStatus(); + if (status != null && !"".equals(status)) + { + text.append(" (").append(status).append(")"); + } + } + if (text.length() > 1) + { + text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">"); + out.println(text.toString()); } - } - if (text.length() > 1) - { - text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">"); - out.println(text.toString()); } } }