X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fschemes%2FUserColourScheme.java;h=00f8f6f6bb1c597eb1af80cf05d222367bc12052;hb=c1e70ea0a01d2c916675aa8020970c6696d0dba5;hp=e5efb1a27de5a5a2ad401ced137de663ab75afe2;hpb=174230b4233d9ce80f94527768d2cd2f76da11ab;p=jalview.git diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index e5efb1a..00f8f6f 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,35 @@ public class UserColourScheme } + + + public Color findColour(char c, int j) + { + Color currentColour; + int index = ResidueProperties.aaIndex[c]; + + if ((threshold == 0) || aboveThreshold(c, j)) + { + if(lowerCaseColours!=null && 'a' <= c && c <= 'z') + currentColour = lowerCaseColours[index]; + else + currentColour = colors[index]; + } + else + { + currentColour = Color.white; + } + + if(conservationColouring) + currentColour = applyConservation(currentColour, j); + + + return currentColour; + } + + public void setLowerCaseColours(Color [] lcolours) + { + lowerCaseColours = lcolours; + } + }