X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemes%2FResidueColourScheme.java;h=b83244d61ea9d2a8857ff451c5e46076a4db6e81;hb=559b96a91b710f3f2e116790c9cf7e3aa6c76766;hp=785d22d36323b4766837f048420f26a65a5ae4d7;hpb=e8bf50102d1e937c715bf15046ae5076343313c0;p=jalview.git diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index 785d22d..b83244d 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -18,6 +18,8 @@ */ package jalview.schemes; +import jalview.analysis.*; + import java.awt.*; import java.util.*; @@ -31,14 +33,31 @@ import java.util.*; */ public class ResidueColourScheme implements ColourSchemeI { + + boolean conservationColouring = false; + boolean consensusColouring = false; + Color[] colors; int threshold = 0; /* Set when threshold colouring to either pid_gaps or pid_nogaps*/ protected String ignoreGaps = "pid_gaps"; - /** DOCUMENT ME!! */ - public Hashtable [] consensus; + /** Consenus as a hashtable array */ + Hashtable [] consensus; + + /** Conservation string as a char array */ + char [] conservation; + + /** DOCUMENT ME!! */ + int inc = 30; + + /** + * The colour to be calculated, manipulated and returned + */ + Color currentColour = null; + + /** * Creates a new ResidueColourScheme object. @@ -46,9 +65,9 @@ public class ResidueColourScheme implements ColourSchemeI * @param colors DOCUMENT ME! * @param threshold DOCUMENT ME! */ - public ResidueColourScheme(Color[] colors, int threshold) + public ResidueColourScheme(Color[] colours, int threshold) { - this.colors = colors; + this.colors = colours; this.threshold = threshold; } @@ -60,56 +79,41 @@ public class ResidueColourScheme implements ColourSchemeI } /** - * DOCUMENT ME! - * - * @param consensus DOCUMENT ME! - */ - public void setConsensus(Vector vconsensus) - { - int i, iSize=vconsensus.size(); - consensus = new Hashtable[iSize]; - for(i=0; i= threshold) + if (((Float)consensus[j].get(ignoreGaps)).floatValue() >= threshold) { return true; } @@ -153,4 +155,109 @@ public class ResidueColourScheme implements ColourSchemeI return false; } + + + public boolean conservationApplied() + { + return conservationColouring; + } + + public void setConservationInc(int i) + { + inc = i; + } + + public int getConservationInc() + { + return inc; + } + + /** + * DOCUMENT ME! + * + * @param consensus DOCUMENT ME! + */ + public void setConsensus(Vector vconsensus) + { + if(vconsensus==null) + return; + + int i, iSize=vconsensus.size(); + consensus = new Hashtable[iSize]; + for(i=0; i 255 || green > 255 || blue > 255) + currentColour = Color.white; + else + currentColour = new Color(red, green, blue); + } + } + } + + }