igv 2.13.9 → 2.13.11

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/igv.js CHANGED
@@ -21936,7 +21936,7 @@
21936
21936
  }
21937
21937
  };
21938
21938
 
21939
- const _version = "2.13.9";
21939
+ const _version = "2.13.11";
21940
21940
  function version$1() {
21941
21941
  return _version;
21942
21942
  }
@@ -27260,12 +27260,15 @@
27260
27260
  /**
27261
27261
  * Return inflated data from startBlock through endBlock as an UInt8Array
27262
27262
  *
27263
- * @param startBlock
27264
- * @param endBlock
27263
+ * @param minv minimum virtual pointer {block, offset}
27264
+ * @param maxv maximum virtual pointer {block, offset}
27265
27265
  * @returns {Promise<Uint8Array>}
27266
27266
  */
27267
- async getData(startBlock, endBlock) {
27268
- const blocks = await this.getInflatedBlocks(startBlock, endBlock);
27267
+ async getData(minv, maxv) {
27268
+ const startBlock = minv.block;
27269
+ const endBlock = maxv.block;
27270
+ const skipEnd = maxv.offset === 0;
27271
+ const blocks = await this.getInflatedBlocks(startBlock, endBlock, skipEnd);
27269
27272
  if (blocks.length === 1) {
27270
27273
  return blocks[0];
27271
27274
  }
@@ -27289,14 +27292,16 @@
27289
27292
  * @param endBlock
27290
27293
  * @returns {Promise<*[Uint8Array]>}
27291
27294
  */
27292
- async getInflatedBlocks(startBlock, endBlock) {
27295
+ async getInflatedBlocks(startBlock, endBlock, skipEnd) {
27293
27296
  if (!this.cacheBlocks) {
27294
- const buffer = await this.loadBLockData(startBlock, endBlock);
27297
+ const buffer = await this.loadBLockData(startBlock, endBlock, {
27298
+ skipEnd
27299
+ });
27295
27300
  return inflateBlocks(buffer);
27296
27301
  } else {
27297
27302
  const c = this.cache;
27298
- if (c && c.startBlock <= startBlock && c.endBlock >= endBlock) {
27299
- //console.log("Complete overlap")
27303
+ if (c && c.startBlock <= startBlock && (c.endBlock >= endBlock || skipEnd && c.nextEndBlock === endBlock)) {
27304
+ console.log("Complete overlap");
27300
27305
  const startOffset = startBlock - c.startBlock;
27301
27306
  const endOffset = endBlock - c.startBlock;
27302
27307
  return inflateBlocks(c.buffer, startOffset, endOffset);
@@ -27305,7 +27310,9 @@
27305
27310
  let buffer;
27306
27311
  if (!c || c.startBlock > endBlock || c.endBlock < startBlock) {
27307
27312
  // no overlap with cache
27308
- buffer = await this.loadBLockData(startBlock, endBlock);
27313
+ buffer = await this.loadBLockData(startBlock, endBlock, {
27314
+ skipEnd
27315
+ });
27309
27316
  } else {
27310
27317
  //console.log("Some overlap")
27311
27318
  const arrayBuffers = [];
@@ -27347,15 +27354,24 @@
27347
27354
  // Load end blocks, if any
27348
27355
  if (endBlock > c.endBlock) {
27349
27356
  const endBuffer = await this.loadBLockData(c.endBlock, endBlock, {
27350
- skipStart: true
27357
+ skipStart: true,
27358
+ skipEnd
27351
27359
  });
27352
27360
  arrayBuffers.push(endBuffer);
27353
27361
  }
27354
27362
  buffer = concatenateArrayBuffers(arrayBuffers);
27355
27363
  }
27364
+
27365
+ // If skipEnd === true we need to find boundary of last block in cache
27366
+ let nextEndBlock = endBlock;
27367
+ if (skipEnd) {
27368
+ const boundaries = findBlockBoundaries(buffer);
27369
+ endBlock = boundaries[boundaries.length - 1];
27370
+ }
27356
27371
  this.cache = {
27357
27372
  startBlock,
27358
27373
  endBlock,
27374
+ nextEndBlock,
27359
27375
  buffer
27360
27376
  };
27361
27377
  return inflateBlocks(buffer);
@@ -27647,7 +27663,7 @@
27647
27663
  for (let chunk of chunks) {
27648
27664
  let inflated;
27649
27665
  if (tabix) {
27650
- inflated = await this._blockLoader.getData(chunk.minv.block, chunk.maxv.block);
27666
+ inflated = await this._blockLoader.getData(chunk.minv, chunk.maxv);
27651
27667
  } else {
27652
27668
  const options = buildOptions(config, {
27653
27669
  range: {
@@ -30080,6 +30096,22 @@
30080
30096
  })[1] != 7;
30081
30097
  });
30082
30098
 
30099
+ var functionBindNative = !fails(function () {
30100
+ // eslint-disable-next-line es/no-function-prototype-bind -- safe
30101
+ var test = function () {/* empty */}.bind();
30102
+ // eslint-disable-next-line no-prototype-builtins -- safe
30103
+ return typeof test != 'function' || test.hasOwnProperty('prototype');
30104
+ });
30105
+
30106
+ var FunctionPrototype$2 = Function.prototype;
30107
+ var call$2 = FunctionPrototype$2.call;
30108
+ var uncurryThisWithBind = functionBindNative && FunctionPrototype$2.bind.bind(call$2, call$2);
30109
+ var functionUncurryThis = functionBindNative ? uncurryThisWithBind : function (fn) {
30110
+ return function () {
30111
+ return call$2.apply(fn, arguments);
30112
+ };
30113
+ };
30114
+
30083
30115
  var documentAll$2 = typeof document == 'object' && document.all;
30084
30116
 
30085
30117
  // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
@@ -30100,22 +30132,6 @@
30100
30132
  return typeof argument == 'function';
30101
30133
  };
30102
30134
 
30103
- var functionBindNative = !fails(function () {
30104
- // eslint-disable-next-line es/no-function-prototype-bind -- safe
30105
- var test = function () {/* empty */}.bind();
30106
- // eslint-disable-next-line no-prototype-builtins -- safe
30107
- return typeof test != 'function' || test.hasOwnProperty('prototype');
30108
- });
30109
-
30110
- var FunctionPrototype$2 = Function.prototype;
30111
- var call$2 = FunctionPrototype$2.call;
30112
- var uncurryThisWithBind = functionBindNative && FunctionPrototype$2.bind.bind(call$2, call$2);
30113
- var functionUncurryThis = functionBindNative ? uncurryThisWithBind : function (fn) {
30114
- return function () {
30115
- return call$2.apply(fn, arguments);
30116
- };
30117
- };
30118
-
30119
30135
  // we can't use just `it == null` since of `document.all` special case
30120
30136
  // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot-aec
30121
30137
  var isNullOrUndefined = function (it) {
@@ -30250,7 +30266,7 @@
30250
30266
 
30251
30267
  var objectIsPrototypeOf = functionUncurryThis({}.isPrototypeOf);
30252
30268
 
30253
- var engineUserAgent = getBuiltIn('navigator', 'userAgent') || '';
30269
+ var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
30254
30270
 
30255
30271
  var process$2 = global$1.process;
30256
30272
  var Deno = global$1.Deno;
@@ -30338,10 +30354,10 @@
30338
30354
  (module.exports = function (key, value) {
30339
30355
  return sharedStore[key] || (sharedStore[key] = value !== undefined ? value : {});
30340
30356
  })('versions', []).push({
30341
- version: '3.27.1',
30357
+ version: '3.27.2',
30342
30358
  mode: 'global',
30343
- copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
30344
- license: 'https://github.com/zloirock/core-js/blob/v3.27.1/LICENSE',
30359
+ copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
30360
+ license: 'https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE',
30345
30361
  source: 'https://github.com/zloirock/core-js'
30346
30362
  });
30347
30363
  });
@@ -30353,20 +30369,12 @@
30353
30369
  return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
30354
30370
  };
30355
30371
 
30356
- var WellKnownSymbolsStore = shared('wks');
30357
30372
  var Symbol$1 = global$1.Symbol;
30358
- var symbolFor = Symbol$1 && Symbol$1['for'];
30359
- var createWellKnownSymbol = useSymbolAsUid ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
30373
+ var WellKnownSymbolsStore = shared('wks');
30374
+ var createWellKnownSymbol = useSymbolAsUid ? Symbol$1['for'] || Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid;
30360
30375
  var wellKnownSymbol = function (name) {
30361
- if (!hasOwnProperty_1(WellKnownSymbolsStore, name) || !(symbolConstructorDetection || typeof WellKnownSymbolsStore[name] == 'string')) {
30362
- var description = 'Symbol.' + name;
30363
- if (symbolConstructorDetection && hasOwnProperty_1(Symbol$1, name)) {
30364
- WellKnownSymbolsStore[name] = Symbol$1[name];
30365
- } else if (useSymbolAsUid && symbolFor) {
30366
- WellKnownSymbolsStore[name] = symbolFor(description);
30367
- } else {
30368
- WellKnownSymbolsStore[name] = createWellKnownSymbol(description);
30369
- }
30376
+ if (!hasOwnProperty_1(WellKnownSymbolsStore, name)) {
30377
+ WellKnownSymbolsStore[name] = symbolConstructorDetection && hasOwnProperty_1(Symbol$1, name) ? Symbol$1[name] : createWellKnownSymbol('Symbol.' + name);
30370
30378
  }
30371
30379
  return WellKnownSymbolsStore[name];
30372
30380
  };
@@ -30525,8 +30533,12 @@
30525
30533
  var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
30526
30534
  var enforceInternalState = internalState.enforce;
30527
30535
  var getInternalState = internalState.get;
30536
+ var $String = String;
30528
30537
  // eslint-disable-next-line es/no-object-defineproperty -- safe
30529
30538
  var defineProperty = Object.defineProperty;
30539
+ var stringSlice = functionUncurryThis(''.slice);
30540
+ var replace = functionUncurryThis(''.replace);
30541
+ var join = functionUncurryThis([].join);
30530
30542
  var CONFIGURABLE_LENGTH = descriptors && !fails(function () {
30531
30543
  return defineProperty(function () {/* empty */}, 'length', {
30532
30544
  value: 8
@@ -30534,8 +30546,8 @@
30534
30546
  });
30535
30547
  var TEMPLATE = String(String).split('String');
30536
30548
  var makeBuiltIn = module.exports = function (value, name, options) {
30537
- if (String(name).slice(0, 7) === 'Symbol(') {
30538
- name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']';
30549
+ if (stringSlice($String(name), 0, 7) === 'Symbol(') {
30550
+ name = '[' + replace($String(name), /^Symbol\(([^)]*)\)/, '$1') + ']';
30539
30551
  }
30540
30552
  if (options && options.getter) name = 'get ' + name;
30541
30553
  if (options && options.setter) name = 'set ' + name;
@@ -30560,7 +30572,7 @@
30560
30572
  } catch (error) {/* empty */}
30561
30573
  var state = enforceInternalState(value);
30562
30574
  if (!hasOwnProperty_1(state, 'source')) {
30563
- state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
30575
+ state.source = join(TEMPLATE, typeof name == 'string' ? name : '');
30564
30576
  }
30565
30577
  return value;
30566
30578
  };
@@ -33595,7 +33607,7 @@
33595
33607
  return alignmentContainer;
33596
33608
  }
33597
33609
  for (let c of chunks) {
33598
- const ba = await this._blockLoader.getData(c.minv.block, c.maxv.block);
33610
+ const ba = await this._blockLoader.getData(c.minv, c.maxv);
33599
33611
  const done = BamUtils.decodeBamRecords(ba, c.minv.offset, alignmentContainer, this.indexToChr, chrId, bpStart, bpEnd, this.filter);
33600
33612
  if (done) {
33601
33613
  break;
@@ -34150,7 +34162,7 @@
34150
34162
 
34151
34163
  var engineIsIos = /(?:ipad|iphone|ipod).*applewebkit/i.test(engineUserAgent);
34152
34164
 
34153
- var engineIsNode = classofRaw(global$1.process) == 'process';
34165
+ var engineIsNode = typeof process != 'undefined' && classofRaw(process) == 'process';
34154
34166
 
34155
34167
  var set = global$1.setImmediate;
34156
34168
  var clear = global$1.clearImmediate;
@@ -34163,10 +34175,10 @@
34163
34175
  var queue = {};
34164
34176
  var ONREADYSTATECHANGE = 'onreadystatechange';
34165
34177
  var $location, defer, channel, port;
34166
- try {
34178
+ fails(function () {
34167
34179
  // Deno throws a ReferenceError on `location` access without `--location` flag
34168
34180
  $location = global$1.location;
34169
- } catch (error) {/* empty */}
34181
+ });
34170
34182
  var run = function (id) {
34171
34183
  if (hasOwnProperty_1(queue, id)) {
34172
34184
  var fn = queue[id];
@@ -34179,10 +34191,10 @@
34179
34191
  run(id);
34180
34192
  };
34181
34193
  };
34182
- var listener = function (event) {
34194
+ var eventListener = function (event) {
34183
34195
  run(event.data);
34184
34196
  };
34185
- var post = function (id) {
34197
+ var globalPostMessageDefer = function (id) {
34186
34198
  // old engines have not location.origin
34187
34199
  global$1.postMessage(String$1(id), $location.protocol + '//' + $location.host);
34188
34200
  };
@@ -34217,13 +34229,13 @@
34217
34229
  } else if (MessageChannel$1 && !engineIsIos) {
34218
34230
  channel = new MessageChannel$1();
34219
34231
  port = channel.port2;
34220
- channel.port1.onmessage = listener;
34232
+ channel.port1.onmessage = eventListener;
34221
34233
  defer = functionBindContext(port.postMessage, port);
34222
34234
  // Browsers with postMessage, skip WebWorkers
34223
34235
  // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
34224
- } else if (global$1.addEventListener && isCallable(global$1.postMessage) && !global$1.importScripts && $location && $location.protocol !== 'file:' && !fails(post)) {
34225
- defer = post;
34226
- global$1.addEventListener('message', listener, false);
34236
+ } else if (global$1.addEventListener && isCallable(global$1.postMessage) && !global$1.importScripts && $location && $location.protocol !== 'file:' && !fails(globalPostMessageDefer)) {
34237
+ defer = globalPostMessageDefer;
34238
+ global$1.addEventListener('message', eventListener, false);
34227
34239
  // IE8-
34228
34240
  } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
34229
34241
  defer = function (id) {
@@ -52960,7 +52972,7 @@
52960
52972
  }
52961
52973
  }
52962
52974
  if (this.track.autoscale) {
52963
- let allFeatures;
52975
+ let allFeatures = [];
52964
52976
  for (let visibleViewport of visibleViewports) {
52965
52977
  const referenceFrame = visibleViewport.referenceFrame;
52966
52978
  const start = referenceFrame.start;
@@ -52969,17 +52981,13 @@
52969
52981
  // If the "features" object has a getMax function use it. Currently only alignmentContainer implements this, for coverage.
52970
52982
  if (typeof visibleViewport.featureCache.features.getMax === 'function') {
52971
52983
  const max = visibleViewport.featureCache.features.getMax(start, end);
52972
- allFeatures = [{
52984
+ allFeatures.push({
52973
52985
  value: max
52974
- }];
52986
+ });
52975
52987
  } else {
52976
52988
  const viewFeatures = FeatureUtils.findOverlapping(visibleViewport.featureCache.features, start, end);
52977
- if (!allFeatures) {
52978
- allFeatures = viewFeatures;
52979
- } else {
52980
- for (let f of viewFeatures) {
52981
- allFeatures.push(f);
52982
- }
52989
+ for (let f of viewFeatures) {
52990
+ allFeatures.push(f);
52983
52991
  }
52984
52992
  }
52985
52993
  }
@@ -54248,9 +54256,6 @@
54248
54256
  const pixelWidth = options.pixelWidth;
54249
54257
  options.pixelHeight;
54250
54258
  const bpEnd = bpStart + pixelWidth * bpPerPixel + 1;
54251
- let lastPixelEnd = -1;
54252
- let lastValue = -1;
54253
- let lastNegValue = 1;
54254
54259
  const posColor = this.color || DEFAULT_COLOR;
54255
54260
  let baselineColor;
54256
54261
  if (typeof posColor === "string" && posColor.startsWith("rgb(")) {
@@ -54264,6 +54269,9 @@
54264
54269
  // Max can be less than min if config.min is set but max left to autoscale. If that's the case there is
54265
54270
  // nothing to paint.
54266
54271
  if (this.dataRange.max > this.dataRange.min) {
54272
+ let lastPixelEnd = -1;
54273
+ let lastY;
54274
+ let lastValue = -1;
54267
54275
  const y0 = yScale(0);
54268
54276
  for (let f of features) {
54269
54277
  if (f.end < bpStart) continue;
@@ -54282,6 +54290,17 @@
54282
54290
  "fillStyle": color,
54283
54291
  "strokeStyle": color
54284
54292
  });
54293
+ } else if (this.graphType === "line") {
54294
+ if (lastY != undefined) {
54295
+ IGVGraphics.strokeLine(ctx, lastPixelEnd, lastY, x, y, {
54296
+ "fillStyle": color,
54297
+ "strokeStyle": color
54298
+ });
54299
+ }
54300
+ IGVGraphics.strokeLine(ctx, x, y, x + width, y, {
54301
+ "fillStyle": color,
54302
+ "strokeStyle": color
54303
+ });
54285
54304
  } else {
54286
54305
  let height = y - y0;
54287
54306
  const pixelEnd = x + width;
@@ -54290,9 +54309,10 @@
54290
54309
  fillStyle: color
54291
54310
  });
54292
54311
  }
54293
- lastValue = f.value;
54294
- lastPixelEnd = pixelEnd;
54295
54312
  }
54313
+ lastPixelEnd = x + width;
54314
+ lastValue = f.value;
54315
+ lastY = y;
54296
54316
  }
54297
54317
 
54298
54318
  // If the track includes negative values draw a baseline