igv 2.15.12 → 2.15.13

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
@@ -19246,7 +19246,7 @@
19246
19246
  */
19247
19247
 
19248
19248
  function _random(min, max) {
19249
- return Math.random() * (max - min) + min;
19249
+ return Math.random() * (max - min) + min
19250
19250
  }
19251
19251
 
19252
19252
  const IGVColor = {
@@ -19266,7 +19266,7 @@
19266
19266
  accumulation.pop();
19267
19267
  accumulation.push(IGVColor.rgbColor(16, 16, 16));
19268
19268
 
19269
- return accumulation;
19269
+ return accumulation
19270
19270
  },
19271
19271
 
19272
19272
  rgbToHex: function (rgb) {
@@ -19274,7 +19274,7 @@
19274
19274
  return (rgb && rgb.length === 4) ? "#" +
19275
19275
  ("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) +
19276
19276
  ("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) +
19277
- ("0" + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
19277
+ ("0" + parseInt(rgb[3], 10).toString(16)).slice(-2) : ''
19278
19278
  },
19279
19279
 
19280
19280
  hexToRgb: function (hex) {
@@ -19282,10 +19282,10 @@
19282
19282
  var cooked = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
19283
19283
 
19284
19284
  if (null === cooked) {
19285
- return undefined;
19285
+ return undefined
19286
19286
  }
19287
19287
 
19288
- return "rgb(" + parseInt(cooked[1], 16) + "," + parseInt(cooked[2], 16) + "," + parseInt(cooked[3], 16) + ")";
19288
+ return "rgb(" + parseInt(cooked[1], 16) + "," + parseInt(cooked[2], 16) + "," + parseInt(cooked[3], 16) + ")"
19289
19289
  },
19290
19290
 
19291
19291
  /**
@@ -19313,25 +19313,25 @@
19313
19313
  switch (i % 6) {
19314
19314
  case 0:
19315
19315
  r = v, g = t, b = p;
19316
- break;
19316
+ break
19317
19317
  case 1:
19318
19318
  r = q, g = v, b = p;
19319
- break;
19319
+ break
19320
19320
  case 2:
19321
19321
  r = p, g = v, b = t;
19322
- break;
19322
+ break
19323
19323
  case 3:
19324
19324
  r = p, g = q, b = v;
19325
- break;
19325
+ break
19326
19326
  case 4:
19327
19327
  r = t, g = p, b = v;
19328
- break;
19328
+ break
19329
19329
  case 5:
19330
19330
  r = v, g = p, b = q;
19331
- break;
19331
+ break
19332
19332
  }
19333
19333
 
19334
- return [Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)];
19334
+ return [Math.floor(r * 255), Math.floor(g * 255), Math.floor(b * 255)]
19335
19335
  },
19336
19336
 
19337
19337
  /**
@@ -19363,16 +19363,16 @@
19363
19363
  b = IGVColor.hue2rgb(p, q, h - 1 / 3);
19364
19364
  }
19365
19365
 
19366
- return [r * 255, g * 255, b * 255];
19366
+ return [r * 255, g * 255, b * 255]
19367
19367
  },
19368
19368
 
19369
19369
  hue2rgb: (p, q, t) => {
19370
19370
  if (t < 0) t += 1;
19371
19371
  if (t > 1) t -= 1;
19372
- if (t < 1 / 6) return p + (q - p) * 6 * t;
19373
- if (t < 1 / 2) return q;
19374
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
19375
- return p;
19372
+ if (t < 1 / 6) return p + (q - p) * 6 * t
19373
+ if (t < 1 / 2) return q
19374
+ if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6
19375
+ return p
19376
19376
  },
19377
19377
 
19378
19378
  rgbaColor: function (r, g, b, a) {
@@ -19382,7 +19382,7 @@
19382
19382
  b = IGVMath.clamp(b, 0, 255);
19383
19383
  a = IGVMath.clamp(a, 0.0, 1.0);
19384
19384
 
19385
- return "rgba(" + r + "," + g + "," + b + "," + a + ")";
19385
+ return "rgba(" + r + "," + g + "," + b + "," + a + ")"
19386
19386
  },
19387
19387
 
19388
19388
  rgbColor: function (r, g, b) {
@@ -19391,14 +19391,14 @@
19391
19391
  g = IGVMath.clamp(g, 0, 255);
19392
19392
  b = IGVMath.clamp(b, 0, 255);
19393
19393
 
19394
- return "rgb(" + r + "," + g + "," + b + ")";
19394
+ return "rgb(" + r + "," + g + "," + b + ")"
19395
19395
  },
19396
19396
 
19397
19397
  greyScale: function (value) {
19398
19398
 
19399
19399
  var grey = IGVMath.clamp(value, 0, 255);
19400
19400
 
19401
- return "rgb(" + grey + "," + grey + "," + grey + ")";
19401
+ return "rgb(" + grey + "," + grey + "," + grey + ")"
19402
19402
  },
19403
19403
 
19404
19404
  randomGrey: function (min, max) {
@@ -19408,7 +19408,7 @@
19408
19408
 
19409
19409
  var g = Math.round(_random(min, max)).toString(10);
19410
19410
 
19411
- return "rgb(" + g + "," + g + "," + g + ")";
19411
+ return "rgb(" + g + "," + g + "," + g + ")"
19412
19412
  },
19413
19413
 
19414
19414
  randomRGB: function (min, max) {
@@ -19420,7 +19420,7 @@
19420
19420
  var g = Math.round(_random(min, max)).toString(10);
19421
19421
  var b = Math.round(_random(min, max)).toString(10);
19422
19422
 
19423
- return "rgb(" + r + "," + g + "," + b + ")";
19423
+ return "rgb(" + r + "," + g + "," + b + ")"
19424
19424
  },
19425
19425
 
19426
19426
  randomRGBConstantAlpha: function (min, max, alpha) {
@@ -19432,12 +19432,12 @@
19432
19432
  var g = Math.round(_random(min, max)).toString(10);
19433
19433
  var b = Math.round(_random(min, max)).toString(10);
19434
19434
 
19435
- return "rgba(" + r + "," + g + "," + b + "," + alpha + ")";
19435
+ return "rgba(" + r + "," + g + "," + b + "," + alpha + ")"
19436
19436
  },
19437
19437
 
19438
19438
  addAlpha: function (color, alpha) {
19439
19439
 
19440
- if(color === "0" || color === ".") {
19440
+ if (color === "0" || color === ".") {
19441
19441
  color = "rgb(0,0,0)";
19442
19442
  } else {
19443
19443
  const c = this.colorNameToHex(color);
@@ -19450,7 +19450,7 @@
19450
19450
 
19451
19451
  if (color.startsWith("rgba")) {
19452
19452
  const idx = color.lastIndexOf(",");
19453
- return color.substring(0, idx+1) + alpha.toString() + ")";
19453
+ return color.substring(0, idx + 1) + alpha.toString() + ")"
19454
19454
  }
19455
19455
 
19456
19456
  if (isHex) {
@@ -19458,38 +19458,37 @@
19458
19458
  }
19459
19459
 
19460
19460
  if (color.startsWith("rgb")) {
19461
- return color.replace("rgb", "rgba").replace(")", ", " + alpha + ")");
19461
+ return color.replace("rgb", "rgba").replace(")", ", " + alpha + ")")
19462
19462
  } else {
19463
19463
  console.log(color + " is not an rgb style string");
19464
- return color;
19464
+ return color
19465
19465
  }
19466
19466
  },
19467
19467
 
19468
19468
  rgbComponents: function (color) {
19469
19469
 
19470
- if(color === "0" || color === ".") {
19471
- return [0,0,0];
19470
+ if (color === "0" || color === ".") {
19471
+ return [0, 0, 0]
19472
19472
  }
19473
19473
  const isHex = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(color);
19474
19474
  if (isHex) {
19475
19475
  color = IGVColor.hexToRgb(color);
19476
19476
  } else {
19477
- if(!color.startsWith("rgb")) {
19477
+ if (!color.startsWith("rgb")) {
19478
19478
  const hex = this.colorNameToHex(color);
19479
19479
  color = this.hexToRgb(hex);
19480
19480
  }
19481
19481
  }
19482
19482
 
19483
19483
  if (color.startsWith("rgb(")) {
19484
- return color.substring(4, color.length-1).split(",").map(s => Number.parseInt(s.trim()));
19485
- } else if (color.startsWith("rgba(")) {
19486
- return color.substring(5, color.length-1).split(",").map((s, i) => {
19484
+ return color.substring(4, color.length - 1).split(",").map(s => Number.parseInt(s.trim()))
19485
+ } else if (color.startsWith("rgba(")) {
19486
+ return color.substring(5, color.length - 1).split(",").map((s, i) => {
19487
19487
  s = s.trim();
19488
19488
  return i === 3 ? Number.parseFloat(s) : Number.parseInt(s)
19489
- });
19490
- }
19491
- else {
19492
- throw Error("Unrecognized color string: color");
19489
+ })
19490
+ } else {
19491
+ throw Error("Unrecognized color string: color")
19493
19492
  }
19494
19493
  },
19495
19494
 
@@ -19506,19 +19505,46 @@
19506
19505
  g = Math.floor(alpha * src[1] + (1 - alpha) * dest[1]),
19507
19506
  b = Math.floor(alpha * src[2] + (1 - alpha) * dest[2]);
19508
19507
 
19509
- return "rgb(" + r + "," + g + "," + b + ")";
19508
+ return "rgb(" + r + "," + g + "," + b + ")"
19510
19509
 
19511
19510
  },
19512
19511
 
19513
-
19512
+ /**
19513
+ * Return a color represented by the string. If the string is not a recognized color format return the
19514
+ * string itself. This function exists for backward compatibility, createColorStringSafe is preferredz
19515
+ * @param str
19516
+ */
19514
19517
  createColorString: function (str) {
19518
+ // Excel will quote color strings, strip all quotes
19519
+ const color = this.createColorStringSafe(str);
19520
+ return color ? color : str
19521
+ },
19522
+
19523
+ /**
19524
+ * If str is a recognized color format return a string encoding the color
19525
+ * @param str
19526
+ */
19527
+ createColorStringSafe: function (str) {
19515
19528
  // Excel will quote color strings, strip all quotes
19516
19529
  str = stripQuotes$1(str);
19517
19530
 
19518
- if (str.includes(",")) {
19519
- return str.startsWith("rgb") ? str : "rgb(" + str + ")";
19520
- } else {
19521
- return str;
19531
+ if (str.startsWith('rgb(') && str.endsWith(')')) {
19532
+ return str
19533
+ }
19534
+ if (str.startsWith('#') && str.length < 8) {
19535
+ return str
19536
+ }
19537
+
19538
+ // See if string is a recognized web color
19539
+ const hex = this.colorNameToHex(str);
19540
+ if (hex) {
19541
+ return hex
19542
+ }
19543
+
19544
+ // UCSC format (e.g. 0,0,255)
19545
+ const tokens = str.split(",");
19546
+ if (tokens.length === 3 && isColorComponent(tokens[0]) && isColorComponent(tokens[1]) && isColorComponent(tokens[2])) {
19547
+ return `rgb(${str})`
19522
19548
  }
19523
19549
  },
19524
19550
 
@@ -19526,8 +19552,8 @@
19526
19552
 
19527
19553
  let src;
19528
19554
  let hexColor = this.colorNameToHex(color);
19529
- if(hexColor) {
19530
- src = IGVColor.hexToRgb(hexColor);
19555
+ if (hexColor) {
19556
+ src = IGVColor.hexToRgb(hexColor);
19531
19557
  } else {
19532
19558
  src = color.startsWith('rgb(') ? color : IGVColor.hexToRgb(color);
19533
19559
  }
@@ -19538,7 +19564,7 @@
19538
19564
  const g = Math.max(0, Math.min(255, Number.parseInt(components[1].trim()) + amt));
19539
19565
  const b = Math.max(0, Math.min(255, Number.parseInt(components[2].trim()) + amt));
19540
19566
 
19541
- return 'rgb(' + r.toString() + ',' + g.toString() + ',' + b.toString() + ')';
19567
+ return 'rgb(' + r.toString() + ',' + g.toString() + ',' + b.toString() + ')'
19542
19568
 
19543
19569
  },
19544
19570
 
@@ -19697,10 +19723,15 @@
19697
19723
  "lightslategrey": "#778899",
19698
19724
  "slategrey": "#708090"
19699
19725
  };
19700
- return definedColorNames[colorName];
19726
+ return definedColorNames[colorName]
19701
19727
  }
19702
19728
  };
19703
19729
 
19730
+ function isColorComponent(str) {
19731
+ const num = Number.parseInt(str);
19732
+ return !Number.isNaN(num) && num >= 0 && num <= 255
19733
+ }
19734
+
19704
19735
  // Support for oauth token based authorization
19705
19736
  // This class supports explicit setting of an oauth token either globally or for specific hosts.
19706
19737
  //
@@ -19927,7 +19958,7 @@
19927
19958
 
19928
19959
  // Note: callback is added when accessToken is requested
19929
19960
  const codeClientConfig = {
19930
- client_id: config.client_id,
19961
+ client_id: config.client_id || config.clientId,
19931
19962
  scope: config.scope || 'https://www.googleapis.com/auth/userinfo.profile',
19932
19963
  state: config.state || 'igv',
19933
19964
  error: (err) => {
@@ -20007,7 +20038,7 @@
20007
20038
 
20008
20039
  function getScopeForURL(url) {
20009
20040
  if (isGoogleDriveURL(url)) {
20010
- return "https://www.googleapis.com/auth/drive.readonly"
20041
+ return "https://www.googleapis.com/auth/drive.file"
20011
20042
  } else if (isGoogleStorageURL(url)) {
20012
20043
  return "https://www.googleapis.com/auth/devstorage.read_only"
20013
20044
  } else {
@@ -20243,6 +20274,24 @@
20243
20274
  }
20244
20275
  }
20245
20276
 
20277
+ /**
20278
+ * A wrapper around loadArrayBuffer that inflates gzipped data
20279
+ * @param url
20280
+ * @param options
20281
+ * @returns {Promise<Uint8Array>}
20282
+ */
20283
+ async loadByteArray(url, options) {
20284
+ const arraybuffer = await this.loadArrayBuffer(url, options);
20285
+ let plain;
20286
+ if (isgzipped(arraybuffer)) {
20287
+ plain = ungzip_blocks(arraybuffer);
20288
+ } else {
20289
+ plain = new Uint8Array(arraybuffer);
20290
+ }
20291
+ return plain
20292
+ }
20293
+
20294
+
20246
20295
  async loadJson(url, options) {
20247
20296
  options = options || {};
20248
20297
  const method = options.method || (options.sendData ? "POST" : "GET");
@@ -20413,7 +20462,7 @@
20413
20462
  }
20414
20463
  } else if (xhr.status === 416) {
20415
20464
  handleError(Error(`416 Unsatisfiable Range`));
20416
- } else if ((typeof gapi !== "undefined") &&
20465
+ } else if (isInitialized() &&
20417
20466
  ((xhr.status === 404 || xhr.status === 401 || xhr.status === 403) &&
20418
20467
  isGoogleURL(url)) &&
20419
20468
  !options.retries) {
@@ -25622,7 +25671,7 @@
25622
25671
  }
25623
25672
  };
25624
25673
 
25625
- const _version = "2.15.12";
25674
+ const _version = "2.15.13";
25626
25675
  function version() {
25627
25676
  return _version
25628
25677
  }
@@ -51292,6 +51341,13 @@
51292
51341
  }
