X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueColourScheme.java;h=df905006fe4f1fe03ac5112a1b15e13799258a84;hb=f78ed026becc8e143d5b5953fce6c0961428d2a7;hp=64fd62e1cb2c921ddaaf9de7519c94fd0ec31d01;hpb=a2299be0ebb414d06b12d6735312a1bb1147694f;p=jalview.git diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index 64fd62e..df90500 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -52,12 +52,6 @@ public class ResidueColourScheme implements ColourSchemeI /** DOCUMENT ME!! */ int inc = 30; - /** - * The colour to be calculated, manipulated and returned - */ - Color currentColour = null; - - /** * Creates a new ResidueColourScheme object. @@ -81,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 { @@ -103,7 +96,7 @@ public class ResidueColourScheme implements ColourSchemeI } if(conservationColouring) - applyConservation(j); + currentColour = applyConservation(currentColour, j); return currentColour; @@ -142,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) { @@ -227,7 +218,7 @@ public class ResidueColourScheme implements ColourSchemeI * @return DOCUMENT ME! */ - void applyConservation(int i) + Color applyConservation(Color currentColour, int i) { if ((conservation[i] != '*') && (conservation[i] != '+')) @@ -241,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(); @@ -267,6 +257,7 @@ public class ResidueColourScheme implements ColourSchemeI currentColour = new Color(red, green, blue); } } + return currentColour; }