2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 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;
23 import jalview.datamodel.*;
25 public class PIDColourScheme
26 extends ResidueColourScheme
28 public Color[] pidColours;
29 public float[] thresholds;
32 public PIDColourScheme()
34 this.pidColours = ResidueProperties.pidColours;
35 this.thresholds = ResidueProperties.pidThresholds;
38 public Color findColour(String s, int j)
40 char res = s.charAt(0);
41 if ('a' <= res && res <= 'z')
43 s = String.valueOf(res -= ('a' - 'A'));
47 if ( (threshold != 0) && !aboveThreshold(s, j))
52 currentColour = Color.white;
56 if(consensus.length<=j)
59 if ( (Integer.parseInt(consensus[j].get("maxCount").toString()) != -1) &&
60 consensus[j].contains(s))
62 sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue();
64 if (!jalview.util.Comparison.isGap(res))
66 for (int i = 0; i < thresholds.length; i++)
68 if (sc > thresholds[i])
70 currentColour = pidColours[i];
78 if(conservationColouring)