51293
51342
  }
51294
51343
 
51344
+ var __defProp = Object.defineProperty;
51345
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
51346
+ var __publicField = (obj, key, value) => {
51347
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
51348
+ return value;
51349
+ };
51350
+
51295
51351
  // esm/core.js
51296
51352
  async function _unpack_struct_from_async(structure, async_buf, offset = 0) {
51297
51353
  var output = /* @__PURE__ */ new Map();
@@ -51408,7 +51464,7 @@
51408
51464
  return big_endian;
51409
51465
  }
51410
51466
  async unpack_from_async(fmt, async_buf, offset) {
51411
- var offset = Number(offset || 0);
51467
+ offset = Number.parseInt(offset || 0);
51412
51468
  const total_size = this.calcsize(fmt);
51413
51469
  const local_buffer = await async_buf.slice(offset, offset + total_size);
51414
51470
  let local_offset = 0;
@@ -51435,7 +51491,7 @@
51435
51491
  return output;
51436
51492
  }
51437
51493
  unpack_from(fmt, buffer, offset) {
51438
- var offset = Number(offset || 0);
51494
+ offset = Number.parseInt(offset || 0);
51439
51495
  const total_size = this.calcsize(fmt);
51440
51496
  const local_buffer = buffer.slice(offset, offset + total_size);
51441
51497
  let local_offset = 0;
@@ -51473,7 +51529,7 @@
51473
51529
  const left = BigInt(this.getUint32(byteOffset, littleEndian));
51474
51530
  const right = BigInt(this.getUint32(byteOffset + 4, littleEndian));
51475
51531
  let combined = littleEndian ? left + (right << 32n) : (left << 32n) + right;
51476
- return Number(combined);
51532
+ return Number.parseInt(combined);
51477
51533
  }
