higlass 2.3.0 → 2.3.2

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.
@@ -90,6 +90,10 @@ class BarTrack extends HorizontalLine1DPixiTrack {
90
90
  }
91
91
 
92
92
  const { graphics } = tile;
93
+ const numBins =
94
+ this.tilesetInfo.tile_size ||
95
+ this.tilesetInfo.bins_per_dimension ||
96
+ tile.tileData.dense.length;
93
97
 
94
98
  // Reset svg data to avoid overplotting
95
99
  tile.svgData = undefined;
@@ -97,7 +101,7 @@ class BarTrack extends HorizontalLine1DPixiTrack {
97
101
  const { tileX, tileWidth } = this.getTilePosAndDimensions(
98
102
  tile.tileData.zoomLevel,
99
103
  tile.tileData.tilePos,
100
- this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size,
104
+ numBins,
101
105
  );
102
106
  const tileValues = tile.tileData.dense;
103
107
 
@@ -142,10 +146,7 @@ class BarTrack extends HorizontalLine1DPixiTrack {
142
146
  // this scale should go from an index in the data array to
143
147
  // a position in the genome coordinates
144
148
  const tileXScale = scaleLinear()
145
- .domain([
146
- 0,
147
- this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension,
148
- ])
149
+ .domain([0, numBins])
149
150
  .range([tileX, tileX + tileWidth]);
150
151
 
151
152
  const strokeWidth = 0;
@@ -5187,6 +5187,12 @@ class HiGlassComponent extends React.Component {
5187
5187
  x.type === 'vertical-chromosome-labels' ||
5188
5188
  x.type === 'chromosome-labels',
5189
5189
  );
5190
+ const uniqueAnnotationTilesets = new Set(
5191
+ annotationTracks.map((x) => x.tilesetUid),
5192
+ );
5193
+ const uniqueChromSizesTilesets = new Set(
5194
+ chromSizesTracks.map((x) => x.tilesetUid),
5195
+ );
5190
5196
 
5191
5197
  const getGenomePositionSearchBox = (isFocused, onFocus) => (
5192
5198
  <GenomePositionSearchBox
@@ -5197,18 +5203,26 @@ class HiGlassComponent extends React.Component {
5197
5203
  }}
5198
5204
  // Custom props
5199
5205
  autocompleteId={
5200
- annotationTracks.length === 1
5206
+ annotationTracks.length >= 1 &&
5207
+ uniqueAnnotationTilesets.size === 1
5201
5208
  ? annotationTracks[0].tilesetUid
5202
5209
  : null
5203
5210
  }
5204
5211
  autocompleteServer={
5205
- annotationTracks.length === 1 ? annotationTracks[0].server : null
5212
+ annotationTracks.length >= 1 &&
5213
+ uniqueAnnotationTilesets.size === 1
5214
+ ? annotationTracks[0].server
5215
+ : null
5206
5216
  }
5207
5217
  chromInfoId={
5208
- chromSizesTracks.length ? chromSizesTracks[0].tilesetUid : null
5218
+ (chromSizesTracks.length && chromSizesTracks[0].tilesetUid) ||
5219
+ view.genomePositionSearchBox?.chromInfoId ||
5220
+ null
5209
5221
  }
5210
5222
  chromInfoServer={
5211
- chromSizesTracks.length ? chromSizesTracks[0].server : null
5223
+ (chromSizesTracks.length && chromSizesTracks[0].server) ||
5224
+ view.genomePositionSearchBox?.chromInfoServer ||
5225
+ null
5212
5226
  }
5213
5227
  isFocused={isFocused}
5214
5228
  // the chromInfoId is either specified in the viewconfig or guessed based on
@@ -5229,8 +5243,10 @@ class HiGlassComponent extends React.Component {
5229
5243
  (chromSizesTracks.length === 0 &&
5230
5244
  'no chromosome track present') ||
5231
5245
  (chromSizesTracks.length >= 2 &&
5246
+ uniqueChromSizesTilesets.size > 1 &&
5232
5247
  'multiple chromosome tracks present') ||
5233
5248
  (annotationTracks.length >= 2 &&
5249
+ uniqueAnnotationTilesets.size > 1 &&
5234
5250
  'multiple annotation tracks present')
5235
5251
  }
5236
5252
  />
@@ -212,13 +212,17 @@ class Tiled1DPixiTrack extends TiledPixiTrack {
212
212
  const { tileX, tileWidth } = this.getTilePosAndDimensions(
213
213
  tile.tileData.zoomLevel,
214
214
  tile.tileData.tilePos,
215
- this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size,
215
+ this.tilesetInfo.bins_per_dimension ||
216
+ this.tilesetInfo.tile_size ||
217
+ tile.tileData.dense.length,
216
218
  );
217
219
 
218
220
  const tileXScale = scaleLinear()
219
221
  .domain([
220
222
  0,
221
- this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension,
223
+ this.tilesetInfo.tile_size ||
224
+ this.tilesetInfo.bins_per_dimension ||
225
+ tile.tileData.dense.length,
222
226
  ])
223
227
  .range([tileX, tileX + tileWidth]);
224
228
 
@@ -450,7 +450,7 @@ export default class DataFetcher {
450
450
  // we need to extract the row corresponding to the data we need
451
451
 
452
452
  const tilesetUid = dictValues(returnedTiles)[0].tilesetUid;
453
- // console.log('tilesetUid:', tilesetUid);
453
+
454
454
  /** @type {Record<string, Tile>} */
455
455
  const newTiles = {};
456
456
 
@@ -486,6 +486,7 @@ export default class DataFetcher {
486
486
  sliceIndex,
487
487
  1,
488
488
  );
489
+
489
490
  for (let j = 0; j < dataSlice.length; j++) {
490
491
  dataSlice[j] += mirroredDataSlice[j];
491
492
  }
@@ -483,7 +483,11 @@ export function calculateTileAndPosInTile(
483
483
  : 256;
484
484
 
485
485
  if (!isLegacyTilesetInfo(tilesetInfo)) {
486
- tileWidth = tilesetInfo.resolutions[zoomLevel] * pixelsPerTile;
486
+ const sortedResolutions = tilesetInfo.resolutions
487
+ .map((x) => +x)
488
+ .sort((a, b) => b - a);
489
+
490
+ tileWidth = sortedResolutions[zoomLevel] * pixelsPerTile;
487
491
  } else {
488
492
  tileWidth = maxDim / 2 ** zoomLevel;
489
493
  }
package/dist/hglib.js CHANGED
@@ -12606,7 +12606,7 @@
12606
12606
  /** @type {const} */
12607
12607
  [window, map$4((c) => c.charCodeAt(0))(
12608
12608
  // @ts-expect-error - A global added by `vite.config.js`.
12609
- "2.3.0"
12609
+ "2.3.2"
12610
12610
  ).map((number3) => number3 <= 999 ? `00${number3}`.slice(-3) : number3).join("")]
12611
12611
  );
12612
12612
  const gradient = (steps, width = 1, height = 100, fromX = 0, fromY = 0, toX = 0, toY = 100) => {
@@ -49038,7 +49038,8 @@
49038
49038
  let tileWidth = null;
49039
49039
  const pixelsPerTile = isLegacyTilesetInfo(tilesetInfo) ? tilesetInfo.bins_per_dimension ?? 256 : 256;
49040
49040
  if (!isLegacyTilesetInfo(tilesetInfo)) {
49041
- tileWidth = tilesetInfo.resolutions[zoomLevel] * pixelsPerTile;
49041
+ const sortedResolutions = tilesetInfo.resolutions.map((x) => +x).sort((a, b) => b - a);
49042
+ tileWidth = sortedResolutions[zoomLevel] * pixelsPerTile;
49042
49043
  } else {
49043
49044
  tileWidth = maxDim / 2 ** zoomLevel;
49044
49045
  }
@@ -78861,8 +78862,8 @@ ${x}` : x, "");
78861
78862
  const {
78862
78863
  tileX,
78863
78864
  tileWidth
78864
- } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size);
78865
- const tileXScale = linear().domain([0, this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension]).range([tileX, tileX + tileWidth]);
78865
+ } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size || tile.tileData.dense.length);
78866
+ const tileXScale = linear().domain([0, this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension || tile.tileData.dense.length]).range([tileX, tileX + tileWidth]);
78866
78867
  const start2 = Math.max(0, Math.round(tileXScale.invert(this._xScale.invert(visible[0]))));
78867
78868
  const end2 = Math.min(tile.tileData.dense.length, Math.round(tileXScale.invert(this._xScale.invert(visible[1]))));
78868
78869
  return [start2, end2];
@@ -83317,11 +83318,12 @@ ${x}` : x, "");
83317
83318
  const {
83318
83319
  graphics
83319
83320
  } = tile;
83321
+ const numBins = this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension || tile.tileData.dense.length;
83320
83322
  tile.svgData = void 0;
83321
83323
  const {
83322
83324
  tileX,
83323
83325
  tileWidth
83324
- } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, this.tilesetInfo.bins_per_dimension || this.tilesetInfo.tile_size);
83326
+ } = this.getTilePosAndDimensions(tile.tileData.zoomLevel, tile.tileData.tilePos, numBins);
83325
83327
  const tileValues = tile.tileData.dense;
83326
83328
  if (tileValues.length === 0) return;
83327
83329
  const [valueScale, pseudocount] = this.makeValueScale(this.minValue(), this.medianVisibleValue, this.maxValue(), 0);
@@ -83337,7 +83339,7 @@ ${x}` : x, "");
83337
83339
  return;
83338
83340
  }
83339
83341
  const stroke = colorToHex(this.options.lineStrokeColor || "blue");
83340
- const tileXScale = linear().domain([0, this.tilesetInfo.tile_size || this.tilesetInfo.bins_per_dimension]).range([tileX, tileX + tileWidth]);
83342
+ const tileXScale = linear().domain([0, numBins]).range([tileX, tileX + tileWidth]);
83341
83343
  const strokeWidth = 0;
83342
83344
  graphics.lineStyle(strokeWidth, stroke, 1);
83343
83345
  const color2 = this.options.barFillColor || "grey";
@@ -93787,7 +93789,7 @@ ${x}` : x, "");
93787
93789
  toJSON,
93788
93790
  toString
93789
93791
  });
