1 Clazz.declarePackage ("jalview.schemes");
\r
2 Clazz.load (["jalview.schemes.ResidueColourScheme", "java.util.HashMap"], ["jalview.schemes.ConsensusColour", "$.ClustalxColourScheme"], ["jalview.schemes.Consensus", "$.ResidueProperties", "java.awt.Color"], function () {
\r
3 c$ = Clazz.decorateAsClass (function () {
\r
6 this.residueColour = null;
\r
9 this.includeGaps = true;
\r
10 Clazz.instantialize (this, arguments);
\r
11 }, jalview.schemes, "ClustalxColourScheme", jalview.schemes.ResidueColourScheme);
\r
12 Clazz.prepareFields (c$, function () {
\r
13 this.conses = new Array (32);
\r
15 Clazz.makeConstructor (c$,
\r
16 function (alignment, hiddenReps) {
\r
17 Clazz.superConstructor (this, jalview.schemes.ClustalxColourScheme, []);
\r
18 this.alignmentChanged (alignment, hiddenReps);
\r
19 }, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
\r
20 Clazz.overrideMethod (c$, "alignmentChanged",
\r
21 function (alignment, hiddenReps) {
\r
22 var maxWidth = alignment.getWidth ();
\r
23 var seqs = alignment.getSequences (hiddenReps);
\r
24 this.cons2 = Clazz.newIntArray (maxWidth, 24, 0);
\r
25 this.includeGaps = this.isIncludeGaps ();
\r
27 for (var j = 0; j < 24; j++) {
\r
28 for (var i = 0; i < maxWidth; i++) {
\r
29 this.cons2[i][j] = 0;
\r
36 for (var sq, $sq = seqs.iterator (); $sq.hasNext () && ((sq = $sq.next ()) || true);) {
\r
37 seq = sq.getSequence ();
\r
38 var end_j = seq.length - 1;
\r
39 for (i = start; i <= end_j; i++) {
\r
40 if ((seq.length - 1) < i) {
\r
43 res = jalview.schemes.ResidueProperties.aaIndex[seq[i].charCodeAt (0)];
\r
44 }this.cons2[i][res]++;
\r
48 this.size = seqs.size ();
\r
49 this.makeColours ();
\r
50 }, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
\r
51 Clazz.defineMethod (c$, "makeColours",
\r
53 this.conses[0] = new jalview.schemes.Consensus ("WLVIMAFCYHP", 60);
\r
54 this.conses[1] = new jalview.schemes.Consensus ("WLVIMAFCYHP", 80);
\r
55 this.conses[2] = new jalview.schemes.Consensus ("ED", 50);
\r
56 this.conses[3] = new jalview.schemes.Consensus ("KR", 60);
\r
57 this.conses[4] = new jalview.schemes.Consensus ("G", 50);
\r
58 this.conses[5] = new jalview.schemes.Consensus ("N", 50);
\r
59 this.conses[6] = new jalview.schemes.Consensus ("QE", 50);
\r
60 this.conses[7] = new jalview.schemes.Consensus ("P", 50);
\r
61 this.conses[8] = new jalview.schemes.Consensus ("TS", 50);
\r
62 this.conses[26] = new jalview.schemes.Consensus ("A", 85);
\r
63 this.conses[27] = new jalview.schemes.Consensus ("C", 85);
\r
64 this.conses[10] = new jalview.schemes.Consensus ("E", 85);
\r
65 this.conses[11] = new jalview.schemes.Consensus ("F", 85);
\r
66 this.conses[12] = new jalview.schemes.Consensus ("G", 85);
\r
67 this.conses[13] = new jalview.schemes.Consensus ("H", 85);
\r
68 this.conses[14] = new jalview.schemes.Consensus ("I", 85);
\r
69 this.conses[15] = new jalview.schemes.Consensus ("L", 85);
\r
70 this.conses[16] = new jalview.schemes.Consensus ("M", 85);
\r
71 this.conses[17] = new jalview.schemes.Consensus ("N", 85);
\r
72 this.conses[18] = new jalview.schemes.Consensus ("P", 85);
\r
73 this.conses[19] = new jalview.schemes.Consensus ("Q", 85);
\r
74 this.conses[20] = new jalview.schemes.Consensus ("R", 85);
\r
75 this.conses[21] = new jalview.schemes.Consensus ("S", 85);
\r
76 this.conses[22] = new jalview.schemes.Consensus ("T", 85);
\r
77 this.conses[23] = new jalview.schemes.Consensus ("V", 85);
\r
78 this.conses[24] = new jalview.schemes.Consensus ("W", 85);
\r
79 this.conses[25] = new jalview.schemes.Consensus ("Y", 85);
\r
80 this.conses[28] = new jalview.schemes.Consensus ("K", 85);
\r
81 this.conses[29] = new jalview.schemes.Consensus ("D", 85);
\r
82 this.conses[30] = new jalview.schemes.Consensus ("G", 0);
\r
83 this.conses[31] = new jalview.schemes.Consensus ("P", 0);
\r
84 this.colours = new Array (11);
\r
85 var tmp8 = new Array (1);
\r
86 tmp8[0] = this.conses[30];
\r
87 this.colours[7] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.ORANGE), tmp8);
\r
88 var tmp9 = new Array (1);
\r
89 tmp9[0] = this.conses[31];
\r
90 this.colours[8] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.YELLOW), tmp9);
\r
91 var tmp10 = new Array (1);
\r
92 tmp10[0] = this.conses[27];
\r
93 this.colours[9] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.PINK), tmp8);
\r
94 var tmp1 = new Array (14);
\r
95 tmp1[0] = this.conses[0];
\r
96 tmp1[1] = this.conses[1];
\r
97 tmp1[2] = this.conses[26];
\r
98 tmp1[3] = this.conses[27];
\r
99 tmp1[4] = this.conses[11];
\r
100 tmp1[5] = this.conses[13];
\r
101 tmp1[6] = this.conses[14];
\r
102 tmp1[7] = this.conses[15];
\r
103 tmp1[8] = this.conses[16];
\r
104 tmp1[9] = this.conses[23];
\r
105 tmp1[10] = this.conses[24];
\r
106 tmp1[11] = this.conses[25];
\r
107 tmp1[12] = this.conses[18];
\r
108 tmp1[13] = this.conses[19];
\r
109 this.colours[0] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.BLUE), tmp1);
\r
110 this.colours[10] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.CYAN), tmp1);
\r
111 var tmp2 = new Array (5);
\r
112 tmp2[0] = this.conses[8];
\r
113 tmp2[1] = this.conses[21];
\r
114 tmp2[2] = this.conses[22];
\r
115 tmp2[3] = this.conses[0];
\r
116 tmp2[4] = this.conses[1];
\r
117 this.colours[1] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.GREEN), tmp2);
\r
118 var tmp3 = new Array (3);
\r
119 tmp3[0] = this.conses[17];
\r
120 tmp3[1] = this.conses[29];
\r
121 tmp3[2] = this.conses[5];
\r
122 this.colours[2] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.GREEN), tmp3);
\r
123 var tmp4 = new Array (6);
\r
124 tmp4[0] = this.conses[6];
\r
125 tmp4[1] = this.conses[19];
\r
126 tmp4[2] = this.conses[22];
\r
127 tmp4[3] = this.conses[3];
\r
128 tmp4[4] = this.conses[28];
\r
129 tmp4[5] = this.conses[20];
\r
130 this.colours[3] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.GREEN), tmp4);
\r
131 var tmp5 = new Array (4);
\r
132 tmp5[0] = this.conses[3];
\r
133 tmp5[1] = this.conses[28];
\r
134 tmp5[2] = this.conses[20];
\r
135 tmp5[3] = this.conses[19];
\r
136 this.colours[4] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.RED), tmp5);
\r
137 var tmp6 = new Array (6);
\r
138 tmp6[0] = this.conses[3];
\r
139 tmp6[1] = this.conses[29];
\r
140 tmp6[2] = this.conses[10];
\r
141 tmp6[3] = this.conses[6];
\r
142 tmp6[4] = this.conses[19];
\r
143 tmp6[5] = this.conses[2];
\r
144 this.colours[5] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.MAGENTA), tmp6);
\r
145 var tmp7 = new Array (5);
\r
146 tmp7[0] = this.conses[3];
\r
147 tmp7[1] = this.conses[29];
\r
148 tmp7[2] = this.conses[10];
\r
149 tmp7[3] = this.conses[17];
\r
150 tmp7[4] = this.conses[2];
\r
151 this.colours[6] = new jalview.schemes.ConsensusColour (jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.MAGENTA), tmp7);
\r
152 this.residueColour = new Array (20);
\r
153 this.residueColour[0] = this.colours[0];
\r
154 this.residueColour[1] = this.colours[4];
\r
155 this.residueColour[2] = this.colours[2];
\r
156 this.residueColour[3] = this.colours[6];
\r
157 this.residueColour[4] = this.colours[0];
\r
158 this.residueColour[5] = this.colours[3];
\r
159 this.residueColour[6] = this.colours[5];
\r
160 this.residueColour[7] = this.colours[7];
\r
161 this.residueColour[8] = this.colours[10];
\r
162 this.residueColour[9] = this.colours[0];
\r
163 this.residueColour[10] = this.colours[0];
\r
164 this.residueColour[11] = this.colours[4];
\r
165 this.residueColour[12] = this.colours[0];
\r
166 this.residueColour[13] = this.colours[0];
\r
167 this.residueColour[14] = this.colours[8];
\r
168 this.residueColour[15] = this.colours[1];
\r
169 this.residueColour[16] = this.colours[1];
\r
170 this.residueColour[17] = this.colours[0];
\r
171 this.residueColour[18] = this.colours[10];
\r
172 this.residueColour[19] = this.colours[0];
\r
174 Clazz.defineMethod (c$, "findColour",
\r
176 return java.awt.Color.pink;
\r
178 Clazz.defineMethod (c$, "findColour",
\r
179 function (c, j, seq) {
\r
181 if (this.cons2.length <= j || (this.includeGaps && this.threshold != 0 && !this.aboveThreshold (c, j))) {
\r
182 return java.awt.Color.white;
\r
183 }var i = jalview.schemes.ResidueProperties.aaIndex[c.charCodeAt (0)];
\r
184 currentColour = java.awt.Color.white;
\r
186 return currentColour;
\r
187 }for (var k = 0; k < this.residueColour[i].conses.length; k++) {
\r
188 if (this.residueColour[i].conses[k].isConserved (this.cons2, j, this.size, this.includeGaps)) {
\r
189 currentColour = this.residueColour[i].c;
\r
192 if (this.conses[27].isConserved (this.cons2, j, this.size, this.includeGaps)) {
\r
193 currentColour = jalview.schemes.ClustalxColourScheme.colhash.get (java.awt.Color.PINK);
\r
194 }}if (this.conservationColouring) {
\r
195 currentColour = this.applyConservation (currentColour, j);
\r
196 }return currentColour;
\r
197 }, "~S,~N,jalview.datamodel.SequenceI");
\r
198 Clazz.defineMethod (c$, "isIncludeGaps",
\r
200 return this.includeGaps;
\r
202 Clazz.defineMethod (c$, "setIncludeGaps",
\r
203 function (includeGaps) {
\r
204 this.includeGaps = includeGaps;
\r
206 Clazz.overrideMethod (c$, "applyTo",
\r
207 function (sg, hiddenRepSequences) {
\r
208 var css = new jalview.schemes.ClustalxColourScheme (sg, hiddenRepSequences);
\r
209 css.includeGaps = this.includeGaps;
\r
211 }, "jalview.datamodel.AnnotatedCollectionI,java.util.Map");
\r
212 Clazz.defineStatics (c$,
\r
217 c$.colhash = c$.prototype.colhash = new java.util.HashMap ();
\r
219 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.RED, new java.awt.Color (0.9, 0.2, 0.1));
\r
220 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.BLUE, new java.awt.Color (0.5, 0.7, 0.9));
\r
221 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.GREEN, new java.awt.Color (0.1, 0.8, 0.1));
\r
222 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.ORANGE, new java.awt.Color (0.9, 0.6, 0.3));
\r
223 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.CYAN, new java.awt.Color (0.1, 0.7, 0.7));
\r
224 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.PINK, new java.awt.Color (0.9, 0.5, 0.5));
\r
225 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.MAGENTA, new java.awt.Color (0.8, 0.3, 0.8));
\r
226 jalview.schemes.ClustalxColourScheme.colhash.put (java.awt.Color.YELLOW, new java.awt.Color (0.8, 0.8, 0.0));
\r
227 }c$ = Clazz.decorateAsClass (function () {
\r
228 this.conses = null;
\r
230 Clazz.instantialize (this, arguments);
\r
231 }, jalview.schemes, "ConsensusColour");
\r
232 Clazz.makeConstructor (c$,
\r
233 function (c, conses) {
\r
234 this.conses = conses;
\r
236 }, "java.awt.Color,~A");
\r