X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FPIDColourScheme.java;h=86868948cbaabc6905181855e9ce8f6ac46c030c;hb=51bbc79eee43d019f9fcb14b7aa6e0a0c2c99f76;hp=9dc4c66aa729c9086b2d84d37a47f47432bea273;hpb=503ebba0021fa583fa7af58f9406f9234274fd7c;p=jalview.git diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index 9dc4c66..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 @@ -21,6 +21,7 @@ package jalview.schemes; import java.awt.*; import jalview.datamodel.*; +import jalview.analysis.AAFrequency; public class PIDColourScheme extends ResidueColourScheme @@ -35,45 +36,54 @@ public class PIDColourScheme this.thresholds = ResidueProperties.pidThresholds; } - public Color findColour(String s, int j) + public Color findColour(char c, int j) { - char res = s.charAt(0); - if ('a' <= res && res <= 'z') + if ('a' <= c && c <= 'z') { - s = Character.toString(res -= ('a' - 'A')); + c -= ('a' - 'A'); } - - if ( (threshold != 0) && !aboveThreshold(s, j)) + if (consensus == null + || j >= consensus.length + || consensus[j]==null) { return Color.white; } + if ( (threshold != 0) && !aboveThreshold(c, j)) + { + return Color.white; + } - - Color c = Color.white; + Color currentColour = Color.white; double sc = 0; - if ( (Integer.parseInt(consensus[j].get("maxCount").toString()) != -1) && - consensus[j].contains(s)) - { - sc = ((Float)consensus[j].get(ignoreGaps)).floatValue(); + if(consensus.length<=j) + return Color.white; - if (!jalview.util.Comparison.isGap( res )) + 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; } }