igv 2.15.5 → 2.15.7

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
@@ -18,19 +18,19 @@ Below are examples and a quickstart guide. See the [Wiki](https://github.com/ig
18
18
 
19
19
  # Examples
20
20
 
21
- ***[Alignments](https://igv.org/web/release/2.15.5/examples/cram-vcf.html)***
21
+ ***[Alignments](https://igv.org/web/release/2.15.7/examples/cram-vcf.html)***
22
22
 
23
- ***[Interactions](https://igv.org/web/release/2.15.5/examples/interact.html)***
23
+ ***[Interactions](https://igv.org/web/release/2.15.7/examples/interact.html)***
24
24
 
25
- ***[Copy number](https://igv.org/web/release/2.15.5/examples/copyNumber.html)***
25
+ ***[Copy number](https://igv.org/web/release/2.15.7/examples/copyNumber.html)***
26
26
 
27
- ***[Multiple regions](https://igv.org/web/release/2.15.5/examples/multi-locus.html)***
27
+ ***[Multiple regions](https://igv.org/web/release/2.15.7/examples/multi-locus.html)***
28
28
 
29
- ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.15.5/examples/maf-tcga.html)***
29
+ ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.15.7/examples/maf-tcga.html)***
30
30
 
31
- ***[Variant color options](https://igv.org/web/release/2.15.5/examples/variant-colors.html)***
31
+ ***[Variant color options](https://igv.org/web/release/2.15.7/examples/variant-colors.html)***
32
32
 
33
- ***[More](https://igv.org/web/release/2.15.5/examples/)***
33
+ ***[More](https://igv.org/web/release/2.15.7/examples/)***
34
34
 
35
35
 
36
36
  # Quickstart
@@ -39,18 +39,18 @@ Below are examples and a quickstart guide. See the [Wiki](https://github.com/ig
39
39
  igv.js consists of a single javascript file with no external dependencies.
40
40
 
41
41
  Pre-built files for script include, AMD, or CJS module systems (igv.min.js) and an ES6 module (igv.esm.min.js)
42
- can be downloaded from [https://cdn.jsdelivr.net/npm/igv@2.15.5/dist/](https://cdn.jsdelivr.net/npm/igv@2.15.5/dist/).
42
+ can be downloaded from [https://cdn.jsdelivr.net/npm/igv@2.15.7/dist/](https://cdn.jsdelivr.net/npm/igv@2.15.7/dist/).
43
43
 
44
44
  To import igv as an ES6 module
45
45
 
46
46
  ```javascript
47
- import igv from "https://cdn.jsdelivr.net/npm/igv@2.15.5/dist/igv.esm.min.js"
47
+ import igv from "https://cdn.jsdelivr.net/npm/igv@2.15.7/dist/igv.esm.min.js"
48
48
  ```
49
49
 
50
50
  Or as a script include (defines the "igv" global)
51
51
 
52
52
  ```html
53
- <script src="https://cdn.jsdelivr.net/npm/igv@2.15.5/dist/igv.min.js"></script>
53
+ <script src="https://cdn.jsdelivr.net/npm/igv@2.15.7/dist/igv.min.js"></script>
54
54
  ```
55
55
 
56
56
  Alternatively you can install with npm
package/dist/igv.esm.js CHANGED
@@ -18578,7 +18578,6 @@ class IGVXhr {
18578
18578
  });
18579
18579
  this.RANGE_WARNING_GIVEN = false;
18580
18580
  this.oauth = new Oauth();
18581
- this.contentLengthMap = new Map();
18582
18581
  }
18583
18582
 
18584
18583
  setApiKey(key) {
@@ -18656,18 +18655,6 @@ class IGVXhr {
18656
18655
  }
18657
18656
  }
18658
18657
 
18659
- async getContentLength(url, options) {
18660
- if (!this.contentLengthMap.has(url)) {
18661
- options = options || {};
18662
- options.method = 'HEAD';
18663
- options.GET_CONTENT_LENGTH = true;
18664
- const contentLengthString = await this._loadURL(url, options);
18665
- const contentLength = contentLengthString ? Number.parseInt(contentLengthString) : -1;
18666
- this.contentLengthMap.set(url, contentLength);
18667
- }
18668
- return this.contentLengthMap.get(url)
18669
- }
18670
-
18671
18658
  async _loadURL(url, options) {
18672
18659
 
18673
18660
  const self = this;
@@ -18682,11 +18669,6 @@ class IGVXhr {
18682
18669
  oauthToken = await (typeof oauthToken === 'function' ? oauthToken() : oauthToken);
18683
18670
  }
18684
18671
 
18685
- let contentLength = -1;
18686
- if (options.range && !isAmazonV4Signed(url) && !isGoogleStorageSigned(url)) {
18687
- contentLength = await this.getContentLength(url);
18688
- }
18689
-
18690
18672
  return new Promise(function (resolve, reject) {
18691
18673
 
18692
18674
  // Various Google tansformations
@@ -18727,13 +18709,7 @@ class IGVXhr {
18727
18709
  }
18728
18710
 
18729
18711
  if (range) {
18730
- let rangeEnd = "";
18731
- if (range.size) {
18732
- rangeEnd = range.start + range.size - 1;
18733
- if (contentLength > 0) {
18734
- rangeEnd = Math.min(rangeEnd, contentLength - 1);
18735
- }
18736
- }
18712
+ var rangeEnd = range.size ? range.start + range.size - 1 : "";
18737
18713
  xhr.setRequestHeader("Range", "bytes=" + range.start + "-" + rangeEnd);
18738
18714
  // xhr.setRequestHeader("Cache-Control", "no-cache"); <= This can cause CORS issues, disabled for now
18739
18715
  }
@@ -18759,11 +18735,6 @@ class IGVXhr {
18759
18735
  }
18760
18736
 
18761
18737
  xhr.onload = async function (event) {
18762
-
18763
- if (options.GET_CONTENT_LENGTH) {
18764
- resolve(xhr.getResponseHeader('content-length'));
18765
- }
18766
-
18767
18738
  // when the url points to a local file, the status is 0 but that is not an error
18768
18739
  if (xhr.status === 0 || (xhr.status >= 200 && xhr.status <= 300)) {
18769
18740
  if (range && xhr.status !== 206 && range.start !== 0) {
@@ -19086,10 +19057,6 @@ function getGlobalObject() {
19086
19057
  }
19087
19058
  }
19088
19059
 
19089
- function isAmazonV4Signed(url) {
19090
- return url.indexOf("X-Amz-Signature") > -1
19091
- }
19092
-
19093
19060
 
19094
19061
  const igvxhr = new IGVXhr();
19095
19062
 
@@ -23971,7 +23938,7 @@ const Cytoband = function (start, end, name, typestain) {
23971
23938
  }
23972
23939
  };
23973
23940
 
23974
- const _version = "2.15.5";
23941
+ const _version = "2.15.7";
23975
23942
  function version() {
23976
23943
  return _version
23977
23944
  }
@@ -32196,30 +32163,45 @@ class BufferedReader {
32196
32163
  * @param fulfill - function to receive result
32197
32164
  * @param asUint8 - optional flag to return result as an UInt8Array
32198
32165
  */
32199
- async dataViewForRange(requestedRange, asUint8) {
32200
-
32201
- const hasData = (this.data && (this.range.start <= requestedRange.start) &&
32202
- ((this.range.start + this.range.size) >= (requestedRange.start + requestedRange.size)));
32166
+ async dataViewForRange(requestedRange, asUint8, retries = 0) {
32167
+ try {
32168
+ console.log(`buffered reader ${requestedRange}`);
32169
+ const hasData = (this.data && (this.range.start <= requestedRange.start) &&
32170
+ ((this.range.start + this.range.size) >= (requestedRange.start + requestedRange.size)));
32171
+
32172
+ if (!hasData) {
32173
+ let bufferSize;
32174
+ // If requested range size is specified, potentially expand buffer size
32175
+ if (requestedRange.size) {
32176
+ bufferSize = Math.max(this.bufferSize, requestedRange.size);
32177
+ } else {
32178
+ bufferSize = this.bufferSize;
32179
+ }
32180
+ if (this.contentLength) {
32181
+ bufferSize = Math.min(bufferSize, this.contentLength - requestedRange.start);
32182
+ }
32183
+ const loadRange = {start: requestedRange.start, size: bufferSize};
32184
+ const arrayBuffer = await igvxhr.loadArrayBuffer(this.path, buildOptions(this.config, {range: loadRange}));
32185
+ this.data = arrayBuffer;
32186
+ this.range = loadRange;
32187
+ }
32203
32188
 
32204
- if (!hasData) {
32205
- let bufferSize;
32206
- // If requested range size is specified, potentially expand buffer size
32207
- if (requestedRange.size) {
32208
- bufferSize = Math.max(this.bufferSize, requestedRange.size);
32209
- } else {
32210
- bufferSize = this.bufferSize;
32189
+ const len = this.data.byteLength;
32190
+ const bufferStart = requestedRange.start - this.range.start;
32191
+ return asUint8 ?
32192
+ new Uint8Array(this.data, bufferStart, len - bufferStart) :
32193
+ new DataView(this.data, bufferStart, len - bufferStart)
32194
+ } catch (e) {
32195
+ if (retries === 0 && e.message && e.message.startsWith("416")) {
32196
+ try {
32197
+ this.contentLength = await igvxhr.getContentLength(this.path, buildOptions(this.config));
32198
+ return this.dataViewForRange(requestedRange, asUint8, ++retries)
32199
+ } catch (e1) {
32200
+ console.error(e1);
32201
+ }
32202
+ throw e
32211
32203
  }
32212
- const loadRange = {start: requestedRange.start, size: bufferSize};
32213
- const arrayBuffer = await igvxhr.loadArrayBuffer(this.path, buildOptions(this.config, {range: loadRange}));
32214
- this.data = arrayBuffer;
32215
- this.range = loadRange;
32216
32204
  }
32217
-
32218
- const len = this.data.byteLength;
32219
- const bufferStart = requestedRange.start - this.range.start;
32220
- return asUint8 ?
32221
- new Uint8Array(this.data, bufferStart, len - bufferStart) :
32222
- new DataView(this.data, bufferStart, len - bufferStart)
32223
32205
  }
32224
32206
  }
32225
32207