X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueColourScheme.java;h=df905006fe4f1fe03ac5112a1b15e13799258a84;hb=2e699d341f8e64868e3c279f9c02af617c4e9b44;hp=bf8366547f6d93fb38e857de28994fd5c3b3b758;hpb=3d941a02a998676a12f8ff43fa98d9e1f4c27142;p=jalview.git diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index bf83665..df90500 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -75,21 +75,20 @@ public class ResidueColourScheme implements ColourSchemeI /** * Find a colour without an index in a sequence */ - public Color findColour(String aa) + public Color findColour(char c) { - return colors[ResidueProperties.aaIndex[aa.charAt(0)]]; + return colors[ResidueProperties.aaIndex[c]]; } - public Color findColour(String s, int j) + public Color findColour(char c, int j) { Color currentColour; - int index = ResidueProperties.aaIndex[s.charAt(0)]; - if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j)) + if ((threshold == 0) || aboveThreshold(c, j)) { - currentColour = colors[index]; + currentColour = colors[ResidueProperties.aaIndex[c]]; } else { @@ -97,7 +96,7 @@ public class ResidueColourScheme implements ColourSchemeI } if(conservationColouring) - applyConservation(currentColour, j); + currentColour = applyConservation(currentColour, j); return currentColour; @@ -136,22 +135,20 @@ public class ResidueColourScheme implements ColourSchemeI * * @return DOCUMENT ME! */ - public boolean aboveThreshold(String s, int j) + public boolean aboveThreshold(char c, int j) { - char c = s.charAt(0); if ('a' <= c && c <= 'z') { // TO UPPERCASE !!! //Faster than toUpperCase c -= ('a' - 'A'); - s = String.valueOf(c); } if (consensus == null || consensus[j] == null) return false; if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) && - consensus[j].contains(s)) + consensus[j].contains(String.valueOf(c))) { if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold) { @@ -221,7 +218,7 @@ public class ResidueColourScheme implements ColourSchemeI * @return DOCUMENT ME! */ - void applyConservation(Color currentColour, int i) + Color applyConservation(Color currentColour, int i) { if ((conservation[i] != '*') && (conservation[i] != '+')) @@ -235,8 +232,7 @@ public class ResidueColourScheme implements ColourSchemeI float t = 11 - (conservation[i] - '0'); if(t==0) { - currentColour = Color.white; - return; + return Color.white; } int red = currentColour.getRed(); @@ -261,6 +257,7 @@ public class ResidueColourScheme implements ColourSchemeI currentColour = new Color(red, green, blue); } } + return currentColour; }