X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FScoreColourScheme.java;h=c11e1ecee6b18adcc25a1f55878a8262f8cde1b6;hb=6ddf2d553aee329db44dd36b564211c3880563ec;hp=b69e536cfa30384bf30b07eb992fdea38795d9f0;hpb=efc31b4a8d5cee63555586804a2b79c06bdb5a14;p=jalview.git diff --git a/src/jalview/schemes/ScoreColourScheme.java b/src/jalview/schemes/ScoreColourScheme.java index b69e536..c11e1ec 100755 --- a/src/jalview/schemes/ScoreColourScheme.java +++ b/src/jalview/schemes/ScoreColourScheme.java @@ -52,6 +52,26 @@ public class ScoreColourScheme extends ResidueColourScheme this.scores = scores; this.min = min; this.max = max; + + // Make colours in constructor + // Why wasn't this done earlier? + int i, iSize=scores.length; + colors = new Color[scores.length]; + for (i = 0; i < iSize; i++) + { + float red = (float) (scores[i] - (float) min) / (float) (max - min); + + if (red > 1.0f) + { + red = 1.0f; + } + + if (red < 0.0f) + { + red = 0.0f; + } + colors[i] = makeColour(red); + } } /** @@ -72,19 +92,6 @@ public class ScoreColourScheme extends ResidueColourScheme } } - float red = (float) (scores[((Integer) ResidueProperties.aaHash.get(s)).intValue()] - - (float) min) / (float) (max - min); - - if (red > 1.0f) - { - red = 1.0f; - } - - if (red < 0.0f) - { - red = 0.0f; - } - char c = s.charAt(0); if (jalview.util.Comparison.isGap((c))) @@ -92,8 +99,12 @@ public class ScoreColourScheme extends ResidueColourScheme return Color.white; } - // This isn';t great - pool of colours in here? - return makeColour(red); + currentColour = colors[((Integer) ResidueProperties.aaHash.get(s)).intValue()]; + + if(conservationColouring) + applyConservation(j); + + return currentColour; } /**