gosling.js 0.16.0 → 0.17.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/dist/{exported-utils-ac60e3c5.js → exported-utils-c7f92c46.js} +17 -7
- package/dist/{exported-utils-ac60e3c5.js.map → exported-utils-c7f92c46.js.map} +1 -1
- package/dist/gosling.js +79 -29
- package/dist/gosling.js.map +1 -1
- package/dist/src/compiler/higlass-model.d.ts.map +1 -1
- package/dist/src/core/utils/assembly.d.ts +6 -1
- package/dist/src/core/utils/assembly.d.ts.map +1 -1
- package/dist/src/tracks/gosling-track/gosling-track.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/gosling.js
CHANGED
|
@@ -34,7 +34,7 @@ import "bezier-js";
|
|
|
34
34
|
import { scaleLinear, scaleSequential, scaleOrdinal, scaleBand } from "d3-scale";
|
|
35
35
|
import { sampleSize, isEqual, uniqBy, cloneDeepWith } from "lodash-es";
|
|
36
36
|
import { interpolateViridis } from "d3-scale-chromatic";
|
|
37
|
-
import { A as Ajv, I as IsChannelDeep, r as resolveSuperposedTracks, t as traverseTracks, a as IsTemplateTrack, g as getTextStyle, c as computeChromSizes, b as cartesianToPolar, u as uuid, R as RADIAN_GAP, v as valueToRadian, p as pointsToDegree, d as commonjsGlobal, e as RemoteFile, f as IsOneOfFilter, h as IsRangeFilter, i as IsIncludeFilter, j as getChannelKeysByAggregateFnc, k as getChannelKeysByType, s as sanitizeChrName, l as filterUsingGenoPos, m as IsDataDeepTileset, n as IsDomainChr, o as IsDomainInterval, q as IsDomainChrInterval, S as SUPPORTED_CHANNELS, w as insertItemToArray, x as
|
|
37
|
+
import { A as Ajv, I as IsChannelDeep, r as resolveSuperposedTracks, t as traverseTracks, a as IsTemplateTrack, g as getTextStyle, c as computeChromSizes, b as cartesianToPolar, u as uuid, R as RADIAN_GAP, v as valueToRadian, p as pointsToDegree, d as commonjsGlobal, e as RemoteFile, f as IsOneOfFilter, h as IsRangeFilter, i as IsIncludeFilter, j as getChannelKeysByAggregateFnc, k as getChannelKeysByType, s as sanitizeChrName, l as filterUsingGenoPos, m as IsDataDeepTileset, n as IsDomainChr, o as IsDomainInterval, q as IsDomainChrInterval, S as SUPPORTED_CHANNELS, w as insertItemToArray, x as getAutoCompleteObject, y as IsChannelValue, z as getValueUsingChannel, B as rectProperty, C as pointProperty, D as barProperty, E as IsStackedChannel, F as IsDomainArray, P as PREDEFINED_COLOR_STR_MAP, G as IsRangeArray, H as Is2DTrack, J as isTabularDataFetcher, K as drawPreEmbellishment, L as drawMark, M as drawPostEmbellishment, N as getRelativeGenomicPosition, O as hasDataTransform, Q as IsXAxis, T as IsMouseEventsDeep, U as colorToHex, V as flatArrayToPairArray, W as DEWFAULT_TITLE_PADDING_ON_TOP_AND_BOTTOM, X as traverseTracksAndViews, Y as traverseViewArrangements, Z as DEFAULT_VIEW_SPACING, _ as DEFAULT_INNER_RADIUS_PROP, $ as IsDummyTrack, a0 as IsOverlaidTrack, a1 as IsYAxis, a2 as DEFAULT_CIRCULAR_VIEW_PADDING, a3 as IsDataDeep, a4 as IsHiGlassMatrix, a5 as getHiGlassColorRange, a6 as DEFAULT_TEXT_STYLE, a7 as overrideDataTemplates, a8 as traverseToFixSpecDownstream, a9 as GenomicPositionHelper, aa as isObject } from "./exported-utils-c7f92c46.js";
|
|
38
38
|
import higlassRegister from "higlass-register";
|
|
39
39
|
import { TextTrack } from "higlass-text";
|
|
40
40
|
import RBush from "rbush";
|
|
@@ -52,7 +52,7 @@ import require$$0 from "react-dom";
|
|
|
52
52
|
import { HiGlassComponent } from "higlass";
|
|
53
53
|
import { ResizeSensor } from "css-element-queries";
|
|
54
54
|
const name = "gosling.js";
|
|
55
|
-
const version = "0.
|
|
55
|
+
const version = "0.17.0";
|
|
56
56
|
const $ref$2 = "#/definitions/GoslingSpec";
|
|
57
57
|
const $schema$2 = "http://json-schema.org/draft-07/schema#";
|
|
58
58
|
const definitions$2 = {
|
|
@@ -23122,12 +23122,7 @@ const HIGLASS_AXIS_SIZE = 30;
|
|
|
23122
23122
|
const getViewTemplate = (assembly) => {
|
|
23123
23123
|
return {
|
|
23124
23124
|
genomePositionSearchBoxVisible: false,
|
|
23125
|
-
genomePositionSearchBox:
|
|
23126
|
-
autocompleteServer: "https://higlass.io/api/v1",
|
|
23127
|
-
autocompleteId: getAutoCompleteId(assembly),
|
|
23128
|
-
chromInfoServer: "https://higlass.io/api/v1",
|
|
23129
|
-
chromInfoId: assembly != null ? assembly : "hg38"
|
|
23130
|
-
},
|
|
23125
|
+
genomePositionSearchBox: getAutoCompleteObject(assembly),
|
|
23131
23126
|
layout: { w: 12, h: 12, x: 0, y: 0 },
|
|
23132
23127
|
tracks: {
|
|
23133
23128
|
top: [],
|
|
@@ -24434,9 +24429,9 @@ const config$1 = {
|
|
|
24434
24429
|
const factory$1 = (HGC, context, options) => {
|
|
24435
24430
|
var _assembly2, _processedTileInfo, _mouseDownX, _mouseDownY, _isRangeBrushActivated, _gBrush, _loadingTextStyleObj, _loadingTextBg, _loadingText, _processedTileMap, _tilesToId, tilesToId_fn, _binsPerTile, binsPerTile_get, _generateTabularData, generateTabularData_fn, _onMouseDown, onMouseDown_fn, _onMouseMove, onMouseMove_fn, _onMouseUp, onMouseUp_fn, _onMouseOut, onMouseOut_fn, _getElementsWithinMouse, getElementsWithinMouse_fn, _publishTrackEvents, publishTrackEvents_fn, _onRangeBrush, onRangeBrush_fn, _highlightMarks, highlightMarks_fn, _publishOnNewTrack, publishOnNewTrack_fn, _hasStretchableGraphics, hasStretchableGraphics_fn, _isTooStretched, isTooStretched_fn;
|
|
24436
24431
|
const { tileProxy } = HGC.services;
|
|
24437
|
-
const {
|
|
24432
|
+
const { TiledPixiTrack } = HGC.tracks;
|
|
24438
24433
|
const loadingTextStyle = getTextStyle({ color: "black", size: 12 });
|
|
24439
|
-
const _GoslingTrackClass = class _GoslingTrackClass extends
|
|
24434
|
+
const _GoslingTrackClass = class _GoslingTrackClass extends TiledPixiTrack {
|
|
24440
24435
|
/* *
|
|
24441
24436
|
*
|
|
24442
24437
|
* Constructor
|
|
@@ -24450,11 +24445,6 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24450
24445
|
* Construct tabular data from a higlass tileset and a gosling track model.
|
|
24451
24446
|
*/
|
|
24452
24447
|
__privateAdd(this, _generateTabularData);
|
|
24453
|
-
/* *
|
|
24454
|
-
*
|
|
24455
|
-
* Mouse methods
|
|
24456
|
-
*
|
|
24457
|
-
* */
|
|
24458
24448
|
__privateAdd(this, _onMouseDown);
|
|
24459
24449
|
__privateAdd(this, _onMouseMove);
|
|
24460
24450
|
__privateAdd(this, _onMouseUp);
|
|
@@ -24486,8 +24476,7 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24486
24476
|
*/
|
|
24487
24477
|
__privateAdd(this, _hasStretchableGraphics);
|
|
24488
24478
|
/**
|
|
24489
|
-
* Used in drawTile()
|
|
24490
|
-
* Checks if the tile Graphic is too stretched. If so, it returns true.
|
|
24479
|
+
* Used in drawTile(). Checks if the tile Graphic is too stretched. If so, it returns true.
|
|
24491
24480
|
* @param stretchFactor The factor by which the tile is stretched
|
|
24492
24481
|
* @returns True if the tile is too stretched, false otherwise
|
|
24493
24482
|
*/
|
|
@@ -24526,6 +24515,7 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24526
24515
|
// This is used to persist processed tile data across draw() calls.
|
|
24527
24516
|
__privateAdd(this, _processedTileMap, /* @__PURE__ */ new WeakMap());
|
|
24528
24517
|
__publicField(this, "hideMousePosition");
|
|
24518
|
+
const { isShowGlobalMousePosition } = context;
|
|
24529
24519
|
context.dataFetcher.track = this;
|
|
24530
24520
|
__privateSet(this, _processedTileInfo, {});
|
|
24531
24521
|
__privateSet(this, _assembly2, this.options.spec.assembly);
|
|
@@ -24561,15 +24551,11 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24561
24551
|
});
|
|
24562
24552
|
this.pMask.on("mouseout", __privateMethod(this, _onMouseOut, onMouseOut_fn).bind(this));
|
|
24563
24553
|
this.flipText = this.options.spec.orientation === "vertical";
|
|
24564
|
-
if (this.hideMousePosition) {
|
|
24565
|
-
this.hideMousePosition();
|
|
24566
|
-
this.hideMousePosition = void 0;
|
|
24567
|
-
}
|
|
24568
24554
|
if (((_d = this.options) == null ? void 0 : _d.showMousePosition) && !this.hideMousePosition) {
|
|
24569
24555
|
this.hideMousePosition = HGC.utils.showMousePosition(
|
|
24570
24556
|
this,
|
|
24571
24557
|
Is2DTrack(this.getResolvedTracks()[0]),
|
|
24572
|
-
|
|
24558
|
+
isShowGlobalMousePosition()
|
|
24573
24559
|
);
|
|
24574
24560
|
}
|
|
24575
24561
|
this.pLabel.removeChild(this.trackNotFoundText);
|
|
@@ -24603,6 +24589,11 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24603
24589
|
const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher;
|
|
24604
24590
|
this.processAllTiles(isBamDataFetcher);
|
|
24605
24591
|
super.draw();
|
|
24592
|
+
Object.values(this.fetchedTiles).forEach((tile) => {
|
|
24593
|
+
if (!tile.drawnAtScale)
|
|
24594
|
+
return;
|
|
24595
|
+
[tile.graphics.scale.x, tile.graphics.position.x] = this.getXScaleAndOffset(tile.drawnAtScale);
|
|
24596
|
+
});
|
|
24606
24597
|
this.prevVisibleAndFetchedTiles = this.visibleAndFetchedTiles();
|
|
24607
24598
|
};
|
|
24608
24599
|
if (isTabularDataFetcher(this.dataFetcher) && !isEqual(this.visibleAndFetchedTiles(), this.prevVisibleAndFetchedTiles)) {
|
|
@@ -24616,6 +24607,17 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24616
24607
|
this.firstDraw = false;
|
|
24617
24608
|
}
|
|
24618
24609
|
}
|
|
24610
|
+
/**
|
|
24611
|
+
* Copied from BarTrack
|
|
24612
|
+
*/
|
|
24613
|
+
getXScaleAndOffset(drawnAtScale) {
|
|
24614
|
+
const dA = drawnAtScale.domain();
|
|
24615
|
+
const dB = this._xScale.domain();
|
|
24616
|
+
const tileK = (dA[1] - dA[0]) / (dB[1] - dB[0]);
|
|
24617
|
+
const newRange = this._xScale.domain().map(drawnAtScale);
|
|
24618
|
+
const posOffset = newRange[0];
|
|
24619
|
+
return [tileK, -posOffset * tileK];
|
|
24620
|
+
}
|
|
24619
24621
|
/*
|
|
24620
24622
|
* Do whatever is necessary before rendering a new tile. This function is called from `receivedTiles()`.
|
|
24621
24623
|
* Overrides initTile in BarTrack
|
|
@@ -24656,7 +24658,8 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24656
24658
|
this.pBackground.clear();
|
|
24657
24659
|
this.pBackground.removeChildren();
|
|
24658
24660
|
this.pBorder.clear();
|
|
24659
|
-
this.pBorder.removeChildren();
|
|
24661
|
+
const children = this.pBorder.removeChildren();
|
|
24662
|
+
children.forEach((c) => c.destroy());
|
|
24660
24663
|
this.displayedLegends = [];
|
|
24661
24664
|
tileInfo.goslingModels.forEach((model) => {
|
|
24662
24665
|
const trackWidth = this.dimensions[0];
|
|
@@ -24728,6 +24731,7 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24728
24731
|
setPosition(newPosition) {
|
|
24729
24732
|
super.setPosition(newPosition);
|
|
24730
24733
|
[this.pMain.position.x, this.pMain.position.y] = this.position;
|
|
24734
|
+
[this.pMouseOver.position.x, this.pMouseOver.position.y] = this.position;
|
|
24731
24735
|
this.mRangeBrush.setOffset(...newPosition);
|
|
24732
24736
|
}
|
|
24733
24737
|
/**
|
|
@@ -24830,7 +24834,7 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24830
24834
|
callback();
|
|
24831
24835
|
}
|
|
24832
24836
|
/**
|
|
24833
|
-
*
|
|
24837
|
+
* This method is called in the TiledPixiTrack constructor `super(context, options)`.
|
|
24834
24838
|
* So be aware to use defined variables.
|
|
24835
24839
|
*/
|
|
24836
24840
|
calculateVisibleTiles() {
|
|
@@ -24875,7 +24879,7 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24875
24879
|
} else {
|
|
24876
24880
|
const xTiles = tileProxy.calculateTiles(
|
|
24877
24881
|
zoomLevel,
|
|
24878
|
-
this.
|
|
24882
|
+
this._xScale,
|
|
24879
24883
|
this.tilesetInfo.min_pos[0],
|
|
24880
24884
|
this.tilesetInfo.max_pos[0],
|
|
24881
24885
|
this.tilesetInfo.max_zoom,
|
|
@@ -24899,7 +24903,31 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24899
24903
|
}
|
|
24900
24904
|
}
|
|
24901
24905
|
/**
|
|
24902
|
-
*
|
|
24906
|
+
* Copied from HorizontalTiled1DPixiTrack
|
|
24907
|
+
*/
|
|
24908
|
+
calculateZoomLevel() {
|
|
24909
|
+
if (!this.tilesetInfo) {
|
|
24910
|
+
throw Error("tilesetInfo not parsed");
|
|
24911
|
+
}
|
|
24912
|
+
if ("resolutions" in this.tilesetInfo) {
|
|
24913
|
+
const zoomIndexX = tileProxy.calculateZoomLevelFromResolutions(
|
|
24914
|
+
this.tilesetInfo.resolutions,
|
|
24915
|
+
this._xScale
|
|
24916
|
+
);
|
|
24917
|
+
return zoomIndexX;
|
|
24918
|
+
}
|
|
24919
|
+
const xZoomLevel = tileProxy.calculateZoomLevel(
|
|
24920
|
+
this._xScale,
|
|
24921
|
+
this.tilesetInfo.min_pos[0],
|
|
24922
|
+
this.tilesetInfo.max_pos[0],
|
|
24923
|
+
this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size
|
|
24924
|
+
);
|
|
24925
|
+
let zoomLevel = Math.min(xZoomLevel, this.maxZoom);
|
|
24926
|
+
zoomLevel = Math.max(zoomLevel, 0);
|
|
24927
|
+
return zoomLevel;
|
|
24928
|
+
}
|
|
24929
|
+
/**
|
|
24930
|
+
* Get the tile's position in its coordinate system. Based on method in Tiled1DPixiTrack
|
|
24903
24931
|
*/
|
|
24904
24932
|
getTilePosAndDimensions(zoomLevel, tilePos) {
|
|
24905
24933
|
if (!this.tilesetInfo) {
|
|
@@ -24936,7 +24964,7 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24936
24964
|
}
|
|
24937
24965
|
}
|
|
24938
24966
|
/**
|
|
24939
|
-
* Gets the indices of the visible data a tile.
|
|
24967
|
+
* Gets the indices of the visible data a tile. Based on method in Tiled1DPixiTrack
|
|
24940
24968
|
*/
|
|
24941
24969
|
getIndicesOfVisibleDataInTile(tile) {
|
|
24942
24970
|
const visible = this._xScale.range();
|
|
@@ -24954,7 +24982,6 @@ const factory$1 = (HGC, context, options) => {
|
|
|
24954
24982
|
}
|
|
24955
24983
|
/**
|
|
24956
24984
|
* Overrides method in TiledPixiTrack
|
|
24957
|
-
* @param loadedTiles
|
|
24958
24985
|
*/
|
|
24959
24986
|
receivedTiles(loadedTiles) {
|
|
24960
24987
|
super.receivedTiles(loadedTiles);
|
|
@@ -25007,6 +25034,18 @@ const factory$1 = (HGC, context, options) => {
|
|
|
25007
25034
|
const isBamDataFetcher = this.dataFetcher instanceof BamDataFetcher;
|
|
25008
25035
|
return includesDisplaceTransform && !hasDenseTiles() && !isBamDataFetcher;
|
|
25009
25036
|
}
|
|
25037
|
+
/**
|
|
25038
|
+
* Copied from Tiled1DPixiTrack. The ID of the local tile
|
|
25039
|
+
*/
|
|
25040
|
+
tileToLocalId(tile) {
|
|
25041
|
+
return `${tile.join(".")}`;
|
|
25042
|
+
}
|
|
25043
|
+
/**
|
|
25044
|
+
* Copied from Tiled1DPixiTrack. The ID of the tile on the server.
|
|
25045
|
+
*/
|
|
25046
|
+
tileToRemoteId(tile) {
|
|
25047
|
+
return `${tile.join(".")}`;
|
|
25048
|
+
}
|
|
25010
25049
|
/**
|
|
25011
25050
|
* Creates an array of SingleTracks if there are overlaid tracks.
|
|
25012
25051
|
* This method cannot be private because it is called by functions which are called by super.draw();
|
|
@@ -25101,9 +25140,20 @@ const factory$1 = (HGC, context, options) => {
|
|
|
25101
25140
|
});
|
|
25102
25141
|
return tileInfo.goslingModels;
|
|
25103
25142
|
}
|
|
25143
|
+
/* *
|
|
25144
|
+
*
|
|
25145
|
+
* Mouse methods
|
|
25146
|
+
*
|
|
25147
|
+
* */
|
|
25148
|
+
/**
|
|
25149
|
+
* This is for the HiGlass mouseMoveZoom event. However, GoslingTrack has its own way of handling mouse events.
|
|
25150
|
+
*/
|
|
25151
|
+
mouseMoveZoomHandler() {
|
|
25152
|
+
return;
|
|
25153
|
+
}
|
|
25104
25154
|
// set in HorizontalTiled1DPixiTrack
|
|
25105
25155
|
/**
|
|
25106
|
-
*
|
|
25156
|
+
* Called by showHoverMenu() in HiGlassComponent
|
|
25107
25157
|
*/
|
|
25108
25158
|
getMouseOverHtml(mouseX, mouseY) {
|
|
25109
25159
|
var _a, _b, _c, _d, _e;
|