- if (conservation == null || conservation.length <= column)
- {
- return currentColour;
- }
- char conservationScore = conservation[column];
-
- /*
- * if residues are fully conserved (* or 11), or all properties
- * are conserved (+ or 10), leave colour unchanged
- */
- if (conservationScore == '*' || conservationScore == '+'
- || conservationScore == (char) 10
- || conservationScore == (char) 11)
- {
- return currentColour;
- }
-
- if (Comparison.isGap(conservationScore))
- {
- return Color.white;
- }
-
- /*
- * convert score 0-9 to a bleaching factor 1.1 - 0.2
- */
- float bleachFactor = (11 - (conservationScore - '0')) / 10f;
-
- /*
- * scale this by the percentage slider / 20
- */
- bleachFactor *= (inc / 20f);
-
- int red = currentColour.getRed();
- int green = currentColour.getGreen();
- int blue = currentColour.getBlue();
-
- /*
- * bleach colours towards white (255, 255, 255),
- * depending on the consensus score and the conservation slider value
- * scores of: 0 1 2 3 4 5 6 7 8 9
- * fade to white at slider value: 18 20 22 25 29 33 40 50 67 100%
- */
- red += (255 - red) * bleachFactor;
- green += (255 - green) * bleachFactor;
- blue += (255 - blue) * bleachFactor;
-
- if (red > 255 || green > 255 || blue > 255)
- {
- currentColour = Color.white;
- }
- else
- {
- currentColour = new Color(red, green, blue);
- }
- return currentColour;