51478
51534
  getInt64(byteOffset, littleEndian) {
51479
51535
  var low, high;
@@ -51485,7 +51541,7 @@
51485
51541
  low = this.getUint32(byteOffset + 4, false);
51486
51542
  }
51487
51543
  let combined = BigInt(low) + (BigInt(high) << 32n);
51488
- return Number(combined);
51544
+ return Number.parseInt(combined);
51489
51545
  }
51490
51546
  getString(byteOffset, littleEndian, length) {
51491
51547
  const str_buffer = this.buffer.slice(byteOffset, byteOffset + length);
@@ -53938,14 +53994,17 @@
53938
53994
  }
53939
53995
  };
53940
53996
  var BTreeV1 = class extends AbstractBTree {
53941
- B_LINK_NODE = /* @__PURE__ */ new Map([
53942
- ["signature", "4s"],
53943
- ["node_type", "B"],
53944
- ["node_level", "B"],
53945
- ["entries_used", "H"],
53946
- ["left_sibling", "Q"],
53947
- ["right_sibling", "Q"]
53948
- ]);
53997
+ constructor() {
53998
+ super(...arguments);
53999
+ __publicField(this, "B_LINK_NODE", /* @__PURE__ */ new Map([
54000
+ ["signature", "4s"],
54001
+ ["node_type", "B"],
54002
+ ["node_level", "B"],
54003
+ ["entries_used", "H"],
54004
+ ["left_sibling", "Q"],
54005
+ ["right_sibling", "Q"]
54006
+ ]));
54007
+ }
53949
54008
  async _read_node_header(offset, node_level) {
53950
54009
  let node = await _unpack_struct_from_async(this.B_LINK_NODE, this.fh, offset);
53951
54010
  if (node_level != null) {
@@ -53957,9 +54016,9 @@
53957
54016
  }
53958
54017
  };
53959
54018
  var BTreeV1Groups = class extends BTreeV1 {
53960
- NODE_TYPE = 0;
53961
54019
  constructor(fh, offset) {
53962
54020
  super(fh, offset);
54021
+ __publicField(this, "NODE_TYPE", 0);
53963
54022
  this.ready = this.init();
53964
54023
  }
53965
54024
  async _read_node(offset, node_level) {
@@ -53991,9 +54050,9 @@
53991
54050
  }
53992
54051
  };
53993
54052
  var BTreeV1RawDataChunks = class extends BTreeV1 {
53994
- NODE_TYPE = 1;
53995
54053
  constructor(fh, offset, dims) {
53996
54054
  super(fh, offset);
54055
+ __publicField(this, "NODE_TYPE", 1);
53997
54056
  this.dims = dims;
53998
54057
  this.ready = this.init();
53999
54058
  }
@@ -54032,7 +54091,7 @@
54032
54091
  if (size != 8) {
54033
54092
  throw "NotImplementedError('Unsupported Reference type')";
54034
54093
  }
54035
- var dtype = "<u8";
54094
+ dtype = "<u8";
54036
54095
  item_getter = "getUint64";
54037
54096
  item_big_endian = false;
54038
54097
  item_size = 8;
@@ -54139,26 +54198,26 @@
54139
54198
  }
54140
54199
  };
