X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FPIDColourScheme.java;h=86868948cbaabc6905181855e9ce8f6ac46c030c;hb=f78ed026becc8e143d5b5953fce6c0961428d2a7;hp=e09745a0c315399fcfbac91a366b1daf9cd6683f;hpb=c3c305755d392741176209a0274a47897ac4d8a8;p=jalview.git diff --git a/src/jalview/schemes/PIDColourScheme.java b/src/jalview/schemes/PIDColourScheme.java index e09745a..8686894 100755 --- a/src/jalview/schemes/PIDColourScheme.java +++ b/src/jalview/schemes/PIDColourScheme.java @@ -36,21 +36,26 @@ 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; @@ -58,11 +63,11 @@ public class PIDColourScheme return Color.white; if ( (Integer.parseInt(consensus[j].get(AAFrequency.MAXCOUNT).toString()) != -1) && - consensus[j].contains(s)) + 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++) { @@ -77,7 +82,7 @@ public class PIDColourScheme } if(conservationColouring) - applyConservation(j); + currentColour = applyConservation(currentColour, j); return currentColour; }