higlass 1.13.6 → 2.0.1
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/app/scripts/AddTrackDialog.jsx +8 -1
- package/app/scripts/AddTrackPositionMenu.jsx +26 -5
- package/app/scripts/Annotations1dTrack.js +90 -251
- package/app/scripts/Annotations2dTrack.js +9 -2
- package/app/scripts/Autocomplete.jsx +1 -9
- package/app/scripts/BedLikeTrack.js +549 -441
- package/app/scripts/ContextMenuContainer.jsx +3 -0
- package/app/scripts/ContextMenuItem.jsx +13 -2
- package/app/scripts/FilledLine.js +349 -0
- package/app/scripts/GenomePositionSearchBox.jsx +178 -477
- package/app/scripts/HiGlassComponent.jsx +443 -349
- package/app/scripts/HiGlassComponentContext.js +5 -0
- package/app/scripts/SeriesListMenu.jsx +94 -44
- package/app/scripts/SeriesListSubmenuMixin.jsx +1 -0
- package/app/scripts/Tiled1DPixiTrack.js +0 -1
- package/app/scripts/TiledPixiTrack.js +72 -63
- package/app/scripts/TiledPlot.jsx +530 -77
- package/app/scripts/TrackRenderer.jsx +2 -2
- package/app/scripts/ViewContextMenu.jsx +50 -2
- package/app/scripts/ViewHeader.jsx +3 -2
- package/app/scripts/api.js +87 -6
- package/app/scripts/configs/index.js +6 -1
- package/app/scripts/configs/primitives.js +2 -0
- package/app/scripts/configs/tracks-info.js +1 -0
- package/app/scripts/data-fetchers/genbank-fetcher.js +9 -14
- package/app/scripts/data-fetchers/local-tile-fetcher.js +8 -2
- package/app/scripts/hglib.jsx +61 -70
- package/app/scripts/options-info.js +49 -11
- package/app/scripts/services/tile-proxy.js +0 -4
- package/app/scripts/services/worker.js +1 -0
- package/app/scripts/test-helpers/index.js +2 -1
- package/app/scripts/test-helpers/test-helpers.jsx +154 -66
- package/app/scripts/types.ts +68 -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/get-default-track-for-datatype.js +2 -1
- package/app/scripts/utils/get-default-tracks-for-datatype.ts +46 -0
- package/app/scripts/utils/index.js +1 -0
- package/app/scripts/utils/positioned-tracks-to-all-tracks.js +55 -0
- package/app/scripts/utils/show-mouse-position.js +0 -16
- package/app/scripts/utils/visit-positioned-tracks.js +4 -1
- package/app/styles/AddTrackPositionMenu.module.scss +37 -0
- package/app/styles/HiGlass.module.scss +3 -1
- package/app/styles/TiledPlot.module.scss +20 -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 +65302 -79868
- package/dist/hglib.min.js +104 -112
- package/dist/higlass.mjs +64214 -78780
- package/dist/index.html +1 -3
- package/dist/package.json +134 -0
- package/package.json +13 -10
|
@@ -444,6 +444,7 @@ export class TrackRenderer extends React.Component {
|
|
|
444
444
|
throw new Error('Component did not mount, this.element is not defined.');
|
|
445
445
|
}
|
|
446
446
|
this.elementPos = this.element.getBoundingClientRect();
|
|
447
|
+
|
|
447
448
|
this.elementSelection = select(this.element);
|
|
448
449
|
|
|
449
450
|
/** @type {import('pixi.js').Graphics} */
|
|
@@ -1961,9 +1962,8 @@ export class TrackRenderer extends React.Component {
|
|
|
1961
1962
|
case 'arrowhead-domains':
|
|
1962
1963
|
return new ArrowheadDomainsTrack(context, track.options);
|
|
1963
1964
|
|
|
1965
|
+
case '1d-annotations':
|
|
1964
1966
|
case 'horizontal-1d-annotations':
|
|
1965
|
-
return new Annotations1dTrack(context, track.options);
|
|
1966
|
-
|
|
1967
1967
|
case 'vertical-1d-annotations':
|
|
1968
1968
|
// Fix this: LeftTrackModifier is doing a whole bunch of things not
|
|
1969
1969
|
// needed by this track but the current setup is not consistent.
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
+
import { format } from 'd3-format';
|
|
3
4
|
import PropTypes from 'prop-types';
|
|
4
5
|
import React from 'react';
|
|
6
|
+
|
|
5
7
|
import { mix } from './mixwith';
|
|
6
8
|
|
|
7
9
|
import { getSeriesItems } from './SeriesListItems';
|
|
8
|
-
import { expandCombinedTracks } from './utils';
|
|
10
|
+
import { absToChr, expandCombinedTracks } from './utils';
|
|
11
|
+
import copyTextToClipboard from './utils/copy-text-to-clipboard';
|
|
9
12
|
|
|
10
13
|
import ContextMenuContainer from './ContextMenuContainer';
|
|
11
14
|
import ContextMenuItem from './ContextMenuItem';
|
|
12
15
|
import SeriesListSubmenuMixin from './SeriesListSubmenuMixin';
|
|
13
16
|
|
|
14
|
-
import { THEME_DARK } from './configs';
|
|
17
|
+
import { THEME_DARK } from './configs/themes';
|
|
15
18
|
|
|
16
19
|
// Styles
|
|
17
20
|
import classes from '../styles/ContextMenu.module.scss';
|
|
@@ -58,6 +61,17 @@ class ViewContextMenu extends mix(ContextMenuContainer).with(
|
|
|
58
61
|
|
|
59
62
|
{seriesItems && <hr className={classes['context-menu-hr']} />}
|
|
60
63
|
|
|
64
|
+
{this.props.genomePositionSearchBox && (
|
|
65
|
+
<ContextMenuItem
|
|
66
|
+
onClick={this.copyLocationToClipboard.bind(this)}
|
|
67
|
+
onMouseEnter={(e) => this.handleOtherMouseEnter(e)}
|
|
68
|
+
>
|
|
69
|
+
Copy location under cursor
|
|
70
|
+
</ContextMenuItem>
|
|
71
|
+
)}
|
|
72
|
+
|
|
73
|
+
<hr className={classes['context-menu-hr']} />
|
|
74
|
+
|
|
61
75
|
<ContextMenuItem
|
|
62
76
|
onClick={() =>
|
|
63
77
|
this.props.onAddTrack({
|
|
@@ -155,6 +169,40 @@ class ViewContextMenu extends mix(ContextMenuContainer).with(
|
|
|
155
169
|
});
|
|
156
170
|
}
|
|
157
171
|
|
|
172
|
+
copyLocationToClipboard() {
|
|
173
|
+
const is2d =
|
|
174
|
+
this.props.tracks[0] && this.props.tracks[0].position === 'center';
|
|
175
|
+
|
|
176
|
+
const chromInfo =
|
|
177
|
+
this.props.genomePositionSearchBox?.searchField?.chromInfo;
|
|
178
|
+
|
|
179
|
+
if (!chromInfo) {
|
|
180
|
+
console.warn(
|
|
181
|
+
'There needs to be a genome position search box present to copy the location',
|
|
182
|
+
);
|
|
183
|
+
this.props.closeMenu();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const xAbsCoord = this.props.coords[0];
|
|
188
|
+
const yAbsCoord = this.props.coords[1];
|
|
189
|
+
|
|
190
|
+
const xChr = absToChr(xAbsCoord, chromInfo);
|
|
191
|
+
const stringFormat = format(',d');
|
|
192
|
+
|
|
193
|
+
let locationText = `${xChr[0]}:${stringFormat(xChr[1])}`;
|
|
194
|
+
|
|
195
|
+
if (is2d) {
|
|
196
|
+
const yChr = absToChr(yAbsCoord, chromInfo);
|
|
197
|
+
locationText = `${locationText} & ${yChr[0]}:${stringFormat(yChr[1])}`;
|
|
198
|
+
copyTextToClipboard(locationText);
|
|
199
|
+
} else {
|
|
200
|
+
copyTextToClipboard(locationText);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
this.props.closeMenu();
|
|
204
|
+
}
|
|
205
|
+
|
|
158
206
|
handleAddVerticalSection() {
|
|
159
207
|
const trackList = expandCombinedTracks(this.props.tracks);
|
|
160
208
|
const matrixTrack = trackList.filter(
|
|
@@ -80,8 +80,8 @@ class ViewHeader extends React.Component {
|
|
|
80
80
|
*
|
|
81
81
|
* We just need to close the menu here.
|
|
82
82
|
*/
|
|
83
|
-
handleTrackPositionChosen(position) {
|
|
84
|
-
this.props.onTrackPositionChosen(position);
|
|
83
|
+
handleTrackPositionChosen(position, extent) {
|
|
84
|
+
this.props.onTrackPositionChosen(position, extent);
|
|
85
85
|
|
|
86
86
|
this.setState({
|
|
87
87
|
addTrackPositionMenuUid: null,
|
|
@@ -287,6 +287,7 @@ class ViewHeader extends React.Component {
|
|
|
287
287
|
onClick={() =>
|
|
288
288
|
this.handleAddTrackPositionMenuOpened(this.props.viewUid)
|
|
289
289
|
}
|
|
290
|
+
data-testid="add-track"
|
|
290
291
|
>
|
|
291
292
|
<title>Add Track</title>
|
|
292
293
|
<use xlinkHref="#plus" />
|
package/app/scripts/api.js
CHANGED
|
@@ -5,18 +5,28 @@ 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
|
/**
|
|
@@ -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.
|
|
@@ -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:
|
|
@@ -742,6 +795,18 @@ const createApi = function api(context, pubSub) {
|
|
|
742
795
|
typeof listenerId === 'object' ? listenerId.callback : listenerId;
|
|
743
796
|
|
|
744
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
|
+
|
|
745
810
|
case 'click':
|
|
746
811
|
apiPubSub.unsubscribe('click', callback);
|
|
747
812
|
break;
|
|
@@ -750,6 +815,10 @@ const createApi = function api(context, pubSub) {
|
|
|
750
815
|
apiPubSub.unsubscribe('cursorLocation', callback);
|
|
751
816
|
break;
|
|
752
817
|
|
|
818
|
+
case 'datasetInfo':
|
|
819
|
+
apiPubSub.unsubscribe('datasetInfo', callback);
|
|
820
|
+
break;
|
|
821
|
+
|
|
753
822
|
case 'location':
|
|
754
823
|
self.offLocationChange(viewId, listenerId);
|
|
755
824
|
break;
|
|
@@ -797,7 +866,7 @@ const createApi = function api(context, pubSub) {
|
|
|
797
866
|
*
|
|
798
867
|
* **Event types**
|
|
799
868
|
*
|
|
800
|
-
* ``click``: Returns
|
|
869
|
+
* ``click``: Returns clicked objects. (Currently only clicks on 1D annotations are captured.)
|
|
801
870
|
*
|
|
802
871
|
* .. code-block:: javascript
|
|
803
872
|
*
|
|
@@ -966,12 +1035,24 @@ const createApi = function api(context, pubSub) {
|
|
|
966
1035
|
*/
|
|
967
1036
|
on(event, callback, viewId, callbackId) {
|
|
968
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
|
+
|
|
969
1047
|
case 'click':
|
|
970
1048
|
return apiPubSub.subscribe('click', callback);
|
|
971
1049
|
|
|
972
1050
|
case 'cursorLocation':
|
|
973
1051
|
return apiPubSub.subscribe('cursorLocation', callback);
|
|
974
1052
|
|
|
1053
|
+
case 'datasetInfo':
|
|
1054
|
+
return apiPubSub.subscribe('datasetInfo', callback);
|
|
1055
|
+
|
|
975
1056
|
case 'location':
|
|
976
1057
|
// returns a set of scales (xScale, yScale) on every zoom event
|
|
977
1058
|
return self.onLocationChange(viewId, callback, callbackId);
|
|
@@ -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';
|
|
@@ -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
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import genbankParser from 'genbank-parser';
|
|
2
|
-
import pako from 'pako';
|
|
3
2
|
import slugid from 'slugid';
|
|
4
3
|
|
|
4
|
+
import decompress from '../utils/decompress';
|
|
5
|
+
|
|
5
6
|
/** @import { AbstractDataFetcher } from '../types' */
|
|
6
7
|
/** @typedef {{ start: number, end: number, type: 'filler', strand: "+" | "-" }} FillerSegment */
|
|
7
8
|
|
|
@@ -201,18 +202,6 @@ function gbToJsonAndFeatures(gbText) {
|
|
|
201
202
|
return { json: gbJson, features };
|
|
202
203
|
}
|
|
203
204
|
|
|
204
|
-
/**
|
|
205
|
-
* Extract the response from a fetch request
|
|
206
|
-
* @param {Response} response
|
|
207
|
-
* @param {{ gzipped: boolean }} options
|
|
208
|
-
* @returns {Promise<string>}
|
|
209
|
-
*/
|
|
210
|
-
async function extractResponse(response, { gzipped }) {
|
|
211
|
-
if (!gzipped) return response.text();
|
|
212
|
-
const buffer = await response.arrayBuffer();
|
|
213
|
-
return pako.inflate(buffer, { to: 'string' });
|
|
214
|
-
}
|
|
215
|
-
|
|
216
205
|
/**
|
|
217
206
|
* @typedef GenbankDataConfig
|
|
218
207
|
* @prop {string=} url
|
|
@@ -243,7 +232,13 @@ class GBKDataFetcher {
|
|
|
243
232
|
mode: 'cors',
|
|
244
233
|
redirect: 'follow',
|
|
245
234
|
method: 'GET',
|
|
246
|
-
}).then((
|
|
235
|
+
}).then((originalResponse) => {
|
|
236
|
+
const normalizedResponse =
|
|
237
|
+
extension === '.gz'
|
|
238
|
+
? decompress(originalResponse, { format: 'gzip' })
|
|
239
|
+
: originalResponse;
|
|
240
|
+
return normalizedResponse.text();
|
|
241
|
+
});
|
|
247
242
|
} else if (dataConfig.text) {
|
|
248
243
|
textPromise = Promise.resolve(dataConfig.text);
|
|
249
244
|
} else {
|
|
@@ -3,7 +3,7 @@ import { tileResponseToData } from '../services';
|
|
|
3
3
|
/** @import { AbstractDataFetcher, TilesetInfo } from '../types' */
|
|
4
4
|
|
|
5
5
|
// TODO: Add type for LocalTile
|
|
6
|
-
/** @typedef {{}} LocalTile */
|
|
6
|
+
/** @typedef {{tilePositionId?: string}} LocalTile */
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef LocalTileDataConfig
|
|
@@ -28,7 +28,12 @@ class LocalTileDataFetcher {
|
|
|
28
28
|
/** @param {import('../types').HandleTilesetInfoFinished} callback */
|
|
29
29
|
async tilesetInfo(callback) {
|
|
30
30
|
this.tilesetInfoLoading = false;
|
|
31
|
-
|
|
31
|
+
await new Promise((resolve) =>
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
callback(this.tilesetInfoData);
|
|
34
|
+
resolve(true);
|
|
35
|
+
}, 0),
|
|
36
|
+
);
|
|
32
37
|
return this.tilesetInfoData;
|
|
33
38
|
}
|
|
34
39
|
|
|
@@ -57,6 +62,7 @@ class LocalTileDataFetcher {
|
|
|
57
62
|
|
|
58
63
|
for (const tileId of tileIds) {
|
|
59
64
|
ret[tileId] = this.tilesData[`localtile.${tileId}`];
|
|
65
|
+
ret[tileId].tilePositionId = tileId;
|
|
60
66
|
}
|
|
61
67
|
receivedTiles(ret);
|
|
62
68
|
return ret;
|
package/app/scripts/hglib.jsx
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import ReactDOM from 'react-dom';
|
|
4
3
|
import HiGlassComponent from './HiGlassComponent';
|
|
5
4
|
|
|
6
5
|
import HorizontalGeneAnnotationsTrack from './HorizontalGeneAnnotationsTrack';
|
|
7
|
-
// these exports can be used to create new tracks in outside
|
|
8
|
-
// environments (e.g. Observable)
|
|
6
|
+
// these exports can be used to create new tracks in outside environments (e.g. Observable)
|
|
9
7
|
import SVGTrack from './SVGTrack';
|
|
10
8
|
import TiledPixiTrack from './TiledPixiTrack';
|
|
11
9
|
|
|
@@ -22,7 +20,15 @@ export const tracks = {
|
|
|
22
20
|
HorizontalGeneAnnotationsTrack,
|
|
23
21
|
};
|
|
24
22
|
|
|
25
|
-
export { default as schema } from '../schema.json';
|
|
23
|
+
export { default as schema } from '../schema.json' with { type: 'json' };
|
|
24
|
+
export { version } from '../../package.json' with { type: 'json' };
|
|
25
|
+
|
|
26
|
+
/** @import * as api from './api' */
|
|
27
|
+
/** @import * as types from './types' */
|
|
28
|
+
|
|
29
|
+
/** @typedef {api.HiGlassApi["public"]} HiGlassApi */
|
|
30
|
+
/** @typedef {types.HiGlassOptions} HiGlassOptions */
|
|
31
|
+
/** @typedef {types.HiGlassViewConfig} HiGlassViewConfig */
|
|
26
32
|
|
|
27
33
|
// export functions that are useful for testing
|
|
28
34
|
export {
|
|
@@ -32,86 +38,71 @@ export {
|
|
|
32
38
|
mountHGComponent,
|
|
33
39
|
} from './test-helpers';
|
|
34
40
|
|
|
35
|
-
export {
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
export {
|
|
42
|
+
debounce,
|
|
43
|
+
getDefaultTracksForDatatype,
|
|
44
|
+
getTrackByUid,
|
|
45
|
+
getTrackObjectFromHGC,
|
|
46
|
+
} from './utils';
|
|
38
47
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
export { TRACKS_INFO_BY_TYPE } from './configs';
|
|
49
|
+
export { OPTIONS_INFO } from './options-info';
|
|
50
|
+
/**
|
|
51
|
+
* Create a `HiGlassComponent` instance.
|
|
52
|
+
*
|
|
53
|
+
* @param {HTMLElement} element - The element to attach the HiGlassComponent.
|
|
54
|
+
* @param {HiGlassViewConfig} config - The view configuration.
|
|
55
|
+
* @param {HiGlassOptions} [options] - How the component is drawn and and behaves.
|
|
56
|
+
*
|
|
57
|
+
* @returns {Promise<HiGlassComponent>}
|
|
58
|
+
*/
|
|
59
|
+
const launch = async (element, config, options = {}) => {
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
ReactDOM.render(
|
|
62
|
+
<HiGlassComponent
|
|
63
|
+
ref={(/** @type {HiGlassComponent | null} */ ref) => {
|
|
64
|
+
// Wait to resolve until React gives us a ref
|
|
65
|
+
ref && resolve(ref);
|
|
66
|
+
}}
|
|
67
|
+
options={options}
|
|
68
|
+
viewConfig={config}
|
|
69
|
+
/>,
|
|
70
|
+
element,
|
|
71
|
+
);
|
|
72
|
+
});
|
|
60
73
|
};
|
|
61
74
|
|
|
62
75
|
/**
|
|
63
76
|
* Create a HiGlass component.
|
|
64
77
|
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
78
|
+
* @param {HTMLElement} element - DOM element to render the HiGlass component.
|
|
79
|
+
* @param {HiGlassViewConfig | string} viewConfig - The view config to load.
|
|
80
|
+
* @param {HiGlassOptions} [options] - Additional options for how the HiGlass component is drawn and behaves
|
|
81
|
+
* @returns {Promise<HiGlassApi>} Newly created HiGlass component.
|
|
67
82
|
*
|
|
68
|
-
*
|
|
69
|
-
(e.g. ``JWT xyz``)
|
|
70
|
-
* * **bounded** *(bool)* - A boolean specifying whether the component should be sized
|
|
71
|
-
to fit within the enclosing div [default=false]. If it is false, then the component
|
|
72
|
-
will grow as needed to fit the tracks within it.
|
|
73
|
-
* * **editable** *(bool)* - Can the layout be changed? If false, the view headers will
|
|
74
|
-
be hidden. This can also be specified in the viewconfig using the ``editable`` option.
|
|
75
|
-
The value passed here overrides the value in the viewconf. [default=true]
|
|
76
|
-
* * **defaultTrackOptions** *(dict)* - Specify a set of default options that will be used for
|
|
77
|
-
* newly added tracks. These can be broken down into two types: `all` - affecting all
|
|
78
|
-
* all track types and `trackSpecific` which will affect only some track types. See the
|
|
79
|
-
* example below for a concrete demonstration.
|
|
80
|
-
* @param {Object} element DOM element the HiGlass component should be
|
|
81
|
-
* attached to.
|
|
82
|
-
* @param {Object|String} viewConfig The viewconfig to load. If this parameter is a string
|
|
83
|
-
* it will be interpreted as a url from which to retrieve the viewconf. If it is a dictionary
|
|
84
|
-
* it will be loaded as is.
|
|
85
|
-
* @param {Object} options Dictionary of public options. See the description above for a list
|
|
86
|
-
of available values.
|
|
87
|
-
* @example
|
|
83
|
+
* Note: If `viewConfig` is a string, it will be interpreted as a url from which to retrieve the viewconf.
|
|
88
84
|
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```js
|
|
87
|
+
* const hgv = hglib.viewer(document.querySelector('#app'), viewconf, {
|
|
88
|
+
* bounded: true,
|
|
93
89
|
* defaultTrackOptions: {
|
|
94
|
-
* all: {
|
|
95
|
-
* showTooltip: true,
|
|
96
|
-
* },
|
|
90
|
+
* all: { showTooltip: true },
|
|
97
91
|
* trackSpecific: {
|
|
98
|
-
*
|
|
99
|
-
* showTooltip: false,
|
|
100
|
-
* }
|
|
92
|
+
* heatmap: { showTooltip: false }
|
|
101
93
|
* }
|
|
102
94
|
* }
|
|
103
95
|
* });
|
|
104
|
-
*
|
|
105
|
-
* @return {Object} Newly created HiGlass component.
|
|
96
|
+
* ```
|
|
106
97
|
*/
|
|
107
|
-
export const viewer = (element, viewConfig, options) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
98
|
+
export const viewer = async (element, viewConfig, options = {}) => {
|
|
99
|
+
const hg = await launch(
|
|
100
|
+
element,
|
|
101
|
+
typeof viewConfig === 'string'
|
|
102
|
+
? await fetch(viewConfig).then((response) => response.json())
|
|
103
|
+
: viewConfig,
|
|
104
|
+
options,
|
|
105
|
+
);
|
|
115
106
|
return hg.api;
|
|
116
107
|
};
|
|
117
108
|
|