54141
54200
  var BTreeV2 = class extends AbstractBTree {
54142
- B_TREE_HEADER = /* @__PURE__ */ new Map([
54143
- ["signature", "4s"],
54144
- ["version", "B"],
54145
- ["node_type", "B"],
54146
- ["node_size", "I"],
54147
- ["record_size", "H"],
54148
- ["depth", "H"],
54149
- ["split_percent", "B"],
54150
- ["merge_percent", "B"],
54151
- ["root_address", "Q"],
54152
- ["root_nrecords", "H"],
54153
- ["total_nrecords", "Q"]
54154
- ]);
54155
- B_LINK_NODE = /* @__PURE__ */ new Map([
54156
- ["signature", "4s"],
54157
- ["version", "B"],
54158
- ["node_type", "B"]
54159
- ]);
54160
54201
  constructor(fh, offset) {
54161
54202
  super(fh, offset);
54203
+ __publicField(this, "B_TREE_HEADER", /* @__PURE__ */ new Map([
54204
+ ["signature", "4s"],
54205
+ ["version", "B"],
54206
+ ["node_type", "B"],
54207
+ ["node_size", "I"],
54208
+ ["record_size", "H"],
54209
+ ["depth", "H"],
54210
+ ["split_percent", "B"],
54211
+ ["merge_percent", "B"],
54212
+ ["root_address", "Q"],
54213
+ ["root_nrecords", "H"],
54214
+ ["total_nrecords", "Q"]
54215
+ ]));
54216
+ __publicField(this, "B_LINK_NODE", /* @__PURE__ */ new Map([
54217
+ ["signature", "4s"],
54218
+ ["version", "B"],
54219
+ ["node_type", "B"]
54220
+ ]));
54162
54221
  this.ready = this.init();
54163
54222
  }
54164
54223
  async _read_root_node() {
@@ -54284,7 +54343,10 @@
54284
54343
  }
54285
54344
  };
