package jalview.schemes; import jalview.datamodel.*; import jalview.jbgui.*; import java.util.*; import java.awt.*; public class PIDColourScheme extends ResidueColourScheme { public Color[] pidColours; public float[] thresholds; SequenceGroup group; public PIDColourScheme() { this.pidColours = ResidueProperties.pidColours; this.thresholds = ResidueProperties.pidThresholds; } public Color getColour(SequenceI seq, int j,Vector aa) { Color c = Color.white; String s = seq.getSequence(j,j+1); if (aa != null && j < aa.size()) { c = findColour(seq,s,j,aa); } return c; } public Color findColour(SequenceI seq,String s, int j,Vector aa) { Color c = Color.white; Hashtable hash = null; if (aa != null) { hash = (Hashtable)aa.elementAt(j); } else return c; String max = (String)hash.get("maxResidue"); double sc = 0; if (((Integer)hash.get("maxCount")).intValue() != -1 && hash.contains(s)) { sc = ((Integer)hash.get(s)).intValue()*100.0/Integer.parseInt((String)hash.get("maxResidue")); // MC Should be isGap if ( !s.equals("-") && !s.equals(".") && !s.equals(" ")) { for (int i=0; i < thresholds.length; i++) { if (sc > thresholds[i]) { c = pidColours[i]; break; } } } else { c = Color.white; } } return c; } }