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.
- package/README.md +13 -11
- package/bundle/index.js +122 -112
- package/bundle/index.js.map +4 -4
- package/dist/colorSchemes.js +1 -2
- package/dist/colorSchemes.js.map +1 -1
- package/dist/columnStats.d.ts +28 -0
- package/dist/columnStats.js +34 -0
- package/dist/columnStats.js.map +1 -0
- package/dist/components/DragHandle.d.ts +3 -2
- package/dist/components/DragHandle.js +11 -5
- package/dist/components/DragHandle.js.map +1 -1
- package/dist/components/Loading.js +2 -2
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/MSAView.js +17 -6
- package/dist/components/MSAView.js.map +1 -1
- package/dist/components/MSAViewer.d.ts +69 -4
- package/dist/components/MSAViewer.js +201 -8
- package/dist/components/MSAViewer.js.map +1 -1
- package/dist/components/PortalTooltip.d.ts +11 -0
- package/dist/components/PortalTooltip.js +29 -0
- package/dist/components/PortalTooltip.js.map +1 -0
- package/dist/components/ResizeHandles.d.ts +3 -3
- package/dist/components/ResizeHandles.js +13 -24
- package/dist/components/ResizeHandles.js.map +1 -1
- package/dist/components/SequenceTextArea.js +3 -3
- package/dist/components/SequenceTextArea.js.map +1 -1
- package/dist/components/Track.js +41 -22
- package/dist/components/Track.js.map +1 -1
- package/dist/components/dialogs/{InterProScanDialog.d.ts → AnnotationFileDialog.d.ts} +2 -2
- package/dist/components/dialogs/AnnotationFileDialog.js +92 -0
- package/dist/components/dialogs/AnnotationFileDialog.js.map +1 -0
- package/dist/components/dialogs/ExportSVGDialog.js +5 -3
- package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
- package/dist/components/dialogs/FeatureDialog.js +13 -9
- package/dist/components/dialogs/FeatureDialog.js.map +1 -1
- package/dist/components/dialogs/TrackInfoDialog.js +1 -1
- package/dist/components/dialogs/TrackInfoDialog.js.map +1 -1
- package/dist/components/header/GappynessSlider.js +6 -11
- package/dist/components/header/GappynessSlider.js.map +1 -1
- package/dist/components/header/Header.js +7 -0
- package/dist/components/header/Header.js.map +1 -1
- package/dist/components/header/HeaderStatusArea.js +0 -2
- package/dist/components/header/HeaderStatusArea.js.map +1 -1
- package/dist/components/header/LoadWarnings.d.ts +6 -0
- package/dist/components/header/LoadWarnings.js +35 -0
- package/dist/components/header/LoadWarnings.js.map +1 -0
- package/dist/components/header/MultiAlignmentSelector.js +0 -0
- package/dist/components/header/MultiAlignmentSelector.js.map +1 -1
- package/dist/components/header/ScrollZoomIcons.d.ts +6 -0
- package/dist/components/header/ScrollZoomIcons.js +35 -0
- package/dist/components/header/ScrollZoomIcons.js.map +1 -0
- package/dist/components/header/TreeSettingsMenu.js +7 -1
- package/dist/components/header/TreeSettingsMenu.js.map +1 -1
- package/dist/components/header/UnshareableDataWarning.d.ts +6 -0
- package/dist/components/header/UnshareableDataWarning.js +40 -0
- package/dist/components/header/UnshareableDataWarning.js.map +1 -0
- package/dist/components/header/ZoomControls.js +49 -6
- package/dist/components/header/ZoomControls.js.map +1 -1
- package/dist/components/header/getAnnotationsMenu.js +11 -14
- package/dist/components/header/getAnnotationsMenu.js.map +1 -1
- package/dist/components/header/settingsMenuItems.js +10 -7
- package/dist/components/header/settingsMenuItems.js.map +1 -1
- package/dist/components/import/ImportForm.js +1 -1
- package/dist/components/import/ImportForm.js.map +1 -1
- package/dist/components/import/ImportFormExamples.js +2 -6
- package/dist/components/import/ImportFormExamples.js.map +1 -1
- package/dist/components/import/util.js +2 -0
- package/dist/components/import/util.js.map +1 -1
- package/dist/components/minimap/Minimap.js +1 -2
- package/dist/components/minimap/Minimap.js.map +1 -1
- package/dist/components/msa/AnnotationLegend.js +27 -19
- package/dist/components/msa/AnnotationLegend.js.map +1 -1
- package/dist/components/msa/MSACanvas.js +1 -1
- package/dist/components/msa/MSACanvas.js.map +1 -1
- package/dist/components/msa/MSACanvasBlock.js +17 -20
- package/dist/components/msa/MSACanvasBlock.js.map +1 -1
- package/dist/components/msa/MSAMouseoverCanvas.js +2 -1
- package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
- package/dist/components/msa/domainBandCursor.d.ts +7 -11
- package/dist/components/msa/domainBandCursor.js +7 -11
- package/dist/components/msa/domainBandCursor.js.map +1 -1
- package/dist/components/msa/drawFeatureSpans.d.ts +53 -0
- package/dist/components/msa/drawFeatureSpans.js +78 -0
- package/dist/components/msa/drawFeatureSpans.js.map +1 -0
- package/dist/components/msa/legendRows.d.ts +8 -0
- package/dist/components/msa/legendRows.js +16 -0
- package/dist/components/msa/legendRows.js.map +1 -0
- package/dist/components/msa/msaRaster.d.ts +30 -27
- package/dist/components/msa/msaRaster.js +193 -90
- package/dist/components/msa/msaRaster.js.map +1 -1
- package/dist/components/msa/packDomainLanes.d.ts +20 -0
- package/dist/components/msa/packDomainLanes.js +33 -0
- package/dist/components/msa/packDomainLanes.js.map +1 -0
- package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +3 -1
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js +51 -87
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
- package/dist/components/msa/renderHighlights.d.ts +44 -4
- package/dist/components/msa/renderHighlights.js +99 -11
- package/dist/components/msa/renderHighlights.js.map +1 -1
- package/dist/components/msa/renderMSABlock.d.ts +1 -2
- package/dist/components/msa/renderMSABlock.js +28 -31
- package/dist/components/msa/renderMSABlock.js.map +1 -1
- package/dist/components/msa/renderMSAMouseover.js +9 -30
- package/dist/components/msa/renderMSAMouseover.js.map +1 -1
- package/dist/components/msa/tileColor.js +4 -7
- package/dist/components/msa/tileColor.js.map +1 -1
- package/dist/components/msa/useMsaBlockMouse.d.ts +5 -3
- package/dist/components/msa/useMsaBlockMouse.js +6 -6
- package/dist/components/msa/useMsaBlockMouse.js.map +1 -1
- package/dist/components/renderCtx.d.ts +1 -1
- package/dist/components/rowpanels/RowPanelBlock.d.ts +9 -0
- package/dist/components/rowpanels/RowPanelBlock.js +86 -0
- package/dist/components/rowpanels/RowPanelBlock.js.map +1 -0
- package/dist/components/rowpanels/RowPanelHeaders.d.ts +12 -0
- package/dist/components/rowpanels/RowPanelHeaders.js +38 -0
- package/dist/components/rowpanels/RowPanelHeaders.js.map +1 -0
- package/dist/components/{msa/ColumnStats.d.ts → rowpanels/RowPanels.d.ts} +2 -2
- package/dist/components/rowpanels/RowPanels.js +32 -0
- package/dist/components/rowpanels/RowPanels.js.map +1 -0
- package/dist/components/rowpanels/headerLayout.d.ts +1 -0
- package/dist/components/rowpanels/headerLayout.js +5 -0
- package/dist/components/rowpanels/headerLayout.js.map +1 -0
- package/dist/components/rowpanels/renderFeaturePanel.d.ts +21 -0
- package/dist/components/rowpanels/renderFeaturePanel.js +37 -0
- package/dist/components/rowpanels/renderFeaturePanel.js.map +1 -0
- package/dist/components/rowpanels/renderRowPanel.d.ts +23 -0
- package/dist/components/rowpanels/renderRowPanel.js +22 -0
- package/dist/components/rowpanels/renderRowPanel.js.map +1 -0
- package/dist/components/rowpanels/renderStrip.d.ts +20 -0
- package/dist/components/rowpanels/renderStrip.js +26 -0
- package/dist/components/rowpanels/renderStrip.js.map +1 -0
- package/dist/components/tracks/TrackBlocks.js +13 -16
- package/dist/components/tracks/TrackBlocks.js.map +1 -1
- package/dist/components/tracks/TrackTooltipContent.d.ts +15 -0
- package/dist/components/tracks/TrackTooltipContent.js +109 -0
- package/dist/components/tracks/TrackTooltipContent.js.map +1 -0
- package/dist/components/tracks/drawTracks.d.ts +30 -12
- package/dist/components/tracks/drawTracks.js +127 -34
- package/dist/components/tracks/drawTracks.js.map +1 -1
- package/dist/components/tracks/useTrackHover.d.ts +22 -0
- package/dist/components/tracks/useTrackHover.js +30 -0
- package/dist/components/tracks/useTrackHover.js.map +1 -0
- package/dist/components/tree/CladeLabels.d.ts +12 -0
- package/dist/components/tree/CladeLabels.js +48 -0
- package/dist/components/tree/CladeLabels.js.map +1 -0
- package/dist/components/tree/TreeCanvas.js +6 -4
- package/dist/components/tree/TreeCanvas.js.map +1 -1
- package/dist/components/tree/TreeCanvasBlock.js +6 -21
- package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
- package/dist/components/tree/TreeOverview.d.ts +14 -0
- package/dist/components/tree/TreeOverview.js +75 -0
- package/dist/components/tree/TreeOverview.js.map +1 -0
- package/dist/components/tree/TreeRuler.js +11 -5
- package/dist/components/tree/TreeRuler.js.map +1 -1
- package/dist/components/tree/cladeBrackets.d.ts +25 -0
- package/dist/components/tree/cladeBrackets.js +51 -0
- package/dist/components/tree/cladeBrackets.js.map +1 -0
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +2 -2
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
- package/dist/components/tree/renderTreeCanvas.d.ts +0 -1
- package/dist/components/tree/renderTreeCanvas.js +221 -47
- package/dist/components/tree/renderTreeCanvas.js.map +1 -1
- package/dist/components/tree/renderTreeOverview.d.ts +52 -0
- package/dist/components/tree/renderTreeOverview.js +138 -0
- package/dist/components/tree/renderTreeOverview.js.map +1 -0
- package/dist/components/tree/scaleBar.d.ts +10 -0
- package/dist/components/tree/scaleBar.js +24 -0
- package/dist/components/tree/scaleBar.js.map +1 -0
- package/dist/components/tree/useTreeHover.js +2 -4
- package/dist/components/tree/useTreeHover.js.map +1 -1
- package/dist/constants.d.ts +18 -1
- package/dist/constants.js +51 -8
- package/dist/constants.js.map +1 -1
- package/dist/createPaletteMap.d.ts +7 -6
- package/dist/createPaletteMap.js +10 -9
- package/dist/createPaletteMap.js.map +1 -1
- package/dist/element.d.ts +13 -0
- package/dist/element.js +269 -0
- package/dist/element.js.map +1 -0
- package/dist/featureFields.d.ts +11 -0
- package/dist/featureFields.js +17 -0
- package/dist/featureFields.js.map +1 -0
- package/dist/fetchUtils.d.ts +7 -7
- package/dist/fetchUtils.js +4 -32
- package/dist/fetchUtils.js.map +1 -1
- package/dist/flatToTree.js +1 -2
- package/dist/flatToTree.js.map +1 -1
- package/dist/ggplotPalettes.d.ts +10 -0
- package/dist/ggplotPalettes.js +58 -0
- package/dist/ggplotPalettes.js.map +1 -1
- package/dist/hierarchy.d.ts +29 -1
- package/dist/hierarchy.js +82 -19
- package/dist/hierarchy.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/model/DataModel.js +4 -4
- package/dist/model/DataModel.js.map +1 -1
- package/dist/model/msaModel.d.ts +3 -2
- package/dist/model/msaModel.js +3 -2
- package/dist/model/msaModel.js.map +1 -1
- package/dist/model/treeModel.d.ts +30 -0
- package/dist/model/treeModel.js +37 -1
- package/dist/model/treeModel.js.map +1 -1
- package/dist/model.d.ts +792 -259
- package/dist/model.js +2092 -675
- package/dist/model.js.map +1 -1
- package/dist/mount.d.ts +11 -0
- package/dist/mount.js +22 -0
- package/dist/mount.js.map +1 -0
- package/dist/neighborJoining.js +8 -32
- package/dist/neighborJoining.js.map +1 -1
- package/dist/renderToStaticMarkup.d.ts +15 -13
- package/dist/renderToStaticMarkup.js +37 -25
- package/dist/renderToStaticMarkup.js.map +1 -1
- package/dist/renderToSvg.js +198 -68
- package/dist/renderToSvg.js.map +1 -1
- package/dist/rowCoordinateCalculations.d.ts +26 -28
- package/dist/rowCoordinateCalculations.js +13 -39
- package/dist/rowCoordinateCalculations.js.map +1 -1
- package/dist/scales.d.ts +22 -0
- package/dist/scales.js +30 -0
- package/dist/scales.js.map +1 -0
- package/dist/seqPosToGlobalCol.d.ts +2 -3
- package/dist/seqPosToGlobalCol.js +5 -4
- package/dist/seqPosToGlobalCol.js.map +1 -1
- package/dist/sequenceLogo.d.ts +6 -11
- package/dist/sequenceLogo.js +6 -11
- package/dist/sequenceLogo.js.map +1 -1
- package/dist/stripDefault.d.ts +7 -14
- package/dist/stripDefault.js +7 -14
- package/dist/stripDefault.js.map +1 -1
- package/dist/svgTestUtil.d.ts +306 -124
- package/dist/types.d.ts +295 -3
- package/dist/umd.d.ts +2 -0
- package/dist/umd.js +4 -2
- package/dist/umd.js.map +1 -1
- package/dist/useCanvasAutorun.d.ts +5 -10
- package/dist/useCanvasAutorun.js +5 -10
- package/dist/useCanvasAutorun.js.map +1 -1
- package/dist/useMsaSvgFigure.d.ts +20 -0
- package/dist/useMsaSvgFigure.js +46 -0
- package/dist/useMsaSvgFigure.js.map +1 -0
- package/dist/util.d.ts +10 -4
- package/dist/util.js +37 -10
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/wuss.d.ts +14 -0
- package/dist/wuss.js +55 -0
- package/dist/wuss.js.map +1 -0
- package/package.json +23 -14
- package/src/colorSchemes.ts +1 -2
- package/src/columnStats.ts +58 -0
- package/src/components/DragHandle.tsx +18 -7
- package/src/components/Loading.tsx +14 -8
- package/src/components/MSAView.tsx +19 -5
- package/src/components/MSAViewer.tsx +326 -10
- package/src/components/PortalTooltip.tsx +47 -0
- package/src/components/ResizeHandles.tsx +21 -36
- package/src/components/SequenceTextArea.tsx +3 -3
- package/src/components/Track.tsx +55 -18
- package/src/components/dialogs/AnnotationFileDialog.tsx +162 -0
- package/src/components/dialogs/ExportSVGDialog.tsx +7 -2
- package/src/components/dialogs/FeatureDialog.tsx +13 -9
- package/src/components/dialogs/TrackInfoDialog.tsx +1 -1
- package/src/components/header/GappynessSlider.tsx +6 -11
- package/src/components/header/Header.tsx +10 -0
- package/src/components/header/HeaderStatusArea.tsx +0 -5
- package/src/components/header/LoadWarnings.tsx +48 -0
- package/src/components/header/MultiAlignmentSelector.tsx +0 -0
- package/src/components/header/ScrollZoomIcons.tsx +52 -0
- package/src/components/header/TreeSettingsMenu.tsx +7 -1
- package/src/components/header/UnshareableDataWarning.tsx +56 -0
- package/src/components/header/ZoomControls.tsx +74 -14
- package/src/components/header/getAnnotationsMenu.ts +13 -17
- package/src/components/header/settingsMenuItems.ts +11 -6
- package/src/components/import/ImportForm.tsx +2 -2
- package/src/components/import/ImportFormExamples.tsx +4 -8
- package/src/components/import/util.ts +2 -0
- package/src/components/minimap/Minimap.tsx +1 -2
- package/src/components/msa/AnnotationLegend.tsx +48 -38
- package/src/components/msa/MSACanvas.tsx +3 -5
- package/src/components/msa/MSACanvasBlock.tsx +17 -21
- package/src/components/msa/MSAMouseoverCanvas.tsx +2 -1
- package/src/components/msa/domainBandCursor.ts +7 -11
- package/src/components/msa/drawFeatureSpans.ts +150 -0
- package/src/components/msa/legendRows.ts +24 -0
- package/src/components/msa/msaRaster.ts +236 -88
- package/src/components/msa/packDomainLanes.ts +36 -0
- package/src/components/msa/renderBoxFeatureCanvasBlock.ts +69 -123
- package/src/components/msa/renderHighlights.ts +141 -10
- package/src/components/msa/renderMSABlock.ts +29 -38
- package/src/components/msa/renderMSAMouseover.ts +9 -39
- package/src/components/msa/tileColor.ts +4 -7
- package/src/components/msa/useMsaBlockMouse.ts +6 -6
- package/src/components/renderCtx.ts +1 -0
- package/src/components/rowpanels/RowPanelBlock.tsx +139 -0
- package/src/components/rowpanels/RowPanelHeaders.tsx +57 -0
- package/src/components/rowpanels/RowPanels.tsx +77 -0
- package/src/components/rowpanels/headerLayout.ts +5 -0
- package/src/components/rowpanels/renderFeaturePanel.ts +66 -0
- package/src/components/rowpanels/renderRowPanel.ts +41 -0
- package/src/components/rowpanels/renderStrip.ts +46 -0
- package/src/components/tracks/TrackBlocks.tsx +13 -18
- package/src/components/tracks/TrackTooltipContent.tsx +156 -0
- package/src/components/tracks/drawTracks.ts +169 -38
- package/src/components/tracks/useTrackHover.ts +42 -0
- package/src/components/tree/CladeLabels.tsx +77 -0
- package/src/components/tree/TreeCanvas.tsx +4 -3
- package/src/components/tree/TreeCanvasBlock.tsx +10 -32
- package/src/components/tree/TreeOverview.tsx +106 -0
- package/src/components/tree/TreeRuler.tsx +29 -5
- package/src/components/tree/cladeBrackets.ts +73 -0
- package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +2 -2
- package/src/components/tree/renderTreeCanvas.ts +312 -48
- package/src/components/tree/renderTreeOverview.ts +212 -0
- package/src/components/tree/scaleBar.ts +23 -0
- package/src/components/tree/useTreeHover.ts +2 -4
- package/src/constants.ts +61 -8
- package/src/createPaletteMap.ts +10 -9
- package/src/element.ts +321 -0
- package/src/featureFields.ts +19 -0
- package/src/fetchUtils.ts +7 -40
- package/src/flatToTree.ts +1 -2
- package/src/ggplotPalettes.ts +60 -0
- package/src/hierarchy.ts +97 -20
- package/src/index.ts +46 -6
- package/src/model/DataModel.ts +5 -4
- package/src/model/msaModel.ts +3 -2
- package/src/model/treeModel.ts +42 -0
- package/src/model.ts +2492 -793
- package/src/mount.tsx +32 -0
- package/src/neighborJoining.ts +8 -32
- package/src/rawImports.d.ts +9 -0
- package/src/renderToStaticMarkup.ts +41 -25
- package/src/renderToSvg.tsx +365 -92
- package/src/rowCoordinateCalculations.ts +16 -62
- package/src/scales.ts +47 -0
- package/src/seqPosToGlobalCol.ts +5 -4
- package/src/sequenceLogo.ts +6 -11
- package/src/stripDefault.ts +7 -14
- package/src/types.ts +352 -12
- package/src/umd.ts +4 -2
- package/src/useCanvasAutorun.ts +5 -10
- package/src/useMsaSvgFigure.ts +72 -0
- package/src/util.ts +40 -14
- package/src/version.ts +1 -1
- package/src/wuss.ts +62 -0
- package/dist/components/dialogs/InterProScanDialog.js +0 -137
- package/dist/components/dialogs/InterProScanDialog.js.map +0 -1
- package/dist/components/dialogs/InterProScanFileDialog.d.ts +0 -7
- package/dist/components/dialogs/InterProScanFileDialog.js +0 -64
- package/dist/components/dialogs/InterProScanFileDialog.js.map +0 -1
- package/dist/components/msa/ColumnStats.js +0 -42
- package/dist/components/msa/ColumnStats.js.map +0 -1
- package/dist/launchInterProScan.d.ts +0 -13
- package/dist/launchInterProScan.js +0 -110
- package/dist/launchInterProScan.js.map +0 -1
- package/dist/useColorContrast.d.ts +0 -10
- package/dist/useColorContrast.js +0 -13
- package/dist/useColorContrast.js.map +0 -1
- package/src/clustalX.test.ts +0 -74
- package/src/colSpace.test.ts +0 -67
- package/src/collapseLogic.test.ts +0 -115
- package/src/colorSchemes.docs.test.ts +0 -57
- package/src/columnCounts.test.ts +0 -73
- package/src/columnStats.test.ts +0 -94
- package/src/columnTracks.test.ts +0 -97
- package/src/components/dialogs/InterProScanDialog.tsx +0 -214
- package/src/components/dialogs/InterProScanFileDialog.tsx +0 -138
- package/src/components/minimap/minimapLayout.test.ts +0 -71
- package/src/components/msa/ColumnStats.tsx +0 -54
- package/src/components/msa/msaRaster.test.ts +0 -145
- package/src/components/msa/renderBoxFeatureCanvasBlock.test.ts +0 -51
- package/src/components/tree/renderTreeCanvas.test.ts +0 -296
- package/src/dataInitialized.test.ts +0 -42
- package/src/domainBands.test.ts +0 -122
- package/src/domainLetterColor.test.ts +0 -80
- package/src/exportFileName.test.ts +0 -40
- package/src/fetchUtils.test.ts +0 -83
- package/src/flatToTree.test.ts +0 -51
- package/src/hierarchy.test.ts +0 -228
- package/src/highlights.test.ts +0 -70
- package/src/impgRender.test.tsx +0 -68
- package/src/largeTree.test.ts +0 -67
- package/src/launchInterProScan.ts +0 -167
- package/src/loadErrorDisplay.test.tsx +0 -102
- package/src/modelFilehandleLoaders.test.ts +0 -137
- package/src/modelReset.test.ts +0 -120
- package/src/neighborJoining.test.ts +0 -164
- package/src/parseAsn1.test.ts +0 -36
- package/src/propertyConservation.test.ts +0 -36
- package/src/renderColumnTracksSvg.test.tsx +0 -108
- package/src/renderDomainsSvg.test.tsx +0 -118
- package/src/renderHighlightsSvg.test.tsx +0 -85
- package/src/renderMinimapSvg.test.tsx +0 -62
- package/src/renderRasterSvg.test.tsx +0 -144
- package/src/renderSequenceLogoSvg.test.tsx +0 -165
- package/src/renderToSvg.test.tsx +0 -65
- package/src/reset.test.ts +0 -61
- package/src/rowCoordinateCalculations.test.ts +0 -211
- package/src/rowSpace.test.ts +0 -46
- package/src/segmentOverlay.test.ts +0 -70
- package/src/seqPosToGlobalCol.test.ts +0 -59
- package/src/sequenceLogo.test.ts +0 -88
- package/src/setFontSize.test.ts +0 -33
- package/src/stripDefault.test.ts +0 -48
- package/src/stripDefaultSnapshot.test.ts +0 -87
- package/src/treeMetadata.test.ts +0 -39
- package/src/useCanvasAutorun.test.tsx +0 -98
- package/src/useColorContrast.ts +0 -18
- package/src/viewChrome.test.tsx +0 -134
- package/src/wheelZoom.test.ts +0 -46
package/src/mount.tsx
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import { createRoot } from 'react-dom/client'
|
|
4
|
+
|
|
5
|
+
import MSAViewer from './components/MSAViewer.tsx'
|
|
6
|
+
|
|
7
|
+
import type { MSAViewerProps } from './components/MSAViewer.tsx'
|
|
8
|
+
|
|
9
|
+
export interface MountedViewer {
|
|
10
|
+
/** merge new props over the current ones */
|
|
11
|
+
update: (props: Partial<MSAViewerProps>) => void
|
|
12
|
+
destroy: () => void
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Render MSAViewer into an element, for a host that is not a React app: a
|
|
17
|
+
* script tag, an R htmlwidget, a notebook widget, a custom element.
|
|
18
|
+
*/
|
|
19
|
+
export function mount(el: HTMLElement, props: MSAViewerProps): MountedViewer {
|
|
20
|
+
const root = createRoot(el)
|
|
21
|
+
let current = props
|
|
22
|
+
root.render(<MSAViewer {...current} />)
|
|
23
|
+
return {
|
|
24
|
+
update(next) {
|
|
25
|
+
current = { ...current, ...next }
|
|
26
|
+
root.render(<MSAViewer {...current} />)
|
|
27
|
+
},
|
|
28
|
+
destroy() {
|
|
29
|
+
root.unmount()
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/neighborJoining.ts
CHANGED
|
@@ -35,11 +35,8 @@ const NUM_SYMBOLS = BLOSUM62_KEYS.length
|
|
|
35
35
|
const BLOSUM62 = Int8Array.from(BLOSUM62_DATA.flat())
|
|
36
36
|
|
|
37
37
|
// charCode -> row/column in BLOSUM62, -1 for anything the matrix does not name.
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
// lookups, and on a 120x800 alignment the Map form spent nearly all of its time
|
|
41
|
-
// allocating one-character strings in toUpperCase: 2.6s to build a tree, versus
|
|
42
|
-
// 0.34s here for a byte-identical newick.
|
|
38
|
+
// On a 120x800 alignment a Map keyed by upper-cased character took 2.6s to
|
|
39
|
+
// build a tree, against 0.34s for this table.
|
|
43
40
|
const symbolOfCode = new Int8Array(128).fill(-1)
|
|
44
41
|
for (let i = 0; i < NUM_SYMBOLS; i++) {
|
|
45
42
|
const key = BLOSUM62_KEYS[i]!
|
|
@@ -50,10 +47,7 @@ for (let i = 0; i < NUM_SYMBOLS; i++) {
|
|
|
50
47
|
// gap, or past the end of a row shorter than the alignment
|
|
51
48
|
const GAP = -2
|
|
52
49
|
|
|
53
|
-
// stockholm and a3m write gaps as '.'
|
|
54
|
-
// charges the pair the unknown-symbol penalty on every padded column, so two
|
|
55
|
-
// sequences that differ only in where an unrelated row forced padding come out
|
|
56
|
-
// as divergent.
|
|
50
|
+
// stockholm and a3m also write gaps as '.'
|
|
57
51
|
function symbolAt(seq: string, i: number) {
|
|
58
52
|
if (i >= seq.length) {
|
|
59
53
|
return GAP
|
|
@@ -71,10 +65,8 @@ function blosumScore(a: number, b: number) {
|
|
|
71
65
|
}
|
|
72
66
|
|
|
73
67
|
function computePairwiseDistance(seq1: string, seq2: string) {
|
|
74
|
-
//
|
|
75
|
-
//
|
|
76
|
-
// remainder, the same rule the model's `blanks` getter applies. Requiring
|
|
77
|
-
// equal lengths here instead made "build tree from MSA" throw on those files.
|
|
68
|
+
// a3m and hand-edited fasta produce short rows; past its end a row counts as
|
|
69
|
+
// gapped, as in the model's `blanks` getter
|
|
78
70
|
const len = Math.max(seq1.length, seq2.length)
|
|
79
71
|
let compared = 0
|
|
80
72
|
let totalScore = 0
|
|
@@ -103,17 +95,14 @@ function computePairwiseDistance(seq1: string, seq2: string) {
|
|
|
103
95
|
return 1
|
|
104
96
|
}
|
|
105
97
|
|
|
106
|
-
// Convert similarity to distance using normalized BLOSUM62 score
|
|
107
|
-
// Higher scores mean more similar, so we invert
|
|
108
98
|
if (maxPossibleScore <= 0) {
|
|
109
99
|
return 1
|
|
110
100
|
}
|
|
111
101
|
|
|
112
102
|
const normalizedScore = totalScore / maxPossibleScore
|
|
113
|
-
// Clamp to valid range and convert to distance
|
|
114
103
|
const clampedScore = Math.max(0.01, Math.min(1, normalizedScore))
|
|
115
104
|
|
|
116
|
-
//
|
|
105
|
+
// Kimura-like correction: d = -ln(similarity)
|
|
117
106
|
return -Math.log(clampedScore)
|
|
118
107
|
}
|
|
119
108
|
|
|
@@ -160,7 +149,6 @@ function neighborJoining(distances: number[][], names: string[]): NJNode {
|
|
|
160
149
|
}
|
|
161
150
|
}
|
|
162
151
|
|
|
163
|
-
// Work with copies that we'll modify
|
|
164
152
|
const D: number[][] = []
|
|
165
153
|
for (let i = 0; i < n; i++) {
|
|
166
154
|
D[i] = [...distances[i]!]
|
|
@@ -170,7 +158,6 @@ function neighborJoining(distances: number[][], names: string[]): NJNode {
|
|
|
170
158
|
let remaining = n
|
|
171
159
|
|
|
172
160
|
while (remaining > 2) {
|
|
173
|
-
// Find active indices
|
|
174
161
|
const active: number[] = []
|
|
175
162
|
for (let i = 0; i < nodes.length; i++) {
|
|
176
163
|
if (nodes[i] !== undefined) {
|
|
@@ -178,7 +165,6 @@ function neighborJoining(distances: number[][], names: string[]): NJNode {
|
|
|
178
165
|
}
|
|
179
166
|
}
|
|
180
167
|
|
|
181
|
-
// Compute r values (sum of distances for each node)
|
|
182
168
|
const r = new Map<number, number>()
|
|
183
169
|
for (const i of active) {
|
|
184
170
|
let sum = 0
|
|
@@ -190,7 +176,6 @@ function neighborJoining(distances: number[][], names: string[]): NJNode {
|
|
|
190
176
|
r.set(i, sum)
|
|
191
177
|
}
|
|
192
178
|
|
|
193
|
-
// Find pair with minimum Q value
|
|
194
179
|
let minQ = Infinity
|
|
195
180
|
let minI = -1
|
|
196
181
|
let minJ = -1
|
|
@@ -209,21 +194,16 @@ function neighborJoining(distances: number[][], names: string[]): NJNode {
|
|
|
209
194
|
}
|
|
210
195
|
}
|
|
211
196
|
|
|
212
|
-
// Calculate branch lengths
|
|
213
197
|
const dij = D[minI]![minJ]!
|
|
214
198
|
const ri = r.get(minI)!
|
|
215
199
|
const rj = r.get(minJ)!
|
|
216
200
|
|
|
217
|
-
// remaining is always > 2 inside this loop; the final two nodes are
|
|
218
|
-
// connected after it
|
|
219
201
|
let limbI = dij / 2 + (ri - rj) / (2 * (remaining - 2))
|
|
220
202
|
let limbJ = dij - limbI
|
|
221
203
|
|
|
222
|
-
// Ensure non-negative branch lengths
|
|
223
204
|
limbI = Math.max(0, limbI)
|
|
224
205
|
limbJ = Math.max(0, limbJ)
|
|
225
206
|
|
|
226
|
-
// Create new node
|
|
227
207
|
const newNode: NJNode = {
|
|
228
208
|
left: nodes[minI],
|
|
229
209
|
right: nodes[minJ],
|
|
@@ -231,7 +211,7 @@ function neighborJoining(distances: number[][], names: string[]): NJNode {
|
|
|
231
211
|
rightLength: limbJ,
|
|
232
212
|
}
|
|
233
213
|
|
|
234
|
-
//
|
|
214
|
+
// the merged node reuses minI's slot
|
|
235
215
|
for (const k of active) {
|
|
236
216
|
if (k !== minI && k !== minJ) {
|
|
237
217
|
const newDist = (D[minI]![k]! + D[minJ]![k]! - dij) / 2
|
|
@@ -240,14 +220,12 @@ function neighborJoining(distances: number[][], names: string[]): NJNode {
|
|
|
240
220
|
}
|
|
241
221
|
}
|
|
242
222
|
|
|
243
|
-
// Mark minJ as removed
|
|
244
223
|
nodes[minJ] = undefined
|
|
245
224
|
nodes[minI] = newNode
|
|
246
225
|
|
|
247
226
|
remaining--
|
|
248
227
|
}
|
|
249
228
|
|
|
250
|
-
// Connect final two nodes
|
|
251
229
|
const finalActive: number[] = []
|
|
252
230
|
for (let i = 0; i < nodes.length; i++) {
|
|
253
231
|
if (nodes[i] !== undefined) {
|
|
@@ -276,9 +254,7 @@ function withBranchLength(newick: string, branchLength?: number) {
|
|
|
276
254
|
: `${newick}:${branchLength.toFixed(6)}`
|
|
277
255
|
}
|
|
278
256
|
|
|
279
|
-
//
|
|
280
|
-
// be a caterpillar of depth ~N, so recursion risks a stack overflow on large
|
|
281
|
-
// alignments (matching the iterative-traversal convention in hierarchy.ts).
|
|
257
|
+
// iterative: an NJ tree of N leaves can be a caterpillar of depth ~N
|
|
282
258
|
function nodeToNewick(root: NJNode): string {
|
|
283
259
|
const postOrder: NJNode[] = []
|
|
284
260
|
const stack: NJNode[] = [root]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Vite resolves a `?raw` import to the file's text. The lib does not build with
|
|
2
|
+
// Vite, but realResidueMapping.test.ts reads the examples package's alignment
|
|
3
|
+
// files that way (they are files, not string constants), so tsc has to be told
|
|
4
|
+
// what the suffix means. tsconfig.build.json excludes this, and tsc emits
|
|
5
|
+
// nothing for a .d.ts anyway, so it stays out of the published types.
|
|
6
|
+
declare module '*?raw' {
|
|
7
|
+
const content: string
|
|
8
|
+
export default content
|
|
9
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { colord } from 'colord'
|
|
1
2
|
import { flushSync } from 'react-dom'
|
|
2
3
|
import { createRoot } from 'react-dom/client'
|
|
3
4
|
|
|
@@ -6,19 +7,11 @@ import type React from 'react'
|
|
|
6
7
|
/**
|
|
7
8
|
* Render a React element to a static markup string, for the SVG export.
|
|
8
9
|
*
|
|
9
|
-
* Inlined
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* never renders. The export path is the only caller, so nothing here or in
|
|
15
|
-
* jbrowse-plugin-msaview/-tview failed to build, lint, typecheck, or boot; the
|
|
16
|
-
* published 3.4.0 and 2.2.1 bundles simply threw the first time a user asked
|
|
17
|
-
* for an SVG on a v5 host.
|
|
18
|
-
*
|
|
19
|
-
* A rendering library asking its host for a renderer was the odd coupling. Both
|
|
20
|
-
* `react-dom` and `react-dom/client` are long-established host externals, so
|
|
21
|
-
* this costs a few hundred bytes in the plugin bundle and no duplicate react.
|
|
10
|
+
* Inlined because core removed `renderToStaticMarkup` from the
|
|
11
|
+
* `@jbrowse/core/util` barrel in jbrowse-components 0d034e2bd8; see the
|
|
12
|
+
* `@jbrowse/core` note in CLAUDE.md. `react-dom` and `react-dom/client` are
|
|
13
|
+
* host externals, so this adds a few hundred bytes to the plugin bundle and no
|
|
14
|
+
* duplicate react.
|
|
22
15
|
*/
|
|
23
16
|
export function renderToStaticMarkup(node: React.ReactElement) {
|
|
24
17
|
const div = document.createElement('div')
|
|
@@ -30,18 +23,41 @@ export function renderToStaticMarkup(node: React.ReactElement) {
|
|
|
30
23
|
})
|
|
31
24
|
html = div.innerHTML
|
|
32
25
|
} finally {
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
// model and re-rendering into a dead div on every pan and zoom, once per
|
|
37
|
-
// export ever taken. The markup is a string by here and needs no DOM.
|
|
26
|
+
// effects run in a client root, so every `observer` holds a MobX reaction;
|
|
27
|
+
// a mounted export of a large alignment would keep tens of thousands of
|
|
28
|
+
// detached nodes re-rendering on every pan and zoom
|
|
38
29
|
root.unmount()
|
|
39
30
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
31
|
+
return html
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const tag = /<[a-zA-Z][^>]*>/g
|
|
35
|
+
const colorAttr = /\b(fill|stroke|stop-color)="([^"]+)"/g
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Rewrites every color an SVG 1.1 presentation attribute cannot hold.
|
|
39
|
+
*
|
|
40
|
+
* `fill`, `stroke` and `stop-color` take a keyword, a hex triplet or rgb(). MUI
|
|
41
|
+
* palette values use rgba() and the percent-identity scheme uses hsl(), and
|
|
42
|
+
* Illustrator and older Inkscape drop an element whose fill they cannot parse.
|
|
43
|
+
* Alpha moves to the matching -opacity attribute unless the element already
|
|
44
|
+
* carries one.
|
|
45
|
+
*/
|
|
46
|
+
export function svgSafeColors(html: string) {
|
|
47
|
+
return html.replaceAll(tag, el =>
|
|
48
|
+
el.replaceAll(colorAttr, (match, attr: string, value: string) => {
|
|
49
|
+
if (!/^(rgba|hsl)/i.test(value)) {
|
|
50
|
+
return match
|
|
51
|
+
}
|
|
52
|
+
const color = colord(value)
|
|
53
|
+
if (!color.isValid()) {
|
|
54
|
+
return match
|
|
55
|
+
}
|
|
56
|
+
const alpha = color.alpha()
|
|
57
|
+
const hex = color.alpha(1).toHex()
|
|
58
|
+
return alpha === 1 || el.includes(`${attr}-opacity=`)
|
|
59
|
+
? `${attr}="${hex}"`
|
|
60
|
+
: `${attr}="${hex}" ${attr}-opacity="${alpha}"`
|
|
61
|
+
}),
|
|
62
|
+
)
|
|
47
63
|
}
|