54286
54345
  var BTreeV2GroupNames = class extends BTreeV2 {
54287
- NODE_TYPE = 5;
54346
+ constructor() {
54347
+ super(...arguments);
54348
+ __publicField(this, "NODE_TYPE", 5);
54349
+ }
54288
54350
  async _parse_record(buf, offset, size) {
54289
54351
  let namehash = (await struct.unpack_from_async("<I", buf, offset))[0];
54290
54352
  offset += 4;
@@ -54293,7 +54355,10 @@
54293
54355
  }
54294
54356
  };
54295
54357
  var BTreeV2GroupOrders = class extends BTreeV2 {
54296
- NODE_TYPE = 6;
54358
+ constructor() {
54359
+ super(...arguments);
54360
+ __publicField(this, "NODE_TYPE", 6);
54361
+ }
54297
54362
  async _parse_record(buf, offset, size) {
54298
54363
  let creationorder = (await struct.unpack_from_async("<Q", buf, offset))[0];
54299
54364
  offset += 8;
@@ -55727,8 +55792,11 @@
55727
55792
  }
55728
55793
  async getValue(data) {
55729
55794
  const dtype = await this.dtype;
55730
- if (dtype.startsWith("S")) {
55731
- return (await data).map((s) => s.substr(0, s.indexOf("\0")));
55795
+ if ((typeof dtype === "string" || dtype instanceof String) && dtype.startsWith("S")) {
55796
+ return (await data).map((s) => {
55797
+ let idx = s.indexOf("\0");
55798
+ return idx >= 0 ? s.substring(0, idx) : s;
55799
+ });
55732
55800
  } else {
55733
55801
  return data;
55734
55802
  }