X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FUserColourScheme.java;h=33492839133bb297f794bedf8348ed6da6a8c544;hb=bc39ee8df9694f820a8a8bd2430f527b87c07f31;hp=e5efb1a27de5a5a2ad401ced137de663ab75afe2;hpb=174230b4233d9ce80f94527768d2cd2f76da11ab;p=jalview.git diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index e5efb1a..3349283 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -24,6 +24,8 @@ import java.util.StringTokenizer; public class UserColourScheme extends ResidueColourScheme { + Color [] lowerCaseColours; + protected String schemeName; public UserColourScheme() @@ -54,6 +56,11 @@ public class UserColourScheme return colors; } + public Color[] getLowerCaseColours() + { + return lowerCaseColours; + } + public void setName(String name) { schemeName = name; @@ -138,11 +145,34 @@ public class UserColourScheme st2 = new StringTokenizer(residues, " ,"); while (st2.hasMoreTokens()) { - int colIndex = - ( (Integer) ResidueProperties.aaHash. - get(st2.nextToken())).intValue(); - - colors[colIndex] = getColourFromString(colour); + token = st2.nextToken(); + + if (ResidueProperties.aaIndex[token.charAt(0)]==-1) + continue; + + int colIndex = ResidueProperties.aaIndex[token.charAt(0)]; + + if(token.equalsIgnoreCase("lowerCase")) + { + if (lowerCaseColours == null) + lowerCaseColours = new Color[23]; + for (int i = 0; i < 23; i++) + if (lowerCaseColours[i] == null) + lowerCaseColours[i] = getColourFromString(colour); + + continue; + } + + if(token.equals(token.toLowerCase())) + { + if(lowerCaseColours==null) + { + lowerCaseColours = new Color[23]; + } + lowerCaseColours[colIndex] = getColourFromString(colour); + } + else + colors[colIndex] = getColourFromString(colour); } } } @@ -154,4 +184,34 @@ public class UserColourScheme } + + + public Color findColour(String s, int j) + { + int index = ResidueProperties.aaIndex[s.charAt(0)]; + + if ((threshold == 0) || aboveThreshold(ResidueProperties.aa[index], j)) + { + if(lowerCaseColours!=null && 'a' <= s.charAt(0) && s.charAt(0) <= 'z') + currentColour = lowerCaseColours[index]; + else + currentColour = colors[index]; + } + else + { + currentColour = Color.white; + } + + if(conservationColouring) + applyConservation(j); + + + return currentColour; + } + + public void setLowerCaseColours(Color [] lcolours) + { + lowerCaseColours = lcolours; + } + }