JAL-1807 Bob's JalviewJS prototype first commit
[jalviewjs.git] / bin / jalview / analysis / NJTree.js
1 Clazz.declarePackage ("jalview.analysis");\r
2 Clazz.load (["java.util.Vector"], ["jalview.analysis.Cluster", "$.NJTree"], ["jalview.analysis.SequenceIdMatcher", "jalview.datamodel.AlignmentView", "$.CigarArray", "$.NodeTransformI", "$.SeqCigar", "$.Sequence", "$.SequenceI", "$.SequenceNode", "jalview.io.NewickFile", "jalview.schemes.ResidueProperties", "jalview.util.Format", "java.lang.StringBuffer"], function () {\r
3 c$ = Clazz.decorateAsClass (function () {\r
4 this.$cluster = null;\r
5 this.sequence = null;\r
6 this.seqData = null;\r
7 this.done = null;\r
8 this.noseqs = 0;\r
9 this.noClus = 0;\r
10 this.distance = null;\r
11 this.mini = 0;\r
12 this.minj = 0;\r
13 this.ri = 0;\r
14 this.rj = 0;\r
15 this.groups = null;\r
16 this.maxdist = null;\r
17 this.top = null;\r
18 this.maxDistValue = 0;\r
19 this.maxheight = 0;\r
20 this.ycount = 0;\r
21 this.node = null;\r
22 this.type = null;\r
23 this.pwtype = null;\r
24 this.found = null;\r
25 this.leaves = null;\r
26 this.hasDistances = true;\r
27 this.hasBootstrap = false;\r
28 this.hasRootDistance = true;\r
29 this._lycount = 0;\r
30 this._lylimit = 0;\r
31 Clazz.instantialize (this, arguments);\r
32 }, jalview.analysis, "NJTree");\r
33 Clazz.prepareFields (c$, function () {\r
34 this.groups =  new java.util.Vector ();\r
35 });\r
36 Clazz.makeConstructor (c$, \r
37 function (seqs, odata, treefile) {\r
38 this.construct (seqs, treefile);\r
39 if (odata != null) {\r
40 this.seqData = odata;\r
41 }}, "~A,jalview.datamodel.AlignmentView,jalview.io.NewickFile");\r
42 Clazz.makeConstructor (c$, \r
43 function (seqs, treefile) {\r
44 this.sequence = seqs;\r
45 this.top = treefile.getTree ();\r
46 this.hasDistances = treefile.HasDistances ();\r
47 this.hasBootstrap = treefile.HasBootstrap ();\r
48 this.hasRootDistance = treefile.HasRootDistance ();\r
49 this.maxheight = this.findHeight (this.top);\r
50 var algnIds =  new jalview.analysis.SequenceIdMatcher (seqs);\r
51 var leaves =  new java.util.Vector ();\r
52 this.findLeaves (this.top, leaves);\r
53 var i = 0;\r
54 var namesleft = seqs.length;\r
55 var j;\r
56 var nam;\r
57 var realnam;\r
58 var one2many =  new java.util.Vector ();\r
59 var countOne2Many = 0;\r
60 while (i < leaves.size ()) {\r
61 j = leaves.elementAt (i++);\r
62 realnam = j.getName ();\r
63 nam = null;\r
64 if (namesleft > -1) {\r
65 nam = algnIds.findIdMatch (realnam);\r
66 }if (nam != null) {\r
67 j.setElement (nam);\r
68 if (one2many.contains (nam)) {\r
69 countOne2Many++;\r
70 } else {\r
71 one2many.addElement (nam);\r
72 namesleft--;\r
73 }} else {\r
74 j.setElement ( new jalview.datamodel.Sequence (realnam, "THISISAPLACEHLDER"));\r
75 j.setPlaceholder (true);\r
76 }}\r
77 }, "~A,jalview.io.NewickFile");\r
78 Clazz.makeConstructor (c$, \r
79 function (sequence, seqData, type, pwtype, sm, start, end) {\r
80 this.sequence = sequence;\r
81 this.node =  new java.util.Vector ();\r
82 this.type = type;\r
83 this.pwtype = pwtype;\r
84 if (seqData != null) {\r
85 this.seqData = seqData;\r
86 } else {\r
87 var seqs =  new Array (sequence.length);\r
88 for (var i = 0; i < sequence.length; i++) {\r
89 seqs[i] =  new jalview.datamodel.SeqCigar (sequence[i], start, end);\r
90 }\r
91 var sdata =  new jalview.datamodel.CigarArray (seqs);\r
92 sdata.addOperation ('M', end - start + 1);\r
93 this.seqData =  new jalview.datamodel.AlignmentView (sdata, start);\r
94 }if (!(type.equals ("NJ"))) {\r
95 type = "AV";\r
96 }if (sm == null && !(pwtype.equals ("PID"))) {\r
97 if (jalview.schemes.ResidueProperties.getScoreMatrix (pwtype) == null) {\r
98 pwtype = "BLOSUM62";\r
99 }}var i = 0;\r
100 this.done =  Clazz.newIntArray (sequence.length, 0);\r
101 while ((i < sequence.length) && (sequence[i] != null)) {\r
102 this.done[i] = 0;\r
103 i++;\r
104 }\r
105 this.noseqs = i++;\r
106 this.distance = this.findDistances (sm);\r
107 this.makeLeaves ();\r
108 this.noClus = this.$cluster.size ();\r
109 this.cluster ();\r
110 }, "~A,jalview.datamodel.AlignmentView,~S,~S,jalview.api.analysis.ScoreModelI,~N,~N");\r
111 Clazz.overrideMethod (c$, "toString", \r
112 function () {\r
113 var fout =  new jalview.io.NewickFile (this.getTopNode ());\r
114 return fout.print (this.isHasBootstrap (), this.isHasDistances (), this.isHasRootDistance ());\r
115 });\r
116 Clazz.defineMethod (c$, "UpdatePlaceHolders", \r
117 function (list) {\r
118 var leaves =  new java.util.Vector ();\r
119 this.findLeaves (this.top, leaves);\r
120 var sz = leaves.size ();\r
121 var seqmatcher = null;\r
122 var i = 0;\r
123 while (i < sz) {\r
124 var leaf = leaves.elementAt (i++);\r
125 if (list.contains (leaf.element ())) {\r
126 leaf.setPlaceholder (false);\r
127 } else {\r
128 if (seqmatcher == null) {\r
129 var seqs =  new Array (list.size ());\r
130 for (var j = 0; j < seqs.length; j++) {\r
131 seqs[j] = list.get (j);\r
132 }\r
133 seqmatcher =  new jalview.analysis.SequenceIdMatcher (seqs);\r
134 }var nam = seqmatcher.findIdMatch (leaf.getName ());\r
135 if (nam != null) {\r
136 if (!leaf.isPlaceholder ()) {\r
137 }leaf.setPlaceholder (false);\r
138 leaf.setElement (nam);\r
139 } else {\r
140 if (!leaf.isPlaceholder ()) {\r
141 leaf.setElement ( new jalview.datamodel.Sequence (leaf.getName (), "THISISAPLACEHLDER"));\r
142 }leaf.setPlaceholder (true);\r
143 }}}\r
144 }, "java.util.List");\r
145 Clazz.defineMethod (c$, "renameAssociatedNodes", \r
146 function () {\r
147 this.applyToNodes (((Clazz.isClassDefined ("jalview.analysis.NJTree$1") ? 0 : jalview.analysis.NJTree.$NJTree$1$ ()), Clazz.innerTypeInstance (jalview.analysis.NJTree$1, this, null)));\r
148 });\r
149 Clazz.defineMethod (c$, "cluster", \r
150 function () {\r
151 while (this.noClus > 2) {\r
152 if (this.type.equals ("NJ")) {\r
153 this.findMinNJDistance ();\r
154 } else {\r
155 this.findMinDistance ();\r
156 }var c = this.joinClusters (this.mini, this.minj);\r
157 this.done[this.minj] = 1;\r
158 this.$cluster.setElementAt (null, this.minj);\r
159 this.$cluster.setElementAt (c, this.mini);\r
160 this.noClus--;\r
161 }\r
162 var onefound = false;\r
163 var one = -1;\r
164 var two = -1;\r
165 for (var i = 0; i < this.noseqs; i++) {\r
166 if (this.done[i] != 1) {\r
167 if (onefound == false) {\r
168 two = i;\r
169 onefound = true;\r
170 } else {\r
171 one = i;\r
172 }}}\r
173 this.joinClusters (one, two);\r
174 this.top = (this.node.elementAt (one));\r
175 this.reCount (this.top);\r
176 this.findHeight (this.top);\r
177 this.findMaxDist (this.top);\r
178 });\r
179 Clazz.defineMethod (c$, "joinClusters", \r
180 function (i, j) {\r
181 var dist = this.distance[i][j];\r
182 var noi = (this.$cluster.elementAt (i)).value.length;\r
183 var noj = (this.$cluster.elementAt (j)).value.length;\r
184 var value =  Clazz.newIntArray (noi + noj, 0);\r
185 for (var ii = 0; ii < noi; ii++) {\r
186 value[ii] = (this.$cluster.elementAt (i)).value[ii];\r
187 }\r
188 for (var ii = noi; ii < (noi + noj); ii++) {\r
189 value[ii] = (this.$cluster.elementAt (j)).value[ii - noi];\r
190 }\r
191 var c =  new jalview.analysis.Cluster (value);\r
192 this.ri = this.findr (i, j);\r
193 this.rj = this.findr (j, i);\r
194 if (this.type.equals ("NJ")) {\r
195 this.findClusterNJDistance (i, j);\r
196 } else {\r
197 this.findClusterDistance (i, j);\r
198 }var sn =  new jalview.datamodel.SequenceNode ();\r
199 sn.setLeft ((this.node.elementAt (i)));\r
200 sn.setRight ((this.node.elementAt (j)));\r
201 var tmpi = (this.node.elementAt (i));\r
202 var tmpj = (this.node.elementAt (j));\r
203 if (this.type.equals ("NJ")) {\r
204 this.findNewNJDistances (tmpi, tmpj, dist);\r
205 } else {\r
206 this.findNewDistances (tmpi, tmpj, dist);\r
207 }tmpi.setParent (sn);\r
208 tmpj.setParent (sn);\r
209 this.node.setElementAt (sn, i);\r
210 return c;\r
211 }, "~N,~N");\r
212 Clazz.defineMethod (c$, "findNewNJDistances", \r
213 function (tmpi, tmpj, dist) {\r
214 tmpi.dist = ((dist + this.ri) - this.rj) / 2;\r
215 tmpj.dist = (dist - tmpi.dist);\r
216 if (tmpi.dist < 0) {\r
217 tmpi.dist = 0;\r
218 }if (tmpj.dist < 0) {\r
219 tmpj.dist = 0;\r
220 }}, "jalview.datamodel.SequenceNode,jalview.datamodel.SequenceNode,~N");\r
221 Clazz.defineMethod (c$, "findNewDistances", \r
222 function (tmpi, tmpj, dist) {\r
223 var ih = 0;\r
224 var jh = 0;\r
225 var sni = tmpi;\r
226 var snj = tmpj;\r
227 while (sni != null) {\r
228 ih = ih + sni.dist;\r
229 sni = sni.left ();\r
230 }\r
231 while (snj != null) {\r
232 jh = jh + snj.dist;\r
233 snj = snj.left ();\r
234 }\r
235 tmpi.dist = ((dist / 2) - ih);\r
236 tmpj.dist = ((dist / 2) - jh);\r
237 }, "jalview.datamodel.SequenceNode,jalview.datamodel.SequenceNode,~N");\r
238 Clazz.defineMethod (c$, "findClusterDistance", \r
239 function (i, j) {\r
240 var noi = (this.$cluster.elementAt (i)).value.length;\r
241 var noj = (this.$cluster.elementAt (j)).value.length;\r
242 var newdist =  Clazz.newFloatArray (this.noseqs, 0);\r
243 for (var l = 0; l < this.noseqs; l++) {\r
244 if ((l != i) && (l != j)) {\r
245 newdist[l] = ((this.distance[i][l] * noi) + (this.distance[j][l] * noj)) / (noi + noj);\r
246 } else {\r
247 newdist[l] = 0;\r
248 }}\r
249 for (var ii = 0; ii < this.noseqs; ii++) {\r
250 this.distance[i][ii] = newdist[ii];\r
251 this.distance[ii][i] = newdist[ii];\r
252 }\r
253 }, "~N,~N");\r
254 Clazz.defineMethod (c$, "findClusterNJDistance", \r
255 function (i, j) {\r
256 var newdist =  Clazz.newFloatArray (this.noseqs, 0);\r
257 for (var l = 0; l < this.noseqs; l++) {\r
258 if ((l != i) && (l != j)) {\r
259 newdist[l] = ((this.distance[i][l] + this.distance[j][l]) - this.distance[i][j]) / 2;\r
260 } else {\r
261 newdist[l] = 0;\r
262 }}\r
263 for (var ii = 0; ii < this.noseqs; ii++) {\r
264 this.distance[i][ii] = newdist[ii];\r
265 this.distance[ii][i] = newdist[ii];\r
266 }\r
267 }, "~N,~N");\r
268 Clazz.defineMethod (c$, "findr", \r
269 function (i, j) {\r
270 var tmp = 1;\r
271 for (var k = 0; k < this.noseqs; k++) {\r
272 if ((k != i) && (k != j) && (this.done[k] != 1)) {\r
273 tmp = tmp + this.distance[i][k];\r
274 }}\r
275 if (this.noClus > 2) {\r
276 tmp = tmp / (this.noClus - 2);\r
277 }return tmp;\r
278 }, "~N,~N");\r
279 Clazz.defineMethod (c$, "findMinNJDistance", \r
280 function () {\r
281 var min = 100000;\r
282 for (var i = 0; i < (this.noseqs - 1); i++) {\r
283 for (var j = i + 1; j < this.noseqs; j++) {\r
284 if ((this.done[i] != 1) && (this.done[j] != 1)) {\r
285 var tmp = this.distance[i][j] - (this.findr (i, j) + this.findr (j, i));\r
286 if (tmp < min) {\r
287 this.mini = i;\r
288 this.minj = j;\r
289 min = tmp;\r
290 }}}\r
291 }\r
292 return min;\r
293 });\r
294 Clazz.defineMethod (c$, "findMinDistance", \r
295 function () {\r
296 var min = 100000;\r
297 for (var i = 0; i < (this.noseqs - 1); i++) {\r
298 for (var j = i + 1; j < this.noseqs; j++) {\r
299 if ((this.done[i] != 1) && (this.done[j] != 1)) {\r
300 if (this.distance[i][j] < min) {\r
301 this.mini = i;\r
302 this.minj = j;\r
303 min = this.distance[i][j];\r
304 }}}\r
305 }\r
306 return min;\r
307 });\r
308 Clazz.defineMethod (c$, "findDistances", \r
309 function (_pwmatrix) {\r
310 var distance =  Clazz.newFloatArray (this.noseqs, this.noseqs, 0);\r
311 if (_pwmatrix == null) {\r
312 _pwmatrix = jalview.schemes.ResidueProperties.getScoreModel (this.pwtype);\r
313 if (_pwmatrix == null) {\r
314 _pwmatrix = jalview.schemes.ResidueProperties.getScoreMatrix ("BLOSUM62");\r
315 }}distance = _pwmatrix.findDistances (this.seqData);\r
316 return distance;\r
317 }, "jalview.api.analysis.ScoreModelI");\r
318 Clazz.defineMethod (c$, "makeLeaves", \r
319 function () {\r
320 this.$cluster =  new java.util.Vector ();\r
321 for (var i = 0; i < this.noseqs; i++) {\r
322 var sn =  new jalview.datamodel.SequenceNode ();\r
323 sn.setElement (this.sequence[i]);\r
324 sn.setName (this.sequence[i].getName ());\r
325 this.node.addElement (sn);\r
326 var value =  Clazz.newIntArray (1, 0);\r
327 value[0] = i;\r
328 var c =  new jalview.analysis.Cluster (value);\r
329 this.$cluster.addElement (c);\r
330 }\r
331 });\r
332 Clazz.defineMethod (c$, "findLeaves", \r
333 function (node, leaves) {\r
334 if (node == null) {\r
335 return leaves;\r
336 }if ((node.left () == null) && (node.right () == null)) {\r
337 leaves.addElement (node);\r
338 return leaves;\r
339 } else {\r
340 this.findLeaves (node.left (), leaves);\r
341 this.findLeaves (node.right (), leaves);\r
342 }return leaves;\r
343 }, "jalview.datamodel.SequenceNode,java.util.Vector");\r
344 Clazz.defineMethod (c$, "findLeaf", \r
345 function (node, count) {\r
346 this.found = this._findLeaf (node, count);\r
347 return this.found;\r
348 }, "jalview.datamodel.SequenceNode,~N");\r
349 Clazz.defineMethod (c$, "_findLeaf", \r
350 function (node, count) {\r
351 if (node == null) {\r
352 return null;\r
353 }if (node.ycount == count) {\r
354 this.found = node.element ();\r
355 return this.found;\r
356 } else {\r
357 this._findLeaf (node.left (), count);\r
358 this._findLeaf (node.right (), count);\r
359 }return this.found;\r
360 }, "jalview.datamodel.SequenceNode,~N");\r
361 Clazz.defineMethod (c$, "printNode", \r
362 function (node) {\r
363 if (node == null) {\r
364 return;\r
365 }if ((node.left () == null) && (node.right () == null)) {\r
366 System.out.println ("Leaf = " + (node.element ()).getName ());\r
367 System.out.println ("Dist " + node.dist);\r
368 System.out.println ("Boot " + node.getBootstrap ());\r
369 } else {\r
370 System.out.println ("Dist " + node.dist);\r
371 this.printNode (node.left ());\r
372 this.printNode (node.right ());\r
373 }}, "jalview.datamodel.SequenceNode");\r
374 Clazz.defineMethod (c$, "findMaxDist", \r
375 function (node) {\r
376 if (node == null) {\r
377 return;\r
378 }if ((node.left () == null) && (node.right () == null)) {\r
379 var dist = node.dist;\r
380 if (dist > this.maxDistValue) {\r
381 this.maxdist = node;\r
382 this.maxDistValue = dist;\r
383 }} else {\r
384 this.findMaxDist (node.left ());\r
385 this.findMaxDist (node.right ());\r
386 }}, "jalview.datamodel.SequenceNode");\r
387 Clazz.defineMethod (c$, "getGroups", \r
388 function () {\r
389 return this.groups;\r
390 });\r
391 Clazz.defineMethod (c$, "getMaxHeight", \r
392 function () {\r
393 return this.maxheight;\r
394 });\r
395 Clazz.defineMethod (c$, "groupNodes", \r
396 function (node, threshold) {\r
397 if (node == null) {\r
398 return;\r
399 }if ((node.height / this.maxheight) > threshold) {\r
400 this.groups.addElement (node);\r
401 } else {\r
402 this.groupNodes (node.left (), threshold);\r
403 this.groupNodes (node.right (), threshold);\r
404 }}, "jalview.datamodel.SequenceNode,~N");\r
405 Clazz.defineMethod (c$, "findHeight", \r
406 function (node) {\r
407 if (node == null) {\r
408 return this.maxheight;\r
409 }if ((node.left () == null) && (node.right () == null)) {\r
410 node.height = (node.parent ()).height + node.dist;\r
411 if (node.height > this.maxheight) {\r
412 return node.height;\r
413 } else {\r
414 return this.maxheight;\r
415 }} else {\r
416 if (node.parent () != null) {\r
417 node.height = (node.parent ()).height + node.dist;\r
418 } else {\r
419 this.maxheight = 0;\r
420 node.height = 0.0;\r
421 }this.maxheight = this.findHeight ((node.left ()));\r
422 this.maxheight = this.findHeight ((node.right ()));\r
423 }return this.maxheight;\r
424 }, "jalview.datamodel.SequenceNode");\r
425 Clazz.defineMethod (c$, "reRoot", \r
426 function () {\r
427 if (this.maxdist != null) {\r
428 this.ycount = 0;\r
429 var tmpdist = this.maxdist.dist;\r
430 var sn =  new jalview.datamodel.SequenceNode ();\r
431 sn.setParent (null);\r
432 var snr = this.maxdist.parent ();\r
433 this.changeDirection (snr, this.maxdist);\r
434 System.out.println ("Printing reversed tree");\r
435 this.printN (snr);\r
436 snr.dist = tmpdist / 2;\r
437 this.maxdist.dist = tmpdist / 2;\r
438 snr.setParent (sn);\r
439 this.maxdist.setParent (sn);\r
440 sn.setRight (snr);\r
441 sn.setLeft (this.maxdist);\r
442 this.top = sn;\r
443 this.ycount = 0;\r
444 this.reCount (this.top);\r
445 this.findHeight (this.top);\r
446 }return this.top;\r
447 });\r
448 Clazz.defineMethod (c$, "hasOriginalSequenceData", \r
449 function () {\r
450 return this.seqData != null;\r
451 });\r
452 Clazz.defineMethod (c$, "printOriginalSequenceData", \r
453 function (gapChar) {\r
454 if (this.seqData == null) {\r
455 return null;\r
456 }var sb =  new StringBuffer ();\r
457 var seqdatas = this.seqData.getSequenceStrings (gapChar);\r
458 for (var i = 0; i < seqdatas.length; i++) {\r
459 sb.append ( new jalview.util.Format ("%-15s").form (this.sequence[i].getName ()));\r
460 sb.append (" " + seqdatas[i] + "\n");\r
461 }\r
462 return sb.toString ();\r
463 }, "~S");\r
464 Clazz.defineMethod (c$, "printN", \r
465 function (node) {\r
466 if (node == null) {\r
467 return;\r
468 }if ((node.left () != null) && (node.right () != null)) {\r
469 this.printN (node.left ());\r
470 this.printN (node.right ());\r
471 } else {\r
472 System.out.println (" name = " + (node.element ()).getName ());\r
473 }System.out.println (" dist = " + node.dist + " " + node.count + " " + node.height);\r
474 }, "jalview.datamodel.SequenceNode");\r
475 Clazz.defineMethod (c$, "reCount", \r
476 function (node) {\r
477 this.ycount = 0;\r
478 this._lycount = 0;\r
479 this._reCount (node);\r
480 }, "jalview.datamodel.SequenceNode");\r
481 Clazz.defineMethod (c$, "_reCount", \r
482 function (node) {\r
483 if (node == null) {\r
484 return;\r
485 }this._lycount++;\r
486 if ((node.left () != null) && (node.right () != null)) {\r
487 this._reCount (node.left ());\r
488 this._reCount (node.right ());\r
489 var l = node.left ();\r
490 var r = node.right ();\r
491 node.count = l.count + r.count;\r
492 node.ycount = (l.ycount + r.ycount) / 2;\r
493 } else {\r
494 node.count = 1;\r
495 node.ycount = this.ycount++;\r
496 }this._lycount--;\r
497 }, "jalview.datamodel.SequenceNode");\r
498 Clazz.defineMethod (c$, "swapNodes", \r
499 function (node) {\r
500 if (node == null) {\r
501 return;\r
502 }var tmp = node.left ();\r
503 node.setLeft (node.right ());\r
504 node.setRight (tmp);\r
505 }, "jalview.datamodel.SequenceNode");\r
506 Clazz.defineMethod (c$, "changeDirection", \r
507 function (node, dir) {\r
508 if (node == null) {\r
509 return;\r
510 }if (node.parent () !== this.top) {\r
511 this.changeDirection (node.parent (), node);\r
512 var tmp = node.parent ();\r
513 if (dir === node.left ()) {\r
514 node.setParent (dir);\r
515 node.setLeft (tmp);\r
516 } else if (dir === node.right ()) {\r
517 node.setParent (dir);\r
518 node.setRight (tmp);\r
519 }} else {\r
520 if (dir === node.left ()) {\r
521 node.setParent (node.left ());\r
522 if (this.top.left () === node) {\r
523 node.setRight (this.top.right ());\r
524 } else {\r
525 node.setRight (this.top.left ());\r
526 }} else {\r
527 node.setParent (node.right ());\r
528 if (this.top.left () === node) {\r
529 node.setLeft (this.top.right ());\r
530 } else {\r
531 node.setLeft (this.top.left ());\r
532 }}}}, "jalview.datamodel.SequenceNode,jalview.datamodel.SequenceNode");\r
533 Clazz.defineMethod (c$, "getMaxDist", \r
534 function () {\r
535 return this.maxdist;\r
536 });\r
537 Clazz.defineMethod (c$, "getTopNode", \r
538 function () {\r
539 return this.top;\r
540 });\r
541 Clazz.defineMethod (c$, "isHasDistances", \r
542 function () {\r
543 return this.hasDistances;\r
544 });\r
545 Clazz.defineMethod (c$, "isHasBootstrap", \r
546 function () {\r
547 return this.hasBootstrap;\r
548 });\r
549 Clazz.defineMethod (c$, "isHasRootDistance", \r
550 function () {\r
551 return this.hasRootDistance;\r
552 });\r
553 Clazz.defineMethod (c$, "applyToNodes", \r
554 function (nodeTransformI) {\r
555 for (var nodes = this.node.elements (); nodes.hasMoreElements (); nodeTransformI.transform (nodes.nextElement ())) {\r
556 ;}\r
557 }, "jalview.datamodel.NodeTransformI");\r
558 c$.$NJTree$1$ = function () {\r
559 Clazz.pu$h ();\r
560 c$ = Clazz.declareAnonymous (jalview.analysis, "NJTree$1", null, jalview.datamodel.NodeTransformI);\r
561 Clazz.defineMethod (c$, "transform", \r
562 function (node) {\r
563 var el = node.element ();\r
564 if (el != null && Clazz.instanceOf (el, jalview.datamodel.SequenceI)) {\r
565 node.setName ((el).getName ());\r
566 }}, "jalview.datamodel.BinaryNode");\r
567 c$ = Clazz.p0p ();\r
568 };\r
569 c$ = Clazz.decorateAsClass (function () {\r
570 this.value = null;\r
571 Clazz.instantialize (this, arguments);\r
572 }, jalview.analysis, "Cluster");\r
573 Clazz.makeConstructor (c$, \r
574 function (value) {\r
575 this.value = value;\r
576 }, "~A");\r
577 });\r