2 * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3 * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 package jalview.schemes;
29 public class ScoreColourScheme extends ResidueColourScheme
38 public double[] scores;
41 * Creates a new ScoreColourScheme object.
50 public ScoreColourScheme(double[] scores, double min, double max)
58 // Make colours in constructor
59 // Why wasn't this done earlier?
60 int i, iSize = scores.length;
61 colors = new Color[scores.length];
62 for (i = 0; i < iSize; i++)
64 float red = (float) (scores[i] - (float) min) / (float) (max - min);
75 colors[i] = makeColour(red);
87 * @return DOCUMENT ME!
89 public Color findColour(char c, int j)
93 if (!aboveThreshold(c, j))
99 if (jalview.util.Comparison.isGap(c))
104 Color currentColour = colors[ResidueProperties.aaIndex[c]];
106 if (conservationColouring)
108 currentColour = applyConservation(currentColour, j);
111 return currentColour;
120 * @return DOCUMENT ME!
122 public Color makeColour(float c)
124 return new Color(c, (float) 0.0, (float) 1.0 - c);