package jalview.schemes; import jalview.datamodel.*; import jalview.jbgui.*; import java.util.*; import java.awt.*; public class ScoreColourScheme extends ResidueColourScheme { public double min; public double max; public double[] scores; public ScoreColourScheme( double[] scores, double min, double max) { super(); this.scores = scores; this.min = min; this.max = max; } public Color findColour(String s,int j,Vector aa) { if (threshold > 0) { if (!aboveThreshold(aa,s,j)) return Color.white; } 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))) return Color.white; // This isn';t great - pool of colours in here? return makeColour(red); } public Color makeColour(float c) { return new Color(c,(float)0.0,(float)1.0-c); } }