93790
- const version = "2.3.0";
93792
+ const version = "2.3.2";
93791
93793
  const configs = {
93792
93794
  ..._configs,
93793
93795
  IS_TRACK_RANGE_SELECTABLE,
@@ -111050,6 +111052,8 @@ ${svgString}`;
111050
111052
  const looseTracks = positionedTracksToAllTracks(view.tracks);
111051
111053
  const annotationTracks = looseTracks.filter((x) => x.type === "horizontal-gene-annotations" || x.type === "vertical-gene-annotations" || x.type === "gene-annotations");
111052
111054
  const chromSizesTracks = looseTracks.filter((x) => x.type === "horizontal-chromosome-labels" || x.type === "vertical-chromosome-labels" || x.type === "chromosome-labels");
111055
+ const uniqueAnnotationTilesets = new Set(annotationTracks.map((x) => x.tilesetUid));
111056
+ const uniqueChromSizesTilesets = new Set(chromSizesTracks.map((x) => x.tilesetUid));
111053
111057
  const getGenomePositionSearchBox = (isFocused, onFocus) => /* @__PURE__ */ React.createElement(
111054
111058
  GenomePositionSearchBox$1,
111055
111059
  {
@@ -111057,10 +111061,10 @@ ${svgString}`;
111057
111061
  ref: (c) => {
111058
111062
  this.genomePositionSearchBoxes[view.uid] = c;
111059
111063
  },
111060
- autocompleteId: annotationTracks.length === 1 ? annotationTracks[0].tilesetUid : null,
111061
- autocompleteServer: annotationTracks.length === 1 ? annotationTracks[0].server : null,
111062
- chromInfoId: chromSizesTracks.length ? chromSizesTracks[0].tilesetUid : null,
111063
- chromInfoServer: chromSizesTracks.length ? chromSizesTracks[0].server : null,
111064
+ autocompleteId: annotationTracks.length >= 1 && uniqueAnnotationTilesets.size === 1 ? annotationTracks[0].tilesetUid : null,
111065
+ autocompleteServer: annotationTracks.length >= 1 && uniqueAnnotationTilesets.size === 1 ? annotationTracks[0].server : null,
111066
+ chromInfoId: chromSizesTracks.length && chromSizesTracks[0].tilesetUid || view.genomePositionSearchBox?.chromInfoId || null,
111067
+ chromInfoServer: chromSizesTracks.length && chromSizesTracks[0].server || view.genomePositionSearchBox?.chromInfoServer || null,
111064
111068
  isFocused,
111065
111069
  onFocus,
111066
111070
  registerViewportChangedListener: (listener) => this.addScalesChangedListener(view.uid, view.uid, listener),
@@ -111068,7 +111072,7 @@ ${svgString}`;
111068
111072
  setCenters: (centerX, centerY, k, animateTime) => this.setCenters[view.uid](centerX, centerY, k, false, animateTime),
111069
111073
  trackSourceServers: this.state.viewConfig.trackSourceServers,
111070
111074
  twoD: true,
111071
- error: chromSizesTracks.length === 0 && "no chromosome track present" || chromSizesTracks.length >= 2 && "multiple chromosome tracks present" || annotationTracks.length >= 2 && "multiple annotation tracks present"
111075
+ error: chromSizesTracks.length === 0 && "no chromosome track present" || chromSizesTracks.length >= 2 && uniqueChromSizesTilesets.size > 1 && "multiple chromosome tracks present" || annotationTracks.length >= 2 && uniqueAnnotationTilesets.size > 1 && "multiple annotation tracks present"
111072
111076
  }
111073
111077
  );
111074
111078
  const multiTrackHeader = this.isEditable() && !this.isViewHeaderDisabled() && !this.state.viewConfig.hideHeader ? /* @__PURE__ */ React.createElement(ViewHeader$1, {