+ * Computes a colour for a score by
+ * <ul>
+ * <li>first scaling the score linearly from 0 (minScore) to 1 (maxScore)</li>
+ * <li>then interpolating rgb values from minColour to maxColour</li>
+ * </ul>
+ * This method is used to make colours for residue scores, but may also be
+ * called to generate a colour for an intermediate score value (for example, a
+ * column average).
+ */
+ public Color getScoreColour(double rawScore)
+ {
+ float score = (float) (rawScore - (float) min) / (float) (max - min);
+ score = Math.max(score, 0f);
+ score = Math.min(score, 1f);
+
+ int r = minColour.getRed()
+ + Math.round((maxColour.getRed() - minColour.getRed()) * score);
+ int g = minColour.getGreen()
+ + Math.round(
+ (maxColour.getGreen() - minColour.getGreen()) * score);
+ int b = minColour.getBlue()
+ + Math.round(
+ (maxColour.getBlue() - minColour.getBlue()) * score);
+
+ Color c = new Color(r, g, b);
+ return c;
+ }
+
+ /**
+ * Inspects score values and saves the minimum and maximum