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