public class Blosum62ColourScheme extends ResidueColourScheme\r
{\r
\r
- // need to keep an eye on the changing visible consensus sequence\r
- AlignViewport av;\r
-\r
- public Blosum62ColourScheme(AlignViewport av)\r
+ public Blosum62ColourScheme()\r
{\r
super();\r
- this.av = av;\r
}\r
\r
- public Color findColour(String s, int j, Vector aa)\r
+ public Color findColour(String s, int j)\r
{\r
- Hashtable hash;\r
-\r
- if (aa != null)\r
- hash = (Hashtable)aa.elementAt(j);\r
- else\r
- return Color.white;\r
+ Hashtable hash = (Hashtable)consensus.elementAt(j);\r
\r
if (!jalview.util.Comparison.isGap((s.charAt(0))))\r
{\r
\r
public boolean canThreshold()\r
{\r
- return false;\r
+ return true;\r
}\r
\r
}\r
size = i;\r
}\r
\r
- public Color findColour(String s, int j, Vector seqs)\r
+ public Color findColour(String s, int j)\r
{\r
int i = ((Integer)ResidueProperties.aaHash.get(s)).intValue();\r
\r
\r
}\r
\r
+ public void setConsensus(Vector consensus)\r
+ {\r
+ // Clustal colouring cannot be coloured by PID\r
+ }\r
\r
public boolean canThreshold()\r
{\r
public interface ColourSchemeI\r
{\r
public Color findColour(String aa);\r
- public Color findColour(String s,int j, Vector aa);\r
+ public Color findColour(String s,int j);\r
public boolean canThreshold();\r
public boolean isUserDefinable();\r
+ public void setConsensus(Vector v);\r
}\r
public Conservation conserve;\r
public ColourSchemeI cs;\r
public int inc = 30;\r
- int colourThreshold = 7;\r
\r
public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs)\r
{\r
super();\r
conserve = cons;\r
cs = oldcs;\r
-\r
}\r
\r
\r
- public Color findColour(String s, int i, java.util.Vector v)\r
+ public Color findColour(String s, int i)\r
{\r
Color c = Color.white;\r
- if(cs == null)\r
+ if (cs == null)\r
return c;\r
\r
- if (colourThreshold > 0 && conserve.getConsSequence() != null)\r
+ char ch = conserve.getConsSequence().getSequence().charAt(i);\r
+ if (ch == '*' || ch == '+')\r
+ {\r
+ c = cs.findColour(s, i);\r
+ }\r
+ else\r
{\r
- if (conserve.getConsSequence().getSequence().charAt(i) == '*'\r
- || conserve.getConsSequence().getSequence().charAt(i) == '+')\r
+ int tmp = 10;\r
+ int t = 0;\r
+ if (!jalview.util.Comparison.isGap(ch))\r
+ t = Integer.parseInt(ch + "");\r
+\r
+ c = cs.findColour(s, i);\r
+\r
+ while (tmp >= t)\r
{\r
- c = cs.findColour(s, i, v);\r
+ c = lighter(c, inc);\r
+ tmp--;\r
}\r
- else\r
- {\r
- int tmp = 10;\r
- int t = 0;\r
- if (!jalview.util.Comparison.isGap(conserve.getConsSequence().\r
- getSequence().charAt(i)))\r
- t = Integer.parseInt(conserve.getConsSequence().getSequence().\r
- substring(i, i + 1));\r
\r
- c = cs.findColour(s, i, v);\r
- while (tmp >= t)\r
- {\r
- c = lighter(c, inc);\r
- tmp--;\r
- }\r
- }\r
}\r
- return c;\r
+\r
+ return c;\r
}\r
\r
\r
}\r
\r
\r
- public Color findColour(String n, int j, Vector aa) {\r
+ public Color findColour(String n, int j) {\r
\r
- if (threshold == 0 || aboveThreshold(aa, n, j))\r
+ if (threshold == 0 || aboveThreshold( n, j))\r
try\r
{\r
return colors[ ( (Integer) (ResidueProperties.nucleotideHash.get(n))).intValue()];\r
}\r
\r
\r
- public Color findColour(String s, int j,Vector aa) {\r
+ public Color findColour(String s, int j) {\r
Color c = Color.white;\r
- Hashtable hash = null;\r
-\r
-\r
- if (aa != null)\r
- hash = (Hashtable)aa.elementAt(j);\r
- else\r
- return c;\r
-\r
- String max = (String)hash.get("maxResidue");\r
+ Hashtable hash = (Hashtable)consensus.elementAt(j);\r
\r
double sc = 0;\r
if ( Integer.parseInt( hash.get("maxCount").toString() ) != -1 && hash.contains(s))\r
public class ResidueColourScheme implements ColourSchemeI{\r
Color [] colors;\r
int threshold = 0;\r
+ public Vector consensus;\r
\r
public ResidueColourScheme(Color[] colors, int threshold) {\r
- this.colors = colors;\r
+ this.colors = colors;\r
this.threshold = threshold;\r
}\r
\r
- public ResidueColourScheme() {\r
+ public ResidueColourScheme()\r
+ { }\r
+\r
+ public void setConsensus(Vector consensus)\r
+ {\r
+ this.consensus = consensus;\r
}\r
\r
public Color findColour(String aa)\r
return colors[((Integer)(ResidueProperties.aaHash.get(aa))).intValue()];\r
}\r
\r
- public Color findColour(String s, int j, Vector aa) {\r
+ public Color findColour(String s, int j) {\r
\r
- if( threshold==0 || aboveThreshold(aa,s,j))\r
+ if( threshold==0 || aboveThreshold(s,j))\r
return colors[((Integer)(ResidueProperties.aaHash.get(s))).intValue()];\r
else\r
return Color.white;\r
threshold = ct;\r
}\r
\r
- public boolean aboveThreshold(Vector aa,String s, int j)\r
+ public boolean aboveThreshold(String s, int j)\r
{\r
-\r
- Hashtable hash = (Hashtable)aa.elementAt(j);\r
+ Hashtable hash = (Hashtable)consensus.elementAt(j);\r
\r
if ( ( (Integer) hash.get("maxCount")).intValue() != -1 && hash.contains(s))\r
{\r
}\r
\r
\r
- public Color findColour(String s,int j,Vector aa)\r
+ public Color findColour(String s,int j)\r
{\r
\r
if (threshold > 0)\r
{\r
- if (!aboveThreshold(aa,s,j))\r
+ if (!aboveThreshold(s,j))\r
return Color.white;\r
}\r
\r