From: amwaterhouse Date: Tue, 14 Dec 2004 17:34:50 +0000 (+0000) Subject: PID Colour scheme now operational! X-Git-Tag: Release_2_0~824 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=1032f8a608bb97dd7817390aa56293dba3fe3806 PID Colour scheme now operational! --- diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index 0a28c33..e587fee 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -14,45 +14,39 @@ 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) { 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 (!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; }