From 9f4e46fd644ada321420a3b68750880a138dc797 Mon Sep 17 00:00:00 2001 From: James Procter Date: Mon, 25 Sep 2023 17:40:54 +0100 Subject: [PATCH] JAL-3858 report PAE range with sensible precision --- src/jalview/gui/AnnotationPanel.java | 9 ++++++--- src/jalview/util/Format.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 8a957bc..ee4c327 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -68,6 +68,7 @@ import jalview.renderer.AwtRenderPanelI; import jalview.renderer.ContactGeometry; import jalview.schemes.ResidueProperties; import jalview.util.Comparison; +import jalview.util.Format; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.viewmodel.ViewportListenerI; @@ -1311,9 +1312,11 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, ContactGeometry cgeom = new ContactGeometry(clist, ann.graphHeight); ContactGeometry.contactInterval ci = cgeom.mapFor(rowAndOffset); ContactRange cr = clist.getRangeFor(ci.cStart, ci.cEnd); - tooltip = "Contact from " + clist.getPosition() + ", [" + ci.cStart - + " - " + ci.cEnd + "]" + "
Mean:" + cr.getMean(); - + StringBuilder tooltipb = new StringBuilder(); + tooltipb.append("Contact from ") + .append(clist.getPosition()).append(", [").append(ci.cStart).append(" - ").append(ci.cEnd).append("]").append("
Mean:"); + Format.appendPercentage(tooltipb, (float)cr.getMean(),2); + tooltip = tooltipb.toString(); int col = ann.sequenceRef.findPosition(column); int[][] highlightPos; int[] mappedPos = clist.getMappedPositionsFor(ci.cStart, ci.cEnd); diff --git a/src/jalview/util/Format.java b/src/jalview/util/Format.java index ce7ab6d..df2c76c 100755 --- a/src/jalview/util/Format.java +++ b/src/jalview/util/Format.java @@ -940,7 +940,7 @@ public class Format } /** - * Bespoke method to format percentage float value to the specified number of + * Bespoke method to format a percentage (or any other) float value to the specified number of * decimal places. Avoids use of general-purpose format parsers as a * processing hotspot. * -- 1.7.10.2