JAL-3032 round Quality score for tooltip (as it becomes double in JalviewJS!)
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 21 Jun 2018 09:22:24 +0000 (10:22 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Thu, 21 Jun 2018 09:22:24 +0000 (10:22 +0100)
src/jalview/analysis/Conservation.java

index 131b39c..279d309 100755 (executable)
@@ -30,6 +30,7 @@ import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
 import jalview.schemes.ResidueProperties;
 import jalview.util.Comparison;
+import jalview.util.Format;
 
 import java.awt.Color;
 import java.util.List;
@@ -54,6 +55,8 @@ public class Conservation
 
   private static final int GAP_INDEX = -1;
 
+  private static final Format FORMAT_3DP = new Format("%2.5f");
+
   SequenceI[] sequences;
 
   int start;
@@ -273,7 +276,7 @@ public class Conservation
        * or not conserved (-1)
        * Using TreeMap means properties are displayed in alphabetical order
        */
-      SortedMap<String, Integer> resultHash = new TreeMap<String, Integer>();
+      SortedMap<String, Integer> resultHash = new TreeMap<>();
       SymbolCounts symbolCounts = values.getSymbolCounts();
       char[] symbols = symbolCounts.symbols;
       int[] counts = symbolCounts.values;
@@ -567,7 +570,7 @@ public class Conservation
    */
   private void percentIdentity(ScoreMatrix sm)
   {
-    seqNums = new Vector<int[]>();
+    seqNums = new Vector<>();
     int i = 0, iSize = sequences.length;
     // Do we need to calculate this again?
     for (i = 0; i < iSize; i++)
@@ -622,7 +625,7 @@ public class Conservation
   protected void findQuality(int startCol, int endCol,
           ScoreMatrix scoreMatrix)
   {
-    quality = new Vector<Double>();
+    quality = new Vector<>();
 
     double max = -Double.MAX_VALUE;
     float[][] scores = scoreMatrix.getMatrix();
@@ -808,7 +811,8 @@ public class Conservation
         value = quality.elementAt(i).floatValue();
         float vprop = value - qmin;
         vprop /= qmax;
-        quality2.annotations[i] = new Annotation(" ", String.valueOf(value),
+        String description = FORMAT_3DP.form(value);
+        quality2.annotations[i] = new Annotation(" ", description,
                 ' ', value, new Color(minR + (maxR * vprop),
                         minG + (maxG * vprop), minB + (maxB * vprop)));
       }