react-msaview 5.0.6 → 5.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/bundle/index.js +106 -106
  2. package/bundle/index.js.LICENSE.txt +1 -1
  3. package/bundle/index.js.map +1 -1
  4. package/dist/components/Checkbox2.js +3 -6
  5. package/dist/components/Checkbox2.js.map +1 -1
  6. package/dist/components/MSAViewer.d.ts +14 -0
  7. package/dist/components/MSAViewer.js +34 -0
  8. package/dist/components/MSAViewer.js.map +1 -0
  9. package/dist/components/Track.d.ts +0 -4
  10. package/dist/components/Track.js +6 -26
  11. package/dist/components/Track.js.map +1 -1
  12. package/dist/components/dialogs/DomainDialog.js +2 -5
  13. package/dist/components/dialogs/DomainDialog.js.map +1 -1
  14. package/dist/components/dialogs/InterProScanDialog.js +7 -7
  15. package/dist/components/dialogs/InterProScanDialog.js.map +1 -1
  16. package/dist/components/dialogs/SettingsDialog.js +3 -19
  17. package/dist/components/dialogs/SettingsDialog.js.map +1 -1
  18. package/dist/components/header/ColorSchemeMenu.d.ts +6 -0
  19. package/dist/components/header/ColorSchemeMenu.js +19 -0
  20. package/dist/components/header/ColorSchemeMenu.js.map +1 -0
  21. package/dist/components/header/{ZoomStar.d.ts → FileMenu.d.ts} +2 -2
  22. package/dist/components/header/FileMenu.js +71 -0
  23. package/dist/components/header/FileMenu.js.map +1 -0
  24. package/dist/components/header/Header.js +8 -6
  25. package/dist/components/header/Header.js.map +1 -1
  26. package/dist/components/header/HeaderMenu.js +3 -145
  27. package/dist/components/header/HeaderMenu.js.map +1 -1
  28. package/dist/components/header/MSASettingsMenu.d.ts +6 -0
  29. package/dist/components/header/MSASettingsMenu.js +36 -0
  30. package/dist/components/header/MSASettingsMenu.js.map +1 -0
  31. package/dist/components/header/SettingsMenu.js +1 -21
  32. package/dist/components/header/SettingsMenu.js.map +1 -1
  33. package/dist/components/header/TreeSettingsMenu.d.ts +6 -0
  34. package/dist/components/header/TreeSettingsMenu.js +74 -0
  35. package/dist/components/header/TreeSettingsMenu.js.map +1 -0
  36. package/dist/components/header/ZoomMenu.js +0 -8
  37. package/dist/components/header/ZoomMenu.js.map +1 -1
  38. package/dist/components/header/getDomainsMenu.d.ts +31 -0
  39. package/dist/components/header/getDomainsMenu.js +75 -0
  40. package/dist/components/header/getDomainsMenu.js.map +1 -0
  41. package/dist/components/import/ImportFormExamples.js +21 -19
  42. package/dist/components/import/ImportFormExamples.js.map +1 -1
  43. package/dist/components/msa/MSACanvas.js +13 -89
  44. package/dist/components/msa/MSACanvas.js.map +1 -1
  45. package/dist/components/msa/MSACanvasBlock.js +1 -3
  46. package/dist/components/msa/MSACanvasBlock.js.map +1 -1
  47. package/dist/components/msa/renderMSABlock.js +2 -4
  48. package/dist/components/msa/renderMSABlock.js.map +1 -1
  49. package/dist/components/msa/renderMSAMouseover.js +1 -7
  50. package/dist/components/msa/renderMSAMouseover.js.map +1 -1
  51. package/dist/components/tree/TreeCanvas.js +18 -101
  52. package/dist/components/tree/TreeCanvas.js.map +1 -1
  53. package/dist/components/tree/TreeCanvasBlock.js +33 -1
  54. package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
  55. package/dist/components/tree/TreeNodeMenu.js +5 -16
  56. package/dist/components/tree/TreeNodeMenu.js.map +1 -1
  57. package/dist/components/tree/renderTreeCanvas.js +4 -12
  58. package/dist/components/tree/renderTreeCanvas.js.map +1 -1
  59. package/dist/constants.d.ts +0 -2
  60. package/dist/constants.js +0 -2
  61. package/dist/constants.js.map +1 -1
  62. package/dist/fetchUtils.d.ts +0 -1
  63. package/dist/fetchUtils.js +0 -4
  64. package/dist/fetchUtils.js.map +1 -1
  65. package/dist/flatToTree.d.ts +0 -5
  66. package/dist/flatToTree.js +13 -30
  67. package/dist/flatToTree.js.map +1 -1
  68. package/dist/hierarchy.d.ts +28 -0
  69. package/dist/hierarchy.js +164 -0
  70. package/dist/hierarchy.js.map +1 -0
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.js +1 -0
  73. package/dist/index.js.map +1 -1
  74. package/dist/launchInterProScan.d.ts +0 -5
  75. package/dist/launchInterProScan.js +5 -3
  76. package/dist/launchInterProScan.js.map +1 -1
  77. package/dist/model/DataModel.d.ts +9 -0
  78. package/dist/model/DataModel.js +12 -1
  79. package/dist/model/DataModel.js.map +1 -1
  80. package/dist/model/msaModel.d.ts +3 -0
  81. package/dist/model/msaModel.js +0 -1
  82. package/dist/model/msaModel.js.map +1 -1
  83. package/dist/model/treeModel.d.ts +3 -6
  84. package/dist/model/treeModel.js +3 -15
  85. package/dist/model/treeModel.js.map +1 -1
  86. package/dist/model.d.ts +34 -77
  87. package/dist/model.js +140 -239
  88. package/dist/model.js.map +1 -1
  89. package/dist/neighborJoining.js +40 -633
  90. package/dist/neighborJoining.js.map +1 -1
  91. package/dist/parseAsn1.d.ts +0 -12
  92. package/dist/parseAsn1.js +125 -332
  93. package/dist/parseAsn1.js.map +1 -1
  94. package/dist/useWheelScroll.d.ts +8 -0
  95. package/dist/useWheelScroll.js +93 -0
  96. package/dist/useWheelScroll.js.map +1 -0
  97. package/dist/util.d.ts +1 -6
  98. package/dist/util.js +5 -34
  99. package/dist/util.js.map +1 -1
  100. package/dist/vendor/copyToClipboard.d.ts +1 -10
  101. package/dist/vendor/copyToClipboard.js +14 -109
  102. package/dist/vendor/copyToClipboard.js.map +1 -1
  103. package/dist/vendor/fileSaver.d.ts +1 -11
  104. package/dist/vendor/fileSaver.js +7 -76
  105. package/dist/vendor/fileSaver.js.map +1 -1
  106. package/dist/version.d.ts +1 -1
  107. package/dist/version.js +1 -1
  108. package/dist/version.js.map +1 -1
  109. package/package.json +14 -14
  110. package/src/collapseLogic.test.ts +115 -0
  111. package/src/components/Checkbox2.tsx +9 -18
  112. package/src/components/MSAViewer.tsx +67 -0
  113. package/src/components/Track.tsx +11 -30
  114. package/src/components/dialogs/DomainDialog.tsx +4 -5
  115. package/src/components/dialogs/InterProScanDialog.tsx +7 -7
  116. package/src/components/dialogs/SettingsDialog.tsx +0 -37
  117. package/src/components/header/ColorSchemeMenu.tsx +35 -0
  118. package/src/components/header/FileMenu.tsx +84 -0
  119. package/src/components/header/Header.tsx +8 -6
  120. package/src/components/header/HeaderMenu.tsx +4 -155
  121. package/src/components/header/MSASettingsMenu.tsx +48 -0
  122. package/src/components/header/SettingsMenu.tsx +0 -23
  123. package/src/components/header/TreeSettingsMenu.tsx +96 -0
  124. package/src/components/header/ZoomMenu.tsx +0 -8
  125. package/src/components/header/getDomainsMenu.ts +83 -0
  126. package/src/components/import/ImportFormExamples.tsx +37 -34
  127. package/src/components/msa/MSACanvas.tsx +21 -97
  128. package/src/components/msa/MSACanvasBlock.tsx +1 -3
  129. package/src/components/msa/renderBoxFeatureCanvasBlock.ts +1 -1
  130. package/src/components/msa/renderMSABlock.ts +2 -5
  131. package/src/components/msa/renderMSAMouseover.ts +0 -6
  132. package/src/components/tree/TreeCanvas.tsx +48 -111
  133. package/src/components/tree/TreeCanvasBlock.tsx +44 -0
  134. package/src/components/tree/TreeNodeMenu.tsx +5 -14
  135. package/src/components/tree/renderTreeCanvas.ts +8 -21
  136. package/src/constants.ts +0 -2
  137. package/src/fetchUtils.ts +0 -5
  138. package/src/flatToTree.ts +20 -38
  139. package/src/hierarchy.test.ts +120 -0
  140. package/src/hierarchy.ts +220 -0
  141. package/src/index.ts +2 -0
  142. package/src/launchInterProScan.ts +4 -3
  143. package/src/model/DataModel.ts +12 -1
  144. package/src/model/msaModel.ts +0 -2
  145. package/src/model/treeModel.ts +2 -18
  146. package/src/model.ts +203 -278
  147. package/src/neighborJoining.test.ts +15 -7
  148. package/src/neighborJoining.ts +40 -632
  149. package/src/parseAsn1.test.ts +5 -2
  150. package/src/parseAsn1.ts +135 -405
  151. package/src/useWheelScroll.ts +109 -0
  152. package/src/util.ts +5 -50
  153. package/src/vendor/copyToClipboard.ts +14 -122
  154. package/src/vendor/fileSaver.ts +8 -105
  155. package/src/version.ts +1 -1
  156. package/dist/components/dialogs/AddTrackDialog.d.ts +0 -8
  157. package/dist/components/dialogs/AddTrackDialog.js +0 -30
  158. package/dist/components/dialogs/AddTrackDialog.js.map +0 -1
  159. package/dist/components/dialogs/TabPanel.d.ts +0 -6
  160. package/dist/components/dialogs/TabPanel.js +0 -6
  161. package/dist/components/dialogs/TabPanel.js.map +0 -1
  162. package/dist/components/header/ZoomStar.js +0 -40
  163. package/dist/components/header/ZoomStar.js.map +0 -1
  164. package/dist/createPaletteMap.test.d.ts +0 -1
  165. package/dist/createPaletteMap.test.js +0 -49
  166. package/dist/createPaletteMap.test.js.map +0 -1
  167. package/dist/layout.d.ts +0 -26
  168. package/dist/layout.js +0 -74
  169. package/dist/layout.js.map +0 -1
  170. package/dist/neighborJoining.test.d.ts +0 -1
  171. package/dist/neighborJoining.test.js +0 -110
  172. package/dist/neighborJoining.test.js.map +0 -1
  173. package/dist/parseAsn1.test.d.ts +0 -1
  174. package/dist/parseAsn1.test.js +0 -8
  175. package/dist/parseAsn1.test.js.map +0 -1
  176. package/dist/reparseTree.d.ts +0 -2
  177. package/dist/reparseTree.js +0 -15
  178. package/dist/reparseTree.js.map +0 -1
  179. package/dist/rowCoordinateCalculations.test.d.ts +0 -1
  180. package/dist/rowCoordinateCalculations.test.js +0 -224
  181. package/dist/rowCoordinateCalculations.test.js.map +0 -1
  182. package/dist/seqPosToGlobalCol.test.d.ts +0 -1
  183. package/dist/seqPosToGlobalCol.test.js +0 -60
  184. package/dist/seqPosToGlobalCol.test.js.map +0 -1
  185. package/src/components/dialogs/AddTrackDialog.tsx +0 -85
  186. package/src/components/dialogs/TabPanel.tsx +0 -19
  187. package/src/components/header/ZoomStar.tsx +0 -74
  188. package/src/createPaletteMap.test.ts +0 -57
  189. package/src/layout.ts +0 -118
  190. package/src/reparseTree.ts +0 -18
