higlass 1.13.5 → 1.13.6
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 +3 -3
- package/app/scripts/AddTrackPositionMenu.jsx +2 -2
- package/app/scripts/Annotations1dTrack.js +1 -1
- package/app/scripts/Annotations2dTrack.js +3 -5
- package/app/scripts/Autocomplete.jsx +14 -21
- package/app/scripts/AxisPixi.js +6 -10
- package/app/scripts/BarTrack.js +3 -3
- package/app/scripts/BedLikeTrack.js +12 -13
- 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 +1 -2
- package/app/scripts/ContextMenuItem.jsx +1 -0
- 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/GalleryTracks.jsx +77 -78
- package/app/scripts/GenomePositionSearchBox.jsx +10 -9
- package/app/scripts/HeatmapOptions.jsx +4 -2
- package/app/scripts/HeatmapTiledPixiTrack.js +23 -32
- package/app/scripts/HiGlassComponent.jsx +75 -98
- 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 +6 -11
- package/app/scripts/SeriesListSubmenuMixin.jsx +1 -1
- package/app/scripts/SketchInlinePicker.jsx +2 -2
- package/app/scripts/SortableList.jsx +1 -1
- package/app/scripts/Tiled1DPixiTrack.js +5 -1
- package/app/scripts/TiledPixiTrack.js +232 -99
- package/app/scripts/TiledPlot.jsx +33 -43
- 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 +30 -31
- 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 +4 -4
- package/app/scripts/ViewHeader.jsx +6 -7
- package/app/scripts/ViewportTracker2D.js +1 -1
- package/app/scripts/api.js +5 -6
- package/app/scripts/configs/available-track-types.js +1 -1
- package/app/scripts/configs/positions-by-datatype.js +2 -2
- 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 +2 -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 +6 -10
- package/app/scripts/data-fetchers/local-tile-fetcher.js +2 -6
- package/app/scripts/hglib.jsx +1 -1
- 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/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 -281
- package/app/scripts/services/worker.js +30 -28
- package/app/scripts/test-helpers/test-helpers.jsx +3 -3
- package/app/scripts/types.ts +50 -44
- 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/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 +36 -10
- 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/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/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/show-mouse-position.js +16 -0
- 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 +7 -5
- package/app/styles/d3-context-menu.css +0 -1
- package/app/styles/prism.css +1 -0
- package/dist/hglib.js +78064 -77770
- package/dist/hglib.min.js +109 -109
- package/dist/higlass.mjs +82736 -82442
- package/package.json +13 -18
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Export a PIXI text to an SVG element
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* returns {Element} A DOM SVG Element with all of the attributes set as to display
|
|
7
|
-
* the given text.
|
|
3
|
+
* @param {import('pixi.js').Text} pixiText A PIXI.Text object that we want to create an SVG element for
|
|
4
|
+
* @returns { HTMLElement } A DOM SVG Element with all of the attributes set as to display the given text.
|
|
8
5
|
*/
|
|
9
6
|
export const pixiTextToSvg = (pixiText) => {
|
|
10
7
|
const g = document.createElement('g');
|
|
@@ -18,11 +15,10 @@ export const pixiTextToSvg = (pixiText) => {
|
|
|
18
15
|
t.setAttribute('text-anchor', 'middle');
|
|
19
16
|
}
|
|
20
17
|
|
|
21
|
-
t.setAttribute('font-family', pixiText.style.fontFamily);
|
|
22
|
-
t.setAttribute('font-size', pixiText.style.fontSize);
|
|
18
|
+
t.setAttribute('font-family', pixiText.style.fontFamily?.toString() ?? '');
|
|
19
|
+
t.setAttribute('font-size', pixiText.style.fontSize?.toString() ?? '');
|
|
23
20
|
g.setAttribute('transform', `scale(${pixiText.scale.x},1)`);
|
|
24
|
-
|
|
25
|
-
t.setAttribute('fill', pixiText.style.fill);
|
|
21
|
+
t.setAttribute('fill', pixiText.style.fill?.toString() ?? '');
|
|
26
22
|
t.innerHTML = pixiText.text;
|
|
27
23
|
|
|
28
24
|
g.appendChild(t);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import addArrays from './add-arrays';
|
|
3
2
|
import accessorTransposition from './accessor-transposition';
|
|
3
|
+
import addArrays from './add-arrays';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Perform a 2D query on a 1D array
|
|
@@ -24,9 +24,9 @@ const rangeQuery2d = (
|
|
|
24
24
|
xRange,
|
|
25
25
|
yRange,
|
|
26
26
|
mirrored,
|
|
27
|
-
|
|
27
|
+
// biome-ignore lint/style/useDefaultParameterLast:
|
|
28
28
|
xOff = 0,
|
|
29
|
-
|
|
29
|
+
// biome-ignore lint/style/useDefaultParameterLast:
|
|
30
30
|
yOff = 0,
|
|
31
31
|
outList,
|
|
32
32
|
) => {
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
|
-
* Pure functional reducer. Can be used for currying stuff.
|
|
4
|
-
*
|
|
5
|
-
* @
|
|
2
|
+
* Pure functional reducer. Can be used for currying stuff.
|
|
3
|
+
*
|
|
4
|
+
* @see {@link ./flatten.js}
|
|
5
|
+
*
|
|
6
|
+
* @template T
|
|
7
|
+
* @template U
|
|
8
|
+
*
|
|
9
|
+
* @param {(previousValue: U, currentValue: T, currentIndex: number, array: Array<T>) => U} callbackfn
|
|
10
|
+
* @param {U} initialValue
|
|
11
|
+
* @return {(x: Array<T>) => U} Curried function that accepts an array to be reduced.
|
|
6
12
|
*/
|
|
7
|
-
const reduce = (
|
|
13
|
+
const reduce = (callbackfn, initialValue) => (x) =>
|
|
14
|
+
x.reduce(callbackfn, initialValue);
|
|
8
15
|
|
|
9
16
|
// TODO(Trevor): Not referenced anywhere. Remove?
|
|
10
17
|
export default reduce;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { IntervalTree } from './interval-tree';
|
|
2
|
+
|
|
3
|
+
/** @typedef {{ from:number, to: number }} Segment */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Partition a list of segments into an array of rows containing the segments.
|
|
7
|
+
*
|
|
8
|
+
* WARNING: Sorts the `segments` array input _inplace_.
|
|
9
|
+
*
|
|
10
|
+
* @param {Array<Segment>} segments An array of segments (e.g. [{from: 10, to: 20}, {from: 18, to: 30}])
|
|
11
|
+
* @return: {Array<Array<Segment>>} non-overlapping rows of segments
|
|
12
|
+
*/
|
|
4
13
|
function segmentsToRows(segments) {
|
|
5
|
-
/**
|
|
6
|
-
* Partition a list of segments into an array of
|
|
7
|
-
* rows containing the segments.
|
|
8
|
-
*
|
|
9
|
-
* @param segments: An array of segments (e.g. [{from: 10, to: 20}, {from: 18, to: 30}])
|
|
10
|
-
* @return: An array of arrays of segments, representing
|
|
11
|
-
* non-overlapping rows of segments
|
|
12
|
-
*/
|
|
13
14
|
// sort by the length of each segment
|
|
14
15
|
segments.sort((a, b) => b.to - b.from - (a.to - a.from));
|
|
15
16
|
|
|
17
|
+
/** @type {Array<Array<Segment>>} */
|
|
16
18
|
const rows = [[]];
|
|
17
19
|
const rowIts = [new IntervalTree()];
|
|
18
20
|
|
|
@@ -23,6 +25,7 @@ function segmentsToRows(segments) {
|
|
|
23
25
|
for (let j = 0; j < rows.length; j++) {
|
|
24
26
|
const it = rowIts[j]; // an interval tree
|
|
25
27
|
|
|
28
|
+
/** @type {[number, number]} */
|
|
26
29
|
const toCheck = [+segments[i].from, +segments[i].to];
|
|
27
30
|
const occluded = it.intersects(toCheck);
|
|
28
31
|
|
|
@@ -119,6 +119,22 @@ const showMousePosition = (
|
|
|
119
119
|
y = event.isFrom2dTrack ? event.dataY : event.dataX;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
// If a track is not 2d and is horizontal, the event.dataY
|
|
123
|
+
// value of the mouse pointer location should not be allowed
|
|
124
|
+
// to impact how other tracks globally render their mouse
|
|
125
|
+
// position (see https://github.com/higlass/higlass/issues/814).
|
|
126
|
+
// Likewise, if a track is not 2d and is vertical, the
|
|
127
|
+
// event.dataX value should not be used by other tracks for
|
|
128
|
+
// position reporting.
|
|
129
|
+
|
|
130
|
+
if (!event.isFrom2dTrack) {
|
|
131
|
+
if (!event.isFromVerticalTrack) {
|
|
132
|
+
y = Number.MIN_SAFE_INTEGER;
|
|
133
|
+
} else {
|
|
134
|
+
x = Number.MIN_SAFE_INTEGER;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
122
138
|
// 2d or central tracks are not offset and rather rely on a mask, i.e., the
|
|
123
139
|
// top left *visible* position is *not* [0,0] but given by `getPosition()`.
|
|
124
140
|
const offset = is2d ? getPosition() : [0, 0];
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Generate a SVG line
|
|
4
3
|
* @param {number} x1 Start X
|
|
@@ -6,19 +5,19 @@
|
|
|
6
5
|
* @param {number} x2 End X
|
|
7
6
|
* @param {number} y2 End Y
|
|
8
7
|
* @param {number} strokeWidth Line width
|
|
9
|
-
* @param {
|
|
10
|
-
* @return {
|
|
8
|
+
* @param {string} strokeColor Color HEX string
|
|
9
|
+
* @return {HTMLElement} SVG line object
|
|
11
10
|
*/
|
|
12
11
|
export const svgLine = (x1, y1, x2, y2, strokeWidth, strokeColor) => {
|
|
13
12
|
const line = document.createElement('line');
|
|
14
13
|
|
|
15
|
-
line.setAttribute('x1', x1);
|
|
16
|
-
line.setAttribute('x2', x2);
|
|
17
|
-
line.setAttribute('y1', y1);
|
|
18
|
-
line.setAttribute('y2', y2);
|
|
14
|
+
line.setAttribute('x1', String(x1));
|
|
15
|
+
line.setAttribute('x2', String(x2));
|
|
16
|
+
line.setAttribute('y1', String(y1));
|
|
17
|
+
line.setAttribute('y2', String(y2));
|
|
19
18
|
|
|
20
19
|
if (strokeWidth) {
|
|
21
|
-
line.setAttribute('stroke-width', strokeWidth);
|
|
20
|
+
line.setAttribute('stroke-width', String(strokeWidth));
|
|
22
21
|
}
|
|
23
22
|
if (strokeColor) {
|
|
24
23
|
line.setAttribute('stroke', strokeColor);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
/** @import * as t from '../types' */
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
|
-
* @param {
|
|
3
|
-
* @return {trackConfig is
|
|
4
|
+
* @param {t.TrackConfig} trackConfig
|
|
5
|
+
* @return {trackConfig is t.CombinedTrackConfig}
|
|
4
6
|
*/
|
|
5
7
|
export function isCombinedTrackConfig(trackConfig) {
|
|
6
|
-
return trackConfig.type === 'combined';
|
|
8
|
+
return 'contents' in trackConfig && trackConfig.type === 'combined';
|
|
7
9
|
}
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -23,17 +25,24 @@ export function isObject(obj) {
|
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
|
-
* @param {
|
|
27
|
-
* @returns {info is
|
|
28
|
+
* @param {t.TilesetInfo | undefined} info
|
|
29
|
+
* @returns {info is t.LegacyTilesetInfo}
|
|
28
30
|
*/
|
|
29
31
|
export function isLegacyTilesetInfo(info) {
|
|
30
32
|
return isObject(info) && 'max_width' in info;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
/**
|
|
34
|
-
* @param {
|
|
35
|
-
* @returns {info is
|
|
36
|
+
* @param {t.TilesetInfo | undefined | { error: string }} info
|
|
37
|
+
* @returns {info is t.ResolutionsTilesetInfo}
|
|
36
38
|
*/
|
|
37
39
|
export function isResolutionsTilesetInfo(info) {
|
|
38
40
|
return isObject(info) && 'resolutions' in info;
|
|
39
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* @param {t.TilesetInfo | undefined | { error: string }} info
|
|
44
|
+
* @returns {info is t.TilesetInfo}
|
|
45
|
+
*/
|
|
46
|
+
export function isTilesetInfo(info) {
|
|
47
|
+
return isObject(info) && !('error' in info);
|
|
48
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import visitTracks from './visit-tracks';
|
|
2
2
|
|
|
3
|
-
/** @
|
|
4
|
-
|
|
3
|
+
/** @import { TrackConfig, TrackPosition, TrackVisitor } from '../types' */
|
|
4
|
+
|
|
5
|
+
/** @typedef {{ [Key in TrackPosition]?: Array<TrackConfig> }} PositionedTracks */
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Track visitor for positioned tracks, i.e., tracks with a position.
|
|
9
|
+
*
|
|
8
10
|
* @param {PositionedTracks} positionedTracks - List of all positioned tracks from the view definition.
|
|
9
|
-
* @param {
|
|
11
|
+
* @param {TrackVisitor} visitor - Callback function receiving individual tracks.
|
|
10
12
|
* @param {boolean} inclCombinedTracks - If `true` recursively visit combined tracks.
|
|
11
13
|
*/
|
|
12
14
|
const visitPositionedTracks = (
|
|
@@ -14,11 +16,11 @@ const visitPositionedTracks = (
|
|
|
14
16
|
visitor,
|
|
15
17
|
inclCombinedTracks = true,
|
|
16
18
|
) => {
|
|
17
|
-
/** @type {
|
|
19
|
+
/** @type {Array<TrackConfig>} */
|
|
18
20
|
const allTracks = [];
|
|
19
21
|
|
|
20
22
|
for (const [stringPosition, tracks] of Object.entries(positionedTracks)) {
|
|
21
|
-
/** @type {
|
|
23
|
+
/** @type {TrackPosition} */
|
|
22
24
|
// @ts-expect-error - Typings for Object#entries don't have strong inference,
|
|
23
25
|
// might change in the future.
|
|
24
26
|
const position = stringPosition;
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
-webkit-touch-callout: none; /* iOS Safari */
|
|
26
26
|
-webkit-user-select: none; /* Chrome/Safari/Opera */
|
|
27
|
-
-khtml-user-select: none; /* Konqueror */
|
|
28
27
|
-moz-user-select: none; /* Firefox */
|
|
29
28
|
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
30
29
|
user-select: none;
|