*/\r
\r
package jalview.schemes;\r
+\r
+import jalview.datamodel.*;\r
import java.util.*;\r
import java.awt.*;\r
\r
\r
}\r
Vector colourTable = new Vector();\r
- public ClustalxColourScheme() {\r
- this.cons2 = null;\r
- this.size = 0;\r
- makeColours();\r
- }\r
- public ClustalxColourScheme(int[][] cons2, int size) {\r
- this.cons2 = cons2;\r
- this.size = size;\r
+\r
+\r
+ public ClustalxColourScheme(Vector seqs, int maxWidth)\r
+ {\r
+ cons2 = new int[maxWidth][24];\r
+ int start = 0, end = maxWidth-1;\r
+\r
+ // Initialize the array\r
+ for (int j=0;j<24;j++)\r
+ for (int i=0; i < maxWidth;i++)\r
+ cons2[i][j] = 0;\r
+\r
+ int res,i, j = 0;\r
+ String seq;\r
+ while(j < seqs.size())\r
+ {\r
+ seq = ( (SequenceI) seqs.get(j)).getSequence();\r
+ int end_j = seq.length()-1;\r
+ for (i = start; i <= end_j; i++)\r
+ {\r
+ if(seq.length()-1<i)\r
+ res = 23;\r
+ else\r
+ res = ( (Integer) ResidueProperties.aaHash.get(seq.charAt(i) + "")).intValue();\r
+ cons2[i][res]++;\r
+ }\r
+ j++;\r
+ }\r
+\r
+ this.size = seqs.size();\r
makeColours();\r
}\r
public void makeColours() {\r
return Color.pink;\r
}\r
\r
- public Color findColour(String s, int j, Vector seqs)\r
- {\r
+ public void setGroupSizeChanged(int i)\r
+ {\r
+ size = i;\r
+ }\r
+\r
+ public Color findColour(String s, int j)\r
+ {\r
+ int i = ((Integer)ResidueProperties.aaHash.get(s)).intValue();\r
+\r
+ Color c = Color.white;\r
+\r
+ if(i>19)\r
+ return c;\r
+\r
+ for (int k=0; k < ResidueColour[i].conses.length ; k++)\r
+ if (ResidueColour[i].conses[k].isConserved(cons2,j,size))\r
+ c = ResidueColour[i].c;\r
+\r
+ if (i == 4)\r
+ {\r
+ if (conses[27].isConserved(cons2, j, size))\r
+ c = (Color) colhash.get("PINK");\r
+ }\r
+\r
\r
- int i = Integer.parseInt( ResidueProperties.aaHash.get(s).toString() );\r
+ return c;\r
\r
- if(i>22) // ie -, ., or space\r
- return Color.white;\r
+ }\r
\r
- return ResidueColour[i].c;\r
+ public void setConsensus(Vector consensus)\r
+ {\r
+ // Clustal colouring cannot be coloured by PID\r
}\r
\r
public boolean canThreshold()\r
return false;\r
}\r
\r
+\r
}\r
\r
class ConsensusColour {\r
\r
\r
\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r