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/dist/igv.js CHANGED
@@ -16829,10 +16829,7 @@
16829
16829
  var rgb = this.hsvToRgb(this.hue, saturation, value);
16830
16830
  return "#" + this.padHex(rgb[0].toString(16)) + this.padHex(rgb[1].toString(16)) + this.padHex(rgb[2].toString(16));
16831
16831
  };
16832
- const randomColorGenerator = new RandomColorGenerator();
16833
- function randomColor() {
16834
- return randomColorGenerator.get();
16835
- }
16832
+ new RandomColorGenerator();
16836
16833
  function randomRGB$1(min, max) {
16837
16834
  min = IGVMath.clamp(min, 0, 255);
16838
16835
  max = IGVMath.clamp(max, 0, 255);
@@ -21939,7 +21936,7 @@
21939
21936
  }
21940
21937
  };
21941
21938
 
21942
- const _version = "2.13.8";
21939
+ const _version = "2.13.9";
21943
21940
  function version$1() {
21944
21941
  return _version;
21945
21942
  }
@@ -52976,7 +52973,14 @@
52976
52973
  value: max
52977
52974
  }];
52978
52975
  } else {
52979
- allFeatures = FeatureUtils.findOverlapping(visibleViewport.featureCache.features, start, end);
52976
+ const viewFeatures = FeatureUtils.findOverlapping(visibleViewport.featureCache.features, start, end);
52977
+ if (!allFeatures) {
52978
+ allFeatures = viewFeatures;
52979
+ } else {
52980
+ for (let f of viewFeatures) {
52981
+ allFeatures.push(f);
52982
+ }
52983
+ }
52980
52984
  }
52981
52985
  }
52982
52986
  }
@@ -56892,21 +56896,16 @@
56892
56896
  * Colors used for coding omosomes
56893
56897
  */
56894
56898
 
