igv 2.15.4 → 2.15.5

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.4/examples/cram-vcf.html)***
21
+ ***[Alignments](https://igv.org/web/release/2.15.5/examples/cram-vcf.html)***
22
22
 
23
- ***[Interactions](https://igv.org/web/release/2.15.4/examples/interact.html)***
23
+ ***[Interactions](https://igv.org/web/release/2.15.5/examples/interact.html)***
24
24
 
25
- ***[Copy number](https://igv.org/web/release/2.15.4/examples/copyNumber.html)***
25
+ ***[Copy number](https://igv.org/web/release/2.15.5/examples/copyNumber.html)***
26
26
 
27
- ***[Multiple regions](https://igv.org/web/release/2.15.4/examples/multi-locus.html)***
27
+ ***[Multiple regions](https://igv.org/web/release/2.15.5/examples/multi-locus.html)***
28
28
 
29
- ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.15.4/examples/maf-tcga.html)***
29
+ ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.15.5/examples/maf-tcga.html)***
30
30
 
31
- ***[Variant color options](https://igv.org/web/release/2.15.4/examples/variant-colors.html)***
31
+ ***[Variant color options](https://igv.org/web/release/2.15.5/examples/variant-colors.html)***
32
32
 
33
- ***[More](https://igv.org/web/release/2.15.4/examples/)***
33
+ ***[More](https://igv.org/web/release/2.15.5/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.4/dist/](https://cdn.jsdelivr.net/npm/igv@2.15.4/dist/).
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/).
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.4/dist/igv.esm.min.js"
47
+ import igv from "https://cdn.jsdelivr.net/npm/igv@2.15.5/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.4/dist/igv.min.js"></script>
53
+ <script src="https://cdn.jsdelivr.net/npm/igv@2.15.5/dist/igv.min.js"></script>
54
54
  ```
55
55
 
56
56
  Alternatively you can install with npm
package/dist/igv.esm.js CHANGED
@@ -18578,6 +18578,7 @@ class IGVXhr {
18578
18578
  });
18579
18579
  this.RANGE_WARNING_GIVEN = false;
18580
18580
  this.oauth = new Oauth();
18581
+ this.contentLengthMap = new Map();
18581
18582
  }
18582
18583
 
18583
18584
  setApiKey(key) {
@@ -18655,6 +18656,18 @@ class IGVXhr {
18655
18656
  }
18656
18657
  }
18657
18658
 
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
+
18658
18671
  async _loadURL(url, options) {
18659
18672
 
18660
18673
  const self = this;
@@ -18669,6 +18682,11 @@ class IGVXhr {
18669
18682
  oauthToken = await (typeof oauthToken === 'function' ? oauthToken() : oauthToken);
18670
18683
  }
18671
18684
 
18685
+ let contentLength = -1;
18686
+ if (options.range && !isAmazonV4Signed(url) && !isGoogleStorageSigned(url)) {
18687
+ contentLength = await this.getContentLength(url);
18688
+ }
18689
+
18672
18690
  return new Promise(function (resolve, reject) {
18673
18691
 
18674
18692
  // Various Google tansformations
@@ -18694,13 +18712,6 @@ class IGVXhr {
18694
18712
  }
18695
18713
  const range = options.range;
18696
18714
 
18697
- // const isChrome = navigator.userAgent.indexOf('Chrome') > -1
18698
- // const isSafari = navigator.vendor.indexOf("Apple") === 0 && /\sSafari\//.test(navigator.userAgent)
18699
- // if (range && isChrome && !isAmazonV4Signed(url) && !isGoogleStorageSigned(url)) {
18700
- // // Hack to prevent caching for byte-ranges. Attempt to fix net:err-cache errors in Chrome
18701
- // url += url.includes("?") ? "&" : "?"
18702
- // url += "someRandomSeed=" + Math.random().toString(36)
18703
- // }
18704
18715
 
18705
18716
  const xhr = new XMLHttpRequest();
18706
18717
  const sendData = options.sendData || options.body;
@@ -18716,7 +18727,13 @@ class IGVXhr {
18716
18727
  }
18717
18728
 
18718
18729
  if (range) {
18719
- var rangeEnd = range.size ? range.start + range.size - 1 : "";
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
+ }
18720
18737
  xhr.setRequestHeader("Range", "bytes=" + range.start + "-" + rangeEnd);
18721
18738
  // xhr.setRequestHeader("Cache-Control", "no-cache"); <= This can cause CORS issues, disabled for now
18722
18739
  }
@@ -18742,6 +18759,11 @@ class IGVXhr {
18742
18759
  }
18743
18760
 
18744
18761
  xhr.onload = async function (event) {
18762
+
18763
+ if (options.GET_CONTENT_LENGTH) {
18764
+ resolve(xhr.getResponseHeader('content-length'));
18765
+ }
18766
+
18745
18767
  // when the url points to a local file, the status is 0 but that is not an error
18746
18768
  if (xhr.status === 0 || (xhr.status >= 200 && xhr.status <= 300)) {
18747
18769
  if (range && xhr.status !== 206 && range.start !== 0) {
@@ -18774,6 +18796,7 @@ class IGVXhr {
18774
18796
  }
18775
18797
  };
18776
18798
 
18799
+
18777
18800
  xhr.onerror = function (event) {
18778
18801
  if (isGoogleURL(url) && !options.retries) {
18779
18802
  tryGoogleAuth();
@@ -18905,7 +18928,6 @@ function isGoogleStorageSigned(url) {
18905
18928
  }
18906
18929
 
18907
18930
 
18908
-
18909
18931
  /**
18910
18932
  * Return a Google oAuth token, triggering a sign in if required. This method should not be called until we know
18911
18933
  * a token is required, that is until we've tried the url and received a 401, 403, or 404.
@@ -19064,6 +19086,11 @@ function getGlobalObject() {
19064
19086
  }
19065
19087
  }
19066
19088
 
19089
+ function isAmazonV4Signed(url) {
19090
+ return url.indexOf("X-Amz-Signature") > -1
19091
+ }
19092
+
19093
+
19067
19094
  const igvxhr = new IGVXhr();
19068
19095
 
19069
19096
  /*
@@ -23944,7 +23971,7 @@ const Cytoband = function (start, end, name, typestain) {
23944
23971
  }
23945
23972
  };
23946
23973
 
23947
- const _version = "2.15.4";
23974
+ const _version = "2.15.5";
23948
23975
  function version() {
23949
23976
  return _version
23950
23977
  }
@@ -30279,7 +30306,8 @@ class FeatureFileReader {
30279
30306
  this.config = config || {};
30280
30307
  this.genome = genome;
30281
30308
  this.indexURL = config.indexURL;
30282
- this.indexed = config.indexed;
30309
+ this.indexed = config.indexed || this.indexURL !== undefined;
30310
+ this.queryable = this.indexed;
30283
30311
 
30284
30312
  if (isFile(this.config.url)) {
30285
30313
  this.filename = this.config.url.name;
@@ -31939,7 +31967,7 @@ class TextFeatureSource {
31939
31967
 
31940
31968
  const queryableFormats = new Set(["bigwig", "bw", "bigbed", "bb", "biginteract", "biggenepred", "bignarrowpeak", "tdf"]);
31941
31969
 
31942
- this.queryable = config.queryable === true; // False by default, unless explicitly set
31970
+ this.queryable = config.indexURL || config.queryable === true; // False by default, unless explicitly set
31943
31971
  if (config.reader) {
31944
31972
  // Explicit reader implementation
31945
31973
  this.reader = config.reader;
@@ -32037,6 +32065,7 @@ class TextFeatureSource {
32037
32065
  // * view is "whole genome" but no features are loaded
32038
32066
  // * cache is disabled
32039
32067
  // * cache does not contain requested range
32068
+ // const containsRange = this.featureCache.containsRange(new GenomicInterval(queryChr, start, end))
32040
32069
  if ((isWholeGenome && !this.wgFeatures && this.supportsWholeGenome()) ||
32041
32070
  this.config.disableCache ||
32042
32071
  !this.featureCache ||
@@ -40877,7 +40906,7 @@ function monitorTrackDrag(track) {
40877
40906
 
40878
40907
  function onDragEnd() {
40879
40908
  if (track.trackView && track.displayMode !== "SQUISHED") {
40880
- track.trackView.repaintViews(); // TODO -- refine this to the viewport that was dragged after DOM refactor
40909
+ track.trackView.updateViews(); // TODO -- refine this to the viewport that was dragged after DOM refactor
40881
40910
  }
40882
40911
  }
40883
40912