diff --git a/README.md b/README.md index 983fd05b4..e94c3ca38 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,19 @@ Below are examples and a quickstart guide. See the [developer documentation](ht # Examples -***[Alignments](https://igv.org/web/release/3.0.9/examples/cram-vcf.html)*** +***[Alignments](https://igv.org/web/release/3.1.0/examples/cram-vcf.html)*** -***[Interactions](https://igv.org/web/release/3.0.9/examples/interact.html)*** +***[Interactions](https://igv.org/web/release/3.1.0/examples/interact.html)*** -***[Copy number](https://igv.org/web/release/3.0.9/examples/copyNumber.html)*** +***[Copy number](https://igv.org/web/release/3.1.0/examples/copyNumber.html)*** -***[Multiple regions](https://igv.org/web/release/3.0.9/examples/multi-locus.html)*** +***[Multiple regions](https://igv.org/web/release/3.1.0/examples/multi-locus.html)*** -***[Mutation Annotation Format (MAF)](https://igv.org/web/release/3.0.9/examples/maf-tcga.html)*** +***[Mutation Annotation Format (MAF)](https://igv.org/web/release/3.1.0/examples/maf-tcga.html)*** -***[Variant color options](https://igv.org/web/release/3.0.9/examples/variant-colors.html)*** +***[Variant color options](https://igv.org/web/release/3.1.0/examples/variant-colors.html)*** -***[More](https://igv.org/web/release/3.0.9/examples/)*** +***[More](https://igv.org/web/release/3.1.0/examples/)*** # Quickstart @@ -39,18 +39,18 @@ Below are examples and a quickstart guide. See the [developer documentation](ht igv.js consists of a single javascript file with no external dependencies. Pre-built files for script include, AMD, or CJS module systems (igv.min.js) and an ES6 module (igv.esm.min.js) -can be downloaded from [https://cdn.jsdelivr.net/npm/igv@3.0.9/dist/](https://cdn.jsdelivr.net/npm/igv@3.0.9/dist/). +can be downloaded from [https://cdn.jsdelivr.net/npm/igv@3.1.0/dist/](https://cdn.jsdelivr.net/npm/igv@3.1.0/dist/). To import igv as an ES6 module ```javascript -import igv from "https://cdn.jsdelivr.net/npm/igv@3.0.9/dist/igv.esm.min.js" +import igv from "https://cdn.jsdelivr.net/npm/igv@3.1.0/dist/igv.esm.min.js" ``` Or as a script include (defines the "igv" global) ```html - + ``` Alternatively you can install with npm diff --git a/js/ui/components/colorScaleEditor.js b/js/ui/components/colorScaleEditor.js index 229f79e81..2d618bfc3 100644 --- a/js/ui/components/colorScaleEditor.js +++ b/js/ui/components/colorScaleEditor.js @@ -10,9 +10,9 @@ function paintLegend(legend, newColorScale) { const ctx = legend.getContext("2d") const w = legend.width - const step = (newColorScale.high - newColorScale.low) / w + const step = (newColorScale.max - newColorScale.min) / w for (let i = 0; i < w; i++) { - const v = newColorScale.low + i * step + const v = newColorScale.min + i * step const color = newColorScale.getColor(v) ctx.fillStyle = color ctx.fillRect(i, 0, 1, legend.height) @@ -22,7 +22,7 @@ function paintLegend(legend, newColorScale) { /** * Editor for color scales. Supported types: * - * 'gradient': {low, high, lowColor, highColor} + * 'gradient': {min, max, minColor, maxColor} * * 'diverging': {mid, midColor, lowGradientScale, highGradientScale} * @@ -44,9 +44,9 @@ class ColorScaleEditor { const minTextbox = new TextBoxRow({ label: "Min value", - value: newColorScale.low.toString(), + value: newColorScale.min.toString(), onchange: (v) => { - newColorScale.low = Number.parseFloat(v) + newColorScale.min = Number.parseFloat(v) paintLegend(legend, newColorScale) } }) @@ -54,7 +54,7 @@ class ColorScaleEditor { const midTextbox = new TextBoxRow({ label: "Mid value", - value: (newColorScale.mid || newColorScale.low).toString(), + value: (newColorScale.mid || newColorScale.min).toString(), onchange: (v) => { newColorScale.mid = Number.parseFloat(v) paintLegend(legend, newColorScale) @@ -64,9 +64,9 @@ class ColorScaleEditor { const maxTextbox = new TextBoxRow({ label: "Max value", - value: newColorScale.high.toString(), + value: newColorScale.max.toString(), onchange: (v) => { - newColorScale.high = Number.parseFloat(v) + newColorScale.max = Number.parseFloat(v) paintLegend(legend, newColorScale) } }) @@ -75,9 +75,9 @@ class ColorScaleEditor { const colorElem = new ColorPickerRow({ label: "Min color", - value: newColorScale.lowColor, + value: newColorScale.minColor, onchange: (v) => { - newColorScale.lowColor = v + newColorScale.minColor = v paintLegend(legend, newColorScale) } }) @@ -85,7 +85,7 @@ class ColorScaleEditor { const midColorElem = new ColorPickerRow({ label: "Mid color", - value: newColorScale.midColor || newColorScale.lowColor, + value: newColorScale.midColor || newColorScale.minColor, onchange: (v) => { newColorScale.midColor = v paintLegend(legend, newColorScale) @@ -95,9 +95,9 @@ class ColorScaleEditor { const highColorElem = new ColorPickerRow({ label: "Max color", - value: newColorScale.highColor, + value: newColorScale.maxColor, onchange: (v) => { - newColorScale.highColor = v + newColorScale.maxColor = v paintLegend(legend, newColorScale) } }) @@ -109,7 +109,7 @@ class ColorScaleEditor { onchange: (diverging) => { if (diverging) { // Converting from gradient to diverting - newColorScale.mid = newColorScale.low < 0 && newColorScale.high > 0 ? 0 : (newColorScale.low + newColorScale.high) / 2 + newColorScale.mid = newColorScale.min < 0 && newColorScale.max > 0 ? 0 : (newColorScale.min + newColorScale.max) / 2 newColorScale.midColor = "rgb(255,255,255)" newColorScale = new DivergingGradientScale(newColorScale) diff --git a/js/util/colorScale.js b/js/util/colorScale.js index b3ba3b21c..0227c33e2 100644 --- a/js/util/colorScale.js +++ b/js/util/colorScale.js @@ -15,26 +15,26 @@ const ColorScaleFactory = { } }, - defaultGradientScale: function (low, high) { + defaultGradientScale: function (min, max) { return new GradientColorScale({ "type": "doubleGradient", - "low": low, - "high": high, - "lowColor": "rgb(46,56,183)", - "highColor": "rgb(164,0,30)" + "min": min, + "max": max, + "minColor": "rgb(46,56,183)", + "maxColor": "rgb(164,0,30)" }) }, - defaultDivergingScale: function (low, mid, high) { + defaultDivergingScale: function (min, mid, max) { return new DivergingGradientScale({ "type": "doubleGradient", - "low": 0, + "min": 0, "mid": 0.25, - "high": 0.5, - "lowColor": "rgb(46,56,183)", + "max": 0.5, + "minColor": "rgb(46,56,183)", "midColor": "white", - "highColor": "rgb(164,0,30)" + "maxColor": "rgb(164,0,30)" }) } } @@ -66,45 +66,45 @@ class BinnedColorScale { class GradientColorScale { - constructor({low, high, lowColor, highColor}) { + constructor({min, max, minColor, maxColor}) { this.type = 'gradient' - this.setProperties({low, high, lowColor, highColor}) + this.setProperties({min, max, minColor, maxColor}) } - setProperties({low, high, lowColor, highColor}) { + setProperties({min, max, minColor, maxColor}) { this.type = 'gradient' - this.low = low - this.high = high - this._lowColor = lowColor - this._highColor = highColor - this.lowComponents = IGVColor.rgbComponents(lowColor) - this.highComponents = IGVColor.rgbComponents(highColor) + this.min = min + this.max = max + this._lowColor = minColor + this._highColor = maxColor + this.lowComponents = IGVColor.rgbComponents(minColor) + this.highComponents = IGVColor.rgbComponents(maxColor) } - get lowColor() { + get minColor() { return this._lowColor } - set lowColor(c) { + set minColor(c) { this._lowColor = c this.lowComponents = IGVColor.rgbComponents(c) } - get highColor() { + get maxColor() { return this._highColor } - set highColor(c) { + set maxColor(c) { this._highColor = c this.highComponents = IGVColor.rgbComponents(c) } getColor(value) { - if (value <= this.low) return this.lowColor - else if (value >= this.high) return this.highColor + if (value <= this.min) return this.minColor + else if (value >= this.max) return this.maxColor - const frac = (value - this.low) / (this.high - this.low) + const frac = (value - this.min) / (this.max - this.min) const r = Math.floor(this.lowComponents[0] + frac * (this.highComponents[0] - this.lowComponents[0])) const g = Math.floor(this.lowComponents[1] + frac * (this.highComponents[1] - this.lowComponents[1])) const b = Math.floor(this.lowComponents[2] + frac * (this.highComponents[2] - this.lowComponents[2])) @@ -114,15 +114,15 @@ class GradientColorScale { /** * Return a simple json-like object, not a literaly json string - * @returns {{high, low, highColor, lowColor}} + * @returns {{max, min, maxColor, minColor}} */ toJson() { return { type: this.type, - low: this.low, - high: this.high, - lowColor: this.lowColor, - highColor: this.highColor + min: this.min, + max: this.max, + minColor: this.minColor, + maxColor: this.maxColor } } @@ -136,18 +136,17 @@ class DivergingGradientScale { constructor(json) { this.type = 'diverging' - const {lowColor, midColor, highColor, low, mid, high} = json this.lowGradientScale = new GradientColorScale({ - lowColor: lowColor, - highColor: midColor, - low: low, - high: mid + minColor: json.minColor || json.lowColor, + maxColor: json.midColor, + min: json.min !== undefined ? json.min : json.low, + max: json.mid }) this.highGradientScale = new GradientColorScale({ - lowColor: midColor, - highColor: highColor, - low: mid, - high: high + minColor: json.midColor, + maxColor: json.maxColor || json.highColor, + min: json.mid, + max: json.max !== undefined ? json.max : json.high }) } @@ -159,70 +158,70 @@ class DivergingGradientScale { } } - get low() { - return this.lowGradientScale.low + get min() { + return this.lowGradientScale.min } - set low(v) { - this.lowGradientScale.low = v + set min(v) { + this.lowGradientScale.min = v } - get high() { - return this.highGradientScale.high + get max() { + return this.highGradientScale.max } - set high(v) { - this.highGradientScale.high = v + set max(v) { + this.highGradientScale.max = v } get mid() { - return this.lowGradientScale.high + return this.lowGradientScale.max } set mid(v) { - this.lowGradientScale.high = v - this.highGradientScale.low = v + this.lowGradientScale.max = v + this.highGradientScale.min = v } - get lowColor() { - return this.lowGradientScale.lowColor + get minColor() { + return this.lowGradientScale.minColor } - set lowColor(c) { - this.lowGradientScale.lowColor = c + set minColor(c) { + this.lowGradientScale.minColor = c } - get highColor() { - return this.highGradientScale.highColor + get maxColor() { + return this.highGradientScale.maxColor } - set highColor(c) { - this.highGradientScale.highColor = c + set maxColor(c) { + this.highGradientScale.maxColor = c } get midColor() { - return this.lowGradientScale.highColor + return this.lowGradientScale.maxColor } set midColor(c) { - this.lowGradientScale.highColor = c - this.highGradientScale.lowColor = c + this.lowGradientScale.maxColor = c + this.highGradientScale.minColor = c } /** * Return a simple json-like object, not a literaly json string - * @returns {{high, mid, low, highColor, midColor, lowColor}} + * @returns {{max, mid, min, maxColor, midColor, minColor}} */ toJson() { return { type: this.type, - low: this.low, + min: this.min, mid: this.mid, - high: this.high, - lowColor: this.lowColor, + max: this.max, + minColor: this.minColor, midColor: this.midColor, - highColor: this.highColor + maxColor: this.maxColor } } diff --git a/js/version.js b/js/version.js index ece35d6a3..ccc90882c 100644 --- a/js/version.js +++ b/js/version.js @@ -1,4 +1,4 @@ -const _version = "3.0.9" +const _version = "3.1.0" function version() { return _version } diff --git a/package.json b/package.json index b9c866fc1..de8ace987 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "igv", - "version": "3.0.9", + "version": "3.1.0", "main": "dist/igv.esm.js", "browser": "dist/igv.js", "module": "dist/igv.esm.js",