2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.schemes;
21 import jalview.analysis.AAFrequency;
22 import jalview.datamodel.SequenceGroup;
23 import jalview.datamodel.SequenceI;
25 import java.awt.Color;
27 public class PIDColourScheme extends ResidueColourScheme
29 public Color[] pidColours;
31 public float[] thresholds;
35 public PIDColourScheme()
37 this.pidColours = ResidueProperties.pidColours;
38 this.thresholds = ResidueProperties.pidThresholds;
42 public Color findColour(char c, int j, SequenceI seq)
44 if ('a' <= c && c <= 'z')
49 if (consensus == null || j >= consensus.length || consensus[j] == null)
54 if ((threshold != 0) && !aboveThreshold(c, j))
59 Color currentColour = Color.white;
63 if (consensus.length <= j)
69 .parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != -1)
70 && consensus[j].contains(String.valueOf(c)))
72 sc = ((Float) consensus[j].get(ignoreGaps)).floatValue();
74 if (!jalview.util.Comparison.isGap(c))
76 for (int i = 0; i < thresholds.length; i++)
78 if (sc > thresholds[i])
80 currentColour = pidColours[i];
88 if (conservationColouring)
90 currentColour = applyConservation(currentColour, j);