@@ -1,635 +1,44 @@
1
1
  // Neighbor Joining tree construction using BLOSUM62 distances
2
2
  // Based on Saitou & Nei (1987) "The neighbor-joining method"
3
- const BLOSUM62 = {
4
- A: {
5
- A: 4,
6
- R: -1,
7
- N: -2,
8
- D: -2,
9
- C: 0,
10
- Q: -1,
11
- E: -1,
12
- G: 0,
13
- H: -2,
14
- I: -1,
15
- L: -1,
16
- K: -1,
17
- M: -1,
18
- F: -2,
19
- P: -1,
20
- S: 1,
21
- T: 0,
22
- W: -3,
23
- Y: -2,
24
- V: 0,
25
- B: -2,
26
- Z: -1,
27
- X: 0,
28
- '*': -4,
29
- },
30
- R: {
31
- A: -1,
32
- R: 5,
33
- N: 0,
34
- D: -2,
35
- C: -3,
36
- Q: 1,
37
- E: 0,
38
- G: -2,
39
- H: 0,
40
- I: -3,
41
- L: -2,
42
- K: 2,
43
- M: -1,
44
- F: -3,
45
- P: -2,
46
- S: -1,
47
- T: -1,
48
- W: -3,
49
- Y: -2,
50
- V: -3,
51
- B: -1,
52
- Z: 0,
53
- X: -1,
54
- '*': -4,
55
- },
56
- N: {
57
- A: -2,
58
- R: 0,
59
- N: 6,
60
- D: 1,
61
- C: -3,
62
- Q: 0,
63
- E: 0,
64
- G: 0,
65
- H: 1,
66
- I: -3,
67
- L: -3,
68
- K: 0,
69
- M: -2,
70
- F: -3,
71
- P: -2,
72
- S: 1,
73
- T: 0,
74
- W: -4,
75
- Y: -2,
76
- V: -3,
77
- B: 3,
78
- Z: 0,
79
- X: -1,
80
- '*': -4,
81
- },
82
- D: {
83
- A: -2,
84
- R: -2,
85
- N: 1,
86
- D: 6,
87
- C: -3,
88
- Q: 0,
89
- E: 2,
90
- G: -1,
91
- H: -1,
92
- I: -3,
93
- L: -4,
94
- K: -1,
95
- M: -3,
96
- F: -3,
97
- P: -1,
98
- S: 0,
99
- T: -1,
100
- W: -4,
101
- Y: -3,
102
- V: -3,
103
- B: 4,
104
- Z: 1,
105
- X: -1,
106
- '*': -4,
107
- },
108
- C: {
109
- A: 0,
110
- R: -3,
111
- N: -3,
112
- D: -3,
113
- C: 9,
114
- Q: -3,
115
- E: -4,
116
- G: -3,
117
- H: -3,
118
- I: -1,
119
- L: -1,
120
- K: -3,
121
- M: -1,
122
- F: -2,
123
- P: -3,
124
- S: -1,
125
- T: -1,
126
- W: -2,
127
- Y: -2,
128
- V: -1,
129
- B: -3,
130
- Z: -3,
131
- X: -2,
132
- '*': -4,
133
- },
134
- Q: {
135
- A: -1,
136
- R: 1,
137
- N: 0,
138
- D: 0,
139
- C: -3,
140
- Q: 5,
141
- E: 2,
142
- G: -2,
143
- H: 0,
144
- I: -3,
145
- L: -2,
146
- K: 1,
147
- M: 0,
148
- F: -3,
149
- P: -1,
150
- S: 0,
151
- T: -1,
152
- W: -2,
153
- Y: -1,
154
- V: -2,
155
- B: 0,
156
- Z: 3,
157
- X: -1,
158
- '*': -4,
159
- },
160
- E: {
161
- A: -1,
162
- R: 0,
163
- N: 0,
164
- D: 2,
165
- C: -4,
166
- Q: 2,
167
- E: 5,
168
- G: -2,
169
- H: 0,
170
- I: -3,
171
- L: -3,
172
- K: 1,
173
- M: -2,
174
- F: -3,
175
- P: -1,
176
- S: 0,
177
- T: -1,
178
- W: -3,
179
- Y: -2,
180
- V: -2,
181
- B: 1,
182
- Z: 4,
183
- X: -1,
184
- '*': -4,
185
- },
186
- G: {
187
- A: 0,
188
- R: -2,
189
- N: 0,
190
- D: -1,
191
- C: -3,
192
- Q: -2,
193
- E: -2,
194
- G: 6,
195
- H: -2,
196
- I: -4,
197
- L: -4,
198
- K: -2,
199
- M: -3,
200
- F: -3,
201
- P: -2,
202
- S: 0,
203
- T: -2,
204
- W: -2,
205
- Y: -3,
206
- V: -3,
207
- B: -1,
208
- Z: -2,
209
- X: -1,
210
- '*': -4,
211
- },
212
- H: {
213
- A: -2,
214
- R: 0,
215
- N: 1,
216
- D: -1,
217
- C: -3,
218
- Q: 0,
219
- E: 0,
220
- G: -2,
221
- H: 8,
222
- I: -3,
223
- L: -3,
224
- K: -1,
225
- M: -2,
226
- F: -1,
227
- P: -2,
228
- S: -1,
229
- T: -2,
230
- W: -2,
231
- Y: 2,
232
- V: -3,
233
- B: 0,
234
- Z: 0,
235
- X: -1,
236
- '*': -4,
237
- },
238
- I: {
239
- A: -1,
240
- R: -3,
241
- N: -3,
242
- D: -3,
243
- C: -1,
244
- Q: -3,
245
- E: -3,
246
- G: -4,
247
- H: -3,
248
- I: 4,
249
- L: 2,
250
- K: -3,
251
- M: 1,
252
- F: 0,
253
- P: -3,
254
- S: -2,
255
- T: -1,
256
- W: -3,
257
- Y: -1,
258
- V: 3,
259
- B: -3,
260
- Z: -3,
261
- X: -1,
262
- '*': -4,
263
- },
264
- L: {
265
- A: -1,
266
- R: -2,
267
- N: -3,
268
- D: -4,
269
- C: -1,
270
- Q: -2,
271
- E: -3,
272
- G: -4,
273
- H: -3,
274
- I: 2,
275
- L: 4,
276
- K: -2,
277
- M: 2,
278
- F: 0,
279
- P: -3,
280
- S: -2,
281
- T: -1,
282
- W: -2,
283
- Y: -1,
284
- V: 1,
285
- B: -4,
286
- Z: -3,
287
- X: -1,
288
- '*': -4,
289
- },
290
- K: {
291
- A: -1,
292
- R: 2,
293
- N: 0,
294
- D: -1,
295
- C: -3,
296
- Q: 1,
297
- E: 1,
298
- G: -2,
299
- H: -1,
300
- I: -3,
301
- L: -2,
302
- K: 5,
303
- M: -1,
304
- F: -3,
305
- P: -1,
306
- S: 0,
307
- T: -1,
308
- W: -3,
309
- Y: -2,
310
- V: -2,
311
- B: 0,
312
- Z: 1,
313
- X: -1,
314
- '*': -4,
315
- },
316
- M: {
317
- A: -1,
318
- R: -1,
319
- N: -2,
320
- D: -3,
321
- C: -1,
322
- Q: 0,
323
- E: -2,
324
- G: -3,
325
- H: -2,
326
- I: 1,
327
- L: 2,
328
- K: -1,
329
- M: 5,
330
- F: 0,
331
- P: -2,
332
- S: -1,
333
- T: -1,
334
- W: -1,
335
- Y: -1,
336
- V: 1,
337
- B: -3,
338
- Z: -1,
339
- X: -1,
340
- '*': -4,
341
- },
342
- F: {
343
- A: -2,
344
- R: -3,
345
- N: -3,
346
- D: -3,
347
- C: -2,
348
- Q: -3,
349
- E: -3,
350
- G: -3,
351
- H: -1,
352
- I: 0,
353
- L: 0,
354
- K: -3,
355
- M: 0,
356
- F: 6,
357
- P: -4,
358
- S: -2,
359
- T: -2,
360
- W: 1,
361
- Y: 3,
362
- V: -1,
363
- B: -3,
364
- Z: -3,
365
- X: -1,
366
- '*': -4,
367
- },
368
- P: {
369
- A: -1,
370
- R: -2,
371
- N: -2,
372
- D: -1,
373
- C: -3,
374
- Q: -1,
375
- E: -1,
376
- G: -2,
377
- H: -2,
378
- I: -3,
379
- L: -3,
380
- K: -1,
381
- M: -2,
382
- F: -4,
383
- P: 7,
384
- S: -1,
385
- T: -1,
386
- W: -4,
387
- Y: -3,
388
- V: -2,
389
- B: -2,
390
- Z: -1,
391
- X: -2,
392
- '*': -4,
393
- },
394
- S: {
395
- A: 1,
396
- R: -1,
397
- N: 1,
398
- D: 0,
399
- C: -1,
400
- Q: 0,
401
- E: 0,
402
- G: 0,
403
- H: -1,
404
- I: -2,
405
- L: -2,
406
- K: 0,
407
- M: -1,
408
- F: -2,
409
- P: -1,
410
- S: 4,
411
- T: 1,
412
- W: -3,
413
- Y: -2,
414
- V: -2,
415
- B: 0,
416
- Z: 0,
417
- X: 0,
418
- '*': -4,
419
- },
420
- T: {
421
- A: 0,
422
- R: -1,
423
- N: 0,
424
- D: -1,
425
- C: -1,
426
- Q: -1,
427
- E: -1,
428
- G: -2,
429
- H: -2,
430
- I: -1,
431
- L: -1,
432
- K: -1,
433
- M: -1,
434
- F: -2,
435
- P: -1,
436
- S: 1,
437
- T: 5,
438
- W: -2,
439
- Y: -2,
440
- V: 0,
441
- B: -1,
442
- Z: -1,
443
- X: 0,
444
- '*': -4,
445
- },
446
- W: {
447
- A: -3,
448
- R: -3,
449
- N: -4,
450
- D: -4,
451
- C: -2,
452
- Q: -2,
453
- E: -3,
454
- G: -2,
455
- H: -2,
456
- I: -3,
457
- L: -2,
458
- K: -3,
459
- M: -1,
460
- F: 1,
461
- P: -4,
462
- S: -3,
463
- T: -2,
464
- W: 11,
465
- Y: 2,
466
- V: -3,
467
- B: -4,
468
- Z: -3,
469
- X: -2,
470
- '*': -4,
471
- },
472
- Y: {
473
- A: -2,
474
- R: -2,
475
- N: -2,
476
- D: -3,
477
- C: -2,
478
- Q: -1,
479
- E: -2,
480
- G: -3,
481
- H: 2,
482
- I: -1,
483
- L: -1,
484
- K: -2,
485
- M: -1,
486
- F: 3,
487
- P: -3,
488
- S: -2,
489
- T: -2,
490
- W: 2,
491
- Y: 7,
492
- V: -1,
493
- B: -3,
494
- Z: -2,
495
- X: -1,
496
- '*': -4,
497
- },
498
- V: {
499
- A: 0,
500
- R: -3,
501
- N: -3,
502
- D: -3,
503
- C: -1,
504
- Q: -2,
505
- E: -2,
506
- G: -3,
507
- H: -3,
508
- I: 3,
509
- L: 1,
510
- K: -2,
511
- M: 1,
512
- F: -1,
513
- P: -2,
514
- S: -2,
515
- T: 0,
516
- W: -3,
517
- Y: -1,
518
- V: 4,
519
- B: -3,
520
- Z: -2,
521
- X: -1,
522
- '*': -4,
523
- },
524
- B: {
525
- A: -2,
526
- R: -1,
527
- N: 3,
528
- D: 4,
529
- C: -3,
530
- Q: 0,
531
- E: 1,
532
- G: -1,
533
- H: 0,
534
- I: -3,
535
- L: -4,
536
- K: 0,
537
- M: -3,
538
- F: -3,
539
- P: -2,
540
- S: 0,
541
- T: -1,
542
- W: -4,
543
- Y: -3,
544
- V: -3,
545
- B: 4,
546
- Z: 1,
547
- X: -1,
548
- '*': -4,
549
- },
550
- Z: {
551
- A: -1,
552
- R: 0,
553
- N: 0,
554
- D: 1,
555
- C: -3,
556
- Q: 3,
557
- E: 4,
558
- G: -2,
559
- H: 0,
560
- I: -3,
561
- L: -3,
562
- K: 1,
563
- M: -1,
564
- F: -3,
565
- P: -1,
566
- S: 0,
567
- T: -1,
568
- W: -3,
569
- Y: -2,
570
- V: -2,
571
- B: 1,
572
- Z: 4,
573
- X: -1,
574
- '*': -4,
575
- },
576
- X: {
577
- A: 0,
578
- R: -1,
579
- N: -1,
580
- D: -1,
581
- C: -2,
582
- Q: -1,
583
- E: -1,
584
- G: -1,
585
- H: -1,
586
- I: -1,
587
- L: -1,
588
- K: -1,
589
- M: -1,
590
- F: -1,
591
- P: -2,
592
- S: 0,
593
- T: 0,
594
- W: -2,
595
- Y: -1,
596
- V: -1,
597
- B: -1,
598
- Z: -1,
599
- X: -1,
600
- '*': -4,
601
- },
602
- '*': {
603
- A: -4,
604
- R: -4,
605
- N: -4,
606
- D: -4,
607
- C: -4,
608
- Q: -4,
609
- E: -4,
610
- G: -4,
611
- H: -4,
612
- I: -4,
613
- L: -4,
614
- K: -4,
615
- M: -4,
616
- F: -4,
617
- P: -4,
618
- S: -4,
619
- T: -4,
620
- W: -4,
621
- Y: -4,
622
- V: -4,
623
- B: -4,
624
- Z: -4,
625
- X: -4,
626
- '*': 1,
627
- },
628
- };
3
+ // prettier-ignore
4
+ const BLOSUM62_KEYS = 'ARNDCQEGHILKMFPSTWYVBZX*';
5
+ // prettier-ignore
6
+ const BLOSUM62_DATA = [
7
+ [4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3, -2, 0, -2, -1, 0, -4],
8
+ [-1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2, -3, -1, 0, -1, -4],
9
+ [-2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3, 3, 0, -1, -4],
10
+ [-2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4, -3, -3, 4, 1, -1, -4],
11
+ [0, -3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2, -2, -1, -3, -3, -2, -4],
12
+ [-1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1, -2, 0, 3, -1, -4],
13
+ [-1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4],
14
+ [0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2, -3, -3, -1, -2, -1, -4],
15
+ [-2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2, -3, 0, 0, -1, -4],
16
+ [-1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3, -1, 3, -3, -3, -1, -4],
17
+ [-1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2, -1, 1, -4, -3, -1, -4],
18
+ [-1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2, -2, 0, 1, -1, -4],
19
+ [-1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1, -1, 1, -3, -1, -1, -4],
20
+ [-2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3, -1, -3, -3, -1, -4],
21
+ [-1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1, -4, -3, -2, -2, -1, -2, -4],
22
+ [1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2, -2, 0, 0, 0, -4],
23
+ [0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2, -2, 0, -1, -1, 0, -4],
24
+ [-3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2, 11, 2, -3, -4, -3, -2, -4],
25
+ [-2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2, 7, -1, -3, -2, -1, -4],
26
+ [0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3, -1, 4, -3, -2, -1, -4],
27
+ [-2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4, -3, -3, 4, 1, -1, -4],
28
+ [-1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2, -2, 1, 4, -1, -4],
29
+ [0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0, -2, -1, -1, -1, -1, -1, -4],
30
+ [-4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, 1],
31
+ ];
32
+ const BLOSUM62 = new Map();
33
+ for (let i = 0; i < BLOSUM62_KEYS.length; i++) {
34
+ const row = new Map();
35
+ for (let j = 0; j < BLOSUM62_KEYS.length; j++) {
36
+ row.set(BLOSUM62_KEYS[j], BLOSUM62_DATA[i][j]);
37
+ }
38
+ BLOSUM62.set(BLOSUM62_KEYS[i], row);
39
+ }
629
40
  function getBlosum62Score(a, b) {
630
- const upper_a = a.toUpperCase();
631
- const upper_b = b.toUpperCase();
632
- return BLOSUM62[upper_a]?.[upper_b] ?? -4;
41
+ return BLOSUM62.get(a.toUpperCase())?.get(b.toUpperCase()) ?? -4;
633
42
  }
634
43
  function computePairwiseDistance(seq1, seq2) {
635
44
  if (seq1.length !== seq2.length) {
@@ -810,12 +219,10 @@ function neighborJoining(distances, names) {
810
219
  function nodeToNewick(node, branchLength) {
811
220
  let result;
812
221
  if (node.name !== undefined && !node.left && !node.right) {
813
- // Leaf node - escape special characters in name
814
- const escapedName = node.name.replace(/[():,;[\]]/g, '_');
815
- result = escapedName;
222
+ const quotedName = node.name.replaceAll("'", "''");
223
+ result = `'${quotedName}'`;
816
224
  }
817
225
  else {
818
- // Internal node
819
226
  const leftNewick = node.left ? nodeToNewick(node.left, node.leftLength) : '';
820
227
  const rightNewick = node.right
821
228
  ? nodeToNewick(node.right, node.rightLength)