X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FPIDColourScheme.java;h=86868948cbaabc6905181855e9ce8f6ac46c030c;hb=f78ed026becc8e143d5b5953fce6c0961428d2a7;hp=cfc9f9472139dde27c2e9e215d87208813234b17;hpb=efc31b4a8d5cee63555586804a2b79c06bdb5a14;p=jalview.git diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index cfc9f94..8686894 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -18,11 +18,10 @@ */ package jalview.schemes; -import java.util.*; - import java.awt.*; import jalview.datamodel.*; +import jalview.analysis.AAFrequency; public class PIDColourScheme extends ResidueColourScheme @@ -37,40 +36,54 @@ public class PIDColourScheme this.thresholds = ResidueProperties.pidThresholds; } - public Color findColour(String s, int j) + public Color findColour(char c, int j) { - if ( (threshold != 0) && !aboveThreshold(s, j)) + if ('a' <= c && c <= 'z') + { + c -= ('a' - 'A'); + } + + if (consensus == null + || j >= consensus.length + || consensus[j]==null) { return Color.white; } - Color c = Color.white; - Hashtable hash = (Hashtable) consensus.elementAt(j); + if ( (threshold != 0) && !aboveThreshold(c, j)) + { + return Color.white; + } + + Color currentColour = Color.white; double sc = 0; - if ( (Integer.parseInt(hash.get("maxCount").toString()) != -1) && - hash.contains(s)) - { - sc = ( ( (Integer) hash.get(s)).intValue() * 100.0) / - ( (Integer) hash.get( - "size")).intValue(); + if(consensus.length<=j) + return Color.white; - // MC Should be isGap - if (!jalview.util.Comparison.isGap( (s.charAt(0)))) + if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != -1) && + consensus[j].contains(String.valueOf(c))) { - for (int i = 0; i < thresholds.length; i++) + sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue(); + + if (!jalview.util.Comparison.isGap(c)) { - if (sc > thresholds[i]) + for (int i = 0; i < thresholds.length; i++) { - c = pidColours[i]; + if (sc > thresholds[i]) + { + currentColour = pidColours[i]; - break; + break; + } } } } - } - return c; + if(conservationColouring) + currentColour = applyConservation(currentColour, j); + + return currentColour; } }