X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueColourScheme.java;h=b905c452ba87dcce2683ded2f74c2ec0fdc5cd36;hb=d587f1aa61946dc14f6f089cf1dc2a3116cfb773;hp=7c3620807f767c6e4e121361fbc3e986999f89c2;hpb=c3c305755d392741176209a0274a47897ac4d8a8;p=jalview.git diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index 7c36208..b905c45 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. @@ -90,7 +84,7 @@ public class ResidueColourScheme implements ColourSchemeI public Color findColour(String s, int j) { - + Color currentColour; int index = ResidueProperties.aaIndex[s.charAt(0)]; if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j)) @@ -103,7 +97,7 @@ public class ResidueColourScheme implements ColourSchemeI } if(conservationColouring) - applyConservation(j); + currentColour = applyConservation(currentColour, j); return currentColour; @@ -153,14 +147,16 @@ public class ResidueColourScheme implements ColourSchemeI 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)) + if ( ( ( (Integer) consensus[j].get(AAFrequency.MAXCOUNT)).intValue() != -1) && + consensus[j].contains(s)) { - if (((Float)consensus[j].get(ignoreGaps)).floatValue() >= threshold) - { - return true; - } + if ( ( (Float) consensus[j].get(ignoreGaps)).floatValue() >= threshold) + { + return true; + } } return false; @@ -225,7 +221,7 @@ public class ResidueColourScheme implements ColourSchemeI * @return DOCUMENT ME! */ - void applyConservation(int i) + Color applyConservation(Color currentColour, int i) { if ((conservation[i] != '*') && (conservation[i] != '+')) @@ -239,8 +235,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(); @@ -265,6 +260,7 @@ public class ResidueColourScheme implements ColourSchemeI currentColour = new Color(red, green, blue); } } + return currentColour; }