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/README.md CHANGED
@@ -12,19 +12,19 @@ Below are examples and a quickstart guide. See the [Wiki](https://github.com/ig
12
12
 
13
13
  # Examples
14
14
 
15
- ***[Alignments](https://igv.org/web/release/2.13.9/examples/cram-vcf.html)***
15
+ ***[Alignments](https://igv.org/web/release/2.13.11/examples/cram-vcf.html)***
16
16
 
17
- ***[Interactions](https://igv.org/web/release/2.13.9/examples/interact.html)***
17
+ ***[Interactions](https://igv.org/web/release/2.13.11/examples/interact.html)***
18
18
 
19
- ***[Copy number](https://igv.org/web/release/2.13.9/examples/copyNumber.html)***
19
+ ***[Copy number](https://igv.org/web/release/2.13.11/examples/copyNumber.html)***
20
20
 
21
- ***[Multiple regions](https://igv.org/web/release/2.13.9/examples/multi-locus.html)***
21
+ ***[Multiple regions](https://igv.org/web/release/2.13.11/examples/multi-locus.html)***
22
22
 
23
- ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.13.9/examples/maf-tcga.html)***
23
+ ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.13.11/examples/maf-tcga.html)***
24
24
 
25
- ***[Variant color options](https://igv.org/web/release/2.13.9/examples/variant-colors.html)***
25
+ ***[Variant color options](https://igv.org/web/release/2.13.11/examples/variant-colors.html)***
26
26
 
27
- ***[More](https://igv.org/web/release/2.13.9/examples/)***
27
+ ***[More](https://igv.org/web/release/2.13.11/examples/)***
28
28
 
29
29
 
30
30
  # Quickstart
@@ -33,18 +33,18 @@ Below are examples and a quickstart guide. See the [Wiki](https://github.com/ig
33
33
  igv.js consists of a single javascript file with no external dependencies.
34
34
 
35
35
  Pre-built files for ES5 (igv.min.js) and ES6 (igv.esm.min.js)
36
- can be downloaded from [https://cdn.jsdelivr.net/npm/igv@2.13.9/dist/](https://cdn.jsdelivr.net/npm/igv@2.13.9/dist/).
36
+ can be downloaded from [https://cdn.jsdelivr.net/npm/igv@2.13.11/dist/](https://cdn.jsdelivr.net/npm/igv@2.13.11/dist/).
37
37
 
38
38
  To import igv as an ES6 module
39
39
 
40
40
  ```javascript
41
- import igv from "https://cdn.jsdelivr.net/npm/igv@2.13.9/dist/igv.esm.min.js"
41
+ import igv from "https://cdn.jsdelivr.net/npm/igv@2.13.11/dist/igv.esm.min.js"
42
42
  ```
43
43
 
44
44
  Or as a script include (defines the "igv" global)
45
45
 
46
46
  ```html
47
- <script src="https://cdn.jsdelivr.net/npm/igv@2.13.9/dist/igv.min.js"></script>
47
+ <script src="https://cdn.jsdelivr.net/npm/igv@2.13.11/dist/igv.min.js"></script>
48
48
  ```
49
49
 
50
50
  Alternatively you can install with npm
package/dist/igv.esm.js CHANGED
@@ -24211,7 +24211,7 @@ const Cytoband = function (start, end, name, typestain) {
24211
24211
  }
24212
24212
  };
24213
24213
 
24214
- const _version = "2.13.9";
24214
+ const _version = "2.13.11";
24215
24215
  function version() {
24216
24216
  return _version
24217
24217
  }
@@ -30100,13 +30100,17 @@ class BGZBlockLoader {
30100
30100
  /**
30101
30101
  * Return inflated data from startBlock through endBlock as an UInt8Array
30102
30102
  *
30103
- * @param startBlock
30104
- * @param endBlock
30103
+ * @param minv minimum virtual pointer {block, offset}
30104
+ * @param maxv maximum virtual pointer {block, offset}
30105
30105
  * @returns {Promise<Uint8Array>}
30106
30106
  */
30107
- async getData(startBlock, endBlock) {
30107
+ async getData(minv, maxv) {
30108
30108
 
30109
- const blocks = await this.getInflatedBlocks(startBlock, endBlock);
30109
+ const startBlock = minv.block;
30110
+ const endBlock = maxv.block;
30111
+ const skipEnd = maxv.offset === 0;
30112
+
30113
+ const blocks = await this.getInflatedBlocks(startBlock, endBlock, skipEnd);
30110
30114
  if (blocks.length === 1) {
30111
30115
  return blocks[0]
30112
30116
  }
@@ -30131,16 +30135,18 @@ class BGZBlockLoader {
30131
30135
  * @param endBlock
30132
30136
  * @returns {Promise<*[Uint8Array]>}
30133
30137
  */
30134
- async getInflatedBlocks(startBlock, endBlock) {
30138
+ async getInflatedBlocks(startBlock, endBlock, skipEnd) {
30135
30139
 
30136
30140
  if (!this.cacheBlocks) {
30137
- const buffer = await this.loadBLockData(startBlock, endBlock);
30141
+ const buffer = await this.loadBLockData(startBlock, endBlock, {skipEnd});
30138
30142
  return inflateBlocks(buffer)
30139
30143
  } else {
30140
30144
 
30141
30145
  const c = this.cache;
30142
- if (c && (c.startBlock <= startBlock && c.endBlock >= endBlock)) {
30143
- //console.log("Complete overlap")
30146
+ if (c &&
30147
+ c.startBlock <= startBlock &&
30148
+ (c.endBlock >= endBlock || skipEnd && c.nextEndBlock === endBlock)) {
30149
+ console.log("Complete overlap");
30144
30150
  const startOffset = startBlock - c.startBlock;
30145
30151
  const endOffset = endBlock - c.startBlock;
30146
30152
  return inflateBlocks(c.buffer, startOffset, endOffset)
@@ -30150,7 +30156,7 @@ class BGZBlockLoader {
30150
30156
  let buffer;
30151
30157
  if (!c || (c.startBlock > endBlock || c.endBlock < startBlock)) {
30152
30158
  // no overlap with cache
30153
- buffer = await this.loadBLockData(startBlock, endBlock);
30159
+ buffer = await this.loadBLockData(startBlock, endBlock, {skipEnd});
30154
30160
  } else {
30155
30161
 
30156
30162
  //console.log("Some overlap")
@@ -30189,14 +30195,21 @@ class BGZBlockLoader {
30189
30195
 
30190
30196
  // Load end blocks, if any
30191
30197
  if (endBlock > c.endBlock) {
30192
- const endBuffer = await this.loadBLockData(c.endBlock, endBlock, {skipStart: true});
30198
+ const endBuffer = await this.loadBLockData(c.endBlock, endBlock, {skipStart: true, skipEnd});
30193
30199
  arrayBuffers.push(endBuffer);
30194
30200
  }
30195
30201
 
30196
30202
  buffer = concatenateArrayBuffers(arrayBuffers);
30197
30203
  }
30198
30204
 
30199
- this.cache = {startBlock, endBlock, buffer};
30205
+ // If skipEnd === true we need to find boundary of last block in cache
30206
+ let nextEndBlock = endBlock;
30207
+ if(skipEnd) {
30208
+ const boundaries = findBlockBoundaries(buffer);
30209
+ endBlock = boundaries[boundaries.length - 1];
30210
+ }
30211
+
30212
+ this.cache = {startBlock, endBlock, nextEndBlock, buffer};
30200
30213
  return inflateBlocks(buffer)
30201
30214
  }
30202
30215
  }
@@ -30514,7 +30527,7 @@ class FeatureFileReader {
30514
30527
 
30515
30528
  let inflated;
30516
30529
  if (tabix) {
30517
- inflated = await this._blockLoader.getData(chunk.minv.block, chunk.maxv.block);
30530
+ inflated = await this._blockLoader.getData(chunk.minv, chunk.maxv);
30518
30531
  } else {
30519
30532
  const options = buildOptions(config, {
30520
30533
  range: {
@@ -36651,7 +36664,7 @@ class BamReader {
36651
36664
  }
36652
36665
 
36653
36666
  for (let c of chunks) {
36654
- const ba = await this._blockLoader.getData(c.minv.block, c.maxv.block);
36667
+ const ba = await this._blockLoader.getData(c.minv, c.maxv);
36655
36668
  const done = BamUtils.decodeBamRecords(ba, c.minv.offset, alignmentContainer, this.indexToChr, chrId, bpStart, bpEnd, this.filter);
36656
36669
  if (done) {
36657
36670
  break
@@ -42955,7 +42968,7 @@ class TrackView {
42955
42968
  }
42956
42969
 
42957
42970
  if (this.track.autoscale) {
42958
- let allFeatures;
42971
+ let allFeatures = [];
42959
42972
  for (let visibleViewport of visibleViewports) {
42960
42973
  const referenceFrame = visibleViewport.referenceFrame;
42961
42974
  const start = referenceFrame.start;
@@ -42964,15 +42977,11 @@ class TrackView {
42964
42977
  // If the "features" object has a getMax function use it. Currently only alignmentContainer implements this, for coverage.
42965
42978
  if (typeof visibleViewport.featureCache.features.getMax === 'function') {
42966
42979
  const max = visibleViewport.featureCache.features.getMax(start, end);
42967
- allFeatures = [{value: max}];
42980
+ allFeatures.push({value: max});
42968
42981
  } else {
42969
42982
  const viewFeatures = FeatureUtils.findOverlapping(visibleViewport.featureCache.features, start, end);
42970
- if(!allFeatures) {
42971
- allFeatures = viewFeatures;
42972
- } else {
42973
- for(let f of viewFeatures) {
42974
- allFeatures.push(f);
42975
- }
42983
+ for (let f of viewFeatures) {
42984
+ allFeatures.push(f);
42976
42985
  }
42977
42986
  }
42978
42987
  }
@@ -44381,7 +44390,7 @@ class WigTrack extends TrackBase {
44381
44390
 
44382
44391
  async postInit() {
44383
44392
  const header = await this.getHeader();
44384
- if(this.disposed) return; // This track was removed during async load
44393
+ if (this.disposed) return // This track was removed during async load
44385
44394
  if (header) this.setTrackProperties(header);
44386
44395
  }
44387
44396
 
@@ -44466,9 +44475,6 @@ class WigTrack extends TrackBase {
44466
44475
  const pixelWidth = options.pixelWidth;
44467
44476
  options.pixelHeight;
44468
44477
  const bpEnd = bpStart + pixelWidth * bpPerPixel + 1;
44469
- let lastPixelEnd = -1;
44470
- let lastValue = -1;
44471
- let lastNegValue = 1;
44472
44478
  const posColor = this.color || DEFAULT_COLOR;
44473
44479
 
44474
44480
  let baselineColor;
@@ -44489,6 +44495,9 @@ class WigTrack extends TrackBase {
44489
44495
  // nothing to paint.
44490
44496
  if (this.dataRange.max > this.dataRange.min) {
44491
44497
 
44498
+ let lastPixelEnd = -1;
44499
+ let lastY;
44500
+ let lastValue = -1;
44492
44501
  const y0 = yScale(0);
44493
44502
  for (let f of features) {
44494
44503
 
@@ -44511,15 +44520,22 @@ class WigTrack extends TrackBase {
44511
44520
  const px = x + width / 2;
44512
44521
  IGVGraphics.fillCircle(ctx, px, y, pointSize / 2, {"fillStyle": color, "strokeStyle": color});
44513
44522
 
44523
+ } else if (this.graphType === "line") {
44524
+ if(lastY != undefined) {
44525
+ IGVGraphics.strokeLine(ctx, lastPixelEnd, lastY, x, y, {"fillStyle": color, "strokeStyle": color});
44526
+ }
44527
+ IGVGraphics.strokeLine(ctx, x, y, x + width, y, {"fillStyle": color, "strokeStyle": color});
44514
44528
  } else {
44515
44529
  let height = y - y0;
44516
44530
  const pixelEnd = x + width;
44517
44531
  if (pixelEnd > lastPixelEnd || (f.value >= 0 && f.value > lastValue) || (f.value < 0 && f.value < lastNegValue)) {
44518
44532
  IGVGraphics.fillRect(ctx, x, y0, width, height, {fillStyle: color});
44519
44533
  }
44520
- lastValue = f.value;
44521
- lastPixelEnd = pixelEnd;
44522
44534
  }
44535
+ lastPixelEnd = x + width;
44536
+ lastValue = f.value;
44537
+ lastY = y;
44538
+
44523
44539
  }
44524
44540
 
44525
44541
  // If the track includes negative values draw a baseline
@@ -44548,7 +44564,7 @@ class WigTrack extends TrackBase {
44548
44564
 
44549
44565
  popupData(clickState, features) {
44550
44566
 
44551
- if(features === undefined) features = this.clickedFeatures(clickState);
44567
+ if (features === undefined) features = this.clickedFeatures(clickState);
44552
44568
 
44553
44569
  if (features && features.length > 0) {
44554
44570