X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FPIDColourScheme.java;h=86868948cbaabc6905181855e9ce8f6ac46c030c;hb=f78ed026becc8e143d5b5953fce6c0961428d2a7;hp=1575a6a5d8a7a1f87f1138cca08995bc8c48cf31;hpb=1774759f889464551c244c070b7771dabbb4bad2;p=jalview.git diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index 1575a6a..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,33 +36,38 @@ 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 = String.valueOf(res -= ('a' - 'A')); + c -= ('a' - 'A'); } + if (consensus == null + || j >= consensus.length + || consensus[j]==null) + { + return Color.white; + } - if ( (threshold != 0) && !aboveThreshold(s, j)) + if ( (threshold != 0) && !aboveThreshold(c, j)) { return Color.white; } - currentColour = Color.white; + Color currentColour = Color.white; double sc = 0; if(consensus.length<=j) return Color.white; - if ( (Integer.parseInt(consensus[j].get("maxCount").toString()) != -1) && - consensus[j].contains(s)) + if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != -1) && + consensus[j].contains(String.valueOf(c))) { sc = ( (Float) consensus[j].get(ignoreGaps)).floatValue(); - if (!jalview.util.Comparison.isGap(res)) + if (!jalview.util.Comparison.isGap(c)) { for (int i = 0; i < thresholds.length; i++) { @@ -76,7 +82,7 @@ public class PIDColourScheme } if(conservationColouring) - applyConservation(j); + currentColour = applyConservation(currentColour, j); return currentColour; }