higlass 1.13.5 → 2.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 +48 -54
- package/app/globals.d.ts +1 -1
- package/app/missing-types.d.ts +4 -1
- package/app/scripts/AddTrackDialog.jsx +11 -4
- package/app/scripts/AddTrackPositionMenu.jsx +28 -7
- package/app/scripts/Annotations1dTrack.js +90 -251
- package/app/scripts/Annotations2dTrack.js +12 -7
- package/app/scripts/Autocomplete.jsx +13 -28
- package/app/scripts/AxisPixi.js +6 -10
- package/app/scripts/BarTrack.js +3 -3
- package/app/scripts/BedLikeTrack.js +556 -449
- package/app/scripts/Button.jsx +1 -1
- package/app/scripts/CNVIntervalTrack.js +1 -1
- package/app/scripts/CenterTrack.jsx +8 -7
- package/app/scripts/Chromosome2DAnnotations.js +1 -1
- package/app/scripts/Chromosome2DLabels.js +1 -1
- package/app/scripts/ChromosomeGrid.js +49 -38
- package/app/scripts/ChromosomeInfo.js +1 -1
- package/app/scripts/CombinedTrack.js +3 -1
- package/app/scripts/ConfigTrackMenu.jsx +1 -1
- package/app/scripts/ConfigViewMenu.jsx +2 -2
- package/app/scripts/ContextMenuContainer.jsx +4 -2
- package/app/scripts/ContextMenuItem.jsx +14 -2
- package/app/scripts/CrossRule.js +1 -1
- package/app/scripts/CustomTrackDialog.jsx +2 -2
- package/app/scripts/Dialog.jsx +2 -2
- package/app/scripts/DragListeningDiv.jsx +1 -1
- package/app/scripts/DraggableDiv.jsx +2 -3
- package/app/scripts/ExportLinkDialog.jsx +1 -1
- package/app/scripts/FilledLine.js +349 -0
- package/app/scripts/GalleryTracks.jsx +77 -78
- package/app/scripts/GenomePositionSearchBox.jsx +184 -482
- package/app/scripts/HeatmapOptions.jsx +4 -2
- package/app/scripts/HeatmapTiledPixiTrack.js +23 -32
- package/app/scripts/HiGlassComponent.jsx +515 -444
- package/app/scripts/HiGlassComponentContext.js +5 -0
- package/app/scripts/Horizontal1dHeatmapTrack.js +1 -1
- package/app/scripts/Horizontal2DDomainsTrack.js +1 -1
- package/app/scripts/HorizontalChromosomeLabels.js +28 -22
- package/app/scripts/HorizontalGeneAnnotationsTrack.js +1 -1
- package/app/scripts/HorizontalHeatmapTrack.js +2 -2
- package/app/scripts/HorizontalMultivecTrack.js +6 -7
- package/app/scripts/HorizontalRule.js +1 -2
- package/app/scripts/HorizontalTiled1DPixiTrack.js +4 -4
- package/app/scripts/HorizontalTiledPlot.jsx +9 -9
- package/app/scripts/LeftTrackModifier.js +4 -0
- package/app/scripts/ListWrapper.jsx +1 -2
- package/app/scripts/MapboxTilesTrack.js +1 -2
- package/app/scripts/Modal.jsx +2 -2
- package/app/scripts/MoveableTrack.jsx +10 -12
- package/app/scripts/NestedContextMenu.jsx +2 -1
- package/app/scripts/OSMTileIdsTrack.js +1 -1
- package/app/scripts/OverlayTrack.js +4 -4
- package/app/scripts/PixiTrack.js +27 -13
- package/app/scripts/PlotTypeChooser.jsx +3 -4
- package/app/scripts/SearchField.js +5 -5
- package/app/scripts/SeriesListItems.jsx +3 -4
- package/app/scripts/SeriesListMenu.jsx +95 -53
- package/app/scripts/SeriesListSubmenuMixin.jsx +2 -1
- package/app/scripts/SketchInlinePicker.jsx +2 -2
- package/app/scripts/SortableList.jsx +1 -1
- package/app/scripts/Tiled1DPixiTrack.js +4 -1
- package/app/scripts/TiledPixiTrack.js +244 -102
- package/app/scripts/TiledPlot.jsx +565 -118
- package/app/scripts/TilesetFinder.jsx +12 -4
- package/app/scripts/Track.js +1 -1
- package/app/scripts/TrackArea.jsx +4 -0
- package/app/scripts/TrackControl.jsx +2 -2
- package/app/scripts/TrackRenderer.jsx +32 -33
- package/app/scripts/ValueIntervalTrack.js +1 -1
- package/app/scripts/VerticalRule.js +2 -2
- package/app/scripts/VerticalTiledPlot.jsx +7 -7
- package/app/scripts/ViewConfigEditor.jsx +1 -1
- package/app/scripts/ViewContextMenu.jsx +53 -5
- package/app/scripts/ViewHeader.jsx +9 -9
- package/app/scripts/ViewportTracker2D.js +1 -1
- package/app/scripts/api.js +92 -12
- package/app/scripts/configs/available-track-types.js +1 -1
- package/app/scripts/configs/index.js +6 -1
- package/app/scripts/configs/positions-by-datatype.js +2 -2
- package/app/scripts/configs/primitives.js +2 -0
- package/app/scripts/configs/themes.js +0 -1
- package/app/scripts/configs/tracks-info-by-type.js +11 -8
- package/app/scripts/configs/tracks-info.js +3 -2
- package/app/scripts/d3-context-menu.js +3 -4
- package/app/scripts/data-fetchers/DataFetcher.js +35 -36
- package/app/scripts/data-fetchers/genbank-fetcher.js +13 -22
- package/app/scripts/data-fetchers/local-tile-fetcher.js +10 -8
- package/app/scripts/hglib.jsx +62 -71
- package/app/scripts/hocs/with-modal.jsx +32 -10
- package/app/scripts/hocs/with-pub-sub.js +12 -3
- package/app/scripts/hocs/with-theme.jsx +21 -14
- package/app/scripts/icons.jsx +3 -2
- package/app/scripts/mixwith.js +2 -2
- package/app/scripts/options-info.js +49 -11
- package/app/scripts/plugins/get-data-fetcher.js +2 -3
- package/app/scripts/services/chrom-info.js +32 -4
- package/app/scripts/services/element-resize-listener.js +2 -2
- package/app/scripts/services/index.js +0 -1
- package/app/scripts/services/tile-proxy.js +368 -285
- package/app/scripts/services/worker.js +31 -28
- package/app/scripts/test-helpers/index.js +2 -1
- package/app/scripts/test-helpers/test-helpers.jsx +157 -69
- package/app/scripts/types.ts +118 -47
- package/app/scripts/utils/LruCache.js +3 -2
- package/app/scripts/utils/assert.js +19 -0
- package/app/scripts/utils/background-task-scheduler.js +2 -0
- package/app/scripts/utils/color-domain-to-rgba-array.js +13 -3
- package/app/scripts/utils/copy-text-to-clipboard.js +36 -0
- package/app/scripts/utils/decompress.js +33 -0
- package/app/scripts/utils/default-tracks.js +46 -0
- package/app/scripts/utils/dict-items.js +1 -0
- package/app/scripts/utils/dict-keys.js +1 -0
- package/app/scripts/utils/dict-values.js +1 -0
- package/app/scripts/utils/expand-combined-tracks.js +11 -7
- package/app/scripts/utils/fill-in-min-widths.js +47 -21
- package/app/scripts/utils/flatten.js +0 -1
- package/app/scripts/utils/get-aggregation-function.js +1 -1
- package/app/scripts/utils/get-default-track-for-datatype.js +37 -10
- package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
- package/app/scripts/utils/get-higlass-components.js +27 -3
- package/app/scripts/utils/get-track-position-by-uid.js +8 -1
- package/app/scripts/utils/get-xylofon.js +12 -9
- package/app/scripts/utils/has-parent.js +5 -5
- package/app/scripts/utils/hex-string-to-int.js +1 -1
- package/app/scripts/utils/index.js +1 -0
- package/app/scripts/utils/interval-tree.js +222 -177
- package/app/scripts/utils/load-chrom-infos.js +4 -1
- package/app/scripts/utils/pixi-text-to-svg.js +5 -9
- package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
- package/app/scripts/utils/range-query-2d.js +3 -3
- package/app/scripts/utils/reduce.js +12 -5
- package/app/scripts/utils/segments-to-rows.js +14 -11
- package/app/scripts/utils/svg-line.js +7 -8
- package/app/scripts/utils/type-guards.js +16 -7
- package/app/scripts/utils/visit-positioned-tracks.js +9 -4
- package/app/styles/AddTrackPositionMenu.module.scss +37 -0
- package/app/styles/HiGlass.module.scss +3 -1
- package/app/styles/d3-context-menu.css +0 -1
- package/app/styles/prism.css +1 -0
- package/dist/app/schema.json +525 -0
- package/dist/app/scripts/AddTrackDialog.d.ts +64 -0
- package/dist/app/scripts/AddTrackPositionMenu.d.ts +5 -0
- package/dist/app/scripts/Annotations1dTrack.d.ts +15 -0
- package/dist/app/scripts/Annotations2dTrack.d.ts +95 -0
- package/dist/app/scripts/ArrowheadDomainsTrack.d.ts +36 -0
- package/dist/app/scripts/Autocomplete.d.ts +102 -0
- package/dist/app/scripts/AxisPixi.d.ts +25 -0
- package/dist/app/scripts/BarTrack.d.ts +28 -0
- package/dist/app/scripts/BedLikeTrack.d.ts +84 -0
- package/dist/app/scripts/Button.d.ts +3 -0
- package/dist/app/scripts/CNVIntervalTrack.d.ts +12 -0
- package/dist/app/scripts/CenterTiledPlot.d.ts +3 -0
- package/dist/app/scripts/CenterTrack.d.ts +92 -0
- package/dist/app/scripts/Chromosome2DAnnotations.d.ts +10 -0
- package/dist/app/scripts/Chromosome2DLabels.d.ts +13 -0
- package/dist/app/scripts/ChromosomeGrid.d.ts +24 -0
- package/dist/app/scripts/ChromosomeInfo.d.ts +14 -0
- package/dist/app/scripts/CloseTrackMenu.d.ts +10 -0
- package/dist/app/scripts/CombinedTrack.d.ts +32 -0
- package/dist/app/scripts/ConfigTrackMenu.d.ts +10 -0
- package/dist/app/scripts/ConfigViewMenu.d.ts +34 -0
- package/dist/app/scripts/ConfigureSeriesMenu.d.ts +3 -0
- package/dist/app/scripts/ContextMenuContainer.d.ts +36 -0
- package/dist/app/scripts/ContextMenuItem.d.ts +34 -0
- package/dist/app/scripts/Cross.d.ts +3 -0
- package/dist/app/scripts/CrossRule.d.ts +24 -0
- package/dist/app/scripts/CustomTrackDialog.d.ts +17 -0
- package/dist/app/scripts/Dialog.d.ts +5 -0
- package/dist/app/scripts/DivergentBarTrack.d.ts +4 -0
- package/dist/app/scripts/DragListeningDiv.d.ts +32 -0
- package/dist/app/scripts/DraggableDiv.d.ts +63 -0
- package/dist/app/scripts/ExportLinkDialog.d.ts +21 -0
- package/dist/app/scripts/FilledLine.d.ts +5 -0
- package/dist/app/scripts/FixedTrack.d.ts +5 -0
- package/dist/app/scripts/GalleryTracks.d.ts +20 -0
- package/dist/app/scripts/GenomePositionSearchBox.d.ts +95 -0
- package/dist/app/scripts/HeatmapOptions.d.ts +30 -0
- package/dist/app/scripts/HeatmapTiledPixiTrack.d.ts +184 -0
- package/dist/app/scripts/HiGlassComponent.d.ts +762 -0
- package/dist/app/scripts/HiGlassComponentContext.d.ts +3 -0
- package/dist/app/scripts/HiGlassTrackComponent.d.ts +37 -0
- package/dist/app/scripts/Horizontal1dHeatmapTrack.d.ts +9 -0
- package/dist/app/scripts/Horizontal2DDomainsTrack.d.ts +21 -0
- package/dist/app/scripts/HorizontalChromosomeLabels.d.ts +47 -0
- package/dist/app/scripts/HorizontalGeneAnnotationsTrack.d.ts +25 -0
- package/dist/app/scripts/HorizontalHeatmapTrack.d.ts +12 -0
- package/dist/app/scripts/HorizontalItem.d.ts +3 -0
- package/dist/app/scripts/HorizontalLine1DPixiTrack.d.ts +23 -0
- package/dist/app/scripts/HorizontalMultivecTrack.d.ts +50 -0
- package/dist/app/scripts/HorizontalPoint1DPixiTrack.d.ts +5 -0
- package/dist/app/scripts/HorizontalRule.d.ts +22 -0
- package/dist/app/scripts/HorizontalTiled1DPixiTrack.d.ts +26 -0
- package/dist/app/scripts/HorizontalTiledPlot.d.ts +49 -0
- package/dist/app/scripts/HorizontalTrack.d.ts +6 -0
- package/dist/app/scripts/Id2DTiledPixiTrack.d.ts +10 -0
- package/dist/app/scripts/IdHorizontal1DTiledPixiTrack.d.ts +6 -0
- package/dist/app/scripts/IdVertical1DTiledPixiTrack.d.ts +7 -0
- package/dist/app/scripts/LeftAxisTrack.d.ts +9 -0
- package/dist/app/scripts/LeftTrackModifier.d.ts +29 -0
- package/dist/app/scripts/ListWrapper.d.ts +64 -0
- package/dist/app/scripts/MapboxTilesTrack.d.ts +9 -0
- package/dist/app/scripts/Modal.d.ts +5 -0
- package/dist/app/scripts/MoveableTrack.d.ts +18 -0
- package/dist/app/scripts/NestedContextMenu.d.ts +7 -0
- package/dist/app/scripts/OSMTileIdsTrack.d.ts +5 -0
- package/dist/app/scripts/OSMTilesTrack.d.ts +129 -0
- package/dist/app/scripts/OverlayTrack.d.ts +13 -0
- package/dist/app/scripts/PixiTrack.d.ts +174 -0
- package/dist/app/scripts/PlotTypeChooser.d.ts +25 -0
- package/dist/app/scripts/PopupMenu.d.ts +28 -0
- package/dist/app/scripts/RasterTilesTrack.d.ts +9 -0
- package/dist/app/scripts/RuleMixin.d.ts +2 -0
- package/dist/app/scripts/SVGTrack.d.ts +15 -0
- package/dist/app/scripts/SearchField.d.ts +13 -0
- package/dist/app/scripts/SeriesListItems.d.ts +2 -0
- package/dist/app/scripts/SeriesListMenu.d.ts +51 -0
- package/dist/app/scripts/SeriesListSubmenuMixin.d.ts +2 -0
- package/dist/app/scripts/SketchInlinePicker.d.ts +25 -0
- package/dist/app/scripts/SortableList.d.ts +22 -0
- package/dist/app/scripts/SquareMarkersTrack.d.ts +22 -0
- package/dist/app/scripts/Tiled1DPixiTrack.d.ts +60 -0
- package/dist/app/scripts/TiledPixiTrack.d.ts +369 -0
- package/dist/app/scripts/TiledPlot.d.ts +313 -0
- package/dist/app/scripts/TilesetFinder.d.ts +65 -0
- package/dist/app/scripts/TopAxisTrack.d.ts +9 -0
- package/dist/app/scripts/Track.d.ts +196 -0
- package/dist/app/scripts/TrackArea.d.ts +26 -0
- package/dist/app/scripts/TrackControl.d.ts +5 -0
- package/dist/app/scripts/TrackRenderer.d.ts +724 -0
- package/dist/app/scripts/UnknownPixiTrack.d.ts +7 -0
- package/dist/app/scripts/ValueIntervalTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalItem.d.ts +3 -0
- package/dist/app/scripts/VerticalRule.d.ts +21 -0
- package/dist/app/scripts/VerticalTiled1DPixiTrack.d.ts +6 -0
- package/dist/app/scripts/VerticalTiledPlot.d.ts +50 -0
- package/dist/app/scripts/VerticalTrack.d.ts +6 -0
- package/dist/app/scripts/ViewConfigEditor.d.ts +53 -0
- package/dist/app/scripts/ViewContextMenu.d.ts +17 -0
- package/dist/app/scripts/ViewHeader.d.ts +75 -0
- package/dist/app/scripts/ViewportTracker2D.d.ts +17 -0
- package/dist/app/scripts/ViewportTracker2DPixi.d.ts +11 -0
- package/dist/app/scripts/ViewportTrackerHorizontal.d.ts +17 -0
- package/dist/app/scripts/ViewportTrackerVertical.d.ts +17 -0
- package/dist/app/scripts/api.d.ts +640 -0
- package/dist/app/scripts/configs/available-track-types.d.ts +2 -0
- package/dist/app/scripts/configs/colormaps.d.ts +2 -0
- package/dist/app/scripts/configs/datatype-to-track-type.d.ts +4 -0
- package/dist/app/scripts/configs/default-tracks-for-datatype.d.ts +38 -0
- package/dist/app/scripts/configs/dense-data-extrema-config.d.ts +2 -0
- package/dist/app/scripts/configs/globals.d.ts +5 -0
- package/dist/app/scripts/configs/index.d.ts +16 -0
- package/dist/app/scripts/configs/positions-by-datatype.d.ts +2 -0
- package/dist/app/scripts/configs/primitives.d.ts +20 -0
- package/dist/app/scripts/configs/themes.d.ts +3 -0
- package/dist/app/scripts/configs/tracks-info-by-type.d.ts +4 -0
- package/dist/app/scripts/configs/tracks-info.d.ts +24 -0
- package/dist/app/scripts/d3-context-menu.d.ts +2 -0
- package/dist/app/scripts/data-fetchers/DataFetcher.d.ts +151 -0
- package/dist/app/scripts/data-fetchers/genbank-fetcher.d.ts +86 -0
- package/dist/app/scripts/data-fetchers/index.d.ts +3 -0
- package/dist/app/scripts/data-fetchers/local-tile-fetcher.d.ts +47 -0
- package/dist/app/scripts/gosling-exports.d.ts +17 -0
- package/dist/app/scripts/hglib.d.ts +24 -0
- package/dist/app/scripts/hocs/with-modal.d.ts +19 -0
- package/dist/app/scripts/hocs/with-pub-sub.d.ts +22 -0
- package/dist/app/scripts/hocs/with-theme.d.ts +13 -0
- package/dist/app/scripts/icons.d.ts +161 -0
- package/dist/app/scripts/mixwith.d.ts +27 -0
- package/dist/app/scripts/options-info.d.ts +1355 -0
- package/dist/app/scripts/plugins/available-for-plugins.d.ts +2338 -0
- package/dist/app/scripts/plugins/get-data-fetcher.d.ts +2 -0
- package/dist/app/scripts/plugins/index.d.ts +2 -0
- package/dist/app/scripts/services/chrom-info.d.ts +10 -0
- package/dist/app/scripts/services/dom-event.d.ts +7 -0
- package/dist/app/scripts/services/element-resize-listener.d.ts +5 -0
- package/dist/app/scripts/services/index.d.ts +5 -0
- package/dist/app/scripts/services/tile-proxy.d.ts +180 -0
- package/dist/app/scripts/services/worker.d.ts +157 -0
- package/dist/app/scripts/symbol.d.ts +13 -0
- package/dist/app/scripts/test-helpers/index.d.ts +1 -0
- package/dist/app/scripts/test-helpers/test-helpers.d.ts +33 -0
- package/dist/app/scripts/track-utils.d.ts +73 -0
- package/dist/app/scripts/types.d.ts +199 -0
- package/dist/app/scripts/utils/DenseDataExtrema1D.d.ts +88 -0
- package/dist/app/scripts/utils/DenseDataExtrema2D.d.ts +97 -0
- package/dist/app/scripts/utils/LruCache.d.ts +44 -0
- package/dist/app/scripts/utils/abs-to-chr.d.ts +14 -0
- package/dist/app/scripts/utils/accessor-transposition.d.ts +14 -0
- package/dist/app/scripts/utils/add-arrays.d.ts +18 -0
- package/dist/app/scripts/utils/add-class.d.ts +8 -0
- package/dist/app/scripts/utils/add-event-listener-once.d.ts +11 -0
- package/dist/app/scripts/utils/assert.d.ts +17 -0
- package/dist/app/scripts/utils/background-task-scheduler.d.ts +47 -0
- package/dist/app/scripts/utils/base64-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/chr-to-abs.d.ts +10 -0
- package/dist/app/scripts/utils/chrom-info-bisector.d.ts +4 -0
- package/dist/app/scripts/utils/clone-event.d.ts +12 -0
- package/dist/app/scripts/utils/color-domain-to-rgba-array.d.ts +13 -0
- package/dist/app/scripts/utils/color-to-hex.d.ts +9 -0
- package/dist/app/scripts/utils/color-to-rgba.d.ts +9 -0
- package/dist/app/scripts/utils/copy-text-to-clipboard.d.ts +2 -0
- package/dist/app/scripts/utils/data-to-genomic-loci.d.ts +11 -0
- package/dist/app/scripts/utils/debounce.d.ts +5 -0
- package/dist/app/scripts/utils/dec-to-hex-str.d.ts +8 -0
- package/dist/app/scripts/utils/decompress.d.ts +27 -0
- package/dist/app/scripts/utils/default-tracks.d.ts +3 -0
- package/dist/app/scripts/utils/dict-from-tuples.d.ts +11 -0
- package/dist/app/scripts/utils/dict-items.d.ts +18 -0
- package/dist/app/scripts/utils/dict-keys.d.ts +10 -0
- package/dist/app/scripts/utils/dict-values.d.ts +8 -0
- package/dist/app/scripts/utils/download.d.ts +7 -0
- package/dist/app/scripts/utils/expand-combined-tracks.d.ts +11 -0
- package/dist/app/scripts/utils/fake-pub-sub.d.ts +11 -0
- package/dist/app/scripts/utils/fill-in-min-widths.d.ts +44 -0
- package/dist/app/scripts/utils/flatten.d.ts +9 -0
- package/dist/app/scripts/utils/for-each.d.ts +9 -0
- package/dist/app/scripts/utils/forward-event.d.ts +7 -0
- package/dist/app/scripts/utils/genome-loci-to-pixels.d.ts +9 -0
- package/dist/app/scripts/utils/genomic-range-to-chromosome-chunks.d.ts +21 -0
- package/dist/app/scripts/utils/get-aggregation-function.d.ts +10 -0
- package/dist/app/scripts/utils/get-default-track-for-datatype.d.ts +21 -0
- package/dist/app/scripts/utils/get-default-tracks-for-datatype.d.ts +3 -0
- package/dist/app/scripts/utils/get-element-dim.d.ts +7 -0
- package/dist/app/scripts/utils/get-higlass-components.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-by-uid.d.ts +7 -0
- package/dist/app/scripts/utils/get-track-conf-from-hgc.d.ts +10 -0
- package/dist/app/scripts/utils/get-track-obj-by-id.d.ts +2 -0
- package/dist/app/scripts/utils/get-track-position-by-uid.d.ts +13 -0
- package/dist/app/scripts/utils/get-xylofon.d.ts +2 -0
- package/dist/app/scripts/utils/gradient.d.ts +14 -0
- package/dist/app/scripts/utils/has-class.d.ts +8 -0
- package/dist/app/scripts/utils/has-parent.d.ts +9 -0
- package/dist/app/scripts/utils/hex-string-to-int.d.ts +14 -0
- package/dist/app/scripts/utils/index.d.ts +89 -0
- package/dist/app/scripts/utils/interval-tree.d.ts +109 -0
- package/dist/app/scripts/utils/into-the-void.d.ts +6 -0
- package/dist/app/scripts/utils/is-track-or-child-track.d.ts +7 -0
- package/dist/app/scripts/utils/is-track-range-selectable.d.ts +2 -0
- package/dist/app/scripts/utils/is-within.d.ts +12 -0
- package/dist/app/scripts/utils/lat-to-y.d.ts +9 -0
- package/dist/app/scripts/utils/lng-to-x.d.ts +8 -0
- package/dist/app/scripts/utils/load-chrom-infos.d.ts +8 -0
- package/dist/app/scripts/utils/map.d.ts +13 -0
- package/dist/app/scripts/utils/max-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/max.d.ts +10 -0
- package/dist/app/scripts/utils/min-non-zero.d.ts +6 -0
- package/dist/app/scripts/utils/min.d.ts +10 -0
- package/dist/app/scripts/utils/mod.d.ts +9 -0
- package/dist/app/scripts/utils/ndarray-assign.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-flatten.d.ts +2 -0
- package/dist/app/scripts/utils/ndarray-to-list.d.ts +2 -0
- package/dist/app/scripts/utils/numericify-version.d.ts +6 -0
- package/dist/app/scripts/utils/obj-vals.d.ts +8 -0
- package/dist/app/scripts/utils/or.d.ts +8 -0
- package/dist/app/scripts/utils/parse-chromsizes-rows.d.ts +34 -0
- package/dist/app/scripts/utils/pixi-text-to-svg.d.ts +2 -0
- package/dist/app/scripts/utils/positioned-tracks-to-all-tracks.d.ts +26 -0
- package/dist/app/scripts/utils/q.d.ts +18 -0
- package/dist/app/scripts/utils/rad-to-deg.d.ts +7 -0
- package/dist/app/scripts/utils/range-query-2d.d.ts +17 -0
- package/dist/app/scripts/utils/reduce.d.ts +14 -0
- package/dist/app/scripts/utils/rel-to-abs-chrom-pos.d.ts +10 -0
- package/dist/app/scripts/utils/remove-class.d.ts +7 -0
- package/dist/app/scripts/utils/reset-d3-brush-style.d.ts +10 -0
- package/dist/app/scripts/utils/rgb-to-hex.d.ts +8 -0
- package/dist/app/scripts/utils/scales-center-and-k.d.ts +12 -0
- package/dist/app/scripts/utils/scales-to-genome-loci.d.ts +3 -0
- package/dist/app/scripts/utils/segments-to-rows.d.ts +15 -0
- package/dist/app/scripts/utils/selected-items-to-cum-weights.d.ts +12 -0
- package/dist/app/scripts/utils/selected-items-to-size.d.ts +13 -0
- package/dist/app/scripts/utils/show-mouse-position.d.ts +54 -0
- package/dist/app/scripts/utils/some.d.ts +10 -0
- package/dist/app/scripts/utils/sum.d.ts +8 -0
- package/dist/app/scripts/utils/svg-line.d.ts +2 -0
- package/dist/app/scripts/utils/throttle-and-debounce.d.ts +33 -0
- package/dist/app/scripts/utils/tile-to-canvas.d.ts +9 -0
- package/dist/app/scripts/utils/timeout.d.ts +3 -0
- package/dist/app/scripts/utils/to-void.d.ts +3 -0
- package/dist/app/scripts/utils/total-track-pixel-height.d.ts +27 -0
- package/dist/app/scripts/utils/trim-trailing-slash.d.ts +7 -0
- package/dist/app/scripts/utils/type-guards.d.ts +36 -0
- package/dist/app/scripts/utils/value-to-color.d.ts +12 -0
- package/dist/app/scripts/utils/visit-positioned-tracks.d.ts +18 -0
- package/dist/app/scripts/utils/visit-tracks.d.ts +9 -0
- package/dist/esm.html +1 -3
- package/dist/hglib.js +86315 -100592
- package/dist/hglib.min.js +123 -131
- package/dist/higlass.mjs +88861 -103138
- package/dist/index.html +1 -3
- package/dist/package.json +134 -0
- package/package.json +25 -27
|
@@ -1,47 +1,221 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/** @typedef {[start: number, end: number]} Interval */
|
|
2
|
+
|
|
3
|
+
class IntervalTreeNode {
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
5
|
+
* @param {number} start
|
|
6
|
+
* @param {number} end
|
|
7
|
+
* @param {IntervalTreeNode} [left]
|
|
8
|
+
* @param {IntervalTreeNode} [right]
|
|
6
9
|
*/
|
|
7
|
-
|
|
10
|
+
constructor(start, end, left, right) {
|
|
11
|
+
/**
|
|
12
|
+
* Node interval.
|
|
13
|
+
* @type {Interval}
|
|
14
|
+
*/
|
|
15
|
+
this.interval = [start, end];
|
|
16
|
+
/**
|
|
17
|
+
* Max endpoint in subtree which starts from this node.
|
|
18
|
+
* @type {number}
|
|
19
|
+
*/
|
|
20
|
+
this.max = Number.NEGATIVE_INFINITY;
|
|
21
|
+
/**
|
|
22
|
+
* Parent node.
|
|
23
|
+
* @type {IntervalTreeNode | null}
|
|
24
|
+
*/
|
|
25
|
+
this.parentNode = null;
|
|
26
|
+
/**
|
|
27
|
+
* Left child node.
|
|
28
|
+
* @type {IntervalTreeNode | null}
|
|
29
|
+
*/
|
|
30
|
+
this.left = left ?? null;
|
|
31
|
+
/**
|
|
32
|
+
* Right child node.
|
|
33
|
+
* @type {IntervalTreeNode | null}
|
|
34
|
+
*/
|
|
35
|
+
this.right = right ?? null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Interval tree.
|
|
41
|
+
*
|
|
42
|
+
* @public
|
|
43
|
+
* @constructor
|
|
44
|
+
*/
|
|
45
|
+
export class IntervalTree {
|
|
46
|
+
constructor() {
|
|
47
|
+
/**
|
|
48
|
+
* Root node of the tree.
|
|
49
|
+
* @type {IntervalTreeNode | null}
|
|
50
|
+
*/
|
|
51
|
+
this.root = null;
|
|
52
|
+
}
|
|
8
53
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
54
|
+
* Add new interval to the tree.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @param {Interval} interval - Array with start and end points of the interval.
|
|
11
58
|
*/
|
|
12
|
-
|
|
59
|
+
add(interval) {
|
|
60
|
+
if (!this.root) {
|
|
61
|
+
this.root = new IntervalTreeNode(interval[0], interval[1]);
|
|
62
|
+
this.root.max = interval[1];
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
addHelper(this.root, interval);
|
|
66
|
+
}
|
|
13
67
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
68
|
+
* Checks or point belongs to at least one intarval from the tree.<br><br>
|
|
69
|
+
* Complexity: O(log N).
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
* @method
|
|
73
|
+
* @param {Number} point Point which should be checked.
|
|
74
|
+
* @return {Boolean} True if point belongs to one of the intervals.
|
|
16
75
|
*/
|
|
17
|
-
|
|
76
|
+
contains(point) {
|
|
77
|
+
return contains(point, this.root);
|
|
78
|
+
}
|
|
18
79
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
80
|
+
* Checks or interval belongs to at least one intarval from the tree.<br><br>
|
|
81
|
+
* Complexity: O(log N).
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
* @method
|
|
85
|
+
* @param {Interval} interval Interval which should be checked.
|
|
86
|
+
* @return {boolean} True if interval intersects with one of the intervals.
|
|
21
87
|
*/
|
|
22
|
-
|
|
88
|
+
intersects(interval) {
|
|
89
|
+
return intersectsHelper(interval, this.root);
|
|
90
|
+
}
|
|
23
91
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
92
|
+
* Returns height of the tree.
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
* @method
|
|
96
|
+
* @return {Number} Height of the tree.
|
|
26
97
|
*/
|
|
27
|
-
|
|
28
|
-
|
|
98
|
+
height() {
|
|
99
|
+
return heightHelper(this.root);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns node with the max endpoint in subtree.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
* @method
|
|
106
|
+
* @param {IntervalTreeNode} node Root node of subtree.
|
|
107
|
+
* @return {IntervalTreeNode | null} IntervalTreeNode with the largest endpoint.
|
|
108
|
+
*/
|
|
109
|
+
findMax(node) {
|
|
110
|
+
const stack = [node];
|
|
111
|
+
let current;
|
|
112
|
+
let max = Number.NEGATIVE_INFINITY;
|
|
113
|
+
let maxNode;
|
|
114
|
+
while (stack.length) {
|
|
115
|
+
current = stack.pop();
|
|
116
|
+
if (current?.left) {
|
|
117
|
+
stack.push(current.left);
|
|
118
|
+
}
|
|
119
|
+
if (current?.right) {
|
|
120
|
+
stack.push(current.right);
|
|
121
|
+
}
|
|
122
|
+
// @ts-expect-error - ok assertion
|
|
123
|
+
if (current?.interval[1] > max) {
|
|
124
|
+
// @ts-expect-error - only ok if above assertion succeeds
|
|
125
|
+
max = current.interval[1];
|
|
126
|
+
maxNode = current;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return maxNode ?? null;
|
|
130
|
+
}
|
|
29
131
|
|
|
30
|
-
/**
|
|
31
|
-
* Interval tree.
|
|
32
|
-
*
|
|
33
|
-
* @public
|
|
34
|
-
* @constructor
|
|
35
|
-
*/
|
|
36
|
-
export default function IntervalTree() {
|
|
37
132
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
133
|
+
* Adjust the max value.
|
|
134
|
+
*
|
|
135
|
+
* @param {Interval} interval
|
|
136
|
+
* @param {IntervalTreeNode | null} node
|
|
40
137
|
*/
|
|
41
|
-
|
|
138
|
+
_removeHelper(interval, node) {
|
|
139
|
+
if (!node) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (node.interval[0] === interval[0] && node.interval[1] === interval[1]) {
|
|
143
|
+
// When left and right children exists
|
|
144
|
+
if (node.left && node.right) {
|
|
145
|
+
let replacement = node.left;
|
|
146
|
+
while (replacement.left) {
|
|
147
|
+
replacement = replacement.left;
|
|
148
|
+
}
|
|
149
|
+
const temp = replacement.interval;
|
|
150
|
+
replacement.interval = node.interval;
|
|
151
|
+
node.interval = temp;
|
|
152
|
+
this._removeHelper(replacement.interval, node);
|
|
153
|
+
} else {
|
|
154
|
+
// When only left or right child exists
|
|
155
|
+
/** @type {"left" | "right"} */
|
|
156
|
+
let side = 'left';
|
|
157
|
+
if (node.right) {
|
|
158
|
+
side = 'right';
|
|
159
|
+
}
|
|
160
|
+
const parentNode = node.parentNode;
|
|
161
|
+
if (parentNode) {
|
|
162
|
+
if (parentNode.left === node) {
|
|
163
|
+
parentNode.left = node[side];
|
|
164
|
+
} else {
|
|
165
|
+
parentNode.right = node[side];
|
|
166
|
+
}
|
|
167
|
+
if (node[side]) {
|
|
168
|
+
// @ts-expect-error - ok to set to a node
|
|
169
|
+
node[side].parentNode = parentNode;
|
|
170
|
+
}
|
|
171
|
+
} else {
|
|
172
|
+
this.root = node[side];
|
|
173
|
+
// last node removed
|
|
174
|
+
if (this.root) {
|
|
175
|
+
this.root.parentNode = null;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// Adjust the max value
|
|
180
|
+
const p = node.parentNode;
|
|
181
|
+
if (p) {
|
|
182
|
+
let maxNode = this.findMax(p);
|
|
183
|
+
const max = maxNode?.interval[1] ?? Number.NEGATIVE_INFINITY;
|
|
184
|
+
while (maxNode) {
|
|
185
|
+
if (maxNode.max === node.interval[1]) {
|
|
186
|
+
maxNode.max = max;
|
|
187
|
+
maxNode = maxNode.parentNode;
|
|
188
|
+
} else {
|
|
189
|
+
maxNode = null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
// could be optimized
|
|
195
|
+
this._removeHelper(interval, node.left);
|
|
196
|
+
this._removeHelper(interval, node.right);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Remove interval from the tree.
|
|
201
|
+
*
|
|
202
|
+
* @public
|
|
203
|
+
* @method
|
|
204
|
+
* @param {Interval} interval - Array with start and end of the interval.
|
|
205
|
+
*/
|
|
206
|
+
remove(interval) {
|
|
207
|
+
return this._removeHelper(interval, this.root);
|
|
208
|
+
}
|
|
42
209
|
}
|
|
43
210
|
|
|
211
|
+
/**
|
|
212
|
+
* @param {IntervalTreeNode} node
|
|
213
|
+
* @param {"left"| "right"} side
|
|
214
|
+
* @param {Interval} interval
|
|
215
|
+
* @returns {void}
|
|
216
|
+
*/
|
|
44
217
|
function addNode(node, side, interval) {
|
|
218
|
+
/** @type {IntervalTreeNode | null} */
|
|
45
219
|
let child = new IntervalTreeNode(interval[0], interval[1]);
|
|
46
220
|
child.max = interval[1];
|
|
47
221
|
child.parentNode = node;
|
|
@@ -56,6 +230,11 @@ function addNode(node, side, interval) {
|
|
|
56
230
|
}
|
|
57
231
|
}
|
|
58
232
|
|
|
233
|
+
/**
|
|
234
|
+
* @param {IntervalTreeNode} node
|
|
235
|
+
* @param {Interval} interval
|
|
236
|
+
* @returns {void}
|
|
237
|
+
*/
|
|
59
238
|
function addHelper(node, interval) {
|
|
60
239
|
if (node.interval[0] > interval[0]) {
|
|
61
240
|
if (node.left) {
|
|
@@ -71,20 +250,10 @@ function addHelper(node, interval) {
|
|
|
71
250
|
}
|
|
72
251
|
|
|
73
252
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* @
|
|
77
|
-
* @param {Array} intreval Array with start and end points of the interval.
|
|
253
|
+
* @param {number} point
|
|
254
|
+
* @param {IntervalTreeNode | null} node
|
|
255
|
+
* @returns {boolean}
|
|
78
256
|
*/
|
|
79
|
-
IntervalTree.prototype.add = function add(interval) {
|
|
80
|
-
if (!this.root) {
|
|
81
|
-
this.root = new IntervalTreeNode(interval[0], interval[1]);
|
|
82
|
-
this.root.max = interval[1];
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
addHelper(this.root, interval);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
257
|
function contains(point, node) {
|
|
89
258
|
if (!node) {
|
|
90
259
|
return false;
|
|
@@ -94,7 +263,7 @@ function contains(point, node) {
|
|
|
94
263
|
}
|
|
95
264
|
let result = false;
|
|
96
265
|
let temp;
|
|
97
|
-
['left', 'right'].forEach((key) => {
|
|
266
|
+
/** @type {const} */ (['left', 'right']).forEach((key) => {
|
|
98
267
|
temp = node[key];
|
|
99
268
|
if (temp) {
|
|
100
269
|
if (temp.max > point) {
|
|
@@ -106,18 +275,10 @@ function contains(point, node) {
|
|
|
106
275
|
}
|
|
107
276
|
|
|
108
277
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* @public
|
|
113
|
-
* @method
|
|
114
|
-
* @param {Number} point Point which should be checked.
|
|
115
|
-
* @return {Boolean} True if point belongs to one of the intervals.
|
|
278
|
+
* @param {Interval} a
|
|
279
|
+
* @param {Interval} b
|
|
280
|
+
* @returns {boolean}
|
|
116
281
|
*/
|
|
117
|
-
IntervalTree.prototype.contains = function _contains(point) {
|
|
118
|
-
return contains(point, this.root);
|
|
119
|
-
};
|
|
120
|
-
|
|
121
282
|
function intersects(a, b) {
|
|
122
283
|
return (
|
|
123
284
|
// The first case checks for completely overlapping
|
|
@@ -132,6 +293,11 @@ function intersects(a, b) {
|
|
|
132
293
|
);
|
|
133
294
|
}
|
|
134
295
|
|
|
296
|
+
/**
|
|
297
|
+
* @param {Interval} interval
|
|
298
|
+
* @param {IntervalTreeNode | null} node
|
|
299
|
+
* @returns {boolean}
|
|
300
|
+
*/
|
|
135
301
|
function intersectsHelper(interval, node) {
|
|
136
302
|
if (!node) {
|
|
137
303
|
return false;
|
|
@@ -141,7 +307,7 @@ function intersectsHelper(interval, node) {
|
|
|
141
307
|
}
|
|
142
308
|
let result = false;
|
|
143
309
|
let temp;
|
|
144
|
-
['left', 'right'].forEach((side) => {
|
|
310
|
+
/** @type {const} */ (['left', 'right']).forEach((side) => {
|
|
145
311
|
temp = node[side];
|
|
146
312
|
if (temp && temp.max >= interval[0]) {
|
|
147
313
|
result = result || intersectsHelper(interval, temp);
|
|
@@ -151,133 +317,12 @@ function intersectsHelper(interval, node) {
|
|
|
151
317
|
}
|
|
152
318
|
|
|
153
319
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* @public
|
|
158
|
-
* @method
|
|
159
|
-
* @param {Array} interval Interval which should be checked.
|
|
160
|
-
* @return {Boolean} True if interval intersects with one of the intervals.
|
|
320
|
+
* @param {IntervalTreeNode | null} node
|
|
321
|
+
* @returns {number}
|
|
161
322
|
*/
|
|
162
|
-
IntervalTree.prototype.intersects = function _intersects(interval) {
|
|
163
|
-
return intersectsHelper(interval, this.root);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
323
|
function heightHelper(node) {
|
|
167
324
|
if (!node) {
|
|
168
325
|
return 0;
|
|
169
326
|
}
|
|
170
327
|
return 1 + Math.max(heightHelper(node.left), heightHelper(node.right));
|
|
171
328
|
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* Returns height of the tree.
|
|
175
|
-
*
|
|
176
|
-
* @public
|
|
177
|
-
* @method
|
|
178
|
-
* @return {Number} Height of the tree.
|
|
179
|
-
*/
|
|
180
|
-
IntervalTree.prototype.height = function height() {
|
|
181
|
-
return heightHelper(this.root);
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Returns node with the max endpoint in subtree.
|
|
186
|
-
*
|
|
187
|
-
* @public
|
|
188
|
-
* @method
|
|
189
|
-
* @param {IntervalTreeNode} node Root node of subtree.
|
|
190
|
-
* @return {IntervalTreeNode} IntervalTreeNode with the largest endpoint.
|
|
191
|
-
*/
|
|
192
|
-
IntervalTree.prototype.findMax = function findMax(node) {
|
|
193
|
-
const stack = [node];
|
|
194
|
-
let current;
|
|
195
|
-
let max = -Infinity;
|
|
196
|
-
let maxNode;
|
|
197
|
-
while (stack.length) {
|
|
198
|
-
current = stack.pop();
|
|
199
|
-
if (current.left) {
|
|
200
|
-
stack.push(current.left);
|
|
201
|
-
}
|
|
202
|
-
if (current.right) {
|
|
203
|
-
stack.push(current.right);
|
|
204
|
-
}
|
|
205
|
-
if (current.interval[1] > max) {
|
|
206
|
-
max = current.interval[1];
|
|
207
|
-
maxNode = current;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
return maxNode;
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
// adjust the max value
|
|
214
|
-
IntervalTree.prototype._removeHelper = function _removeHelper(interval, node) {
|
|
215
|
-
if (!node) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (node.interval[0] === interval[0] && node.interval[1] === interval[1]) {
|
|
219
|
-
// When left and right children exists
|
|
220
|
-
if (node.left && node.right) {
|
|
221
|
-
let replacement = node.left;
|
|
222
|
-
while (replacement.left) {
|
|
223
|
-
replacement = replacement.left;
|
|
224
|
-
}
|
|
225
|
-
const temp = replacement.interval;
|
|
226
|
-
replacement.interval = node.interval;
|
|
227
|
-
node.interval = temp;
|
|
228
|
-
this._removeHelper(replacement.interval, node);
|
|
229
|
-
} else {
|
|
230
|
-
// When only left or right child exists
|
|
231
|
-
let side = 'left';
|
|
232
|
-
if (node.right) {
|
|
233
|
-
side = 'right';
|
|
234
|
-
}
|
|
235
|
-
const parentNode = node.parentNode;
|
|
236
|
-
if (parentNode) {
|
|
237
|
-
if (parentNode.left === node) {
|
|
238
|
-
parentNode.left = node[side];
|
|
239
|
-
} else {
|
|
240
|
-
parentNode.right = node[side];
|
|
241
|
-
}
|
|
242
|
-
if (node[side]) {
|
|
243
|
-
node[side].parentNode = parentNode;
|
|
244
|
-
}
|
|
245
|
-
} else {
|
|
246
|
-
this.root = node[side];
|
|
247
|
-
// last node removed
|
|
248
|
-
if (this.root) {
|
|
249
|
-
this.root.parentNode = null;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
// Adjust the max value
|
|
254
|
-
const p = node.parentNode;
|
|
255
|
-
if (p) {
|
|
256
|
-
let maxNode = this.findMax(p);
|
|
257
|
-
const max = maxNode.interval[1];
|
|
258
|
-
while (maxNode) {
|
|
259
|
-
if (maxNode.max === node.interval[1]) {
|
|
260
|
-
maxNode.max = max;
|
|
261
|
-
maxNode = maxNode.parentNode;
|
|
262
|
-
} else {
|
|
263
|
-
maxNode = false;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
} else {
|
|
268
|
-
// could be optimized
|
|
269
|
-
this._removeHelper(interval, node.left);
|
|
270
|
-
this._removeHelper(interval, node.right);
|
|
271
|
-
}
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
/**
|
|
275
|
-
* Remove interval from the tree.
|
|
276
|
-
*
|
|
277
|
-
* @public
|
|
278
|
-
* @method
|
|
279
|
-
* @param {Array} intreval Array with start and end of the interval.
|
|
280
|
-
*/
|
|
281
|
-
IntervalTree.prototype.remove = function remove(interval) {
|
|
282
|
-
return this._removeHelper(interval, this.root);
|
|
283
|
-
};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { chromInfo } from '../services';
|
|
3
2
|
|
|
4
3
|
import objVals from './obj-vals';
|
|
5
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @param {Record<string, { chromInfoPath: string }>} views
|
|
7
|
+
* @returns {void}
|
|
8
|
+
*/
|
|
6
9
|
const loadChromInfos = (views) =>
|
|
7
10
|
objVals(views)
|
|
8
11
|
.map((view) => view.chromInfoPath)
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Export a PIXI text to an SVG element
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* returns {Element} A DOM SVG Element with all of the attributes set as to display
|
|
7
|
-
* the given text.
|
|
3
|
+
* @param {import('pixi.js').Text} pixiText A PIXI.Text object that we want to create an SVG element for
|
|
4
|
+
* @returns { HTMLElement } A DOM SVG Element with all of the attributes set as to display the given text.
|
|
8
5
|
*/
|
|
9
6
|
export const pixiTextToSvg = (pixiText) => {
|
|
10
7
|
const g = document.createElement('g');
|
|
@@ -18,11 +15,10 @@ export const pixiTextToSvg = (pixiText) => {
|
|
|
18
15
|
t.setAttribute('text-anchor', 'middle');
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
t.setAttribute('font-family', pixiText.style.fontFamily);
|
|
22
|
-
t.setAttribute('font-size', pixiText.style.fontSize);
|
|
18
|
+
t.setAttribute('font-family', pixiText.style.fontFamily?.toString() ?? '');
|
|
19
|
+
t.setAttribute('font-size', pixiText.style.fontSize?.toString() ?? '');
|
|
23
20
|
g.setAttribute('transform', `scale(${pixiText.scale.x},1)`);
|
|
24
|
-
|
|
25
|
-
t.setAttribute('fill', pixiText.style.fill);
|
|
21
|
+
t.setAttribute('fill', pixiText.style.fill?.toString() ?? '');
|
|
26
22
|
t.innerHTML = pixiText.text;
|
|
27
23
|
|
|
28
24
|
g.appendChild(t);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** @import { PositionedTracks } from './visit-positioned-tracks' */
|
|
2
|
+
/** @import { TrackConfig, TrackPosition } from '../types' */
|
|
3
|
+
|
|
4
|
+
import { TRACK_LOCATIONS } from '../configs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Convert the position indexed list of tracks.
|
|
8
|
+
*
|
|
9
|
+
* If `includeCombinedContents` is `true`, tracks inside
|
|
10
|
+
* `combined.contents` will also be included in the output.
|
|
11
|
+
*
|
|
12
|
+
* @template {{ type: string } | { type: 'combined', contents: Array<T> }} T
|
|
13
|
+
*
|
|
14
|
+
* @param {PositionedTracks<T>} positionedTracks
|
|
15
|
+
* @param {{ includeCombinedContents?: boolean }} options
|
|
16
|
+
* @returns {Array<T & { position: TrackPosition }>}
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
const positionedTracksToAllTracks = (
|
|
20
|
+
positionedTracks,
|
|
21
|
+
{ includeCombinedContents = true } = {},
|
|
22
|
+
) => {
|
|
23
|
+
/** @type {Array<T & { position: keyof PositionedTracks }>} */
|
|
24
|
+
const allTracks = [];
|
|
25
|
+
|
|
26
|
+
for (const trackType of TRACK_LOCATIONS) {
|
|
27
|
+
const theseTracks = positionedTracks[trackType];
|
|
28
|
+
|
|
29
|
+
theseTracks?.forEach((x) => {
|
|
30
|
+
if ('contents' in x) {
|
|
31
|
+
// we don't really deal with nested combined tracks here,
|
|
32
|
+
// but those shouldn't really be used anyway
|
|
33
|
+
if (includeCombinedContents) {
|
|
34
|
+
x.contents.forEach((y) => {
|
|
35
|
+
allTracks.push(
|
|
36
|
+
Object.assign({}, y, {
|
|
37
|
+
position: trackType,
|
|
38
|
+
}),
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
allTracks.push(
|
|
45
|
+
Object.assign({}, x, {
|
|
46
|
+
position: trackType,
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return allTracks;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export default positionedTracksToAllTracks;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import addArrays from './add-arrays';
|
|
3
2
|
import accessorTransposition from './accessor-transposition';
|
|
3
|
+
import addArrays from './add-arrays';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Perform a 2D query on a 1D array
|
|
@@ -24,9 +24,9 @@ const rangeQuery2d = (
|
|
|
24
24
|
xRange,
|
|
25
25
|
yRange,
|
|
26
26
|
mirrored,
|
|
27
|
-
|
|
27
|
+
// biome-ignore lint/style/useDefaultParameterLast:
|
|
28
28
|
xOff = 0,
|
|
29
|
-
|
|
29
|
+
// biome-ignore lint/style/useDefaultParameterLast:
|
|
30
30
|
yOff = 0,
|
|
31
31
|
outList,
|
|
32
32
|
) => {
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
|
-
* Pure functional reducer. Can be used for currying stuff.
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
2
|
+
* Pure functional reducer. Can be used for currying stuff.
|
|
3
|
+
*
|
|
4
|
+
* @see {@link ./flatten.js}
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* @template U
|
|
8
|
+
*
|
|
9
|
+
* @param {(previousValue: U, currentValue: T, currentIndex: number, array: Array<T>) => U} callbackfn
|
|
10
|
+
* @param {U} initialValue
|
|
11
|
+
* @return {(x: Array<T>) => U} Curried function that accepts an array to be reduced.
|
|
6
12
|
*/
|
|
7
|
-
const reduce = (
|
|
13
|
+
const reduce = (callbackfn, initialValue) => (x) =>
|
|
14
|
+
x.reduce(callbackfn, initialValue);
|
|
8
15
|
|
|
9
16
|
// TODO(Trevor): Not referenced anywhere. Remove?
|
|
10
17
|
export default reduce;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IntervalTree } from './interval-tree';
|
|
2
|
+
|
|
3
|
+
/** @typedef {{ from:number, to: number }} Segment */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Partition a list of segments into an array of rows containing the segments.
|
|
7
|
+
*
|
|
8
|
+
* WARNING: Sorts the `segments` array input _inplace_.
|
|
9
|
+
*
|
|
10
|
+
* @param {Array<Segment>} segments An array of segments (e.g. [{from: 10, to: 20}, {from: 18, to: 30}])
|
|
11
|
+
* @return: {Array<Array<Segment>>} non-overlapping rows of segments
|
|
12
|
+
*/
|
|
4
13
|
function segmentsToRows(segments) {
|
|
5
|
-
/**
|
|
6
|
-
* Partition a list of segments into an array of
|
|
7
|
-
* rows containing the segments.
|
|
8
|
-
*
|
|
9
|
-
* @param segments: An array of segments (e.g. [{from: 10, to: 20}, {from: 18, to: 30}])
|
|
10
|
-
* @return: An array of arrays of segments, representing
|
|
11
|
-
* non-overlapping rows of segments
|
|
12
|
-
*/
|
|
13
14
|
// sort by the length of each segment
|
|
14
15
|
segments.sort((a, b) => b.to - b.from - (a.to - a.from));
|
|
15
16
|
|
|
17
|
+
/** @type {Array<Array<Segment>>} */
|
|
16
18
|
const rows = [[]];
|
|
17
19
|
const rowIts = [new IntervalTree()];
|
|
18
20
|
|
|
@@ -23,6 +25,7 @@ function segmentsToRows(segments) {
|
|
|
23
25
|
for (let j = 0; j < rows.length; j++) {
|
|
24
26
|
const it = rowIts[j]; // an interval tree
|
|
25
27
|
|
|
28
|
+
/** @type {[number, number]} */
|
|
26
29
|
const toCheck = [+segments[i].from, +segments[i].to];
|
|
27
30
|
const occluded = it.intersects(toCheck);
|
|
28
31
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Generate a SVG line
|
|
4
3
|
* @param {number} x1 Start X
|
|
@@ -6,19 +5,19 @@
|
|
|
6
5
|
* @param {number} x2 End X
|
|
7
6
|
* @param {number} y2 End Y
|
|
8
7
|
* @param {number} strokeWidth Line width
|
|
9
|
-
* @param {
|
|
10
|
-
* @return {
|
|
8
|
+
* @param {string} strokeColor Color HEX string
|
|
9
|
+
* @return {HTMLElement} SVG line object
|
|
11
10
|
*/
|
|
12
11
|
export const svgLine = (x1, y1, x2, y2, strokeWidth, strokeColor) => {
|
|
13
12
|
const line = document.createElement('line');
|
|
14
13
|
|
|
15
|
-
line.setAttribute('x1', x1);
|
|
16
|
-
line.setAttribute('x2', x2);
|
|
17
|
-
line.setAttribute('y1', y1);
|
|
18
|
-
line.setAttribute('y2', y2);
|
|
14
|
+
line.setAttribute('x1', String(x1));
|
|
15
|
+
line.setAttribute('x2', String(x2));
|
|
16
|
+
line.setAttribute('y1', String(y1));
|
|
17
|
+
line.setAttribute('y2', String(y2));
|
|
19
18
|
|
|
20
19
|
if (strokeWidth) {
|
|
21
|
-
line.setAttribute('stroke-width', strokeWidth);
|
|
20
|
+
line.setAttribute('stroke-width', String(strokeWidth));
|
|
22
21
|
}
|
|
23
22
|
if (strokeColor) {
|
|
24
23
|
line.setAttribute('stroke', strokeColor);
|