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
package/app/scripts/api.js
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import ReactDOM from 'react-dom';
|
|
3
|
-
import createPubSub from 'pub-sub-es';
|
|
4
2
|
import Ajv from 'ajv';
|
|
3
|
+
import createPubSub from 'pub-sub-es';
|
|
4
|
+
import ReactDOM from 'react-dom';
|
|
5
5
|
|
|
6
6
|
import schema from '../schema.json';
|
|
7
7
|
|
|
8
|
-
import { setTileProxyAuthHeader } from './services';
|
|
8
|
+
import { getTileProxyAuthHeader, setTileProxyAuthHeader } from './services';
|
|
9
9
|
|
|
10
10
|
import { getTrackObjectFromHGC } from './utils';
|
|
11
11
|
|
|
12
|
-
import { MOUSE_TOOL_MOVE, MOUSE_TOOL_SELECT } from './configs';
|
|
13
|
-
|
|
14
12
|
import { version } from '../../package.json';
|
|
13
|
+
import {
|
|
14
|
+
MOUSE_TOOL_MOVE,
|
|
15
|
+
MOUSE_TOOL_SELECT,
|
|
16
|
+
MOUSE_TOOL_TRACK_SELECT,
|
|
17
|
+
SIZE_MODE_BOUNDED,
|
|
18
|
+
SIZE_MODE_BOUNDED_OVERFLOW,
|
|
19
|
+
SIZE_MODE_DEFAULT,
|
|
20
|
+
SIZE_MODE_OVERFLOW,
|
|
21
|
+
SIZE_MODE_SCROLL,
|
|
22
|
+
} from './configs';
|
|
15
23
|
|
|
16
24
|
const forceUpdate = (self) => {
|
|
17
25
|
self.setState(self.state);
|
|
18
26
|
};
|
|
19
27
|
|
|
28
|
+
/** @typedef {ReturnType<typeof createApi>} HiGlassApi */
|
|
29
|
+
|
|
20
30
|
const createApi = function api(context, pubSub) {
|
|
21
31
|
/** @type {import('./HiGlassComponent').default} */
|
|
22
32
|
const self = context;
|
|
@@ -100,7 +110,7 @@ const createApi = function api(context, pubSub) {
|
|
|
100
110
|
* Get the currently set auth header
|
|
101
111
|
*/
|
|
102
112
|
getAuthHeader() {
|
|
103
|
-
return
|
|
113
|
+
return getTileProxyAuthHeader();
|
|
104
114
|
},
|
|
105
115
|
|
|
106
116
|
/**
|
|
@@ -152,7 +162,9 @@ const createApi = function api(context, pubSub) {
|
|
|
152
162
|
*/
|
|
153
163
|
destroy() {
|
|
154
164
|
destroy();
|
|
155
|
-
|
|
165
|
+
if (self.topDivRef.current) {
|
|
166
|
+
ReactDOM.unmountComponentAtNode(self.topDivRef.current);
|
|
167
|
+
}
|
|
156
168
|
},
|
|
157
169
|
|
|
158
170
|
/**
|
|
@@ -193,7 +205,7 @@ const createApi = function api(context, pubSub) {
|
|
|
193
205
|
* hgv.activateTool('select'); // Activate select tool
|
|
194
206
|
* hgv.setRangeSelection1dSize(5000, 10000); // Force selections to be between 5 and 10 Kb
|
|
195
207
|
*/
|
|
196
|
-
setRangeSelection1dSize(minSize = 0, maxSize =
|
|
208
|
+
setRangeSelection1dSize(minSize = 0, maxSize = Number.POSITIVE_INFINITY) {
|
|
197
209
|
self.setState({
|
|
198
210
|
rangeSelection1dSize: [minSize, maxSize],
|
|
199
211
|
});
|
|
@@ -367,6 +379,16 @@ const createApi = function api(context, pubSub) {
|
|
|
367
379
|
});
|
|
368
380
|
},
|
|
369
381
|
|
|
382
|
+
measureSize() {
|
|
383
|
+
self.measureSize();
|
|
384
|
+
|
|
385
|
+
for (const tiledPlot of Object.values(self.tiledPlots)) {
|
|
386
|
+
if (tiledPlot) {
|
|
387
|
+
tiledPlot.measureSize();
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
|
|
370
392
|
/**
|
|
371
393
|
* Show the track chooser which highlights tracks
|
|
372
394
|
* when the mouse is over them.
|
|
@@ -391,7 +413,7 @@ const createApi = function api(context, pubSub) {
|
|
|
391
413
|
* Hide the track chooser.
|
|
392
414
|
*/
|
|
393
415
|
hideTrackChooser() {
|
|
394
|
-
|
|
416
|
+
self.setState({
|
|
395
417
|
chooseTrackHandler: null,
|
|
396
418
|
});
|
|
397
419
|
},
|
|
@@ -587,6 +609,10 @@ const createApi = function api(context, pubSub) {
|
|
|
587
609
|
*/
|
|
588
610
|
activateTool(tool) {
|
|
589
611
|
switch (tool) {
|
|
612
|
+
case 'track-select':
|
|
613
|
+
self.setMouseTool(MOUSE_TOOL_TRACK_SELECT);
|
|
614
|
+
break;
|
|
615
|
+
|
|
590
616
|
case 'select':
|
|
591
617
|
self.setMouseTool(MOUSE_TOOL_SELECT);
|
|
592
618
|
break;
|
|
@@ -597,6 +623,33 @@ const createApi = function api(context, pubSub) {
|
|
|
597
623
|
}
|
|
598
624
|
},
|
|
599
625
|
|
|
626
|
+
/**
|
|
627
|
+
* Set the size mode for the higlass container
|
|
628
|
+
*
|
|
629
|
+
* @param {string sizeMode The size mode for the container.
|
|
630
|
+
* The vailable options are 'default',
|
|
631
|
+
* 'bounded', 'overflow' and 'scroll'
|
|
632
|
+
*/
|
|
633
|
+
setSizeMode(sizeMode) {
|
|
634
|
+
switch (sizeMode) {
|
|
635
|
+
case 'bounded':
|
|
636
|
+
self.setSizeMode(SIZE_MODE_BOUNDED);
|
|
637
|
+
break;
|
|
638
|
+
case 'overflow':
|
|
639
|
+
self.setSizeMode(SIZE_MODE_OVERFLOW);
|
|
640
|
+
break;
|
|
641
|
+
case 'bounded-overflow':
|
|
642
|
+
self.setSizeMode(SIZE_MODE_BOUNDED_OVERFLOW);
|
|
643
|
+
break;
|
|
644
|
+
case 'scroll':
|
|
645
|
+
self.setSizeMode(SIZE_MODE_SCROLL);
|
|
646
|
+
break;
|
|
647
|
+
default:
|
|
648
|
+
self.setSizeMode(SIZE_MODE_DEFAULT);
|
|
649
|
+
break;
|
|
650
|
+
}
|
|
651
|
+
},
|
|
652
|
+
|
|
600
653
|
/**
|
|
601
654
|
* Get a Promise which returns a Blob containing a PNG for the current view.
|
|
602
655
|
* It's possible to get string of the PNG bytes from that:
|
|
@@ -659,8 +712,7 @@ const createApi = function api(context, pubSub) {
|
|
|
659
712
|
getLocation(viewId) {
|
|
660
713
|
const wurstId = viewId
|
|
661
714
|
? self.xScales[viewId] && self.yScales[viewId] && viewId
|
|
662
|
-
: Object.values(self.tiledPlots)[0]
|
|
663
|
-
Object.values(self.tiledPlots)[0].props.uid;
|
|
715
|
+
: Object.values(self.tiledPlots)[0]?.props.uid;
|
|
664
716
|
|
|
665
717
|
if (!wurstId) {
|
|
666
718
|
return 'Please provide a valid view UUID sweetheart 😙';
|
|
@@ -743,6 +795,18 @@ const createApi = function api(context, pubSub) {
|
|
|
743
795
|
typeof listenerId === 'object' ? listenerId.callback : listenerId;
|
|
744
796
|
|
|
745
797
|
switch (event) {
|
|
798
|
+
case 'annotationCreated':
|
|
799
|
+
apiPubSub.unsubscribe('annotationCreated', callback);
|
|
800
|
+
break;
|
|
801
|
+
|
|
802
|
+
case 'annotationChanged':
|
|
803
|
+
apiPubSub.unsubscribe('annotationChanged', callback);
|
|
804
|
+
break;
|
|
805
|
+
|
|
806
|
+
case 'annotationRemoved':
|
|
807
|
+
apiPubSub.unsubscribe('annotationRemoved', callback);
|
|
808
|
+
break;
|
|
809
|
+
|
|
746
810
|
case 'click':
|
|
747
811
|
apiPubSub.unsubscribe('click', callback);
|
|
748
812
|
break;
|
|
@@ -751,6 +815,10 @@ const createApi = function api(context, pubSub) {
|
|
|
751
815
|
apiPubSub.unsubscribe('cursorLocation', callback);
|
|
752
816
|
break;
|
|
753
817
|
|
|
818
|
+
case 'datasetInfo':
|
|
819
|
+
apiPubSub.unsubscribe('datasetInfo', callback);
|
|
820
|
+
break;
|
|
821
|
+
|
|
754
822
|
case 'location':
|
|
755
823
|
self.offLocationChange(viewId, listenerId);
|
|
756
824
|
break;
|
|
@@ -798,7 +866,7 @@ const createApi = function api(context, pubSub) {
|
|
|
798
866
|
*
|
|
799
867
|
* **Event types**
|
|
800
868
|
*
|
|
801
|
-
* ``click``: Returns
|
|
869
|
+
* ``click``: Returns clicked objects. (Currently only clicks on 1D annotations are captured.)
|
|
802
870
|
*
|
|
803
871
|
* .. code-block:: javascript
|
|
804
872
|
*
|
|
@@ -967,12 +1035,24 @@ const createApi = function api(context, pubSub) {
|
|
|
967
1035
|
*/
|
|
968
1036
|
on(event, callback, viewId, callbackId) {
|
|
969
1037
|
switch (event) {
|
|
1038
|
+
case 'annotationCreated':
|
|
1039
|
+
return apiPubSub.subscribe('annotationCreated', callback);
|
|
1040
|
+
|
|
1041
|
+
case 'annotationChanged':
|
|
1042
|
+
return apiPubSub.subscribe('annotationChanged', callback);
|
|
1043
|
+
|
|
1044
|
+
case 'annotationRemoved':
|
|
1045
|
+
return apiPubSub.subscribe('annotationRemoved', callback);
|
|
1046
|
+
|
|
970
1047
|
case 'click':
|
|
971
1048
|
return apiPubSub.subscribe('click', callback);
|
|
972
1049
|
|
|
973
1050
|
case 'cursorLocation':
|
|
974
1051
|
return apiPubSub.subscribe('cursorLocation', callback);
|
|
975
1052
|
|
|
1053
|
+
case 'datasetInfo':
|
|
1054
|
+
return apiPubSub.subscribe('datasetInfo', callback);
|
|
1055
|
+
|
|
976
1056
|
case 'location':
|
|
977
1057
|
// returns a set of scales (xScale, yScale) on every zoom event
|
|
978
1058
|
return self.onLocationChange(viewId, callback, callbackId);
|
|
@@ -23,7 +23,7 @@ import { DATATYPE_TO_TRACK_TYPE } from './datatype-to-track-type';
|
|
|
23
23
|
export const AVAILABLE_TRACK_TYPES = (datatypes, orientation) => {
|
|
24
24
|
const datatypesToTrackTypes = DATATYPE_TO_TRACK_TYPE(orientation);
|
|
25
25
|
let availableTrackTypes = new Set(
|
|
26
|
-
Object.values(datatypesToTrackTypes).
|
|
26
|
+
Object.values(datatypesToTrackTypes).flat(),
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
for (const datatype of datatypes) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/* ------------------------------- Primitives ------------------------------- */
|
|
3
2
|
|
|
4
3
|
export * from './primitives';
|
|
@@ -21,3 +20,9 @@ export {
|
|
|
21
20
|
NUM_PRECOMP_SUBSETS_PER_1D_TTILE,
|
|
22
21
|
NUM_PRECOMP_SUBSETS_PER_2D_TTILE,
|
|
23
22
|
} from './dense-data-extrema-config';
|
|
23
|
+
|
|
24
|
+
export const SIZE_MODE_DEFAULT = 'default';
|
|
25
|
+
export const SIZE_MODE_BOUNDED = 'bounded';
|
|
26
|
+
export const SIZE_MODE_OVERFLOW = 'overflow';
|
|
27
|
+
export const SIZE_MODE_BOUNDED_OVERFLOW = 'bounded-overflow';
|
|
28
|
+
export const SIZE_MODE_SCROLL = 'scroll';
|
|
@@ -3,8 +3,8 @@ import { TRACKS_INFO } from './tracks-info';
|
|
|
3
3
|
|
|
4
4
|
export const POSITIONS_BY_DATATYPE = TRACKS_INFO.reduce(
|
|
5
5
|
(positionsByDatatype, track) => {
|
|
6
|
-
// TODO: Found by
|
|
7
|
-
|
|
6
|
+
// TODO: Found by Biome
|
|
7
|
+
// biome-ignore lint/correctness/noUnreachable: This loop never iterates?
|
|
8
8
|
for (let i = 0; i < track.datatype.length; i++) {
|
|
9
9
|
const datatype = track.datatype[i];
|
|
10
10
|
|
|
@@ -12,6 +12,8 @@ export const MOUSE_TOOL_MOVE = 'move';
|
|
|
12
12
|
|
|
13
13
|
export const MOUSE_TOOL_SELECT = 'select';
|
|
14
14
|
|
|
15
|
+
export const MOUSE_TOOL_TRACK_SELECT = 'track-select';
|
|
16
|
+
|
|
15
17
|
export const TILE_FETCH_DEBOUNCE = 100;
|
|
16
18
|
|
|
17
19
|
// Number of milliseconds zoom-related actions (e.g., tile loading) are debounced
|
|
@@ -2,14 +2,17 @@ import { TRACKS_INFO } from './tracks-info';
|
|
|
2
2
|
|
|
3
3
|
/** @typedef {Record<string, import('./tracks-info').TrackInfo>} TracksInfoByType */
|
|
4
4
|
|
|
5
|
-
export const TRACKS_INFO_BY_TYPE = TRACKS_INFO.reduce(
|
|
6
|
-
tracksByType
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export const TRACKS_INFO_BY_TYPE = TRACKS_INFO.reduce(
|
|
6
|
+
(tracksByType, track) => {
|
|
7
|
+
tracksByType[track.type] = track;
|
|
8
|
+
if (track.aliases) {
|
|
9
|
+
for (const alias of track.aliases) {
|
|
10
|
+
tracksByType[alias] = track;
|
|
11
|
+
}
|
|
10
12
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
return tracksByType;
|
|
14
|
+
},
|
|
15
|
+
/** @type {TracksInfoByType} */ ({}),
|
|
16
|
+
);
|
|
14
17
|
|
|
15
18
|
export default TRACKS_INFO_BY_TYPE;
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
svg2DTilesIcon,
|
|
8
8
|
svgArrowheadDomainsIcon,
|
|
9
9
|
svgGeneAnnotationsIcon,
|
|
10
|
-
|
|
10
|
+
svgGeoMapIcon,
|
|
11
11
|
svgHorizontal1dHeatmap,
|
|
12
|
+
svgHorizontalLineIcon,
|
|
12
13
|
svgVertical1DAxisIcon,
|
|
13
14
|
svgVertical1DTilesIcon,
|
|
14
|
-
svgGeoMapIcon,
|
|
15
15
|
} from '../icons';
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
* @property {number=} defaultWidth
|
|
35
35
|
* @property {string=} chromInfoPath
|
|
36
36
|
* @property {boolean=} projection
|
|
37
|
+
* @property {Record<string, unknown>} [optionsInfo]
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
40
|
const osm = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { mouse, select, selectAll
|
|
2
|
+
import { event, mouse, select, selectAll } from 'd3-selection';
|
|
3
3
|
import slugid from 'slugid';
|
|
4
4
|
|
|
5
5
|
import '../styles/d3-context-menu.css';
|
|
@@ -72,12 +72,11 @@ function contextMenu(menu, optsIn) {
|
|
|
72
72
|
return function onContextMenu(
|
|
73
73
|
data,
|
|
74
74
|
index,
|
|
75
|
-
|
|
75
|
+
// biome-ignore lint/style/useDefaultParameterLast:
|
|
76
76
|
pMouseUp = false,
|
|
77
77
|
clickAwayFunc,
|
|
78
78
|
useMouse = false,
|
|
79
79
|
) {
|
|
80
|
-
const elm = this;
|
|
81
80
|
let mousePos = null;
|
|
82
81
|
const currentThis = this;
|
|
83
82
|
|
|
@@ -136,7 +135,7 @@ function contextMenu(menu, optsIn) {
|
|
|
136
135
|
.on('click', (d) => {
|
|
137
136
|
if (d.disabled) return; // do nothing if disabled
|
|
138
137
|
if (!d.action) return; // headers have no "action"
|
|
139
|
-
d.action(
|
|
138
|
+
d.action(this, data, index, mousePos);
|
|
140
139
|
|
|
141
140
|
// close all context menus
|
|
142
141
|
selectAll('.d3-context-menu').style('display', 'none');
|
|
@@ -1,27 +1,22 @@
|
|
|
1
|
-
import slugid from 'slugid';
|
|
2
1
|
import { scaleLinear } from 'd3-scale';
|
|
2
|
+
import slugid from 'slugid';
|
|
3
3
|
|
|
4
|
-
// Utils
|
|
5
|
-
import tts from '../utils/trim-trailing-slash';
|
|
6
|
-
import dictValues from '../utils/dict-values';
|
|
7
|
-
import minNonZero from '../utils/min-non-zero';
|
|
8
|
-
import maxNonZero from '../utils/max-non-zero';
|
|
9
4
|
import DenseDataExtrema1D from '../utils/DenseDataExtrema1D';
|
|
10
5
|
import DenseDataExtrema2D from '../utils/DenseDataExtrema2D';
|
|
6
|
+
import assert from '../utils/assert';
|
|
7
|
+
import dictValues from '../utils/dict-values';
|
|
8
|
+
import maxNonZero from '../utils/max-non-zero';
|
|
9
|
+
import minNonZero from '../utils/min-non-zero';
|
|
10
|
+
// Utils
|
|
11
|
+
import tts from '../utils/trim-trailing-slash';
|
|
11
12
|
|
|
12
13
|
// Services
|
|
13
14
|
import * as tileProxy from '../services/tile-proxy';
|
|
15
|
+
import { isResolutionsTilesetInfo } from '../utils/type-guards';
|
|
14
16
|
|
|
15
|
-
/** @
|
|
16
|
-
/** @
|
|
17
|
-
/**
|
|
18
|
-
* @template T
|
|
19
|
-
* @typedef {import('../types').AbstractDataFetcher<T>} AbstractDataFetcher
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* @template T
|
|
23
|
-
* @typedef {import('../types').TileSource<T>} TileSource
|
|
24
|
-
*/
|
|
17
|
+
/** @import { PubSub } from 'pub-sub-es' */
|
|
18
|
+
/** @import { TilesetInfo, AbstractDataFetcher, TileSource, DataConfig, HandleTilesetInfoFinished } from '../types' */
|
|
19
|
+
/** @import { CompletedTileData, TileResponse } from '../services/worker' */
|
|
25
20
|
|
|
26
21
|
/**
|
|
27
22
|
* @typedef Tile
|
|
@@ -54,16 +49,16 @@ function isTuple(x) {
|
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
/**
|
|
57
|
-
* @param {
|
|
52
|
+
* @param {PubSub} pubSub
|
|
58
53
|
* @returns {TileSource<Tile>}
|
|
59
54
|
*/
|
|
60
55
|
function createDefaultTileSource(pubSub) {
|
|
61
56
|
return {
|
|
62
|
-
fetchTiles(request) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
57
|
+
async fetchTiles(request) {
|
|
58
|
+
/** @type {Record<string, Tile>} */
|
|
59
|
+
// @ts-expect-error - TODO: Need to resolve these types together
|
|
60
|
+
const tileData = await tileProxy.fetchTilesDebounced(request, pubSub);
|
|
61
|
+
return tileData;
|
|
67
62
|
},
|
|
68
63
|
fetchTilesetInfo({ server, tilesetUid }) {
|
|
69
64
|
return new Promise((resolve, reject) => {
|
|
@@ -88,11 +83,11 @@ function createDefaultTileSource(pubSub) {
|
|
|
88
83
|
};
|
|
89
84
|
}
|
|
90
85
|
|
|
91
|
-
/** @implements {AbstractDataFetcher<Tile | DividedTile>} */
|
|
86
|
+
/** @implements {AbstractDataFetcher<Tile | DividedTile, ResolvedDataConfig>} */
|
|
92
87
|
export default class DataFetcher {
|
|
93
88
|
/**
|
|
94
|
-
* @param {
|
|
95
|
-
* @param {
|
|
89
|
+
* @param {DataConfig} dataConfig
|
|
90
|
+
* @param {PubSub} pubSub
|
|
96
91
|
* @param {TileSource<Tile>} [tileSource]
|
|
97
92
|
*/
|
|
98
93
|
constructor(dataConfig, pubSub, tileSource) {
|
|
@@ -113,7 +108,7 @@ export default class DataFetcher {
|
|
|
113
108
|
this.dataConfig = JSON.parse(JSON.stringify(dataConfig));
|
|
114
109
|
/** @type {string} */
|
|
115
110
|
this.uuid = slugid.nice();
|
|
116
|
-
/** @type {
|
|
111
|
+
/** @type {PubSub} */
|
|
117
112
|
this.pubSub = pubSub;
|
|
118
113
|
|
|
119
114
|
if (dataConfig.children) {
|
|
@@ -146,7 +141,7 @@ export default class DataFetcher {
|
|
|
146
141
|
|
|
147
142
|
/**
|
|
148
143
|
* Obtain tileset infos for all of the tilesets listed
|
|
149
|
-
* @param {
|
|
144
|
+
* @param {HandleTilesetInfoFinished} finished - A callback that will be called
|
|
150
145
|
*/
|
|
151
146
|
tilesetInfo(finished) {
|
|
152
147
|
// if this track has a url, server and filetype
|
|
@@ -177,7 +172,7 @@ export default class DataFetcher {
|
|
|
177
172
|
* infos have the same dimensions and then return a common
|
|
178
173
|
* one.
|
|
179
174
|
*
|
|
180
|
-
* @param {
|
|
175
|
+
* @param {HandleTilesetInfoFinished} finished - A callback that will be called
|
|
181
176
|
* when all tileset infos are loaded
|
|
182
177
|
*/
|
|
183
178
|
tilesetInfoAfterRegister(finished) {
|
|
@@ -257,7 +252,11 @@ export default class DataFetcher {
|
|
|
257
252
|
return this.fetchHorizontalSection(receivedTiles, tileIds, true);
|
|
258
253
|
}
|
|
259
254
|
|
|
260
|
-
if (
|
|
255
|
+
if (
|
|
256
|
+
!this.dataConfig.children &&
|
|
257
|
+
this.dataConfig.tilesetUid &&
|
|
258
|
+
this.dataConfig.server
|
|
259
|
+
) {
|
|
261
260
|
// no children, just return the fetched tiles as is
|
|
262
261
|
const promise = this._tileSource.fetchTiles({
|
|
263
262
|
id: slugid.nice(),
|
|
@@ -325,7 +324,7 @@ export default class DataFetcher {
|
|
|
325
324
|
const result = new Float32Array(numeratorData.length);
|
|
326
325
|
|
|
327
326
|
for (let i = 0; i < result.length; i++) {
|
|
328
|
-
if (denominatorData[i] === 0.0) result[i] = NaN;
|
|
327
|
+
if (denominatorData[i] === 0.0) result[i] = Number.NaN;
|
|
329
328
|
else result[i] = numeratorData[i] / denominatorData[i];
|
|
330
329
|
}
|
|
331
330
|
|
|
@@ -385,10 +384,10 @@ export default class DataFetcher {
|
|
|
385
384
|
/** @type {boolean[]} */
|
|
386
385
|
const mirrored = [];
|
|
387
386
|
|
|
388
|
-
const { slicePos, tilesetInfo } = this.dataConfig;
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
387
|
+
const { slicePos, tilesetInfo, server } = this.dataConfig;
|
|
388
|
+
assert(slicePos, 'No slice position in dataConfig.');
|
|
389
|
+
assert(server, 'No server in dataConfig.');
|
|
390
|
+
assert(tilesetInfo, 'No tilesetInfo in dataConfig.');
|
|
392
391
|
|
|
393
392
|
for (const tileId of tileIds) {
|
|
394
393
|
const parts = tileId.split('.');
|
|
@@ -404,7 +403,7 @@ export default class DataFetcher {
|
|
|
404
403
|
// this needs to be consolidated into one function eventually
|
|
405
404
|
let yTiles = [];
|
|
406
405
|
|
|
407
|
-
if (
|
|
406
|
+
if (isResolutionsTilesetInfo(tilesetInfo)) {
|
|
408
407
|
const sortedResolutions = tilesetInfo.resolutions
|
|
409
408
|
.map((x) => +x)
|
|
410
409
|
.sort((a, b) => b - a);
|
|
@@ -442,7 +441,7 @@ export default class DataFetcher {
|
|
|
442
441
|
// actually fetch the new tileIds
|
|
443
442
|
const promise = this._tileSource.fetchTiles({
|
|
444
443
|
id: slugid.nice(),
|
|
445
|
-
server:
|
|
444
|
+
server: server,
|
|
446
445
|
tileIds: newTileIds.map((x) => `${this.dataConfig.tilesetUid}.${x}`),
|
|
447
446
|
});
|
|
448
447
|
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import slugid from 'slugid';
|
|
2
|
-
import pako from 'pako';
|
|
3
1
|
import genbankParser from 'genbank-parser';
|
|
2
|
+
import slugid from 'slugid';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
* @template T
|
|
7
|
-
* @typedef {import('../types').AbstractDataFetcher<T>} AbstractDataFetcher
|
|
8
|
-
*/
|
|
4
|
+
import decompress from '../utils/decompress';
|
|
9
5
|
|
|
6
|
+
/** @import { AbstractDataFetcher } from '../types' */
|
|
10
7
|
/** @typedef {{ start: number, end: number, type: 'filler', strand: "+" | "-" }} FillerSegment */
|
|
11
8
|
|
|
12
9
|
/**
|
|
@@ -205,18 +202,6 @@ function gbToJsonAndFeatures(gbText) {
|
|
|
205
202
|
return { json: gbJson, features };
|
|
206
203
|
}
|
|
207
204
|
|
|
208
|
-
/**
|
|
209
|
-
* Extract the response from a fetch request
|
|
210
|
-
* @param {Response} response
|
|
211
|
-
* @param {{ gzipped: boolean }} options
|
|
212
|
-
* @returns {Promise<string>}
|
|
213
|
-
*/
|
|
214
|
-
async function extractResponse(response, { gzipped }) {
|
|
215
|
-
if (!gzipped) return response.text();
|
|
216
|
-
const buffer = await response.arrayBuffer();
|
|
217
|
-
return pako.inflate(buffer, { to: 'string' });
|
|
218
|
-
}
|
|
219
|
-
|
|
220
205
|
/**
|
|
221
206
|
* @typedef GenbankDataConfig
|
|
222
207
|
* @prop {string=} url
|
|
@@ -227,7 +212,7 @@ async function extractResponse(response, { gzipped }) {
|
|
|
227
212
|
* @typedef {Array<GeneAnnotation> & { tilePositionId?: string }} GenbankTile
|
|
228
213
|
*/
|
|
229
214
|
|
|
230
|
-
/** @implements {AbstractDataFetcher<GenbankTile>} */
|
|
215
|
+
/** @implements {AbstractDataFetcher<GenbankTile, GenbankDataConfig>} */
|
|
231
216
|
class GBKDataFetcher {
|
|
232
217
|
/** @param {GenbankDataConfig} dataConfig */
|
|
233
218
|
constructor(dataConfig) {
|
|
@@ -247,7 +232,13 @@ class GBKDataFetcher {
|
|
|
247
232
|
mode: 'cors',
|
|
248
233
|
redirect: 'follow',
|
|
249
234
|
method: 'GET',
|
|
250
|
-
}).then((
|
|
235
|
+
}).then((originalResponse) => {
|
|
236
|
+
const normalizedResponse =
|
|
237
|
+
extension === '.gz'
|
|
238
|
+
? decompress(originalResponse, { format: 'gzip' })
|
|
239
|
+
: originalResponse;
|
|
240
|
+
return normalizedResponse.text();
|
|
241
|
+
});
|
|
251
242
|
} else if (dataConfig.text) {
|
|
252
243
|
textPromise = Promise.resolve(dataConfig.text);
|
|
253
244
|
} else {
|
|
@@ -313,8 +304,8 @@ class GBKDataFetcher {
|
|
|
313
304
|
|
|
314
305
|
for (const tileId of tileIds) {
|
|
315
306
|
const parts = tileId.split('.');
|
|
316
|
-
const z = parseInt(parts[0], 10);
|
|
317
|
-
const x = parseInt(parts[1], 10);
|
|
307
|
+
const z = Number.parseInt(parts[0], 10);
|
|
308
|
+
const x = Number.parseInt(parts[1], 10);
|
|
318
309
|
|
|
319
310
|
if (Number.isNaN(x) || Number.isNaN(z)) {
|
|
320
311
|
console.warn('Invalid tile zoom or position:', z, x);
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { tileResponseToData } from '../services';
|
|
2
2
|
|
|
3
|
-
/** @
|
|
4
|
-
/**
|
|
5
|
-
* @template T
|
|
6
|
-
* @typedef {import('../types').AbstractDataFetcher<T>} AbstractDataFetcher
|
|
7
|
-
*/
|
|
3
|
+
/** @import { AbstractDataFetcher, TilesetInfo } from '../types' */
|
|
8
4
|
|
|
9
5
|
// TODO: Add type for LocalTile
|
|
10
|
-
/** @typedef {{}} LocalTile */
|
|
6
|
+
/** @typedef {{tilePositionId?: string}} LocalTile */
|
|
11
7
|
|
|
12
8
|
/**
|
|
13
9
|
* @typedef LocalTileDataConfig
|
|
@@ -15,7 +11,7 @@ import { tileResponseToData } from '../services';
|
|
|
15
11
|
* @property {Record<string, TilesetInfo>} tilesetInfo
|
|
16
12
|
*/
|
|
17
13
|
|
|
18
|
-
/** @implements {AbstractDataFetcher<LocalTile>} */
|
|
14
|
+
/** @implements {AbstractDataFetcher<LocalTile, LocalTileDataConfig>} */
|
|
19
15
|
class LocalTileDataFetcher {
|
|
20
16
|
/** @param {LocalTileDataConfig} dataConfig */
|
|
21
17
|
constructor(dataConfig) {
|
|
@@ -32,7 +28,12 @@ class LocalTileDataFetcher {
|
|
|
32
28
|
/** @param {import('../types').HandleTilesetInfoFinished} callback */
|
|
33
29
|
async tilesetInfo(callback) {
|
|
34
30
|
this.tilesetInfoLoading = false;
|
|
35
|
-
|
|
31
|
+
await new Promise((resolve) =>
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
callback(this.tilesetInfoData);
|
|
34
|
+
resolve(true);
|
|
35
|
+
}, 0),
|
|
36
|
+
);
|
|
36
37
|
return this.tilesetInfoData;
|
|
37
38
|
}
|
|
38
39
|
|
|
@@ -61,6 +62,7 @@ class LocalTileDataFetcher {
|
|
|
61
62
|
|
|
62
63
|
for (const tileId of tileIds) {
|
|
63
64
|
ret[tileId] = this.tilesData[`localtile.${tileId}`];
|
|
65
|
+
ret[tileId].tilePositionId = tileId;
|
|
64
66
|
}
|
|
65
67
|
receivedTiles(ret);
|
|
66
68
|
return ret;
|