56895
- const Colors = {
56899
+ const GWASColors = {
56896
56900
  "X": "rgb(204, 153, 0)",
56897
56901
  "Y": "rgb(153, 204, 0)",
56898
56902
  "Un": "darkGray)",
56899
56903
  "1": "rgb(80, 80, 255)",
56900
- //"1": Color.red);
56901
- "I": "rgb(139, 155, 187)",
56902
56904
  "2": "rgb(206, 61, 50)",
56903
- "II": "rgb(206, 61, 50)",
56904
56905
  "2a": "rgb(210, 65, 55)",
56905
56906
  "2b": "rgb(215, 70, 60)",
56906
56907
  "3": "rgb(116, 155, 88)",
56907
- "III": "rgb(116, 155, 88)",
56908
56908
  "4": "rgb(240, 230, 133)",
56909
- "IV": "rgb(240, 230, 133)",
56910
56909
  "5": "rgb(70, 105, 131)",
56911
56910
  "6": "rgb(186, 99, 56)",
56912
56911
  "7": "rgb(93, 177, 221)",
@@ -56954,9 +56953,25 @@
56954
56953
  };
56955
56954
 
56956
56955
  // aliasing
56957
- for (let key of Object.keys(Colors)) {
56956
+ for (let key of Object.keys(GWASColors)) {
56958
56957
  const altName = "chr" + key;
56959
- Colors[altName] = Colors[key];
56958
+ GWASColors[altName] = GWASColors[key];
56959
+ }
56960
+
56961
+ // romanizing
56962
+ for (let a = 1; a <= 48; a++) {
56963
+ if (a === 10) continue; // Don't overide "X"
56964
+ const roman = romanize(a);
56965
+ GWASColors[roman] = GWASColors[a.toString()];
56966
+ }
56967
+ function romanize(num) {
56968
+ if (!+num) return false;
56969
+ var digits = String(+num).split('');
56970
+ var key = ['', 'C', 'CC', 'CCC', 'CD', 'D', 'DC', 'DCC', 'DCCC', 'CM', '', 'X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC', '', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'];
56971
+ var roman = '',
56972
+ i = 3;
56973
+ while (i--) roman = (key[+digits.pop() + i * 10] || '') + roman;
56974
+ return Array(+digits.join('') + 1).join('M') + roman;
56960
56975
  }
56961
56976
 
56962
56977
  /*
@@ -57004,12 +57019,18 @@
57004
57019
  this.divider = config.divider || "rgb(225,225,225)";
57005
57020
  this.dotSize = config.dotSize || 3;
57006
57021
  this.popoverWindow = config.popoverWindow === undefined ? DEFAULT_POPOVER_WINDOW : config.popoverWindow;
57007
- this.colorScales = config.color ? new ConstantColorScale(config.color) : {
57008
- "*": new BinnedColorScale(config.colorScale || {
57022
+
57023
+ // Color settings
57024
+ if (this.useChrColors) {
57025
+ this.colorScale = new ColorTable(config.colorTable || GWASColors);
57026
+ } else if (config.color) {
57027
+ this.colorScale = new ConstantColorScale(config.color);
57028
+ } else {
57029
+ this.colorScale = new BinnedColorScale(config.colorScale || {
57009
57030
  thresholds: [5e-8, 5e-4, 0.5],
57010
57031
  colors: ["rgb(255,50,50)", "rgb(251,100,100)", "rgb(251,170,170)", "rgb(227,238,249)"]
57011
- })
57012
- };
57032
+ });
57033
+ }
57013
57034
  this.featureSource = FeatureSource(config, this.browser.genome);
57014
57035
  }
57015
57036
  async postInit() {
@@ -57072,18 +57093,16 @@
57072
57093
  const pos = variant.start;
57073
57094
  if (pos < bpStart) continue;
57074
57095
  if (pos > bpEnd) break;
57075
- const colorScale = this.getColorScale(variant._f ? variant._f.chr : variant.chr);
57076
- let color;
57077
57096
  let val;
57078
57097
  if (this.posteriorProbability) {
57079
57098
  val = variant[this.valueProperty];
57080
- color = colorScale.getColor(val);
57081
57099
  } else {
57082
57100
  const pvalue = variant[this.valueProperty];
57083
57101
  if (!pvalue) continue;
57084
57102
  val = -Math.log10(pvalue);
57085
- color = colorScale.getColor(val);
57086
57103
  }
57104
+ const colorKey = this.useChrColors ? variant._f ? variant._f.chr : variant.chr : val;
57105
+ const color = this.colorScale.getColor(colorKey);
57087
57106
  const yScale = (this.dataRange.max - this.dataRange.min) / pixelHeight;
57088
57107
  const px = Math.round((pos - bpStart) / bpPerPixel);
57089
57108
  const py = Math.max(this.dotSize, pixelHeight - Math.round((val - this.dataRange.min) / yScale));
@@ -57099,19 +57118,6 @@
57099
57118
  }
57100
57119
  }
57101
57120
  }
57102
- getColorScale(chr) {
57103
- if (this.useChrColors) {
57104
- let cs = this.colorScales[chr];
57105
- if (!cs) {
57106
- const color = Colors[chr] || randomColor();
57107
- cs = new ConstantColorScale(color);
57108
- this.colorScales[chr] = cs;
57109
- }
57110
- return cs;
57111
- } else {
57112
- return this.colorScales("*");
57113
- }
57114
- }
57115
57121
  paintAxis(ctx, pixelWidth, pixelHeight) {
57116
57122
  IGVGraphics.fillRect(ctx, 0, 0, pixelWidth, pixelHeight, {
57117
57123
  'fillStyle': "rgb(255, 255, 255)"
@@ -57224,11 +57230,15 @@
57224
57230
  } else {
57225
57231
  // No features -- pick something reasonable for PPAs and p-values
57226
57232
  if (this.posteriorProbability) {
57227
- this.dataRange.min = this.config.min || 0;
57228
- this.dataRange.max = this.config.max || 1;
57233
+ this.dataRange = {
57234
+ min: this.config.min || 0,
57235
+ max: this.config.max || 1
57236
+ };
57229
57237
  } else {
57230
- this.dataRange.max = this.config.max || 25;
57231
- this.dataRange.min = this.config.min || 0;
57238
+ this.dataRange = {
57239
+ min: this.config.max || 25,
57240
+ max: this.config.min || 0
57241
+ };
57232
57242
  }
57233
57243
  }
57234
57244
  return this.dataRange;