X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FPIDColourScheme.java;h=cc050d57be5b29f5a76966ca16808c96ae06b283;hb=a2d2bfc9a2efd08446954c01dc5957560fdec9be;hp=312ae7d534ce8a8ce8bcc38419e4063788c9f262;hpb=1ecf6419aba86993b3c223bf5ec0fa79427baf85;p=jalview.git diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index 312ae7d..cc050d5 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -1,8 +1,6 @@ package jalview.schemes; import jalview.datamodel.*; -import jalview.jbgui.*; - import java.util.*; import java.awt.*; @@ -16,45 +14,37 @@ public class PIDColourScheme extends ResidueColourScheme { 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) { + public Color findColour(String s, int j,Vector aa) { Color c = Color.white; Hashtable hash = null; - if (aa != 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; - } + if ( Integer.parseInt( hash.get("maxCount").toString() ) != -1 && hash.contains(s)) + { + sc = ( (Integer) hash.get(s)).intValue() * 100.0 / ((Integer)hash.get("size")).intValue() ; + // MC Should be isGap + if (!jalview.util.Comparison.isGap((s.charAt(0)))) + { + for (int i = 0; i < thresholds.length; i++) + { + if (sc > thresholds[i]) + { + c = pidColours[i]; + break; + } + } + } + } return c; }