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,20 +1,22 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
import { scaleLinear, scaleLog, scaleQuantile } from 'd3-scale';
|
|
3
1
|
import { median, range, ticks } from 'd3-array';
|
|
2
|
+
import { scaleLinear, scaleLog, scaleQuantile } from 'd3-scale';
|
|
4
3
|
import slugid from 'slugid';
|
|
5
4
|
|
|
6
|
-
import DataFetcher from './data-fetchers/DataFetcher';
|
|
7
5
|
import PixiTrack from './PixiTrack';
|
|
6
|
+
import { DataFetcher } from './data-fetchers';
|
|
8
7
|
|
|
9
|
-
// Utils
|
|
10
|
-
import throttleAndDebounce from './utils/throttle-and-debounce';
|
|
11
|
-
import parseChromsizesRows from './utils/parse-chromsizes-rows';
|
|
12
8
|
import backgroundTaskScheduler from './utils/background-task-scheduler';
|
|
9
|
+
// Utils
|
|
10
|
+
import parseChromsizesRows from './utils/parse-chromsizes-rows.js';
|
|
11
|
+
import throttleAndDebounce from './utils/throttle-and-debounce.js';
|
|
12
|
+
import { isResolutionsTilesetInfo, isTilesetInfo } from './utils/type-guards';
|
|
13
13
|
|
|
14
14
|
// Configs
|
|
15
15
|
import GLOBALS from './configs/globals';
|
|
16
16
|
import { ZOOM_DEBOUNCE } from './configs/primitives';
|
|
17
17
|
|
|
18
|
+
/** @import * as t from './types' */
|
|
19
|
+
|
|
18
20
|
/**
|
|
19
21
|
* Get a valueScale for a heatmap.
|
|
20
22
|
*
|
|
@@ -22,13 +24,13 @@ import { ZOOM_DEBOUNCE } from './configs/primitives';
|
|
|
22
24
|
*
|
|
23
25
|
* @param {string} scalingType: The type of the (e.g. 'linear', or 'log')
|
|
24
26
|
* @param {number} minValue: The minimum data value to which this scale will apply
|
|
25
|
-
* @param {number}
|
|
27
|
+
* @param {number} pseudocountIn: A value to add to all numbers to prevent taking the log of 0
|
|
26
28
|
* @param {number} maxValue: The maximum data value to which this scale will apply
|
|
27
29
|
* @param {string} defaultScaling: The default scaling type to use in case
|
|
28
30
|
* 'scalingType' is null (e.g. 'linear' or 'log')
|
|
29
31
|
*
|
|
30
|
-
* @returns {
|
|
31
|
-
*
|
|
32
|
+
* @returns {[string, import('d3-scale').ScaleLogarithmic<number, number> | import('d3-scale').ScaleLinear<number, number>]}
|
|
33
|
+
* An array of [string, scale] containing the scale type and a scale with an appropriately set domain and range
|
|
32
34
|
*/
|
|
33
35
|
export function getValueScale(
|
|
34
36
|
scalingType,
|
|
@@ -60,22 +62,82 @@ export function getValueScale(
|
|
|
60
62
|
return ['linear', scaleLinear().range([254, 0]).domain([minValue, maxValue])];
|
|
61
63
|
}
|
|
62
64
|
|
|
65
|
+
/**
|
|
66
|
+
* @typedef Scale
|
|
67
|
+
* @property {number | null} [minValue]
|
|
68
|
+
* @property {number | null} [maxValue]
|
|
69
|
+
* @property {number | null} [maxRawValue]
|
|
70
|
+
* @property {number | null} [minRawValue]
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* An alternative to Tile. Perhaps the worst data type. An array of numbers with some extra properties.
|
|
75
|
+
* @typedef {Array<number> & Pick<Tile, 'mirrored' | 'tilePositionId'>} TilePositionArrayObject
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @typedef Tile
|
|
80
|
+
* @property {string} tileId
|
|
81
|
+
* @property {TileData} tileData
|
|
82
|
+
* @property {string} remoteId
|
|
83
|
+
* @property {unknown} mirrored
|
|
84
|
+
* @property {string} tilePositionId
|
|
85
|
+
* @property {import("pixi.js").Graphics} graphics
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @typedef TileData
|
|
90
|
+
* @property {string} tilesetUid
|
|
91
|
+
* @property {number} zoomLevel
|
|
92
|
+
* @property {Array<number>} tilePos
|
|
93
|
+
* @property {string} error
|
|
94
|
+
* @property {Float32Array} dense
|
|
95
|
+
* @property {number} minNonZero
|
|
96
|
+
* @property {number} maxNonZero
|
|
97
|
+
* @property {Array<number>} [shape] - Optional 1D or 2D array dimensions
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @typedef TiledPixiTrackContextBase
|
|
102
|
+
* @property {DataFetcher} dataFetcher
|
|
103
|
+
* @property {t.DataConfig} dataConfig
|
|
104
|
+
* @property {function} animate A function to redraw this track. Typically called when an
|
|
105
|
+
* asynchronous event occurs (i.e. tiles loaded)
|
|
106
|
+
* @property {() => void} onValueScaleChanged The range of values has changed so we need to inform
|
|
107
|
+
* the higher ups that the value scale has changed. Only occurs on tracks with ``dense`` data.
|
|
108
|
+
* @property {(t: t.TilesetInfo) => void} [handleTilesetInfoReceived] A callback to do something once once the tileset
|
|
109
|
+
* info is received. Usually it registers some information about the tileset with its definition
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* @typedef {import('./PixiTrack').ExtendedPixiContext<TiledPixiTrackContextBase>} TiledPixiTrackContext
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @typedef TiledPixiTrackOptions
|
|
117
|
+
* @property {string} labelPosition - If the label is to be drawn, where should it be drawn?
|
|
118
|
+
* @property {string} labelText - What should be drawn in the label.
|
|
119
|
+
* @property {number} maxZoom
|
|
120
|
+
* @property {string} name
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @template T
|
|
125
|
+
* @typedef {T & TiledPixiTrackOptions} ExtendedTiledPixiTrackOptions
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The TiledPixiTrack requires an options parameter, which should be an object containing properties specified in
|
|
130
|
+
* TiledPixiTrackOptions. It is capable of accepting any property defined in any of its superclasses.
|
|
131
|
+
* @template {ExtendedTiledPixiTrackOptions<{[key: string]: any}>} Options
|
|
132
|
+
* @extends {PixiTrack<Options>}
|
|
133
|
+
* */
|
|
63
134
|
class TiledPixiTrack extends PixiTrack {
|
|
64
135
|
/**
|
|
65
|
-
* A track that must pull remote tiles
|
|
66
136
|
*
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* ``{{server: 'x/api/v1/', tilesetUuid: 'y'}}`` Object.
|
|
70
|
-
* @param {Object} handleTilesetInfoReceived: A callback to do something once once the tileset
|
|
71
|
-
* info is received. Usually it registers some information about the tileset with its
|
|
72
|
-
* definition
|
|
73
|
-
* @param {Object} options The track's options
|
|
74
|
-
* @param {function} animate A function to redraw this track. Typically called when an
|
|
75
|
-
* asynchronous event occurs (i.e. tiles loaded)
|
|
76
|
-
* @param {function} onValueScaleChanged The range of values has changed so we need to inform
|
|
77
|
-
* the higher ups that the value scale has changed. Only occurs on tracks with ``dense`` data.
|
|
137
|
+
* @param {TiledPixiTrackContext} context
|
|
138
|
+
* @param {Options} options
|
|
78
139
|
*/
|
|
140
|
+
|
|
79
141
|
constructor(context, options) {
|
|
80
142
|
super(context, options);
|
|
81
143
|
const {
|
|
@@ -90,10 +152,13 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
90
152
|
// rerendering all rendering in the same version will have the same
|
|
91
153
|
// scaling so tiles rendered in the same version will have the same
|
|
92
154
|
// output. Mostly useful for heatmap tiles.
|
|
155
|
+
/** @type {number} */
|
|
93
156
|
this.renderVersion = 1;
|
|
94
157
|
|
|
95
158
|
// the tiles which should be visible (although they're not necessarily fetched)
|
|
96
|
-
|
|
159
|
+
/** @type {Array<Pick<Tile, 'tileId' |'remoteId' | 'mirrored'>>} */
|
|
160
|
+
this.visibleTiles = [];
|
|
161
|
+
/** @type {Set<string>} */
|
|
97
162
|
this.visibleTileIds = new Set();
|
|
98
163
|
|
|
99
164
|
// keep track of tiles that are currently being rendered
|
|
@@ -101,14 +166,18 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
101
166
|
|
|
102
167
|
// the tiles we already have requests out for
|
|
103
168
|
this.fetching = new Set();
|
|
169
|
+
/** @type {Scale} */
|
|
104
170
|
this.scale = {};
|
|
105
171
|
|
|
106
172
|
// tiles we have fetched and ready to be rendered
|
|
173
|
+
/** @type {{[id: string]: Tile}} */
|
|
107
174
|
this.fetchedTiles = {};
|
|
108
175
|
|
|
109
176
|
// the graphics that have already been drawn for this track
|
|
177
|
+
/** @type {Object.<string, import('pixi.js').DisplayObject>} */
|
|
110
178
|
this.tileGraphics = {};
|
|
111
179
|
|
|
180
|
+
/** @type {number} */
|
|
112
181
|
this.maxZoom = 0;
|
|
113
182
|
this.medianVisibleValue = null;
|
|
114
183
|
|
|
@@ -123,8 +192,11 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
123
192
|
this.valueScaleMax = null;
|
|
124
193
|
this.fixedValueScaleMax = null;
|
|
125
194
|
|
|
195
|
+
/** @type {Record<string, Array<Function>>} */
|
|
126
196
|
this.listeners = {};
|
|
127
197
|
|
|
198
|
+
/** @type {import('pub-sub-es').PubSub & { __fake__?: boolean }} */
|
|
199
|
+
// @ts-expect-error This is always defined in Track.js
|
|
128
200
|
this.pubSub = pubSub;
|
|
129
201
|
this.animate = animate;
|
|
130
202
|
this.onValueScaleChanged = onValueScaleChanged;
|
|
@@ -140,7 +212,11 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
140
212
|
}
|
|
141
213
|
|
|
142
214
|
// To indicate that this track is requiring a tileset info
|
|
215
|
+
/** @type {t.TilesetInfo} */
|
|
216
|
+
// @ts-expect-error This has to be initialized to null
|
|
143
217
|
this.tilesetInfo = null;
|
|
218
|
+
/** @type {null | string} */
|
|
219
|
+
this.tilesetInfoError = null;
|
|
144
220
|
this.uuid = slugid.nice();
|
|
145
221
|
|
|
146
222
|
// this needs to be above the tilesetInfo() call because if that
|
|
@@ -163,7 +239,31 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
163
239
|
this.dataFetcher.tilesetInfo((tilesetInfo, tilesetUid) => {
|
|
164
240
|
if (!tilesetInfo) return;
|
|
165
241
|
|
|
166
|
-
|
|
242
|
+
if (isTilesetInfo(tilesetInfo)) {
|
|
243
|
+
this.tilesetInfo = tilesetInfo;
|
|
244
|
+
|
|
245
|
+
if (this.tilesetInfo.chromsizes) {
|
|
246
|
+
// We got chromosome info from the tileset info so let's parse it
|
|
247
|
+
// into an object we can use
|
|
248
|
+
this.chromInfo = parseChromsizesRows(this.tilesetInfo.chromsizes);
|
|
249
|
+
}
|
|
250
|
+
} else {
|
|
251
|
+
// no tileset info for this track
|
|
252
|
+
console.warn(
|
|
253
|
+
'Error retrieving tilesetInfo:',
|
|
254
|
+
dataConfig,
|
|
255
|
+
tilesetInfo.error,
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
if (tilesetInfo.error) {
|
|
259
|
+
this.setError(tilesetInfo.error, 'dataFetcher.tilesetInfo');
|
|
260
|
+
}
|
|
261
|
+
// Fritz: Not sure why it's reset
|
|
262
|
+
// this.trackNotFoundText = '';
|
|
263
|
+
this.tilesetInfo = undefined;
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
|
|
167
267
|
// If the dataConfig contained a fileUrl, then
|
|
168
268
|
// we need to update the tilesetUid based
|
|
169
269
|
// on the registration of the fileUrl.
|
|
@@ -174,33 +274,17 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
174
274
|
this.tilesetUid = this.dataFetcher.dataConfig.tilesetUid;
|
|
175
275
|
this.server = this.dataFetcher.dataConfig.server || 'unknown';
|
|
176
276
|
|
|
177
|
-
if (this.tilesetInfo
|
|
277
|
+
if (this.tilesetInfo?.chromsizes) {
|
|
178
278
|
this.chromInfo = parseChromsizesRows(this.tilesetInfo.chromsizes);
|
|
179
279
|
}
|
|
180
280
|
|
|
181
|
-
if (
|
|
182
|
-
// no tileset info for this track
|
|
183
|
-
console.warn(
|
|
184
|
-
'Error retrieving tilesetInfo:',
|
|
185
|
-
dataConfig,
|
|
186
|
-
this.tilesetInfo.error,
|
|
187
|
-
);
|
|
188
|
-
|
|
189
|
-
// Fritz: Not sure why it's reset
|
|
190
|
-
// this.trackNotFoundText = '';
|
|
191
|
-
this.tilesetInfo = null;
|
|
192
|
-
|
|
193
|
-
this.setError(this.tilesetInfo.error);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
if (this.tilesetInfo.resolutions) {
|
|
281
|
+
if (isResolutionsTilesetInfo(this.tilesetInfo)) {
|
|
198
282
|
this.maxZoom = this.tilesetInfo.resolutions.length;
|
|
199
283
|
} else {
|
|
200
284
|
this.maxZoom = +this.tilesetInfo.max_zoom;
|
|
201
285
|
}
|
|
202
286
|
|
|
203
|
-
if (this.options
|
|
287
|
+
if (this.options?.maxZoom) {
|
|
204
288
|
if (this.options.maxZoom >= 0) {
|
|
205
289
|
this.maxZoom = Math.min(this.options.maxZoom, this.maxZoom);
|
|
206
290
|
} else {
|
|
@@ -210,11 +294,15 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
210
294
|
|
|
211
295
|
this.refreshTiles();
|
|
212
296
|
|
|
213
|
-
|
|
297
|
+
// Let this track know that tileset info was received
|
|
298
|
+
this.tilesetInfoReceived();
|
|
214
299
|
|
|
215
|
-
|
|
300
|
+
// Let external listeners know that tileset info was received
|
|
301
|
+
handleTilesetInfoReceived?.(this.tilesetInfo);
|
|
216
302
|
|
|
217
|
-
|
|
303
|
+
// @ts-expect-error This should never happen since options is set in Track
|
|
304
|
+
this.options ??= {};
|
|
305
|
+
this.options.name = this.options.name || this.tilesetInfo.name;
|
|
218
306
|
|
|
219
307
|
this.checkValueScaleLimits();
|
|
220
308
|
|
|
@@ -224,11 +312,23 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
224
312
|
});
|
|
225
313
|
}
|
|
226
314
|
|
|
315
|
+
/**
|
|
316
|
+
* @param {string} error
|
|
317
|
+
* @param {string} source
|
|
318
|
+
*/
|
|
319
|
+
setError(error, source) {
|
|
320
|
+
this.errorTexts[source] = error;
|
|
321
|
+
|
|
322
|
+
this.drawError();
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/** @param {number | string} value */
|
|
227
326
|
setFixedValueScaleMin(value) {
|
|
228
327
|
if (!Number.isNaN(+value)) this.fixedValueScaleMin = +value;
|
|
229
328
|
else this.fixedValueScaleMin = null;
|
|
230
329
|
}
|
|
231
330
|
|
|
331
|
+
/** @param {number | string} value */
|
|
232
332
|
setFixedValueScaleMax(value) {
|
|
233
333
|
if (!Number.isNaN(+value)) this.fixedValueScaleMax = +value;
|
|
234
334
|
else this.fixedValueScaleMax = null;
|
|
@@ -276,6 +376,11 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
276
376
|
this.listeners[event].push(callback);
|
|
277
377
|
}
|
|
278
378
|
|
|
379
|
+
/**
|
|
380
|
+
* @param {string} event The event to listen for
|
|
381
|
+
* @param {function} callback The callback to call when the event occurs. The
|
|
382
|
+
* parameters for the event depend on the event called.
|
|
383
|
+
*/
|
|
279
384
|
off(event, callback) {
|
|
280
385
|
const id = this.listeners[event].indexOf(callback);
|
|
281
386
|
if (id === -1 || id >= this.listeners[event].length) return;
|
|
@@ -283,6 +388,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
283
388
|
this.listeners[event].splice(id, 1);
|
|
284
389
|
}
|
|
285
390
|
|
|
391
|
+
/** @param {Options} options */
|
|
286
392
|
rerender(options) {
|
|
287
393
|
super.rerender(options);
|
|
288
394
|
|
|
@@ -294,13 +400,13 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
294
400
|
|
|
295
401
|
this.checkValueScaleLimits();
|
|
296
402
|
|
|
297
|
-
if (this.tilesetInfo
|
|
403
|
+
if (isResolutionsTilesetInfo(this.tilesetInfo)) {
|
|
298
404
|
this.maxZoom = this.tilesetInfo.resolutions.length;
|
|
299
405
|
} else {
|
|
300
406
|
this.maxZoom = +this.tilesetInfo.max_zoom;
|
|
301
407
|
}
|
|
302
408
|
|
|
303
|
-
if (this.options
|
|
409
|
+
if (this.options?.maxZoom) {
|
|
304
410
|
if (this.options.maxZoom >= 0) {
|
|
305
411
|
this.maxZoom = Math.min(this.options.maxZoom, this.maxZoom);
|
|
306
412
|
} else {
|
|
@@ -309,6 +415,13 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
309
415
|
}
|
|
310
416
|
}
|
|
311
417
|
|
|
418
|
+
/** Called when tileset info is received. The actual tileset info
|
|
419
|
+
* can be found in this.tilesetInfo.
|
|
420
|
+
*
|
|
421
|
+
* Child tracks can implement this method.
|
|
422
|
+
*/
|
|
423
|
+
tilesetInfoReceived() {}
|
|
424
|
+
|
|
312
425
|
/**
|
|
313
426
|
* Return the set of ids of all tiles which are both visible and fetched.
|
|
314
427
|
*/
|
|
@@ -325,12 +438,13 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
325
438
|
/**
|
|
326
439
|
* Set which tiles are visible right now.
|
|
327
440
|
*
|
|
328
|
-
* @param
|
|
329
|
-
* tile positions.
|
|
441
|
+
* @param {Array<TilePositionArrayObject>} tilePositions - A set of tiles which will be considered the currently visible tile positions.
|
|
330
442
|
*/
|
|
331
443
|
setVisibleTiles(tilePositions) {
|
|
332
444
|
this.visibleTiles = tilePositions.map((x) => ({
|
|
445
|
+
// @ts-expect-error Classes which extend TiledPixiTrack have this
|
|
333
446
|
tileId: this.tileToLocalId(x),
|
|
447
|
+
// @ts-expect-error Classes which extend TiledPixiTrack have this
|
|
334
448
|
remoteId: this.tileToRemoteId(x),
|
|
335
449
|
mirrored: x.mirrored,
|
|
336
450
|
}));
|
|
@@ -339,6 +453,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
339
453
|
}
|
|
340
454
|
|
|
341
455
|
removeOldTiles() {
|
|
456
|
+
// @ts-expect-error Classes which extend TiledPixiTrack have this
|
|
342
457
|
this.calculateVisibleTiles();
|
|
343
458
|
|
|
344
459
|
// tiles that are fetched
|
|
@@ -358,6 +473,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
358
473
|
return;
|
|
359
474
|
}
|
|
360
475
|
|
|
476
|
+
// @ts-expect-error Classes which extend TiledPixiTrack have this
|
|
361
477
|
this.calculateVisibleTiles();
|
|
362
478
|
|
|
363
479
|
// tiles that are fetched
|
|
@@ -377,6 +493,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
377
493
|
this.fetchNewTiles(toFetch);
|
|
378
494
|
}
|
|
379
495
|
|
|
496
|
+
/** @param {Tile} tile */
|
|
380
497
|
parentInFetched(tile) {
|
|
381
498
|
const uid = tile.tileData.tilesetUid;
|
|
382
499
|
let zl = tile.tileData.zoomLevel;
|
|
@@ -395,6 +512,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
395
512
|
return false;
|
|
396
513
|
}
|
|
397
514
|
|
|
515
|
+
/** @param {Tile} tile */
|
|
398
516
|
parentTileId(tile) {
|
|
399
517
|
const parentZoomLevel = tile.tileData.zoomLevel - 1;
|
|
400
518
|
const parentPos = tile.tileData.tilePos.map((x) => Math.floor(x / 2));
|
|
@@ -406,7 +524,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
406
524
|
/**
|
|
407
525
|
* Remove obsolete tiles
|
|
408
526
|
*
|
|
409
|
-
* @param toRemoveIds: An array of tile ids to remove from the list of fetched tiles.
|
|
527
|
+
* @param {Array<string>} toRemoveIds: An array of tile ids to remove from the list of fetched tiles.
|
|
410
528
|
*/
|
|
411
529
|
removeTiles(toRemoveIds) {
|
|
412
530
|
// if there's nothing to remove, don't bother doing anything
|
|
@@ -434,10 +552,15 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
434
552
|
this.draw();
|
|
435
553
|
}
|
|
436
554
|
|
|
555
|
+
/**
|
|
556
|
+
* @param {t.Scale} newXScale
|
|
557
|
+
* @param {t.Scale} newYScale
|
|
558
|
+
*/
|
|
437
559
|
zoomed(newXScale, newYScale, k = 1, tx = 0, ty = 0) {
|
|
438
560
|
this.xScale(newXScale);
|
|
439
561
|
this.yScale(newYScale);
|
|
440
562
|
|
|
563
|
+
// @ts-expect-error Not sure why this is called without an argument
|
|
441
564
|
this.refreshTilesDebounced();
|
|
442
565
|
|
|
443
566
|
this.pMobile.position.x = tx;
|
|
@@ -447,12 +570,14 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
447
570
|
this.pMobile.scale.y = 1;
|
|
448
571
|
}
|
|
449
572
|
|
|
573
|
+
/** @param {[number, number]} newPosition */
|
|
450
574
|
setPosition(newPosition) {
|
|
451
575
|
super.setPosition(newPosition);
|
|
452
576
|
|
|
453
577
|
// this.draw();
|
|
454
578
|
}
|
|
455
579
|
|
|
580
|
+
/** @param {[number, number]} newDimensions */
|
|
456
581
|
setDimensions(newDimensions) {
|
|
457
582
|
super.setDimensions(newDimensions);
|
|
458
583
|
|
|
@@ -485,6 +610,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
485
610
|
*/
|
|
486
611
|
allTilesLoaded() {}
|
|
487
612
|
|
|
613
|
+
/** @param {number} [_] - Optional value to set */
|
|
488
614
|
minValue(_) {
|
|
489
615
|
if (_) {
|
|
490
616
|
this.scale.minValue = _;
|
|
@@ -495,6 +621,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
495
621
|
: this.scale.minValue;
|
|
496
622
|
}
|
|
497
623
|
|
|
624
|
+
/** @param {number} [_] - Optional value to set */
|
|
498
625
|
maxValue(_) {
|
|
499
626
|
if (_) {
|
|
500
627
|
this.scale.maxValue = _;
|
|
@@ -517,7 +644,11 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
517
644
|
return this.scale.maxRawValue;
|
|
518
645
|
}
|
|
519
646
|
|
|
520
|
-
|
|
647
|
+
/** @param {Tile} tile */
|
|
648
|
+
initTile(tile) {
|
|
649
|
+
if (!tile.tileData?.dense) {
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
521
652
|
// create the tile
|
|
522
653
|
// should be overwritten by child classes
|
|
523
654
|
this.scale.minRawValue = this.continuousScaling
|
|
@@ -531,9 +662,11 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
531
662
|
this.scale.maxValue = this.scale.maxRawValue;
|
|
532
663
|
}
|
|
533
664
|
|
|
534
|
-
|
|
665
|
+
/** @param {Tile} tile */
|
|
666
|
+
updateTile(tile) {}
|
|
535
667
|
|
|
536
|
-
|
|
668
|
+
/** @param {Tile} tile */
|
|
669
|
+
destroyTile(tile) {
|
|
537
670
|
// remove all data structures needed to draw this tile
|
|
538
671
|
}
|
|
539
672
|
|
|
@@ -596,6 +729,20 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
596
729
|
}
|
|
597
730
|
}
|
|
598
731
|
|
|
732
|
+
/**
|
|
733
|
+
* @typedef TiledAreaTile
|
|
734
|
+
* @property {string} tileId
|
|
735
|
+
* @property {string} type
|
|
736
|
+
* @property {unknown} data
|
|
737
|
+
*/
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
*
|
|
741
|
+
* @param {TiledAreaTile} tile A tile returned by a TiledArea.
|
|
742
|
+
* @param {function} dataLoader A function for extracting drawable data from a tile. This
|
|
743
|
+
* usually means differentiating the between dense and sparse tiles and putting the data into an array.
|
|
744
|
+
* @returns
|
|
745
|
+
*/
|
|
599
746
|
loadTileData(tile, dataLoader) {
|
|
600
747
|
/**
|
|
601
748
|
* Extract drawable data from a tile loaded by a generic tile loader
|
|
@@ -607,17 +754,20 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
607
754
|
*/
|
|
608
755
|
|
|
609
756
|
// see if the data is already cached
|
|
757
|
+
// @ts-expect-error this.lruCache exists in classes that extend this one
|
|
610
758
|
let loadedTileData = this.lruCache.get(tile.tileId);
|
|
611
759
|
|
|
612
760
|
// if not, load it and put it in the cache
|
|
613
761
|
if (!loadedTileData) {
|
|
614
762
|
loadedTileData = dataLoader(tile.data, tile.type);
|
|
763
|
+
// @ts-expect-error this.lruCache exists in classes that extend this one
|
|
615
764
|
this.lruCache.put(tile.tileId, loadedTileData);
|
|
616
765
|
}
|
|
617
766
|
|
|
618
767
|
return loadedTileData;
|
|
619
768
|
}
|
|
620
769
|
|
|
770
|
+
/** @param {Pick<Tile,'remoteId'>[]} toFetch */
|
|
621
771
|
fetchNewTiles(toFetch) {
|
|
622
772
|
this._checkForErrors();
|
|
623
773
|
this.draw();
|
|
@@ -635,6 +785,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
635
785
|
/**
|
|
636
786
|
* We've gotten a bunch of tiles from the server in
|
|
637
787
|
* response to a request from fetchTiles.
|
|
788
|
+
* @param {Object<string, import('./data-fetchers/DataFetcher').DividedTile | Tile | TilePositionArrayObject>} loadedTiles
|
|
638
789
|
*/
|
|
639
790
|
receivedTiles(loadedTiles) {
|
|
640
791
|
for (let i = 0; i < this.visibleTiles.length; i++) {
|
|
@@ -645,6 +796,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
645
796
|
if (this.visibleTiles[i].remoteId in loadedTiles) {
|
|
646
797
|
if (!(tileId in this.fetchedTiles)) {
|
|
647
798
|
// this tile may have graphics associated with it
|
|
799
|
+
// @ts-expect-error more properties will be added to this.fetchedTiles[tileId] later (such as by synchronizeTilesAndGraphics())
|
|
648
800
|
this.fetchedTiles[tileId] = this.visibleTiles[i];
|
|
649
801
|
}
|
|
650
802
|
|
|
@@ -654,14 +806,17 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
654
806
|
// object but an object array...
|
|
655
807
|
if (Array.isArray(loadedTiles[this.visibleTiles[i].remoteId])) {
|
|
656
808
|
const tileData = loadedTiles[this.visibleTiles[i].remoteId];
|
|
809
|
+
// @ts-expect-error this.fetchedTiles[tileId].tileData will get more defined in the next lines
|
|
657
810
|
this.fetchedTiles[tileId].tileData = [...tileData];
|
|
658
811
|
// Fritz: this is sooo hacky... we should really not use object arrays
|
|
659
812
|
Object.keys(tileData)
|
|
660
813
|
.filter((key) => Number.isNaN(+key))
|
|
661
814
|
.forEach((key) => {
|
|
815
|
+
// @ts-expect-error Since tileData is an array, the properties have to be copied over manually
|
|
662
816
|
this.fetchedTiles[tileId].tileData[key] = tileData[key];
|
|
663
817
|
});
|
|
664
818
|
} else {
|
|
819
|
+
// @ts-expect-error The object doesn't at this point have all of the properties that it will have later
|
|
665
820
|
this.fetchedTiles[tileId].tileData = {
|
|
666
821
|
...loadedTiles[this.visibleTiles[i].remoteId],
|
|
667
822
|
};
|
|
@@ -700,12 +855,15 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
700
855
|
|
|
701
856
|
// Let HiGlass know we need to re-render
|
|
702
857
|
// check if the value scale has changed
|
|
858
|
+
// @ts-expect-error This is defined by classes which extend this one
|
|
703
859
|
if (this.valueScale) {
|
|
704
860
|
if (
|
|
705
861
|
!this.prevValueScale ||
|
|
862
|
+
// @ts-expect-error This is defined by classes which extend this one
|
|
706
863
|
JSON.stringify(this.valueScale.domain()) !==
|
|
707
864
|
JSON.stringify(this.prevValueScale.domain())
|
|
708
865
|
) {
|
|
866
|
+
// @ts-expect-error This is defined by classes which extend this one
|
|
709
867
|
this.prevValueScale = this.valueScale.copy();
|
|
710
868
|
|
|
711
869
|
if (this.onValueScaleChanged) {
|
|
@@ -720,18 +878,13 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
720
878
|
// 1. Check if all visible tiles are loaded
|
|
721
879
|
// 2. If `true` then send out event
|
|
722
880
|
if (this.areAllVisibleTilesLoaded()) {
|
|
723
|
-
|
|
724
|
-
this.pubSub.publish('TiledPixiTrack.tilesLoaded', { uuid: this.uuid });
|
|
725
|
-
}
|
|
881
|
+
this.pubSub?.publish('TiledPixiTrack.tilesLoaded', { uuid: this.uuid });
|
|
726
882
|
}
|
|
727
883
|
}
|
|
728
884
|
|
|
729
885
|
_checkForErrors() {
|
|
730
886
|
const errors = Object.values(this.fetchedTiles)
|
|
731
|
-
.map(
|
|
732
|
-
(x) =>
|
|
733
|
-
x.tileData && x.tileData.error && `${x.tileId}: ${x.tileData.error}`,
|
|
734
|
-
)
|
|
887
|
+
.map((x) => x.tileData?.error && `${x.tileId}: ${x.tileData.error}`)
|
|
735
888
|
.filter((x) => x);
|
|
736
889
|
|
|
737
890
|
if (errors.length) {
|
|
@@ -756,26 +909,23 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
756
909
|
if (this.dataFetcher.tilesetInfoLoading) {
|
|
757
910
|
this.trackNotFoundText.text = 'Loading...';
|
|
758
911
|
} else {
|
|
759
|
-
|
|
912
|
+
const server = this.dataFetcher.dataConfig.server || 'unknown';
|
|
913
|
+
const tilesetUid = this.dataFetcher.dataConfig.tilesetUid;
|
|
914
|
+
this.trackNotFoundText.text = `Tileset info not found. Server: [${server}] tilesetUid: [${tilesetUid}]`;
|
|
760
915
|
}
|
|
761
916
|
|
|
762
917
|
[this.trackNotFoundText.x, this.trackNotFoundText.y] = this.position;
|
|
763
|
-
|
|
764
|
-
if (this.flipText)
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
}
|
|
918
|
+
/*
|
|
919
|
+
if (this.flipText)
|
|
920
|
+
this.trackNotFoundText.scale.x = -1;
|
|
921
|
+
*/
|
|
768
922
|
|
|
769
923
|
this.trackNotFoundText.visible = true;
|
|
770
924
|
} else {
|
|
771
925
|
this.trackNotFoundText.visible = false;
|
|
772
926
|
}
|
|
773
927
|
|
|
774
|
-
|
|
775
|
-
this.pubSub.publish('TiledPixiTrack.tilesDrawnStart', {
|
|
776
|
-
uuid: this.uuid,
|
|
777
|
-
});
|
|
778
|
-
}
|
|
928
|
+
this.pubSub?.publish('TiledPixiTrack.tilesDrawnStart', { uuid: this.uuid });
|
|
779
929
|
|
|
780
930
|
this._checkForErrors();
|
|
781
931
|
|
|
@@ -784,17 +934,15 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
784
934
|
Object.keys(this.fetchedTiles).forEach((tilesetUid) => {
|
|
785
935
|
this.drawTile(this.fetchedTiles[tilesetUid]);
|
|
786
936
|
});
|
|
787
|
-
// console.log('errors:', errors);
|
|
788
937
|
|
|
789
|
-
|
|
790
|
-
this.pubSub.publish('TiledPixiTrack.tilesDrawnEnd', { uuid: this.uuid });
|
|
791
|
-
}
|
|
938
|
+
this.pubSub?.publish('TiledPixiTrack.tilesDrawnEnd', { uuid: this.uuid });
|
|
792
939
|
}
|
|
793
940
|
|
|
794
941
|
/**
|
|
795
942
|
* Draw a tile on some graphics
|
|
943
|
+
* @param {Tile} tile
|
|
796
944
|
*/
|
|
797
|
-
drawTile(
|
|
945
|
+
drawTile(tile) {}
|
|
798
946
|
|
|
799
947
|
calculateMedianVisibleValue() {
|
|
800
948
|
if (this.areAllVisibleTilesLoaded()) {
|
|
@@ -807,7 +955,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
807
955
|
visibleAndFetchedIds = Object.keys(this.fetchedTiles);
|
|
808
956
|
}
|
|
809
957
|
|
|
810
|
-
const values = []
|
|
958
|
+
const values = /** @type {Array<number>} */ ([])
|
|
811
959
|
.concat(
|
|
812
960
|
...visibleAndFetchedIds
|
|
813
961
|
.filter((x) => this.fetchedTiles[x].tileData.dense)
|
|
@@ -820,7 +968,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
820
968
|
}
|
|
821
969
|
|
|
822
970
|
allVisibleValues() {
|
|
823
|
-
return [].concat(
|
|
971
|
+
return /** @type {Array<number>} */ ([]).concat(
|
|
824
972
|
...this.visibleAndFetchedIds().map((x) =>
|
|
825
973
|
Array.from(this.fetchedTiles[x].tileData.dense),
|
|
826
974
|
),
|
|
@@ -841,6 +989,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
841
989
|
visibleAndFetchedIds = Object.keys(this.fetchedTiles);
|
|
842
990
|
}
|
|
843
991
|
|
|
992
|
+
/** @type {number | null} */
|
|
844
993
|
let min = Math.min(
|
|
845
994
|
...visibleAndFetchedIds.map(
|
|
846
995
|
(x) => this.fetchedTiles[x].tileData.minNonZero,
|
|
@@ -871,6 +1020,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
871
1020
|
visibleAndFetchedIds = Object.keys(this.fetchedTiles);
|
|
872
1021
|
}
|
|
873
1022
|
|
|
1023
|
+
/** @type {number | null} */
|
|
874
1024
|
let max = Math.max(
|
|
875
1025
|
...visibleAndFetchedIds.map(
|
|
876
1026
|
(x) => this.fetchedTiles[x].tileData.maxNonZero,
|
|
@@ -887,30 +1037,20 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
887
1037
|
return this.valueScaleMax !== null ? this.valueScaleMax : max;
|
|
888
1038
|
}
|
|
889
1039
|
|
|
1040
|
+
/** @typedef {import('d3-scale').ScaleQuantile<number, never> & { ticks?: (count: number) => number[] }} ScaleQuantile */
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Create a value scale that will be used to position values
|
|
1044
|
+
* along the y axis.
|
|
1045
|
+
* @param {number} minValue The minimum value of the data
|
|
1046
|
+
* @param {number} medianValue The median value of the data. Potentially used for adding a pseudocount
|
|
1047
|
+
* @param {number} maxValue The maximum value of the data
|
|
1048
|
+
* @param {number} [inMargin] A number of pixels to be left free on the top and bottom
|
|
1049
|
+
* of the track. For example if the glyphs have a certain
|
|
1050
|
+
* width and we want all of them to fit into the space
|
|
1051
|
+
* @returns {[t.Scale | ScaleQuantile, number]}
|
|
1052
|
+
*/
|
|
890
1053
|
makeValueScale(minValue, medianValue, maxValue, inMargin) {
|
|
891
|
-
/*
|
|
892
|
-
* Create a value scale that will be used to position values
|
|
893
|
-
* along the y axis.
|
|
894
|
-
*
|
|
895
|
-
* Parameters
|
|
896
|
-
* ----------
|
|
897
|
-
* minValue: number
|
|
898
|
-
* The minimum value of the data
|
|
899
|
-
* medianValue: number
|
|
900
|
-
* The median value of the data. Potentially used for adding
|
|
901
|
-
* a pseudocount
|
|
902
|
-
* maxValue: number
|
|
903
|
-
* The maximum value of the data
|
|
904
|
-
* margin: number
|
|
905
|
-
* A number of pixels to be left free on the top and bottom
|
|
906
|
-
* of the track. For example if the glyphs have a certain
|
|
907
|
-
* width and we want all of them to fit into the space.
|
|
908
|
-
*
|
|
909
|
-
* Returns
|
|
910
|
-
* -------
|
|
911
|
-
* valueScale: d3.scale
|
|
912
|
-
* A d3 value scale
|
|
913
|
-
*/
|
|
914
1054
|
let valueScale = null;
|
|
915
1055
|
let offsetValue = 0;
|
|
916
1056
|
|
|
@@ -941,12 +1081,13 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
941
1081
|
// .base(Math.E)
|
|
942
1082
|
.domain([offsetValue, maxValue + offsetValue])
|
|
943
1083
|
// .domain([offsetValue, this.maxValue()])
|
|
944
|
-
.range([
|
|
1084
|
+
.range([maxDimension, minDimension]);
|
|
945
1085
|
|
|
946
1086
|
// pseudocount = offsetValue;
|
|
947
1087
|
} else if (this.options.valueScaling === 'quantile') {
|
|
948
1088
|
const start = this.dimensions[1] - margin;
|
|
949
1089
|
const end = margin;
|
|
1090
|
+
/** @type {ScaleQuantile} */
|
|
950
1091
|
const quantScale = scaleQuantile()
|
|
951
1092
|
.domain(this.allVisibleValues())
|
|
952
1093
|
.range(range(start, end, (end - start) / 256));
|
|
@@ -957,6 +1098,7 @@ class TiledPixiTrack extends PixiTrack {
|
|
|
957
1098
|
const start = this.dimensions[1] - margin;
|
|
958
1099
|
const end = margin;
|
|
959
1100
|
const s = new Set(this.allVisibleValues());
|
|
1101
|
+
/** @type {ScaleQuantile} */
|
|
960
1102
|
const quantScale = scaleQuantile()
|
|
961
1103
|
.domain([...s])
|
|
962
1104
|
.range(range(start, end, (end - start) / 256));
|