react-msaview 6.5.0 → 8.0.0

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 (414) hide show
  1. package/README.md +13 -11
  2. package/bundle/index.js +122 -112
  3. package/bundle/index.js.map +4 -4
  4. package/dist/colorSchemes.js +1 -2
  5. package/dist/colorSchemes.js.map +1 -1
  6. package/dist/columnStats.d.ts +28 -0
  7. package/dist/columnStats.js +34 -0
  8. package/dist/columnStats.js.map +1 -0
  9. package/dist/components/DragHandle.d.ts +3 -2
  10. package/dist/components/DragHandle.js +11 -5
  11. package/dist/components/DragHandle.js.map +1 -1
  12. package/dist/components/Loading.js +2 -2
  13. package/dist/components/Loading.js.map +1 -1
  14. package/dist/components/MSAView.js +17 -6
  15. package/dist/components/MSAView.js.map +1 -1
  16. package/dist/components/MSAViewer.d.ts +69 -4
  17. package/dist/components/MSAViewer.js +201 -8
  18. package/dist/components/MSAViewer.js.map +1 -1
  19. package/dist/components/PortalTooltip.d.ts +11 -0
  20. package/dist/components/PortalTooltip.js +29 -0
  21. package/dist/components/PortalTooltip.js.map +1 -0
  22. package/dist/components/ResizeHandles.d.ts +3 -3
  23. package/dist/components/ResizeHandles.js +13 -24
  24. package/dist/components/ResizeHandles.js.map +1 -1
  25. package/dist/components/SequenceTextArea.js +3 -3
  26. package/dist/components/SequenceTextArea.js.map +1 -1
  27. package/dist/components/Track.js +41 -22
  28. package/dist/components/Track.js.map +1 -1
  29. package/dist/components/dialogs/{InterProScanDialog.d.ts → AnnotationFileDialog.d.ts} +2 -2
  30. package/dist/components/dialogs/AnnotationFileDialog.js +92 -0
  31. package/dist/components/dialogs/AnnotationFileDialog.js.map +1 -0
  32. package/dist/components/dialogs/ExportSVGDialog.js +5 -3
  33. package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
  34. package/dist/components/dialogs/FeatureDialog.js +13 -9
  35. package/dist/components/dialogs/FeatureDialog.js.map +1 -1
  36. package/dist/components/dialogs/TrackInfoDialog.js +1 -1
  37. package/dist/components/dialogs/TrackInfoDialog.js.map +1 -1
  38. package/dist/components/header/GappynessSlider.js +6 -11
  39. package/dist/components/header/GappynessSlider.js.map +1 -1
  40. package/dist/components/header/Header.js +7 -0
  41. package/dist/components/header/Header.js.map +1 -1
  42. package/dist/components/header/HeaderStatusArea.js +0 -2
  43. package/dist/components/header/HeaderStatusArea.js.map +1 -1
  44. package/dist/components/header/LoadWarnings.d.ts +6 -0
  45. package/dist/components/header/LoadWarnings.js +35 -0
  46. package/dist/components/header/LoadWarnings.js.map +1 -0
  47. package/dist/components/header/MultiAlignmentSelector.js +0 -0
  48. package/dist/components/header/MultiAlignmentSelector.js.map +1 -1
  49. package/dist/components/header/ScrollZoomIcons.d.ts +6 -0
  50. package/dist/components/header/ScrollZoomIcons.js +35 -0
  51. package/dist/components/header/ScrollZoomIcons.js.map +1 -0
  52. package/dist/components/header/TreeSettingsMenu.js +7 -1
  53. package/dist/components/header/TreeSettingsMenu.js.map +1 -1
  54. package/dist/components/header/UnshareableDataWarning.d.ts +6 -0
  55. package/dist/components/header/UnshareableDataWarning.js +40 -0
  56. package/dist/components/header/UnshareableDataWarning.js.map +1 -0
  57. package/dist/components/header/ZoomControls.js +49 -6
  58. package/dist/components/header/ZoomControls.js.map +1 -1
  59. package/dist/components/header/getAnnotationsMenu.js +11 -14
  60. package/dist/components/header/getAnnotationsMenu.js.map +1 -1
  61. package/dist/components/header/settingsMenuItems.js +10 -7
  62. package/dist/components/header/settingsMenuItems.js.map +1 -1
  63. package/dist/components/import/ImportForm.js +1 -1
  64. package/dist/components/import/ImportForm.js.map +1 -1
  65. package/dist/components/import/ImportFormExamples.js +2 -6
  66. package/dist/components/import/ImportFormExamples.js.map +1 -1
  67. package/dist/components/import/util.js +2 -0
  68. package/dist/components/import/util.js.map +1 -1
  69. package/dist/components/minimap/Minimap.js +1 -2
  70. package/dist/components/minimap/Minimap.js.map +1 -1
  71. package/dist/components/msa/AnnotationLegend.js +27 -19
  72. package/dist/components/msa/AnnotationLegend.js.map +1 -1
  73. package/dist/components/msa/MSACanvas.js +1 -1
  74. package/dist/components/msa/MSACanvas.js.map +1 -1
  75. package/dist/components/msa/MSACanvasBlock.js +17 -20
  76. package/dist/components/msa/MSACanvasBlock.js.map +1 -1
  77. package/dist/components/msa/MSAMouseoverCanvas.js +2 -1
  78. package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
  79. package/dist/components/msa/domainBandCursor.d.ts +7 -11
  80. package/dist/components/msa/domainBandCursor.js +7 -11
  81. package/dist/components/msa/domainBandCursor.js.map +1 -1
  82. package/dist/components/msa/drawFeatureSpans.d.ts +53 -0
  83. package/dist/components/msa/drawFeatureSpans.js +78 -0
  84. package/dist/components/msa/drawFeatureSpans.js.map +1 -0
  85. package/dist/components/msa/legendRows.d.ts +8 -0
  86. package/dist/components/msa/legendRows.js +16 -0
  87. package/dist/components/msa/legendRows.js.map +1 -0
  88. package/dist/components/msa/msaRaster.d.ts +30 -27
  89. package/dist/components/msa/msaRaster.js +193 -90
  90. package/dist/components/msa/msaRaster.js.map +1 -1
  91. package/dist/components/msa/packDomainLanes.d.ts +20 -0
  92. package/dist/components/msa/packDomainLanes.js +33 -0
  93. package/dist/components/msa/packDomainLanes.js.map +1 -0
  94. package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +3 -1
  95. package/dist/components/msa/renderBoxFeatureCanvasBlock.js +51 -87
  96. package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
  97. package/dist/components/msa/renderHighlights.d.ts +44 -4
  98. package/dist/components/msa/renderHighlights.js +99 -11
  99. package/dist/components/msa/renderHighlights.js.map +1 -1
  100. package/dist/components/msa/renderMSABlock.d.ts +1 -2
  101. package/dist/components/msa/renderMSABlock.js +28 -31
  102. package/dist/components/msa/renderMSABlock.js.map +1 -1
  103. package/dist/components/msa/renderMSAMouseover.js +9 -30
  104. package/dist/components/msa/renderMSAMouseover.js.map +1 -1
  105. package/dist/components/msa/tileColor.js +4 -7
  106. package/dist/components/msa/tileColor.js.map +1 -1
  107. package/dist/components/msa/useMsaBlockMouse.d.ts +5 -3
  108. package/dist/components/msa/useMsaBlockMouse.js +6 -6
  109. package/dist/components/msa/useMsaBlockMouse.js.map +1 -1
  110. package/dist/components/renderCtx.d.ts +1 -1
  111. package/dist/components/rowpanels/RowPanelBlock.d.ts +9 -0
  112. package/dist/components/rowpanels/RowPanelBlock.js +86 -0
  113. package/dist/components/rowpanels/RowPanelBlock.js.map +1 -0
  114. package/dist/components/rowpanels/RowPanelHeaders.d.ts +12 -0
  115. package/dist/components/rowpanels/RowPanelHeaders.js +38 -0
  116. package/dist/components/rowpanels/RowPanelHeaders.js.map +1 -0
  117. package/dist/components/{msa/ColumnStats.d.ts → rowpanels/RowPanels.d.ts} +2 -2
  118. package/dist/components/rowpanels/RowPanels.js +32 -0
  119. package/dist/components/rowpanels/RowPanels.js.map +1 -0
  120. package/dist/components/rowpanels/headerLayout.d.ts +1 -0
  121. package/dist/components/rowpanels/headerLayout.js +5 -0
  122. package/dist/components/rowpanels/headerLayout.js.map +1 -0
  123. package/dist/components/rowpanels/renderFeaturePanel.d.ts +21 -0
  124. package/dist/components/rowpanels/renderFeaturePanel.js +37 -0
  125. package/dist/components/rowpanels/renderFeaturePanel.js.map +1 -0
  126. package/dist/components/rowpanels/renderRowPanel.d.ts +23 -0
  127. package/dist/components/rowpanels/renderRowPanel.js +22 -0
  128. package/dist/components/rowpanels/renderRowPanel.js.map +1 -0
  129. package/dist/components/rowpanels/renderStrip.d.ts +20 -0
  130. package/dist/components/rowpanels/renderStrip.js +26 -0
  131. package/dist/components/rowpanels/renderStrip.js.map +1 -0
  132. package/dist/components/tracks/TrackBlocks.js +13 -16
  133. package/dist/components/tracks/TrackBlocks.js.map +1 -1
  134. package/dist/components/tracks/TrackTooltipContent.d.ts +15 -0
  135. package/dist/components/tracks/TrackTooltipContent.js +109 -0
  136. package/dist/components/tracks/TrackTooltipContent.js.map +1 -0
  137. package/dist/components/tracks/drawTracks.d.ts +30 -12
  138. package/dist/components/tracks/drawTracks.js +127 -34
  139. package/dist/components/tracks/drawTracks.js.map +1 -1
  140. package/dist/components/tracks/useTrackHover.d.ts +22 -0
  141. package/dist/components/tracks/useTrackHover.js +30 -0
  142. package/dist/components/tracks/useTrackHover.js.map +1 -0
  143. package/dist/components/tree/CladeLabels.d.ts +12 -0
  144. package/dist/components/tree/CladeLabels.js +48 -0
  145. package/dist/components/tree/CladeLabels.js.map +1 -0
  146. package/dist/components/tree/TreeCanvas.js +6 -4
  147. package/dist/components/tree/TreeCanvas.js.map +1 -1
  148. package/dist/components/tree/TreeCanvasBlock.js +6 -21
  149. package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
  150. package/dist/components/tree/TreeOverview.d.ts +14 -0
  151. package/dist/components/tree/TreeOverview.js +75 -0
  152. package/dist/components/tree/TreeOverview.js.map +1 -0
  153. package/dist/components/tree/TreeRuler.js +11 -5
  154. package/dist/components/tree/TreeRuler.js.map +1 -1
  155. package/dist/components/tree/cladeBrackets.d.ts +25 -0
  156. package/dist/components/tree/cladeBrackets.js +51 -0
  157. package/dist/components/tree/cladeBrackets.js.map +1 -0
  158. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +2 -2
  159. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
  160. package/dist/components/tree/renderTreeCanvas.d.ts +0 -1
  161. package/dist/components/tree/renderTreeCanvas.js +221 -47
  162. package/dist/components/tree/renderTreeCanvas.js.map +1 -1
  163. package/dist/components/tree/renderTreeOverview.d.ts +52 -0
  164. package/dist/components/tree/renderTreeOverview.js +138 -0
  165. package/dist/components/tree/renderTreeOverview.js.map +1 -0
  166. package/dist/components/tree/scaleBar.d.ts +10 -0
  167. package/dist/components/tree/scaleBar.js +24 -0
  168. package/dist/components/tree/scaleBar.js.map +1 -0
  169. package/dist/components/tree/useTreeHover.js +2 -4
  170. package/dist/components/tree/useTreeHover.js.map +1 -1
  171. package/dist/constants.d.ts +18 -1
  172. package/dist/constants.js +51 -8
  173. package/dist/constants.js.map +1 -1
  174. package/dist/createPaletteMap.d.ts +7 -6
  175. package/dist/createPaletteMap.js +10 -9
  176. package/dist/createPaletteMap.js.map +1 -1
  177. package/dist/element.d.ts +13 -0
  178. package/dist/element.js +269 -0
  179. package/dist/element.js.map +1 -0
  180. package/dist/featureFields.d.ts +11 -0
  181. package/dist/featureFields.js +17 -0
  182. package/dist/featureFields.js.map +1 -0
  183. package/dist/fetchUtils.d.ts +7 -7
  184. package/dist/fetchUtils.js +4 -32
  185. package/dist/fetchUtils.js.map +1 -1
  186. package/dist/flatToTree.js +1 -2
  187. package/dist/flatToTree.js.map +1 -1
  188. package/dist/ggplotPalettes.d.ts +10 -0
  189. package/dist/ggplotPalettes.js +58 -0
  190. package/dist/ggplotPalettes.js.map +1 -1
  191. package/dist/hierarchy.d.ts +29 -1
  192. package/dist/hierarchy.js +82 -19
  193. package/dist/hierarchy.js.map +1 -1
  194. package/dist/index.d.ts +10 -1
  195. package/dist/index.js +10 -2
  196. package/dist/index.js.map +1 -1
  197. package/dist/model/DataModel.js +4 -4
  198. package/dist/model/DataModel.js.map +1 -1
  199. package/dist/model/msaModel.d.ts +3 -2
  200. package/dist/model/msaModel.js +3 -2
  201. package/dist/model/msaModel.js.map +1 -1
  202. package/dist/model/treeModel.d.ts +30 -0
  203. package/dist/model/treeModel.js +37 -1
  204. package/dist/model/treeModel.js.map +1 -1
  205. package/dist/model.d.ts +792 -259
  206. package/dist/model.js +2092 -675
  207. package/dist/model.js.map +1 -1
  208. package/dist/mount.d.ts +11 -0
  209. package/dist/mount.js +22 -0
  210. package/dist/mount.js.map +1 -0
  211. package/dist/neighborJoining.js +8 -32
  212. package/dist/neighborJoining.js.map +1 -1
  213. package/dist/renderToStaticMarkup.d.ts +15 -13
  214. package/dist/renderToStaticMarkup.js +37 -25
  215. package/dist/renderToStaticMarkup.js.map +1 -1
  216. package/dist/renderToSvg.js +198 -68
  217. package/dist/renderToSvg.js.map +1 -1
  218. package/dist/rowCoordinateCalculations.d.ts +26 -28
  219. package/dist/rowCoordinateCalculations.js +13 -39
  220. package/dist/rowCoordinateCalculations.js.map +1 -1
  221. package/dist/scales.d.ts +22 -0
  222. package/dist/scales.js +30 -0
  223. package/dist/scales.js.map +1 -0
  224. package/dist/seqPosToGlobalCol.d.ts +2 -3
  225. package/dist/seqPosToGlobalCol.js +5 -4
  226. package/dist/seqPosToGlobalCol.js.map +1 -1
  227. package/dist/sequenceLogo.d.ts +6 -11
  228. package/dist/sequenceLogo.js +6 -11
  229. package/dist/sequenceLogo.js.map +1 -1
  230. package/dist/stripDefault.d.ts +7 -14
  231. package/dist/stripDefault.js +7 -14
  232. package/dist/stripDefault.js.map +1 -1
  233. package/dist/svgTestUtil.d.ts +306 -124
  234. package/dist/types.d.ts +295 -3
  235. package/dist/umd.d.ts +2 -0
  236. package/dist/umd.js +4 -2
  237. package/dist/umd.js.map +1 -1
  238. package/dist/useCanvasAutorun.d.ts +5 -10
  239. package/dist/useCanvasAutorun.js +5 -10
  240. package/dist/useCanvasAutorun.js.map +1 -1
  241. package/dist/useMsaSvgFigure.d.ts +20 -0
  242. package/dist/useMsaSvgFigure.js +46 -0
  243. package/dist/useMsaSvgFigure.js.map +1 -0
  244. package/dist/util.d.ts +10 -4
  245. package/dist/util.js +37 -10
  246. package/dist/util.js.map +1 -1
  247. package/dist/version.d.ts +1 -1
  248. package/dist/version.js +1 -1
  249. package/dist/wuss.d.ts +14 -0
  250. package/dist/wuss.js +55 -0
  251. package/dist/wuss.js.map +1 -0
  252. package/package.json +23 -14
  253. package/src/colorSchemes.ts +1 -2
  254. package/src/columnStats.ts +58 -0
  255. package/src/components/DragHandle.tsx +18 -7
  256. package/src/components/Loading.tsx +14 -8
  257. package/src/components/MSAView.tsx +19 -5
  258. package/src/components/MSAViewer.tsx +326 -10
  259. package/src/components/PortalTooltip.tsx +47 -0
  260. package/src/components/ResizeHandles.tsx +21 -36
  261. package/src/components/SequenceTextArea.tsx +3 -3
  262. package/src/components/Track.tsx +55 -18
  263. package/src/components/dialogs/AnnotationFileDialog.tsx +162 -0
  264. package/src/components/dialogs/ExportSVGDialog.tsx +7 -2
  265. package/src/components/dialogs/FeatureDialog.tsx +13 -9
  266. package/src/components/dialogs/TrackInfoDialog.tsx +1 -1
  267. package/src/components/header/GappynessSlider.tsx +6 -11
  268. package/src/components/header/Header.tsx +10 -0
  269. package/src/components/header/HeaderStatusArea.tsx +0 -5
  270. package/src/components/header/LoadWarnings.tsx +48 -0
  271. package/src/components/header/MultiAlignmentSelector.tsx +0 -0
  272. package/src/components/header/ScrollZoomIcons.tsx +52 -0
  273. package/src/components/header/TreeSettingsMenu.tsx +7 -1
  274. package/src/components/header/UnshareableDataWarning.tsx +56 -0
  275. package/src/components/header/ZoomControls.tsx +74 -14
  276. package/src/components/header/getAnnotationsMenu.ts +13 -17
  277. package/src/components/header/settingsMenuItems.ts +11 -6
  278. package/src/components/import/ImportForm.tsx +2 -2
  279. package/src/components/import/ImportFormExamples.tsx +4 -8
  280. package/src/components/import/util.ts +2 -0
  281. package/src/components/minimap/Minimap.tsx +1 -2
  282. package/src/components/msa/AnnotationLegend.tsx +48 -38
  283. package/src/components/msa/MSACanvas.tsx +3 -5
  284. package/src/components/msa/MSACanvasBlock.tsx +17 -21
  285. package/src/components/msa/MSAMouseoverCanvas.tsx +2 -1
  286. package/src/components/msa/domainBandCursor.ts +7 -11
  287. package/src/components/msa/drawFeatureSpans.ts +150 -0
  288. package/src/components/msa/legendRows.ts +24 -0
  289. package/src/components/msa/msaRaster.ts +236 -88
  290. package/src/components/msa/packDomainLanes.ts +36 -0
  291. package/src/components/msa/renderBoxFeatureCanvasBlock.ts +69 -123
  292. package/src/components/msa/renderHighlights.ts +141 -10
  293. package/src/components/msa/renderMSABlock.ts +29 -38
  294. package/src/components/msa/renderMSAMouseover.ts +9 -39
  295. package/src/components/msa/tileColor.ts +4 -7
  296. package/src/components/msa/useMsaBlockMouse.ts +6 -6
  297. package/src/components/renderCtx.ts +1 -0
  298. package/src/components/rowpanels/RowPanelBlock.tsx +139 -0
  299. package/src/components/rowpanels/RowPanelHeaders.tsx +57 -0
  300. package/src/components/rowpanels/RowPanels.tsx +77 -0
  301. package/src/components/rowpanels/headerLayout.ts +5 -0
  302. package/src/components/rowpanels/renderFeaturePanel.ts +66 -0
  303. package/src/components/rowpanels/renderRowPanel.ts +41 -0
  304. package/src/components/rowpanels/renderStrip.ts +46 -0
  305. package/src/components/tracks/TrackBlocks.tsx +13 -18
  306. package/src/components/tracks/TrackTooltipContent.tsx +156 -0
  307. package/src/components/tracks/drawTracks.ts +169 -38
  308. package/src/components/tracks/useTrackHover.ts +42 -0
  309. package/src/components/tree/CladeLabels.tsx +77 -0
  310. package/src/components/tree/TreeCanvas.tsx +4 -3
  311. package/src/components/tree/TreeCanvasBlock.tsx +10 -32
  312. package/src/components/tree/TreeOverview.tsx +106 -0
  313. package/src/components/tree/TreeRuler.tsx +29 -5
  314. package/src/components/tree/cladeBrackets.ts +73 -0
  315. package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +2 -2
  316. package/src/components/tree/renderTreeCanvas.ts +312 -48
  317. package/src/components/tree/renderTreeOverview.ts +212 -0
  318. package/src/components/tree/scaleBar.ts +23 -0
  319. package/src/components/tree/useTreeHover.ts +2 -4
  320. package/src/constants.ts +61 -8
  321. package/src/createPaletteMap.ts +10 -9
  322. package/src/element.ts +321 -0
  323. package/src/featureFields.ts +19 -0
  324. package/src/fetchUtils.ts +7 -40
  325. package/src/flatToTree.ts +1 -2
  326. package/src/ggplotPalettes.ts +60 -0
  327. package/src/hierarchy.ts +97 -20
  328. package/src/index.ts +46 -6
  329. package/src/model/DataModel.ts +5 -4
  330. package/src/model/msaModel.ts +3 -2
  331. package/src/model/treeModel.ts +42 -0
  332. package/src/model.ts +2492 -793
  333. package/src/mount.tsx +32 -0
  334. package/src/neighborJoining.ts +8 -32
  335. package/src/rawImports.d.ts +9 -0
  336. package/src/renderToStaticMarkup.ts +41 -25
  337. package/src/renderToSvg.tsx +365 -92
  338. package/src/rowCoordinateCalculations.ts +16 -62
  339. package/src/scales.ts +47 -0
  340. package/src/seqPosToGlobalCol.ts +5 -4
  341. package/src/sequenceLogo.ts +6 -11
  342. package/src/stripDefault.ts +7 -14
  343. package/src/types.ts +352 -12
  344. package/src/umd.ts +4 -2
  345. package/src/useCanvasAutorun.ts +5 -10
  346. package/src/useMsaSvgFigure.ts +72 -0
  347. package/src/util.ts +40 -14
  348. package/src/version.ts +1 -1
  349. package/src/wuss.ts +62 -0
  350. package/dist/components/dialogs/InterProScanDialog.js +0 -137
  351. package/dist/components/dialogs/InterProScanDialog.js.map +0 -1
  352. package/dist/components/dialogs/InterProScanFileDialog.d.ts +0 -7
  353. package/dist/components/dialogs/InterProScanFileDialog.js +0 -64
  354. package/dist/components/dialogs/InterProScanFileDialog.js.map +0 -1
  355. package/dist/components/msa/ColumnStats.js +0 -42
  356. package/dist/components/msa/ColumnStats.js.map +0 -1
  357. package/dist/launchInterProScan.d.ts +0 -13
  358. package/dist/launchInterProScan.js +0 -110
  359. package/dist/launchInterProScan.js.map +0 -1
  360. package/dist/useColorContrast.d.ts +0 -10
  361. package/dist/useColorContrast.js +0 -13
  362. package/dist/useColorContrast.js.map +0 -1
  363. package/src/clustalX.test.ts +0 -74
  364. package/src/colSpace.test.ts +0 -67
  365. package/src/collapseLogic.test.ts +0 -115
  366. package/src/colorSchemes.docs.test.ts +0 -57
  367. package/src/columnCounts.test.ts +0 -73
  368. package/src/columnStats.test.ts +0 -94
  369. package/src/columnTracks.test.ts +0 -97
  370. package/src/components/dialogs/InterProScanDialog.tsx +0 -214
  371. package/src/components/dialogs/InterProScanFileDialog.tsx +0 -138
  372. package/src/components/minimap/minimapLayout.test.ts +0 -71
  373. package/src/components/msa/ColumnStats.tsx +0 -54
  374. package/src/components/msa/msaRaster.test.ts +0 -145
  375. package/src/components/msa/renderBoxFeatureCanvasBlock.test.ts +0 -51
  376. package/src/components/tree/renderTreeCanvas.test.ts +0 -296
  377. package/src/dataInitialized.test.ts +0 -42
  378. package/src/domainBands.test.ts +0 -122
  379. package/src/domainLetterColor.test.ts +0 -80
  380. package/src/exportFileName.test.ts +0 -40
  381. package/src/fetchUtils.test.ts +0 -83
  382. package/src/flatToTree.test.ts +0 -51
  383. package/src/hierarchy.test.ts +0 -228
  384. package/src/highlights.test.ts +0 -70
  385. package/src/impgRender.test.tsx +0 -68
  386. package/src/largeTree.test.ts +0 -67
  387. package/src/launchInterProScan.ts +0 -167
  388. package/src/loadErrorDisplay.test.tsx +0 -102
  389. package/src/modelFilehandleLoaders.test.ts +0 -137
  390. package/src/modelReset.test.ts +0 -120
  391. package/src/neighborJoining.test.ts +0 -164
  392. package/src/parseAsn1.test.ts +0 -36
  393. package/src/propertyConservation.test.ts +0 -36
  394. package/src/renderColumnTracksSvg.test.tsx +0 -108
  395. package/src/renderDomainsSvg.test.tsx +0 -118
  396. package/src/renderHighlightsSvg.test.tsx +0 -85
  397. package/src/renderMinimapSvg.test.tsx +0 -62
  398. package/src/renderRasterSvg.test.tsx +0 -144
  399. package/src/renderSequenceLogoSvg.test.tsx +0 -165
  400. package/src/renderToSvg.test.tsx +0 -65
  401. package/src/reset.test.ts +0 -61
  402. package/src/rowCoordinateCalculations.test.ts +0 -211
  403. package/src/rowSpace.test.ts +0 -46
  404. package/src/segmentOverlay.test.ts +0 -70
  405. package/src/seqPosToGlobalCol.test.ts +0 -59
  406. package/src/sequenceLogo.test.ts +0 -88
  407. package/src/setFontSize.test.ts +0 -33
  408. package/src/stripDefault.test.ts +0 -48
  409. package/src/stripDefaultSnapshot.test.ts +0 -87
  410. package/src/treeMetadata.test.ts +0 -39
  411. package/src/useCanvasAutorun.test.tsx +0 -98
  412. package/src/useColorContrast.ts +0 -18
  413. package/src/viewChrome.test.tsx +0 -134
  414. package/src/wheelZoom.test.ts +0 -46
