JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / site / j2s / jalview / datamodel / SequenceGroup.js
1 Clazz.declarePackage ("jalview.datamodel");\r
2 Clazz.load (["jalview.datamodel.AnnotatedCollectionI", "java.awt.Color", "java.util.ArrayList"], "jalview.datamodel.SequenceGroup", ["jalview.analysis.AAFrequency", "$.Conservation", "jalview.datamodel.AlignmentAnnotation", "$.Sequence", "jalview.schemes.ResidueProperties", "jalview.util.Comparison", "java.lang.StringBuffer"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.groupName = null;\r
5 this.description = null;\r
6 this.conserve = null;\r
7 this.aaFrequency = null;\r
8 this.displayBoxes = true;\r
9 this.displayText = true;\r
10 this.colourText = false;\r
11 this.showNonconserved = false;\r
12 this.sequences = null;\r
13 this.seqrep = null;\r
14 this.width = -1;\r
15 this.cs = null;\r
16 this.startRes = 0;\r
17 this.endRes = 0;\r
18 this.outlineColour = null;\r
19 this.idColour = null;\r
20 this.thresholdTextColour = 0;\r
21 this.textColour = null;\r
22 this.textColour2 = null;\r
23 this.ignoreGapsInConsensus = true;\r
24 this.showSequenceLogo = false;\r
25 this.normaliseSequenceLogo = false;\r
26 this.consPercGaps = 25;\r
27 this.consensusData = null;\r
28 this.hidereps = false;\r
29 this.hidecols = false;\r
30 this.consensus = null;\r
31 this.conservation = null;\r
32 this.showConsensusHistogram = false;\r
33 this.context = null;\r
34 Clazz.instantialize (this, arguments);\r
35 }, jalview.datamodel, "SequenceGroup", null, jalview.datamodel.AnnotatedCollectionI);\r
36 Clazz.prepareFields (c$, function () {\r
37 this.sequences =  new java.util.ArrayList ();\r
38 this.outlineColour = java.awt.Color.black;\r
39 this.textColour = java.awt.Color.black;\r
40 this.textColour2 = java.awt.Color.white;\r
41 });\r
42 Clazz.defineMethod (c$, "isShowSequenceLogo", \r
43 function () {\r
44 return this.showSequenceLogo;\r
45 });\r
46 Clazz.makeConstructor (c$, \r
47 function () {\r
48 this.groupName = "JGroup:" + this.hashCode ();\r
49 });\r
50 Clazz.makeConstructor (c$, \r
51 function (sequences, groupName, scheme, displayBoxes, displayText, colourText, start, end) {\r
52 this.sequences = sequences;\r
53 this.groupName = groupName;\r
54 this.displayBoxes = displayBoxes;\r
55 this.displayText = displayText;\r
56 this.colourText = colourText;\r
57 this.cs = scheme;\r
58 this.startRes = start;\r
59 this.endRes = end;\r
60 this.recalcConservation ();\r
61 }, "java.util.List,~S,jalview.schemes.ColourSchemeI,~B,~B,~B,~N,~N");\r
62 Clazz.makeConstructor (c$, \r
63 function (seqsel) {\r
64 if (seqsel != null) {\r
65 this.sequences =  new java.util.ArrayList ();\r
66 this.sequences.addAll (seqsel.sequences);\r
67 if (seqsel.groupName != null) {\r
68 this.groupName =  String.instantialize (seqsel.groupName);\r
69 }this.displayBoxes = seqsel.displayBoxes;\r
70 this.displayText = seqsel.displayText;\r
71 this.colourText = seqsel.colourText;\r
72 this.startRes = seqsel.startRes;\r
73 this.endRes = seqsel.endRes;\r
74 this.cs = seqsel.cs;\r
75 if (seqsel.description != null) {\r
76 this.description =  String.instantialize (seqsel.description);\r
77 }this.hidecols = seqsel.hidecols;\r
78 this.hidereps = seqsel.hidereps;\r
79 this.idColour = seqsel.idColour;\r
80 this.outlineColour = seqsel.outlineColour;\r
81 this.seqrep = seqsel.seqrep;\r
82 this.textColour = seqsel.textColour;\r
83 this.textColour2 = seqsel.textColour2;\r
84 this.thresholdTextColour = seqsel.thresholdTextColour;\r
85 this.width = seqsel.width;\r
86 this.ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus;\r
87 if (seqsel.conserve != null) {\r
88 this.recalcConservation ();\r
89 }}}, "jalview.datamodel.SequenceGroup");\r
90 Clazz.defineMethod (c$, "getSelectionAsNewSequences", \r
91 function (align) {\r
92 var iSize = this.sequences.size ();\r
93 var seqs =  new Array (iSize);\r
94 var inorder = this.getSequencesInOrder (align);\r
95 for (var i = 0, ipos = 0; i < inorder.length; i++) {\r
96 var seq = inorder[i];\r
97 seqs[ipos] = seq.getSubSequence (this.startRes, this.endRes + 1);\r
98 if (seqs[ipos] != null) {\r
99 seqs[ipos].setDescription (seq.getDescription ());\r
100 seqs[ipos].setDBRef (seq.getDBRef ());\r
101 seqs[ipos].setSequenceFeatures (seq.getSequenceFeatures ());\r
102 if (seq.getDatasetSequence () != null) {\r
103 seqs[ipos].setDatasetSequence (seq.getDatasetSequence ());\r
104 }if (seq.getAnnotation () != null) {\r
105 var alann = align.getAlignmentAnnotation ();\r
106 for (var a = 0; a < seq.getAnnotation ().length; a++) {\r
107 var tocopy = seq.getAnnotation ()[a];\r
108 if (alann != null) {\r
109 var found = false;\r
110 for (var pos = 0; pos < alann.length; pos++) {\r
111 if (alann[pos] === tocopy) {\r
112 found = true;\r
113 break;\r
114 }}\r
115 if (!found) {\r
116 continue;\r
117 }}var newannot =  new jalview.datamodel.AlignmentAnnotation (seq.getAnnotation ()[a]);\r
118 newannot.restrict (this.startRes, this.endRes);\r
119 newannot.setSequenceRef (seqs[ipos]);\r
120 newannot.adjustForAlignment ();\r
121 seqs[ipos].addAlignmentAnnotation (newannot);\r
122 }\r
123 }ipos++;\r
124 } else {\r
125 iSize--;\r
126 }}\r
127 if (iSize != inorder.length) {\r
128 var nseqs =  new Array (iSize);\r
129 System.arraycopy (seqs, 0, nseqs, 0, iSize);\r
130 seqs = nseqs;\r
131 }return seqs;\r
132 }, "jalview.datamodel.AlignmentI");\r
133 Clazz.defineMethod (c$, "findEndRes", \r
134 function (seq) {\r
135 var eres = 0;\r
136 var ch;\r
137 for (var j = 0; j < this.endRes + 1 && j < seq.getLength (); j++) {\r
138 ch = seq.getCharAt (j);\r
139 if (!jalview.util.Comparison.isGap ((ch))) {\r
140 eres++;\r
141 }}\r
142 if (eres > 0) {\r
143 eres += seq.getStart () - 1;\r
144 }return eres;\r
145 }, "jalview.datamodel.SequenceI");\r
146 Clazz.defineMethod (c$, "getSequences", \r
147 function () {\r
148 return this.sequences;\r
149 });\r
150 Clazz.defineMethod (c$, "getSequences", \r
151 function (hiddenReps) {\r
152 if (hiddenReps == null) {\r
153 return this.sequences;\r
154 } else {\r
155 var allSequences =  new java.util.ArrayList ();\r
156 for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {\r
157 allSequences.add (seq);\r
158 if (hiddenReps.containsKey (seq)) {\r
159 var hsg = hiddenReps.get (seq);\r
160 for (var seq2, $seq2 = hsg.getSequences ().iterator (); $seq2.hasNext () && ((seq2 = $seq2.next ()) || true);) {\r
161 if (seq2 !== seq && !allSequences.contains (seq2)) {\r
162 allSequences.add (seq2);\r
163 }}\r
164 }}\r
165 return allSequences;\r
166 }}, "java.util.Map");\r
167 Clazz.defineMethod (c$, "getSequencesAsArray", \r
168 function (map) {\r
169 var tmp = this.getSequences (map);\r
170 if (tmp == null) {\r
171 return null;\r
172 }return tmp.toArray ( new Array (tmp.size ()));\r
173 }, "java.util.Map");\r
174 Clazz.defineMethod (c$, "adjustForRemoveLeft", \r
175 function (col) {\r
176 if (this.startRes >= col) {\r
177 this.startRes = this.startRes - col;\r
178 }if (this.endRes >= col) {\r
179 this.endRes = this.endRes - col;\r
180 if (this.startRes > this.endRes) {\r
181 this.startRes = 0;\r
182 }} else {\r
183 return false;\r
184 }return true;\r
185 }, "~N");\r
186 Clazz.defineMethod (c$, "adjustForRemoveRight", \r
187 function (col) {\r
188 if (this.startRes > col) {\r
189 return false;\r
190 }if (this.endRes >= col) {\r
191 this.endRes = col;\r
192 }return true;\r
193 }, "~N");\r
194 Clazz.defineMethod (c$, "getName", \r
195 function () {\r
196 return this.groupName;\r
197 });\r
198 Clazz.defineMethod (c$, "getDescription", \r
199 function () {\r
200 return this.description;\r
201 });\r
202 Clazz.defineMethod (c$, "setName", \r
203 function (name) {\r
204 this.groupName = name;\r
205 }, "~S");\r
206 Clazz.defineMethod (c$, "setDescription", \r
207 function (desc) {\r
208 this.description = desc;\r
209 }, "~S");\r
210 Clazz.defineMethod (c$, "getConservation", \r
211 function () {\r
212 return this.conserve;\r
213 });\r
214 Clazz.defineMethod (c$, "setConservation", \r
215 function (c) {\r
216 this.conserve = c;\r
217 }, "jalview.analysis.Conservation");\r
218 Clazz.defineMethod (c$, "addSequence", \r
219 function (s, recalc) {\r
220 {\r
221 if (s != null && !this.sequences.contains (s)) {\r
222 this.sequences.add (s);\r
223 }if (recalc) {\r
224 this.recalcConservation ();\r
225 }}}, "jalview.datamodel.SequenceI,~B");\r
226 Clazz.defineMethod (c$, "getConsPercGaps", \r
227 function () {\r
228 return this.consPercGaps;\r
229 });\r
230 Clazz.defineMethod (c$, "setConsPercGaps", \r
231 function (consPercGaps) {\r
232 this.consPercGaps = consPercGaps;\r
233 }, "~N");\r
234 Clazz.defineMethod (c$, "recalcConservation", \r
235 function () {\r
236 if (this.cs == null && this.consensus == null && this.conservation == null) {\r
237 return;\r
238 }try {\r
239 var cnsns = jalview.analysis.AAFrequency.calculate (this.sequences, this.startRes, this.endRes + 1, this.showSequenceLogo);\r
240 if (this.consensus != null) {\r
241 this._updateConsensusRow (cnsns, this.sequences.size ());\r
242 }if (this.cs != null) {\r
243 this.cs.setConsensus (cnsns);\r
244 }if ((this.conservation != null) || (this.cs != null && this.cs.conservationApplied ())) {\r
245 var c =  new jalview.analysis.Conservation (this.groupName, jalview.schemes.ResidueProperties.propHash, 3, this.sequences, this.startRes, this.endRes + 1);\r
246 c.calculate ();\r
247 c.verdict (false, this.consPercGaps);\r
248 if (this.conservation != null) {\r
249 this._updateConservationRow (c);\r
250 }if (this.cs != null) {\r
251 if (this.cs.conservationApplied ()) {\r
252 this.cs.setConservation (c);\r
253 }}}if (this.cs != null) {\r
254 this.cs.alignmentChanged (this.context != null ? this.context : this, null);\r
255 }} catch (err) {\r
256 if (Clazz.exceptionOf (err, OutOfMemoryError)) {\r
257 System.out.println ("Out of memory loading groups: " + err);\r
258 } else {\r
259 throw err;\r
260 }\r
261 }\r
262 });\r
263 Clazz.defineMethod (c$, "_updateConservationRow", \r
264  function (c) {\r
265 if (this.conservation == null) {\r
266 this.getConservation ();\r
267 }this.conservation.label = "Conservation for " + this.getName ();\r
268 this.conservation.description = "Conservation for group " + this.getName () + " less than " + this.consPercGaps + "% gaps";\r
269 var aWidth = (this.conservation.annotations != null) ? (this.endRes < this.conservation.annotations.length ? this.conservation.annotations.length : this.endRes + 1) : this.endRes + 1;\r
270 this.conservation.annotations = null;\r
271 this.conservation.annotations =  new Array (aWidth);\r
272 c.completeAnnotations (this.conservation, null, this.startRes, this.endRes + 1);\r
273 }, "jalview.analysis.Conservation");\r
274 Clazz.defineMethod (c$, "_updateConsensusRow", \r
275  function (cnsns, nseq) {\r
276 if (this.consensus == null) {\r
277 this.getConsensus ();\r
278 }this.consensus.label = "Consensus for " + this.getName ();\r
279 this.consensus.description = "Percent Identity";\r
280 this.consensusData = cnsns;\r
281 var aWidth = (this.consensus.annotations != null) ? (this.endRes < this.consensus.annotations.length ? this.consensus.annotations.length : this.endRes + 1) : this.endRes + 1;\r
282 this.consensus.annotations = null;\r
283 this.consensus.annotations =  new Array (aWidth);\r
284 jalview.analysis.AAFrequency.completeConsensus (this.consensus, cnsns, this.startRes, this.endRes + 1, this.ignoreGapsInConsensus, this.showSequenceLogo, nseq);\r
285 }, "~A,~N");\r
286 Clazz.defineMethod (c$, "addOrRemove", \r
287 function (s, recalc) {\r
288 {\r
289 if (this.sequences.contains (s)) {\r
290 this.deleteSequence (s, recalc);\r
291 } else {\r
292 this.addSequence (s, recalc);\r
293 }}}, "jalview.datamodel.SequenceI,~B");\r
294 Clazz.defineMethod (c$, "deleteSequence", \r
295 function (s, recalc) {\r
296 {\r
297 this.sequences.remove (s);\r
298 if (recalc) {\r
299 this.recalcConservation ();\r
300 }}}, "jalview.datamodel.SequenceI,~B");\r
301 Clazz.overrideMethod (c$, "getStartRes", \r
302 function () {\r
303 return this.startRes;\r
304 });\r
305 Clazz.overrideMethod (c$, "getEndRes", \r
306 function () {\r
307 return this.endRes;\r
308 });\r
309 Clazz.defineMethod (c$, "setStartRes", \r
310 function (i) {\r
311 this.startRes = i;\r
312 }, "~N");\r
313 Clazz.defineMethod (c$, "setEndRes", \r
314 function (i) {\r
315 this.endRes = i;\r
316 }, "~N");\r
317 Clazz.defineMethod (c$, "getSize", \r
318 function () {\r
319 return this.sequences.size ();\r
320 });\r
321 Clazz.defineMethod (c$, "getSequenceAt", \r
322 function (i) {\r
323 return this.sequences.get (i);\r
324 }, "~N");\r
325 Clazz.defineMethod (c$, "setColourText", \r
326 function (state) {\r
327 this.colourText = state;\r
328 }, "~B");\r
329 Clazz.defineMethod (c$, "getColourText", \r
330 function () {\r
331 return this.colourText;\r
332 });\r
333 Clazz.defineMethod (c$, "setDisplayText", \r
334 function (state) {\r
335 this.displayText = state;\r
336 }, "~B");\r
337 Clazz.defineMethod (c$, "getDisplayText", \r
338 function () {\r
339 return this.displayText;\r
340 });\r
341 Clazz.defineMethod (c$, "setDisplayBoxes", \r
342 function (state) {\r
343 this.displayBoxes = state;\r
344 }, "~B");\r
345 Clazz.defineMethod (c$, "getDisplayBoxes", \r
346 function () {\r
347 return this.displayBoxes;\r
348 });\r
349 Clazz.overrideMethod (c$, "getWidth", \r
350 function () {\r
351 {\r
352 var first = true;\r
353 for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {\r
354 if (first || seq.getLength () > this.width) {\r
355 this.width = seq.getLength ();\r
356 first = false;\r
357 }}\r
358 return this.width;\r
359 }});\r
360 Clazz.defineMethod (c$, "setOutlineColour", \r
361 function (c) {\r
362 this.outlineColour = c;\r
363 }, "java.awt.Color");\r
364 Clazz.defineMethod (c$, "getOutlineColour", \r
365 function () {\r
366 return this.outlineColour;\r
367 });\r
368 Clazz.defineMethod (c$, "getSequencesInOrder", \r
369 function (al) {\r
370 return this.getSequencesInOrder (al, true);\r
371 }, "jalview.datamodel.AlignmentI");\r
372 Clazz.defineMethod (c$, "getSequencesInOrder", \r
373 function (al, trim) {\r
374 {\r
375 var sSize = this.sequences.size ();\r
376 var alHeight = al.getHeight ();\r
377 var seqs =  new Array ((trim) ? sSize : alHeight);\r
378 var index = 0;\r
379 for (var i = 0; i < alHeight && index < sSize; i++) {\r
380 if (this.sequences.contains (al.getSequenceAt (i))) {\r
381 seqs[(trim) ? index : i] = al.getSequenceAt (i);\r
382 index++;\r
383 }}\r
384 if (index == 0) {\r
385 return null;\r
386 }if (!trim) {\r
387 return seqs;\r
388 }if (index < seqs.length) {\r
389 var dummy = seqs;\r
390 seqs =  new Array (index);\r
391 while (--index >= 0) {\r
392 seqs[index] = dummy[index];\r
393 dummy[index] = null;\r
394 }\r
395 }return seqs;\r
396 }}, "jalview.datamodel.AlignmentI,~B");\r
397 Clazz.defineMethod (c$, "getIdColour", \r
398 function () {\r
399 return this.idColour;\r
400 });\r
401 Clazz.defineMethod (c$, "setIdColour", \r
402 function (idColour) {\r
403 this.idColour = idColour;\r
404 }, "java.awt.Color");\r
405 Clazz.overrideMethod (c$, "getSeqrep", \r
406 function () {\r
407 return this.seqrep;\r
408 });\r
409 Clazz.overrideMethod (c$, "setSeqrep", \r
410 function (seqrep) {\r
411 this.seqrep = seqrep;\r
412 }, "jalview.datamodel.SequenceI");\r
413 Clazz.overrideMethod (c$, "hasSeqrep", \r
414 function () {\r
415 return this.seqrep != null;\r
416 });\r
417 Clazz.defineMethod (c$, "setHidereps", \r
418 function (visibility) {\r
419 this.hidereps = visibility;\r
420 }, "~B");\r
421 Clazz.defineMethod (c$, "isHidereps", \r
422 function () {\r
423 return this.hidereps;\r
424 });\r
425 Clazz.defineMethod (c$, "setHideCols", \r
426 function (visibility) {\r
427 this.hidecols = visibility;\r
428 }, "~B");\r
429 Clazz.defineMethod (c$, "isHideCols", \r
430 function () {\r
431 return this.hidecols;\r
432 });\r
433 Clazz.defineMethod (c$, "intersect", \r
434 function (alignment, map) {\r
435 var sgroup =  new jalview.datamodel.SequenceGroup (this);\r
436 var insect = this.getSequencesInOrder (alignment);\r
437 sgroup.sequences =  new java.util.ArrayList ();\r
438 for (var s = 0; insect != null && s < insect.length; s++) {\r
439 if (map == null || map.containsKey (insect[s])) {\r
440 sgroup.sequences.add (insect[s]);\r
441 }}\r
442 return sgroup;\r
443 }, "jalview.datamodel.AlignmentI,java.util.Map");\r
444 Clazz.defineMethod (c$, "getShowNonconserved", \r
445 function () {\r
446 return this.showNonconserved;\r
447 });\r
448 Clazz.defineMethod (c$, "setShowNonconserved", \r
449 function (displayNonconserved) {\r
450 this.showNonconserved = displayNonconserved;\r
451 }, "~B");\r
452 Clazz.defineMethod (c$, "setConsensus", \r
453 function (aan) {\r
454 if (this.consensus == null) {\r
455 this.consensus = aan;\r
456 }}, "jalview.datamodel.AlignmentAnnotation");\r
457 Clazz.defineMethod (c$, "getConsensus", \r
458 function () {\r
459 var aWidth = this.getWidth ();\r
460 if (aWidth < 0) {\r
461 return null;\r
462 }if (this.consensus == null) {\r
463 this.consensus =  new jalview.datamodel.AlignmentAnnotation ("", "",  new Array (1), 0, 100, 1);\r
464 this.consensus.hasText = true;\r
465 this.consensus.autoCalculated = true;\r
466 this.consensus.groupRef = this;\r
467 this.consensus.label = "Consensus for " + this.getName ();\r
468 this.consensus.description = "Percent Identity";\r
469 }return this.consensus;\r
470 });\r
471 Clazz.defineMethod (c$, "setConservationRow", \r
472 function (aan) {\r
473 if (this.conservation == null) {\r
474 this.conservation = aan;\r
475 }}, "jalview.datamodel.AlignmentAnnotation");\r
476 Clazz.defineMethod (c$, "getConservationRow", \r
477 function () {\r
478 if (this.conservation == null) {\r
479 this.conservation =  new jalview.datamodel.AlignmentAnnotation ("", "",  new Array (1), 0, 11, 1);\r
480 }this.conservation.hasText = true;\r
481 this.conservation.autoCalculated = true;\r
482 this.conservation.groupRef = this;\r
483 this.conservation.label = "Conservation for " + this.getName ();\r
484 this.conservation.description = "Conservation for group " + this.getName () + " less than " + this.consPercGaps + "% gaps";\r
485 return this.conservation;\r
486 });\r
487 Clazz.defineMethod (c$, "hasAnnotationRows", \r
488 function () {\r
489 return this.consensus != null || this.conservation != null;\r
490 });\r
491 Clazz.defineMethod (c$, "getConsensusSeq", \r
492 function () {\r
493 this.getConsensus ();\r
494 var seqs =  new StringBuffer ();\r
495 for (var i = 0; i < this.consensus.annotations.length; i++) {\r
496 if (this.consensus.annotations[i] != null) {\r
497 if (this.consensus.annotations[i].description.charAt (0) == '[') {\r
498 seqs.append (this.consensus.annotations[i].description.charAt (1));\r
499 } else {\r
500 seqs.append (this.consensus.annotations[i].displayCharacter);\r
501 }}}\r
502 var sq =  new jalview.datamodel.Sequence ("Group" + this.getName () + " Consensus", seqs.toString ());\r
503 sq.setDescription ("Percentage Identity Consensus " + ((this.ignoreGapsInConsensus) ? " without gaps" : ""));\r
504 return sq;\r
505 });\r
506 Clazz.defineMethod (c$, "setIgnoreGapsConsensus", \r
507 function (state) {\r
508 if (this.ignoreGapsInConsensus != state && this.consensus != null) {\r
509 this.ignoreGapsInConsensus = state;\r
510 this.recalcConservation ();\r
511 }this.ignoreGapsInConsensus = state;\r
512 }, "~B");\r
513 Clazz.defineMethod (c$, "getIgnoreGapsConsensus", \r
514 function () {\r
515 return this.ignoreGapsInConsensus;\r
516 });\r
517 Clazz.defineMethod (c$, "setshowSequenceLogo", \r
518 function (showSequenceLogo) {\r
519 if (this.showSequenceLogo != showSequenceLogo && this.consensus != null) {\r
520 this.showSequenceLogo = showSequenceLogo;\r
521 this.recalcConservation ();\r
522 }this.showSequenceLogo = showSequenceLogo;\r
523 }, "~B");\r
524 Clazz.defineMethod (c$, "setShowConsensusHistogram", \r
525 function (showConsHist) {\r
526 if (this.showConsensusHistogram != showConsHist && this.consensus != null) {\r
527 this.showConsensusHistogram = showConsHist;\r
528 this.recalcConservation ();\r
529 }this.showConsensusHistogram = showConsHist;\r
530 }, "~B");\r
531 Clazz.defineMethod (c$, "isShowConsensusHistogram", \r
532 function () {\r
533 return this.showConsensusHistogram;\r
534 });\r
535 Clazz.defineMethod (c$, "setNormaliseSequenceLogo", \r
536 function (norm) {\r
537 this.normaliseSequenceLogo = norm;\r
538 }, "~B");\r
539 Clazz.defineMethod (c$, "isNormaliseSequenceLogo", \r
540 function () {\r
541 return this.normaliseSequenceLogo;\r
542 });\r
543 Clazz.overrideMethod (c$, "getAlignmentAnnotation", \r
544 function () {\r
545 var annot =  new java.util.ArrayList ();\r
546 {\r
547 for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) {\r
548 var aa = seq.getAnnotation ();\r
549 if (aa != null) {\r
550 for (var al, $al = 0, $$al = aa; $al < $$al.length && ((al = $$al[$al]) || true); $al++) {\r
551 if (al.groupRef === this) {\r
552 annot.add (al);\r
553 }}\r
554 }}\r
555 if (this.consensus != null) {\r
556 annot.add (this.consensus);\r
557 }if (this.conservation != null) {\r
558 annot.add (this.conservation);\r
559 }}return annot.toArray ( new Array (0));\r
560 });\r
561 Clazz.overrideMethod (c$, "findAnnotation", \r
562 function (calcId) {\r
563 var aa =  new java.util.ArrayList ();\r
564 for (var a, $a = 0, $$a = this.getAlignmentAnnotation (); $a < $$a.length && ((a = $$a[$a]) || true); $a++) {\r
565 if (a.getCalcId () === calcId) {\r
566 aa.add (a);\r
567 }}\r
568 return aa;\r
569 }, "~S");\r
570 Clazz.overrideMethod (c$, "findAnnotations", \r
571 function (seq, calcId, label) {\r
572 var aa =  new java.util.ArrayList ();\r
573 for (var ann, $ann = 0, $$ann = this.getAlignmentAnnotation (); $ann < $$ann.length && ((ann = $$ann[$ann]) || true); $ann++) {\r
574 if (ann.getCalcId () != null && ann.getCalcId ().equals (calcId) && ann.sequenceRef != null && ann.sequenceRef === seq && ann.label != null && ann.label.equals (label)) {\r
575 aa.add (ann);\r
576 }}\r
577 return aa;\r
578 }, "jalview.datamodel.SequenceI,~S,~S");\r
579 Clazz.defineMethod (c$, "hasAnnotation", \r
580 function (calcId) {\r
581 if (calcId != null && !"".equals (calcId)) {\r
582 for (var a, $a = 0, $$a = this.getAlignmentAnnotation (); $a < $$a.length && ((a = $$a[$a]) || true); $a++) {\r
583 if (a.getCalcId () === calcId) {\r
584 return true;\r
585 }}\r
586 }return false;\r
587 }, "~S");\r
588 Clazz.defineMethod (c$, "clear", \r
589 function () {\r
590 {\r
591 this.sequences.clear ();\r
592 }});\r
593 Clazz.defineMethod (c$, "setContext", \r
594 function (context) {\r
595 this.context = context;\r
596 }, "jalview.datamodel.AnnotatedCollectionI");\r
597 Clazz.overrideMethod (c$, "getContext", \r
598 function () {\r
599 return this.context;\r
600 });\r
601 });\r