igv 2.13.8 → 2.13.9

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.8/examples/cram-vcf.html)***
15
+ ***[Alignments](https://igv.org/web/release/2.13.9/examples/cram-vcf.html)***
16
16
 
17
- ***[Interactions](https://igv.org/web/release/2.13.8/examples/interact.html)***
17
+ ***[Interactions](https://igv.org/web/release/2.13.9/examples/interact.html)***
18
18
 
19
- ***[Copy number](https://igv.org/web/release/2.13.8/examples/copyNumber.html)***
19
+ ***[Copy number](https://igv.org/web/release/2.13.9/examples/copyNumber.html)***
20
20
 
21
- ***[Multiple regions](https://igv.org/web/release/2.13.8/examples/multi-locus.html)***
21
+ ***[Multiple regions](https://igv.org/web/release/2.13.9/examples/multi-locus.html)***
22
22
 
23
- ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.13.8/examples/maf-tcga.html)***
23
+ ***[Mutation Annotation Format (MAF)](https://igv.org/web/release/2.13.9/examples/maf-tcga.html)***
24
24
 
25
- ***[Variant color options](https://igv.org/web/release/2.13.8/examples/variant-colors.html)***
25
+ ***[Variant color options](https://igv.org/web/release/2.13.9/examples/variant-colors.html)***
26
26
 
27
- ***[More](https://igv.org/web/release/2.13.8/examples/)***
27
+ ***[More](https://igv.org/web/release/2.13.9/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.8/dist/](https://cdn.jsdelivr.net/npm/igv@2.13.8/dist/).
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/).
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.8/dist/igv.esm.min.js"
41
+ import igv from "https://cdn.jsdelivr.net/npm/igv@2.13.9/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.8/dist/igv.min.js"></script>
47
+ <script src="https://cdn.jsdelivr.net/npm/igv@2.13.9/dist/igv.min.js"></script>
48
48
  ```
49
49
 
50
50
  Alternatively you can install with npm
package/dist/igv.esm.js CHANGED
@@ -18596,11 +18596,7 @@ RandomColorGenerator.prototype.get = function (saturation, value) {
18596
18596
 
18597
18597
  };
18598
18598
 
18599
- const randomColorGenerator = new RandomColorGenerator();
18600
-
18601
- function randomColor() {
18602
- return randomColorGenerator.get()
18603
- }
18599
+ new RandomColorGenerator();
18604
18600
 
18605
18601
  function randomRGB$1(min, max) {
18606
18602
 
@@ -24215,7 +24211,7 @@ const Cytoband = function (start, end, name, typestain) {
24215
24211
  }
24216
24212
  };
24217
24213
 
24218
- const _version = "2.13.8";
24214
+ const _version = "2.13.9";
24219
24215
  function version() {
24220
24216
  return _version
24221
24217
  }
@@ -42970,7 +42966,14 @@ class TrackView {
42970
42966
  const max = visibleViewport.featureCache.features.getMax(start, end);
42971
42967
  allFeatures = [{value: max}];
42972
42968
  } else {
42973
- allFeatures = FeatureUtils.findOverlapping(visibleViewport.featureCache.features, start, end);
42969
+ 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
+ }
42976
+ }
42974
42977
  }
42975
42978
  }
42976
42979
  }
@@ -47304,21 +47307,16 @@ class EqtlTrack extends TrackBase {
47304
47307
  * Colors used for coding omosomes
47305
47308
  */
47306
47309
 
47307
- const Colors = {
47310
+ const GWASColors = {
47308
47311
  "X": "rgb(204, 153, 0)",
47309
47312
  "Y": "rgb(153, 204, 0)",
47310
47313
  "Un": "darkGray)",
47311
47314
  "1": "rgb(80, 80, 255)",
47312
- //"1": Color.red);
47313
- "I": "rgb(139, 155, 187)",
47314
47315
  "2": "rgb(206, 61, 50)",
47315
- "II": "rgb(206, 61, 50)",
47316
47316
  "2a": "rgb(210, 65, 55)",
47317
47317
  "2b": "rgb(215, 70, 60)",
47318
47318
  "3": "rgb(116, 155, 88)",
47319
- "III": "rgb(116, 155, 88)",
47320
47319
  "4": "rgb(240, 230, 133)",
47321
- "IV": "rgb(240, 230, 133)",
47322
47320
  "5": "rgb(70, 105, 131)",
47323
47321
  "6": "rgb(186, 99, 56)",
47324
47322
  "7": "rgb(93, 177, 221)",
@@ -47366,9 +47364,28 @@ const Colors = {
47366
47364
  };
47367
47365
 
47368
47366
  // aliasing
47369
- for (let key of Object.keys(Colors)) {
47367
+ for (let key of Object.keys(GWASColors)) {
47370
47368
  const altName = "chr" + key;
47371
- Colors[altName] = Colors[key];
47369
+ GWASColors[altName] = GWASColors[key];
47370
+ }
47371
+
47372
+ // romanizing
47373
+ for(let a = 1; a <= 48; a++) {
47374
+ if(a === 10) continue // Don't overide "X"
47375
+ const roman = romanize(a);
47376
+ GWASColors[roman] = GWASColors[a.toString()];
47377
+ }
47378
+
47379
+
47380
+ function romanize (num) {
47381
+ if (!+num) return false;
47382
+ var digits = String(+num).split('');
47383
+ var key = ['','C','CC','CCC','CD','D','DC','DCC','DCCC','CM',
47384
+ '','X','XX','XXX','XL','L','LX','LXX','LXXX','XC',
47385
+ '','I','II','III','IV','V','VI','VII','VIII','IX'];
47386
+ var roman = '', i = 3;
47387
+ while (i--) roman = (key[+digits.pop() + (i * 10)] || '') + roman;
47388
+ return Array(+digits.join('') + 1).join('M') + roman;
47372
47389
  }
47373
47390
 
47374
47391
  /*
@@ -47423,14 +47440,19 @@ class GWASTrack extends TrackBase {
47423
47440
  this.dotSize = config.dotSize || 3;
47424
47441
  this.popoverWindow = (config.popoverWindow === undefined ? DEFAULT_POPOVER_WINDOW : config.popoverWindow);
47425
47442
 
47426
- this.colorScales = config.color ?
47427
- new ConstantColorScale(config.color) :
47428
- {
47429
- "*": new BinnedColorScale(config.colorScale || {
47430
- thresholds: [5e-8, 5e-4, 0.5],
47431
- colors: ["rgb(255,50,50)", "rgb(251,100,100)", "rgb(251,170,170)", "rgb(227,238,249)"],
47432
- })
47433
- };
47443
+ // Color settings
47444
+ if (this.useChrColors) {
47445
+ this.colorScale = new ColorTable(config.colorTable || GWASColors);
47446
+ } else if (config.color) {
47447
+ this.colorScale = new ConstantColorScale(config.color);
47448
+ } else {
47449
+ this.colorScale =
47450
+ new BinnedColorScale(config.colorScale ||
47451
+ {
47452
+ thresholds: [5e-8, 5e-4, 0.5],
47453
+ colors: ["rgb(255,50,50)", "rgb(251,100,100)", "rgb(251,170,170)", "rgb(227,238,249)"],
47454
+ });
47455
+ }
47434
47456
 
47435
47457
  this.featureSource = FeatureSource(config, this.browser.genome);
47436
47458
  }
@@ -47439,7 +47461,7 @@ class GWASTrack extends TrackBase {
47439
47461
 
47440
47462
  if (typeof this.featureSource.getHeader === "function") {
47441
47463
  this.header = await this.featureSource.getHeader();
47442
- if(this.disposed) return; // This track was removed during async load
47464
+ if (this.disposed) return // This track was removed during async load
47443
47465
  }
47444
47466
 
47445
47467
  // Set properties from track line
@@ -47497,20 +47519,20 @@ class GWASTrack extends TrackBase {
47497
47519
  if (pos < bpStart) continue
47498
47520
  if (pos > bpEnd) break
47499
47521
 
47500
- const colorScale = this.getColorScale(variant._f ? variant._f.chr : variant.chr);
47501
-
47502
- let color;
47503
47522
  let val;
47504
47523
  if (this.posteriorProbability) {
47505
47524
  val = variant[this.valueProperty];
47506
- color = colorScale.getColor(val);
47507
47525
  } else {
47508
47526
  const pvalue = variant[this.valueProperty];
47509
47527
  if (!pvalue) continue
47510
47528
  val = -Math.log10(pvalue);
47511
- color = colorScale.getColor(val);
47512
47529
  }
47513
47530
 
47531
+ const colorKey = this.useChrColors ?
47532
+ variant._f ? variant._f.chr : variant.chr :
47533
+ val;
47534
+
47535
+ const color = this.colorScale.getColor(colorKey);
47514
47536
  const yScale = (this.dataRange.max - this.dataRange.min) / pixelHeight;
47515
47537
  const px = Math.round((pos - bpStart) / bpPerPixel);
47516
47538
  const py = Math.max(this.dotSize, pixelHeight - Math.round((val - this.dataRange.min) / yScale));
@@ -47525,21 +47547,6 @@ class GWASTrack extends TrackBase {
47525
47547
  }
47526
47548
  }
47527
47549
 
47528
- getColorScale(chr) {
47529
-
47530
- if (this.useChrColors) {
47531
- let cs = this.colorScales[chr];
47532
- if (!cs) {
47533
- const color = Colors[chr] || randomColor();
47534
- cs = new ConstantColorScale(color);
47535
- this.colorScales[chr] = cs;
47536
- }
47537
- return cs
47538
- } else {
47539
- return this.colorScales("*")
47540
- }
47541
- }
47542
-
47543
47550
  paintAxis(ctx, pixelWidth, pixelHeight) {
47544
47551
 
47545
47552
  IGVGraphics.fillRect(ctx, 0, 0, pixelWidth, pixelHeight, {'fillStyle': "rgb(255, 255, 255)"});
@@ -47576,7 +47583,7 @@ class GWASTrack extends TrackBase {
47576
47583
 
47577
47584
  popupData(clickState, features) {
47578
47585
 
47579
- if(features === undefined) features = clickState.viewport.cachedFeatures;
47586
+ if (features === undefined) features = clickState.viewport.cachedFeatures;
47580
47587
 
47581
47588
  let data = [];
47582
47589
  const track = clickState.viewport.trackView.track;
@@ -47637,13 +47644,10 @@ class GWASTrack extends TrackBase {
47637
47644
  } else {
47638
47645
  // No features -- pick something reasonable for PPAs and p-values
47639
47646
  if (this.posteriorProbability) {
47640
- this.dataRange.min = this.config.min || 0;
47641
- this.dataRange.max = this.config.max || 1;
47647
+ this.dataRange = {min: this.config.min || 0, max: this.config.max || 1};
47642
47648
  } else {
47643
- this.dataRange.max = this.config.max || 25;
47644
- this.dataRange.min = this.config.min || 0;
47649
+ this.dataRange = {min: this.config.max || 25, max: this.config.min || 0};
47645
47650
  }
47646
-
47647
47651
  }
47648
47652
 
47649
47653
  return this.dataRange