X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueColourScheme.java;h=a99380273980c9dc077088ce6497e9a3547aac6f;hb=7be3a744db5213f49e70178ade126d1cc797c762;hp=3c8e69044e73252b2c5380556570d894eebc0611;hpb=064f2fdaa463367f8bf7e6aea5e7fc6a32170138;p=jalview.git diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index 3c8e690..a993802 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle +* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -144,7 +144,17 @@ public class ResidueColourScheme implements ColourSchemeI */ public boolean aboveThreshold(String s, int j) { - if ((((Integer) consensus[j].get("maxCount")).intValue() != -1) && + char c = s.charAt(0); + if ('a' <= c && c <= 'z') + { + // TO UPPERCASE !!! + //Faster than toUpperCase + c -= ('a' - 'A'); + s = String.valueOf(c); + } + + + if ((((Integer) consensus[j].get("maxCount")).intValue() != -1) && consensus[j].contains(s)) { if (((Float)consensus[j].get(ignoreGaps)).floatValue() >= threshold) @@ -177,18 +187,16 @@ public class ResidueColourScheme implements ColourSchemeI * * @param consensus DOCUMENT ME! */ - public void setConsensus(Vector vconsensus) + public void setConsensus(Hashtable [] consensus) { - if(vconsensus==null) + if(consensus==null) return; - int i, iSize=vconsensus.size(); - consensus = new Hashtable[iSize]; - for(i=0; i= t) - { - lighter(inc); - tmp--; - } - } - } - - /** - * DOCUMENT ME! - * - * @param c DOCUMENT ME! - * @param inc DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - void lighter(int inc) + void applyConservation(int i) { - int red = currentColour.getRed(); - int blue = currentColour.getBlue(); - int green = currentColour.getGreen(); - if (red < (255 - inc)) + if ((conservation[i] != '*') && (conservation[i] != '+')) + { + if(jalview.util.Comparison.isGap(conservation[i])) { - red = red + inc; + currentColour = Color.white; } else { - red = 255; - } + float t = 11 - (conservation[i] - '0'); + if(t==0) + { + currentColour = Color.white; + return; + } - if (blue < (255 - inc)) - { - blue = blue + inc; - } - else - { - blue = 255; - } + int red = currentColour.getRed(); + int green = currentColour.getGreen(); + int blue = currentColour.getBlue(); - if (green < (255 - inc)) - { - green = green + inc; + int dr = 255 - red; + int dg = 255 - green; + int db = 255 - blue; + + dr *= t / 10f; + dg *= t / 10f; + db *= t / 10f; + + red += (inc / 20f) * dr; + green += (inc / 20f) * dg; + blue += (inc / 20f) * db; + + if (red > 255 || green > 255 || blue > 255) + currentColour = Color.white; + else + currentColour = new Color(red, green, blue); } - else - { - green = 255; } - - currentColour = new Color(red, green, blue); }