igv 2.13.9 → 2.13.10

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.10";
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: {
@@ -33595,7 +33611,7 @@
33595
33611
  return alignmentContainer;
33596
33612
  }
33597
33613
  for (let c of chunks) {
33598
- const ba = await this._blockLoader.getData(c.minv.block, c.maxv.block);
33614
+ const ba = await this._blockLoader.getData(c.minv, c.maxv);
33599
33615
  const done = BamUtils.decodeBamRecords(ba, c.minv.offset, alignmentContainer, this.indexToChr, chrId, bpStart, bpEnd, this.filter);
33600
33616
  if (done) {
33601
33617
  break;