From: gmungoc Date: Wed, 17 Aug 2016 13:55:26 +0000 (+0100) Subject: JAL-2146 status message now with formatted residue name / code X-Git-Tag: Release_2_10_0~102 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=45694fc1af8ff3cad6cb50331577403fa670d502;p=jalview.git JAL-2146 status message now with formatted residue name / code --- diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 1a5dc05..e5475f8 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -25,6 +25,7 @@ import jalview.datamodel.Annotation; import jalview.datamodel.SequenceI; import jalview.renderer.AnnotationRenderer; import jalview.renderer.AwtRenderPanelI; +import jalview.schemes.ResidueProperties; import jalview.util.Comparison; import jalview.util.MessageManager; @@ -472,9 +473,10 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, StringBuilder text = new StringBuilder(); text.append(MessageManager.getString("label.column")).append(" ") .append(column + 1); - if (aa[row].annotations[column].description != null) + String description = aa[row].annotations[column].description; + if (description != null && description.length() > 0) { - text.append(" ").append(aa[row].annotations[column].description); + text.append(" ").append(description); } /* @@ -493,9 +495,28 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, char residue = seqref.getCharAt(column); if (!Comparison.isGap(residue)) { + text.append(" "); + String name; + if (av.getAlignment().isNucleotide()) + { + name = ResidueProperties.nucleotideName.get(String + .valueOf(residue)); + text.append(" Nucleotide: ").append( + name != null ? name : residue); + } + else + { + name = 'X' == residue ? "X" : ('*' == residue ? "STOP" + : ResidueProperties.aa2Triplet.get(String + .valueOf(residue))); + text.append(" Residue: ").append( + name != null ? name : residue); + } int residuePos = seqref.findPosition(column); - text.append(": ").append(residue).append(" (") - .append(residuePos).append(")"); + text.append(" (").append(residuePos).append(")"); + // int residuePos = seqref.findPosition(column); + // text.append(residue).append(" (") + // .append(residuePos).append(")"); } } } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index eec1881..3c9a13e 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -26,6 +26,7 @@ import jalview.datamodel.ColumnSelection; import jalview.datamodel.SequenceI; import jalview.renderer.AnnotationRenderer; import jalview.renderer.AwtRenderPanelI; +import jalview.schemes.ResidueProperties; import jalview.util.Comparison; import jalview.util.MessageManager; @@ -48,6 +49,8 @@ import java.awt.event.MouseMotionListener; import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelListener; import java.awt.image.BufferedImage; +import java.util.Collections; +import java.util.List; import javax.swing.JColorChooser; import javax.swing.JMenuItem; @@ -444,7 +447,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, String last = ""; ColumnSelection viscols = av.getColumnSelection(); // TODO: refactor and save av.getColumnSelection for efficiency - for (int index : viscols.getSelected()) + List selected = viscols.getSelected(); + Collections.sort(selected); + for (int index : selected) { // always check for current display state - just in case if (!viscols.isVisible(index)) @@ -795,9 +800,24 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, char residue = seqref.getCharAt(column); if (!Comparison.isGap(residue)) { + text.append(" "); + String name; + if (av.getAlignment().isNucleotide()) + { + name = ResidueProperties.nucleotideName.get(String + .valueOf(residue)); + text.append(" Nucleotide: ").append( + name != null ? name : residue); + } + else + { + name = 'X' == residue ? "X" : ('*' == residue ? "STOP" + : ResidueProperties.aa2Triplet.get(String + .valueOf(residue))); + text.append(" Residue: ").append(name != null ? name : residue); + } int residuePos = seqref.findPosition(column); - text.append(": ").append(residue).append(" (") - .append(residuePos).append(")"); + text.append(" (").append(residuePos).append(")"); } } }