@@ -0,0 +1,19 @@
1
+ import type { Annotation } from './types.ts'
2
+
3
+ /**
4
+ * The value a feature gives an encoded field: an Annotation property, else one
5
+ * of the GFF attributes the parser kept.
6
+ */
7
+ export function featureField(annotation: Annotation, field: string) {
8
+ const own = (annotation as unknown as Record<string, unknown>)[field]
9
+ const value = own ?? annotation.attributes?.[field]
10
+ return typeof value === 'string' ? value : undefined
11
+ }
12
+
13
+ /**
14
+ * The name a feature answers to in a transform: its GFF `Name` attribute, else
15
+ * the name the parser gave it.
16
+ */
17
+ export function featureName(annotation: Annotation) {
18
+ return featureField(annotation, 'Name') ?? featureField(annotation, 'name')
19
+ }
package/src/fetchUtils.ts CHANGED
@@ -19,7 +19,6 @@ function statusMessageText(status: RpcStatus | undefined) {
19
19
 
20
20
  export interface FetchStatus {
21
21
  msg: string
22
- url?: string
23
22
  onCancel?: () => void
24
23
  }
25
24
 
@@ -34,14 +33,18 @@ type ProgressFetcher = (
34
33
  * Fetch text from a filehandle while reporting download/unzip progress through
35
34
  * setStatus, and wiring a Cancel handler that aborts the underlying request.
36
35
  * The status is always cleared once the fetch settles. The fetcher is injectable
37
- * for testing.
36
+ * for testing, and so is the AbortController: a caller that can supersede its
37
+ * own request -- the model's loaders, when the filehandle changes under them --
38
+ * holds one and aborts the download it no longer wants.
38
39
  */
39
40
  export async function fetchTextWithProgress(
40
41
  loc: Filehandle,
41
42
  setStatus: (status?: FetchStatus) => void,
42
- fetcher: ProgressFetcher = fetchAndMaybeUnzipText,
43
+ {
44
+ fetcher = fetchAndMaybeUnzipText,
45
+ controller = new AbortController(),
46
+ }: { fetcher?: ProgressFetcher; controller?: AbortController } = {},
43
47
  ) {
44
- const controller = new AbortController()
45
48
  try {
46
49
  return await fetcher(loc, {
47
50
  signal: controller.signal,
@@ -64,42 +67,6 @@ export async function fetchTextWithProgress(
64
67
  }
65
68
  }
66
69
 
67
- export async function myfetch(url: string, args?: RequestInit) {
68
- const response = await fetch(url, args)
69
-
70
- if (!response.ok) {
71
- throw new Error(
72
- `HTTP ${response.status} fetching ${url} ${await response.text()}`,
73
- )
74
- }
75
-
76
- return response
77
- }
78
-
79
- export async function textfetch(url: string, args?: RequestInit) {
80
- const response = await myfetch(url, args)
81
- return response.text()
82
- }
83
-
84
- export async function jsonfetch<T>(url: string, args?: RequestInit) {
85
- const response = await myfetch(url, args)
86
- return response.json() as T
87
- }
88
-
89
- export function timeout(time: number, signal?: AbortSignal) {
90
- return new Promise<void>((resolve, reject) => {
91
- if (signal?.aborted) {
92
- reject(new DOMException('Aborted', 'AbortError'))
93
- } else {
94
- const id = setTimeout(resolve, time)
95
- signal?.addEventListener('abort', () => {
96
- clearTimeout(id)
97
- reject(new DOMException('Aborted', 'AbortError'))
98
- })
99
- }
100
- })
101
- }
102
-
103
70
  export function isAbortError(e: unknown) {
104
71
  return e instanceof DOMException && e.name === 'AbortError'
105
72
  }
package/src/flatToTree.ts CHANGED
@@ -22,8 +22,7 @@ export function flatToTree(items: FlatItem[]): TreeNode {
22
22
  item.id,
23
23
  {
24
24
  id: `${item.id}`,
25
- // the label is what NCBI's own tree viewer shows; falling back to the
26
- // node id would render a tree of bare numbers
25
+ // NCBI's tree viewer shows the label
27
26
  name: item.label || `${item.id}`,
28
27
  ...(length !== undefined && Number.isFinite(length)
29
28
  ? { length }
@@ -19,3 +19,63 @@ const palettes = [
19
19
  ]
20
20
 
21
21
  export default palettes
22
+
23
+ /**
24
+ * Fixed categorical palettes a scale names. `ggplot` is not one of them: it is
25
+ * the ramp above, which picks its colors from the number of keys.
26
+ */
27
+ export const namedPalettes: Record<string, readonly string[]> = {
28
+ set1: [
29
+ '#e41a1c',
30
+ '#377eb8',
31
+ '#4daf4a',
32
+ '#984ea3',
33
+ '#ff7f00',
34
+ '#ffff33',
35
+ '#a65628',
36
+ '#f781bf',
37
+ '#999999',
38
+ ],
39
+ dark2: [
40
+ '#1b9e77',
41
+ '#d95f02',
42
+ '#7570b3',
43
+ '#e7298a',
44
+ '#66a61e',
45
+ '#e6ab02',
46
+ '#a6761d',
47
+ '#666666',
48
+ ],
49
+ // Okabe-Ito, which stays distinguishable under the common forms of color
50
+ // blindness
51
+ okabeito: [
52
+ '#e69f00',
53
+ '#56b4e9',
54
+ '#009e73',
55
+ '#f0e442',
56
+ '#0072b2',
57
+ '#d55e00',
58
+ '#cc79a7',
59
+ '#000000',
60
+ ],
61
+ tableau: [
62
+ '#4e79a7',
63
+ '#f28e2b',
64
+ '#e15759',
65
+ '#76b7b2',
66
+ '#59a14f',
67
+ '#edc948',
68
+ '#b07aa1',
69
+ '#ff9da7',
70
+ '#9c755f',
71
+ '#bab0ac',
72
+ ],
73
+ }
74
+
75
+ /**
76
+ * The colors a palette name asks for. `ggplot`, an unknown name, and no name at
77
+ * all give undefined, which `createPaletteMap` answers with the hue ramp.
78
+ */
79
+ export function paletteNamed(name?: string) {
80
+ return name === undefined ? undefined : namedPalettes[name]
81
+ }
package/src/hierarchy.ts CHANGED
@@ -25,6 +25,11 @@ export interface HierarchyNode<T = NodeWithIds> extends CoreHierarchyNode<T> {
25
25
  parent: HierarchyNode<T> | null
26
26
  x?: number
27
27
  y?: number
28
+ // the span of `x` over this node's subtree, set by clusterLayout. Leaves are
29
+ // laid out in order, so a subtree occupies one contiguous run of rows and a
30
+ // renderer can skip the whole thing when the run misses its block.
31
+ xMin?: number
32
+ xMax?: number
28
33
  len?: number
29
34
  depthToLeaf?: number
30
35
  _children?: HierarchyNode<T>[] | null
@@ -33,10 +38,8 @@ export interface HierarchyNode<T = NodeWithIds> extends CoreHierarchyNode<T> {
33
38
  collapsedTipXFar?: number
34
39
  }
35
40
 
36
- // The generic traversals live in @gmod/newick now, shared with the tree sidebar
37
- // in jbrowse-components. They are iterative there for the reason they were here:
38
- // a phylogenetic tree can be a caterpillar, whose depth equals its leaf count,
39
- // and the recursive form overflows the stack somewhere past 5000 tips.
41
+ // The @gmod/newick traversals are iterative: a caterpillar tree's depth equals
42
+ // its leaf count, and recursion overflows the stack past about 5000 tips.
40
43
  export {
41
44
  descendants,
42
45
  find,
@@ -49,11 +52,8 @@ export {
49
52
  }
50
53
  export type { HierarchyLink } from '@gmod/newick'
51
54
 
52
- // coreHierarchy builds base nodes, and the layout fields above are written onto
53
- // them afterwards by this package. Every one of those fields is optional, so the
54
- // two node types are mutually assignable and this needs no cast -- it exists
55
- // only to declare the wider return type, which is what lets those later
56
- // assignments typecheck.
55
+ // declares the wider return type so the layout code can assign the optional
56
+ // fields above onto coreHierarchy's nodes
57
57
  export function hierarchy<T>(
58
58
  data: T,
59
59
  childrenAccessor: (d: T) => T[] | undefined,
@@ -75,16 +75,26 @@ export function clusterLayout<T>(
75
75
  }
76
76
 
77
77
  // x of an internal node is the mean of its children's x, so process in
78
- // post-order (children before parents)
78
+ // post-order (children before parents). The subtree span comes from the same
79
+ // pass, for the block culls in the tree renderer.
79
80
  const nodes = descendants(root)
80
81
  for (let i = nodes.length - 1; i >= 0; i--) {
81
82
  const node = nodes[i]!
82
83
  if (node.children) {
83
84
  let sum = 0
85
+ let min = Infinity
86
+ let max = -Infinity
84
87
  for (const child of node.children) {
85
88
  sum += child.x!
89
+ min = Math.min(min, child.xMin!)
90
+ max = Math.max(max, child.xMax!)
86
91
  }
87
92
  node.x = sum / node.children.length
93
+ node.xMin = min
94
+ node.xMax = max
95
+ } else {
96
+ node.xMin = node.x
97
+ node.xMax = node.x
88
98
  }
89
99
  }
90
100
 
@@ -172,15 +182,9 @@ export function calcDepthToLeaf<T>(node: HierarchyNode<T>): number {
172
182
  return node.depthToLeaf!
173
183
  }
174
184
 
175
- export function findMaxBranchLen(node: HierarchyNode): number {
176
- let maxLen = 0
177
- for (const n of descendants(node)) {
178
- maxLen = Math.max(maxLen, n.len || 0)
179
- }
180
- return maxLen
181
- }
182
-
183
- // Max root-to-leaf sum of branch lengths within the subtree at d
185
+ // Max root-to-leaf sum of branch lengths within the subtree at d. Negative
186
+ // lengths are floored at zero, the same as setBrLength does when it lays the
187
+ // tree out, so the extent this reports is the one that gets drawn
184
188
  export function maxLength(d: HierarchyNode): number {
185
189
  const nodes = descendants(d)
186
190
  const pathLen = new Map<HierarchyNode, number>()
@@ -192,7 +196,7 @@ export function maxLength(d: HierarchyNode): number {
192
196
  childMax = Math.max(childMax, pathLen.get(child)!)
193
197
  }
194
198
  }
195
- pathLen.set(n, (n.data.length || 0) + childMax)
199
+ pathLen.set(n, Math.max(n.data.length || 0, 0) + childMax)
196
200
  }
197
201
  return pathLen.get(d)!
198
202
  }
@@ -210,3 +214,76 @@ export function setBrLength(d: HierarchyNode, y0: number, k: number) {
210
214
  }
211
215
  }
212
216
  }
217
+
218
+ /**
219
+ * Every leaf by name, with a name two leaves share mapping to undefined: a tip
220
+ * set naming it cannot say which tip it means.
221
+ */
222
+ export function leafIndex<T extends { name: string }>(root: HierarchyNode<T>) {
223
+ const index = new Map<string, HierarchyNode<T> | undefined>()
224
+ for (const leaf of leaves(root)) {
225
+ const { name } = leaf.data
226
+ index.set(name, index.has(name) ? undefined : leaf)
227
+ }
228
+ return index
229
+ }
230
+
231
+ /**
232
+ * The most recent common ancestor of a set of tip names, or undefined when a
233
+ * name is not a tip of this tree or names two of them.
234
+ *
235
+ * Each name lifts through `parent` to the ancestor the names before it share,
236
+ * so the walk holds two nodes. Recording a root-to-tip path per name instead
237
+ * costs the depth in memory per name, and a caterpillar tree's depth is its tip
238
+ * count. `index` is `leafIndex(root)`, which a caller resolving several tip
239
+ * sets against one tree builds once.
240
+ */
241
+ export function mrca<T extends { name: string }>(
242
+ root: HierarchyNode<T>,
243
+ names: string[],
244
+ index = leafIndex(root),
245
+ ) {
246
+ let node: HierarchyNode<T> | undefined
247
+ for (const name of names) {
248
+ let other = index.get(name)
249
+ if (!other) {
250
+ return undefined
251
+ }
252
+ if (!node) {
253
+ node = other
254
+ continue
255
+ }
256
+ while (node.depth > other.depth) {
257
+ node = node.parent!
258
+ }
259
+ while (other.depth > node.depth) {
260
+ other = other.parent!
261
+ }
262
+ while (node !== other) {
263
+ node = node.parent!
264
+ other = other.parent!
265
+ }
266
+ }
267
+ return node
268
+ }
269
+
270
+ /**
271
+ * The deepest node whose subtree covers a run of rows, given in the row-space
272
+ * coordinates clusterLayout writes to xMin/xMax. A subtree's leaves are one
273
+ * contiguous run, so at most one child per level covers the run and the descent
274
+ * visits the tree's depth rather than its nodes.
275
+ */
276
+ export function nodeCoveringRows<T>(
277
+ root: HierarchyNode<T>,
278
+ top: number,
279
+ bottom: number,
280
+ ) {
281
+ let node = root
282
+ for (;;) {
283
+ const child = node.children?.find(c => c.xMin! <= top && c.xMax! >= bottom)
284
+ if (!child) {
285
+ return node
286
+ }
287
+ node = child
288
+ }
289
+ }
package/src/index.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  // PUBLIC API — consumed by external JBrowse 2 plugins. Changing or removing any
2
2
  // export here is a breaking change for downstream repos:
3
- // - jbrowse-plugin-msaview (wraps MSAModelF + MSAView into a JBrowse view)
4
- // - jbrowse-plugin-protein3d (drives MSA<->structure hover/highlight sync)
3
+ // - jbrowse-plugin-msaview (wraps MSAModelF + MSAView into a JBrowse view)
4
+ // - jbrowse-plugin-tview (the same, for a tree-first view)
5
5
  // Those plugins also reach into the MsaViewModel instance at runtime; the model
6
6
  // members they rely on (e.g. mouseCol/setMousePos, setHighlightedColumns,
7
7
  // seqPosToVisibleCol/visibleColToSeqPos) are flagged inline in model.ts.
8
+ // jbrowse-plugin-protein3d no longer depends on this package at all: it reads
9
+ // the msaview plugin's model through a structural type of its own.
8
10
  export { renderToSvg } from './renderToSvg.tsx'
9
11
  export type { ExportSvgOptions } from './renderToSvg.tsx'
10
12
  // renderToSvg outside a browser needs DOM bits jsdom omits; react-msaview-cli
@@ -13,31 +15,69 @@ export {
13
15
  CHAR_WIDTH_RATIO,
14
16
  installHeadlessRenderEnv,
15
17
  } from './headlessRenderEnv.ts'
18
+ // the row count above which calculateNeighborJoiningTreeFromMSA throws, for
19
+ // hosts gating their own menu item
20
+ export { maxNeighborJoiningRows } from './constants.ts'
16
21
  export { default as MSAView } from './components/Loading.tsx'
17
22
  export { default as MSAViewer } from './components/MSAViewer.tsx'
23
+ export type { MSAViewerProps } from './components/MSAViewer.tsx'
24
+ export { mount } from './mount.tsx'
25
+ export { defineMsaElement } from './element.ts'
26
+ export { useMsaSvgFigure } from './useMsaSvgFigure.ts'
27
+ export type { MsaSvgFigure } from './useMsaSvgFigure.ts'
28
+ export type { MountedViewer } from './mount.tsx'
18
29
  export { type MsaViewModel, default as MSAModelF } from './model.ts'
19
30
  export type { MSAFormat, MSAParserType } from 'msa-parsers'
20
31
  export type { HierarchyNode } from './hierarchy.ts'
21
32
  // InterProScanResults is the EBI wire format that setDomains still accepts;
22
33
  // Annotation is the source-agnostic shape everything else is written against
23
34
  export type { InterProScanResults } from 'msa-parsers'
24
- // ColumnCounts, DomainBand and TidyDomainAnnotation surface in the inferred type
25
- // of the composed state model, so a downstream plugin cannot emit declarations
26
- // for its own stateModelFactory without being able to name them (TS2883).
27
- // jbrowse-plugin-msaview already re-exports MSAFormat for exactly this reason.
35
+ // ColumnCounts, ColumnStats, DomainBand and TidyDomainAnnotation surface in the
36
+ // inferred type of the composed state model, so a downstream plugin cannot emit
37
+ // declarations for its own stateModelFactory without being able to name them
38
+ // (TS2883). jbrowse-plugin-msaview already re-exports MSAFormat for exactly this
39
+ // reason.
28
40
  export type { ColumnCounts } from './columnCounts.ts'
41
+ export type { ColumnStats } from './columnStats.ts'
42
+ // the scale an encoding reads its field through, and what resolving one gives
43
+ export type { ResolvedScale, ScaleSpec } from './scales.ts'
29
44
  export type {
30
45
  Accession,
31
46
  Annotation,
47
+ Arc,
48
+ ArcSpec,
49
+ ArcTrackModel,
32
50
  BasicTrack,
33
51
  BasicTrackModel,
52
+ Cell,
53
+ Clade,
54
+ CladeMark,
34
55
  ColumnTrackSpec,
35
56
  DomainBand,
57
+ Encoding,
58
+ EncodingChannel,
36
59
  Highlight,
60
+ Legend,
61
+ LegendEntry,
37
62
  Node,
63
+ MappedStructure,
38
64
  NodeWithIds,
39
65
  NodeWithIdsAndLength,
66
+ Region,
67
+ ResidueEncoding,
68
+ ResidueMapping,
69
+ ResidueMappingProblem,
70
+ ResidueSegment,
71
+ ResolvedClade,
72
+ ResolvedEncoding,
40
73
  ResolvedHighlight,
74
+ ResolvedRowPanel,
75
+ RowPanelSpec,
76
+ RowResidue,
77
+ StructureResidue,
41
78
  TextTrackModel,
42
79
  TidyDomainAnnotation,
80
+ TrackKind,
81
+ UnshareableData,
82
+ Viewport,
43
83
  } from './types.ts'
@@ -1,5 +1,7 @@
1
1
  import { types } from '@jbrowse/mobx-state-tree'
2
2
 
3
+ import { maxInlineSnapshotBytes } from '../constants.ts'
4
+
3
5
  /**
4
6
  * #stateModel DataModel
5
7
  * the data stored for the model. this is sometimes temporary in the case that
@@ -54,13 +56,12 @@ export function DataModelF() {
54
56
  },
55
57
  }))
56
58
  .postProcessSnapshot(snap =>
57
- // a large document is dropped from the snapshot rather than inlined
58
- // into a session or a shared URL, and every field here holds one, so
59
- // the rule is the same for all of them
59
+ // drops any field over maxInlineSnapshotBytes; the parent model's
60
+ // `unshareableData` reports what was dropped
60
61
  Object.fromEntries(
61
62
  Object.entries(snap).map(([key, text]) => [
62
63
  key,
63
- text && text.length > 50_000 ? undefined : text,
64
+ text && text.length > maxInlineSnapshotBytes ? undefined : text,
64
65
  ]),
65
66
  ),
66
67
  )
@@ -31,8 +31,9 @@ export function MSAModelF() {
31
31
 
32
32
  /**
33
33
  * #property
34
- * show a per-column statistics tooltip (consensus, conservation, gaps,
35
- * residue distribution) while hovering the alignment
34
+ * show a tooltip with the hovered column's value for a track while
35
+ * hovering that track: the conservation scores, the logo's composition,
36
+ * an arc's partner columns
36
37
  */
37
38
  showColumnStats: stripDefault(types.boolean, defaultShowColumnStats),
38
39
 
@@ -3,9 +3,12 @@ import { types } from '@jbrowse/mobx-state-tree'
3
3
  import {
4
4
  defaultDrawLabels,
5
5
  defaultDrawNodeBubbles,
6
+ defaultDrawNodeLabels,
6
7
  defaultDrawTree,
7
8
  defaultLabelsAlignRight,
9
+ defaultOverviewHeight,
8
10
  defaultShowBranchLen,
11
+ defaultShowTreeOverview,
9
12
  defaultTreeAreaWidth,
10
13
  defaultTreeWidth,
11
14
  } from '../constants.ts'
@@ -60,6 +63,26 @@ export function TreeModelF() {
60
63
  */
61
64
  drawNodeBubbles: stripDefault(types.boolean, defaultDrawNodeBubbles),
62
65
 
66
+ /**
67
+ * #property
68
+ * draw the label a newick file gives an internal node, which is where a
69
+ * bootstrap or posterior support value lands
70
+ */
71
+ drawNodeLabels: stripDefault(types.boolean, defaultDrawNodeLabels),
72
+
73
+ /**
74
+ * #property
75
+ * draw the whole tree small above the tree panel, with the focused
76
+ * subtree boxed. A click on it focuses the subtree under the pointer
77
+ */
78
+ showTreeOverview: stripDefault(types.boolean, defaultShowTreeOverview),
79
+
80
+ /**
81
+ * #property
82
+ * height of the tree overview band, px
83
+ */
84
+ overviewHeight: stripDefault(types.number, defaultOverviewHeight),
85
+
63
86
  /**
64
87
  * #property
65
88
  * auto-size treeAreaWidth to fit the row labels (plus the tree, if drawn)
@@ -116,6 +139,25 @@ export function TreeModelF() {
116
139
  setDrawNodeBubbles(arg: boolean) {
117
140
  self.drawNodeBubbles = arg
118
141
  },
142
+ /**
143
+ * #action
144
+ */
145
+ setDrawNodeLabels(arg: boolean) {
146
+ self.drawNodeLabels = arg
147
+ },
148
+ /**
149
+ * #action
150
+ */
151
+ setShowTreeOverview(arg: boolean) {
152
+ self.showTreeOverview = arg
153
+ },
154
+ /**
155
+ * #action
156
+ * set the height of the tree overview band (px)
157
+ */
158
+ setOverviewHeight(n: number) {
159
+ self.overviewHeight = Math.round(n)
160
+ },
119
161
  /**
120
162
  * #action
121
163
  */