@jbrowse/plugin-wiggle 2.1.0 → 2.1.3
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/BigWigAdapter/BigWigAdapter.js +74 -200
- package/dist/BigWigAdapter/BigWigAdapter.js.map +1 -1
- package/dist/BigWigAdapter/configSchema.js +1 -1
- package/dist/BigWigAdapter/configSchema.js.map +1 -1
- package/dist/BigWigAdapter/index.js +14 -16
- package/dist/BigWigAdapter/index.js.map +1 -1
- package/dist/CreateMultiWiggleExtension/ConfirmDialog.js +12 -29
- package/dist/CreateMultiWiggleExtension/ConfirmDialog.js.map +1 -1
- package/dist/CreateMultiWiggleExtension/index.js +23 -57
- package/dist/CreateMultiWiggleExtension/index.js.map +1 -1
- package/dist/DensityRenderer/DensityRenderer.js +6 -66
- package/dist/DensityRenderer/DensityRenderer.js.map +1 -1
- package/dist/DensityRenderer/configSchema.js +3 -3
- package/dist/DensityRenderer/configSchema.js.map +1 -1
- package/dist/DensityRenderer/index.js +11 -13
- package/dist/DensityRenderer/index.js.map +1 -1
- package/dist/LinePlotRenderer/LinePlotRenderer.js +11 -78
- package/dist/LinePlotRenderer/LinePlotRenderer.js.map +1 -1
- package/dist/LinePlotRenderer/configSchema.js +3 -3
- package/dist/LinePlotRenderer/configSchema.js.map +1 -1
- package/dist/LinePlotRenderer/index.js +11 -13
- package/dist/LinePlotRenderer/index.js.map +1 -1
- package/dist/LinearWiggleDisplay/components/SetColorDialog.js +18 -35
- package/dist/LinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
- package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.js +16 -32
- package/dist/LinearWiggleDisplay/components/SetMinMaxDialog.js.map +1 -1
- package/dist/LinearWiggleDisplay/components/Tooltip.js +15 -26
- package/dist/LinearWiggleDisplay/components/Tooltip.js.map +1 -1
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js +15 -26
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
- package/dist/LinearWiggleDisplay/components/YScaleBar.js +6 -18
- package/dist/LinearWiggleDisplay/components/YScaleBar.js.map +1 -1
- package/dist/LinearWiggleDisplay/index.js +12 -12
- package/dist/LinearWiggleDisplay/index.js.map +1 -1
- package/dist/LinearWiggleDisplay/models/configSchema.js +6 -6
- package/dist/LinearWiggleDisplay/models/configSchema.js.map +1 -1
- package/dist/LinearWiggleDisplay/models/model.js +378 -451
- package/dist/LinearWiggleDisplay/models/model.js.map +1 -1
- package/dist/MultiDensityRenderer/MultiDensityRenderer.js +32 -125
- package/dist/MultiDensityRenderer/MultiDensityRenderer.js.map +1 -1
- package/dist/MultiDensityRenderer/configSchema.js +3 -3
- package/dist/MultiDensityRenderer/configSchema.js.map +1 -1
- package/dist/MultiDensityRenderer/index.js +11 -13
- package/dist/MultiDensityRenderer/index.js.map +1 -1
- package/dist/MultiLineRenderer/MultiLineRenderer.js +21 -114
- package/dist/MultiLineRenderer/MultiLineRenderer.js.map +1 -1
- package/dist/MultiLineRenderer/configSchema.js +4 -4
- package/dist/MultiLineRenderer/configSchema.js.map +1 -1
- package/dist/MultiLineRenderer/index.js +11 -13
- package/dist/MultiLineRenderer/index.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js +72 -120
- package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/SetMinMaxDialog.js +16 -32
- package/dist/MultiLinearWiggleDisplay/components/SetMinMaxDialog.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/Tooltip.js +21 -50
- package/dist/MultiLinearWiggleDisplay/components/Tooltip.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +2 -2
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +53 -92
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/YScaleBar.js +6 -18
- package/dist/MultiLinearWiggleDisplay/components/YScaleBar.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/components/util.js +16 -18
- package/dist/MultiLinearWiggleDisplay/components/util.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/index.js +9 -9
- package/dist/MultiLinearWiggleDisplay/index.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/models/configSchema.js +8 -8
- package/dist/MultiLinearWiggleDisplay/models/configSchema.js.map +1 -1
- package/dist/MultiLinearWiggleDisplay/models/model.js +489 -566
- package/dist/MultiLinearWiggleDisplay/models/model.js.map +1 -1
- package/dist/MultiQuantitativeTrack/index.js +8 -8
- package/dist/MultiQuantitativeTrack/index.js.map +1 -1
- package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js +29 -121
- package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js.map +1 -1
- package/dist/MultiRowLineRenderer/configSchema.js +4 -4
- package/dist/MultiRowLineRenderer/configSchema.js.map +1 -1
- package/dist/MultiRowLineRenderer/index.js +11 -13
- package/dist/MultiRowLineRenderer/index.js.map +1 -1
- package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +35 -131
- package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js.map +1 -1
- package/dist/MultiRowXYPlotRenderer/configSchema.js +4 -4
- package/dist/MultiRowXYPlotRenderer/configSchema.js.map +1 -1
- package/dist/MultiRowXYPlotRenderer/index.js +11 -13
- package/dist/MultiRowXYPlotRenderer/index.js.map +1 -1
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +1 -0
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js +80 -232
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js.map +1 -1
- package/dist/MultiWiggleAdapter/configSchema.js +1 -1
- package/dist/MultiWiggleAdapter/configSchema.js.map +1 -1
- package/dist/MultiWiggleAdapter/index.js +14 -18
- package/dist/MultiWiggleAdapter/index.js.map +1 -1
- package/dist/MultiWiggleAddTrackWidget/AddTrackWorkflow.js +30 -56
- package/dist/MultiWiggleAddTrackWidget/AddTrackWorkflow.js.map +1 -1
- package/dist/MultiWiggleAddTrackWidget/index.js +10 -12
- package/dist/MultiWiggleAddTrackWidget/index.js.map +1 -1
- package/dist/MultiWiggleRendering.js +45 -109
- package/dist/MultiWiggleRendering.js.map +1 -1
- package/dist/MultiXYPlotRenderer/MultiXYPlotRenderer.js +24 -120
- package/dist/MultiXYPlotRenderer/MultiXYPlotRenderer.js.map +1 -1
- package/dist/MultiXYPlotRenderer/configSchema.js +4 -4
- package/dist/MultiXYPlotRenderer/configSchema.js.map +1 -1
- package/dist/MultiXYPlotRenderer/index.js +11 -13
- package/dist/MultiXYPlotRenderer/index.js.map +1 -1
- package/dist/QuantitativeTrack/index.js +8 -8
- package/dist/QuantitativeTrack/index.js.map +1 -1
- package/dist/Tooltip.js +26 -54
- package/dist/Tooltip.js.map +1 -1
- package/dist/WiggleBaseRenderer.d.ts +6 -6
- package/dist/WiggleBaseRenderer.js +34 -125
- package/dist/WiggleBaseRenderer.js.map +1 -1
- package/dist/WiggleRPC/rpcMethods.d.ts +2 -2
- package/dist/WiggleRPC/rpcMethods.js +101 -244
- package/dist/WiggleRPC/rpcMethods.js.map +1 -1
- package/dist/WiggleRendering.js +20 -69
- package/dist/WiggleRendering.js.map +1 -1
- package/dist/XYPlotRenderer/XYPlotRenderer.js +24 -121
- package/dist/XYPlotRenderer/XYPlotRenderer.js.map +1 -1
- package/dist/XYPlotRenderer/configSchema.js +4 -4
- package/dist/XYPlotRenderer/configSchema.js.map +1 -1
- package/dist/XYPlotRenderer/index.js +11 -13
- package/dist/XYPlotRenderer/index.js.map +1 -1
- package/dist/configSchema.js +2 -2
- package/dist/configSchema.js.map +1 -1
- package/dist/drawxy.js +192 -311
- package/dist/drawxy.js.map +1 -1
- package/dist/index.js +44 -62
- package/dist/index.js.map +1 -1
- package/dist/util.js +105 -168
- package/dist/util.js.map +1 -1
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +1 -0
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +5 -3
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js.map +1 -1
- package/esm/WiggleBaseRenderer.d.ts +6 -6
- package/esm/WiggleBaseRenderer.js +4 -3
- package/esm/WiggleBaseRenderer.js.map +1 -1
- package/esm/WiggleRPC/rpcMethods.d.ts +2 -2
- package/esm/WiggleRPC/rpcMethods.js.map +1 -1
- package/package.json +2 -3
- package/src/MultiWiggleAdapter/MultiWiggleAdapter.ts +7 -3
- package/src/WiggleBaseRenderer.tsx +4 -3
- package/src/WiggleRPC/rpcMethods.ts +8 -2
- package/src/declare.d.ts +0 -2
package/dist/drawxy.js
CHANGED
|
@@ -1,47 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
14
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
15
|
-
if (!m) return o;
|
|
16
|
-
var i = m.call(o), r, ar = [], e;
|
|
17
|
-
try {
|
|
18
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
19
|
-
}
|
|
20
|
-
catch (error) { e = { error: error }; }
|
|
21
|
-
finally {
|
|
22
|
-
try {
|
|
23
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
24
|
-
}
|
|
25
|
-
finally { if (e) throw e.error; }
|
|
26
|
-
}
|
|
27
|
-
return ar;
|
|
28
|
-
};
|
|
29
|
-
var __values = (this && this.__values) || function(o) {
|
|
30
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
31
|
-
if (m) return m.call(o);
|
|
32
|
-
if (o && typeof o.length === "number") return {
|
|
33
|
-
next: function () {
|
|
34
|
-
if (o && i >= o.length) o = void 0;
|
|
35
|
-
return { value: o && o[i++], done: !o };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
39
|
-
};
|
|
40
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
3
|
exports.drawDensity = exports.drawLine = exports.drawXY = void 0;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
4
|
+
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
|
+
const util_1 = require("@jbrowse/core/util");
|
|
6
|
+
const util_2 = require("./util");
|
|
45
7
|
function fillRectCtx(x, y, width, height, ctx, color) {
|
|
46
8
|
if (width < 0) {
|
|
47
9
|
x += width;
|
|
@@ -56,160 +18,119 @@ function fillRectCtx(x, y, width, height, ctx, color) {
|
|
|
56
18
|
}
|
|
57
19
|
ctx.fillRect(x, y, width, height);
|
|
58
20
|
}
|
|
59
|
-
|
|
60
|
-
|
|
21
|
+
const fudgeFactor = 0.4;
|
|
22
|
+
const clipHeight = 2;
|
|
61
23
|
function drawXY(ctx, props) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var width = (region.end - region.start) / bpPerPx;
|
|
24
|
+
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, Color, } = props;
|
|
25
|
+
const [region] = regions;
|
|
26
|
+
const width = (region.end - region.start) / bpPerPx;
|
|
66
27
|
// the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
|
|
67
28
|
// wiggle display, and makes the height of the actual drawn area add
|
|
68
29
|
// "padding" to the top and bottom of the display
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
30
|
+
const height = unadjustedHeight - offset * 2;
|
|
31
|
+
const filled = (0, configuration_1.readConfObject)(config, 'filled');
|
|
32
|
+
const clipColor = (0, configuration_1.readConfObject)(config, 'clipColor');
|
|
33
|
+
const summaryScoreMode = (0, configuration_1.readConfObject)(config, 'summaryScoreMode');
|
|
34
|
+
const pivotValue = (0, configuration_1.readConfObject)(config, 'bicolorPivotValue');
|
|
35
|
+
const minSize = (0, configuration_1.readConfObject)(config, 'minSize');
|
|
36
|
+
const scale = (0, util_2.getScale)({ ...scaleOpts, range: [0, height] });
|
|
37
|
+
const originY = (0, util_2.getOrigin)(scaleOpts.scaleType);
|
|
38
|
+
const [niceMin, niceMax] = scale.domain();
|
|
39
|
+
const toY = (n) => (0, util_1.clamp)(height - (scale(n) || 0), 0, height) + offset;
|
|
40
|
+
const toOrigin = (n) => toY(originY) - toY(n);
|
|
41
|
+
const getHeight = (n) => (filled ? toOrigin(n) : Math.max(minSize, 1));
|
|
42
|
+
let hasClipping = false;
|
|
43
|
+
let prevLeftPx = 0;
|
|
44
|
+
const reducedFeatures = [];
|
|
45
|
+
const crossingOrigin = niceMin < pivotValue && niceMax > pivotValue;
|
|
85
46
|
// we handle whiskers separately to render max row, min row, and avg in three
|
|
86
47
|
// passes. this reduces subpixel rendering issues. note: for stylistic
|
|
87
48
|
// reasons, clipping indicator is only drawn for score, not min/max score
|
|
88
49
|
if (summaryScoreMode === 'whiskers') {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
? c
|
|
101
|
-
: c === lastCol
|
|
102
|
-
? lastMix
|
|
103
|
-
: (lastMix = Color(c).lighten(0.4).toString());
|
|
104
|
-
fillRectCtx(leftPx, toY(max), w, getHeight(max), ctx, effectiveC);
|
|
105
|
-
lastCol = c;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
110
|
-
finally {
|
|
111
|
-
try {
|
|
112
|
-
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
113
|
-
}
|
|
114
|
-
finally { if (e_1) throw e_1.error; }
|
|
115
|
-
}
|
|
116
|
-
lastMix = undefined;
|
|
117
|
-
lastCol = undefined;
|
|
118
|
-
try {
|
|
119
|
-
for (var _m = __values(features.values()), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
120
|
-
var feature = _o.value;
|
|
121
|
-
var _p = __read((0, util_1.featureSpanPx)(feature, region, bpPerPx), 2), leftPx = _p[0], rightPx = _p[1];
|
|
122
|
-
var score = feature.get('score');
|
|
123
|
-
var max = feature.get('maxScore');
|
|
124
|
-
var min = feature.get('minScore');
|
|
125
|
-
var summary = feature.get('summary');
|
|
126
|
-
var c = colorCallback(feature, score);
|
|
127
|
-
var effectiveC = crossingOrigin && summary
|
|
128
|
-
? c === lastCol
|
|
50
|
+
let lastCol;
|
|
51
|
+
let lastMix;
|
|
52
|
+
for (const feature of features.values()) {
|
|
53
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
54
|
+
if (feature.get('summary')) {
|
|
55
|
+
const w = rightPx - leftPx + fudgeFactor;
|
|
56
|
+
const max = feature.get('maxScore');
|
|
57
|
+
const c = colorCallback(feature, max);
|
|
58
|
+
const effectiveC = crossingOrigin
|
|
59
|
+
? c
|
|
60
|
+
: c === lastCol
|
|
129
61
|
? lastMix
|
|
130
|
-
: (lastMix = Color(
|
|
131
|
-
|
|
132
|
-
.toString())
|
|
133
|
-
: c;
|
|
134
|
-
var w = Math.max(rightPx - leftPx + fudgeFactor, minSize);
|
|
135
|
-
// create reduced features, avoiding multiple features per px
|
|
136
|
-
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
137
|
-
reducedFeatures.push(feature);
|
|
138
|
-
prevLeftPx = leftPx;
|
|
139
|
-
}
|
|
140
|
-
hasClipping = hasClipping || score < niceMin || score > niceMax;
|
|
141
|
-
fillRectCtx(leftPx, toY(score), w, getHeight(score), ctx, effectiveC);
|
|
62
|
+
: (lastMix = Color(c).lighten(0.4).toString());
|
|
63
|
+
fillRectCtx(leftPx, toY(max), w, getHeight(max), ctx, effectiveC);
|
|
142
64
|
lastCol = c;
|
|
143
65
|
}
|
|
144
66
|
}
|
|
145
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
146
|
-
finally {
|
|
147
|
-
try {
|
|
148
|
-
if (_o && !_o.done && (_b = _m.return)) _b.call(_m);
|
|
149
|
-
}
|
|
150
|
-
finally { if (e_2) throw e_2.error; }
|
|
151
|
-
}
|
|
152
67
|
lastMix = undefined;
|
|
153
68
|
lastCol = undefined;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
69
|
+
for (const feature of features.values()) {
|
|
70
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
71
|
+
const score = feature.get('score');
|
|
72
|
+
const max = feature.get('maxScore');
|
|
73
|
+
const min = feature.get('minScore');
|
|
74
|
+
const summary = feature.get('summary');
|
|
75
|
+
const c = colorCallback(feature, score);
|
|
76
|
+
const effectiveC = crossingOrigin && summary
|
|
77
|
+
? c === lastCol
|
|
78
|
+
? lastMix
|
|
79
|
+
: (lastMix = Color(colorCallback(feature, max))
|
|
80
|
+
.mix(Color(colorCallback(feature, min)))
|
|
81
|
+
.toString())
|
|
82
|
+
: c;
|
|
83
|
+
const w = Math.max(rightPx - leftPx + fudgeFactor, minSize);
|
|
84
|
+
// create reduced features, avoiding multiple features per px
|
|
85
|
+
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
86
|
+
reducedFeatures.push(feature);
|
|
87
|
+
prevLeftPx = leftPx;
|
|
170
88
|
}
|
|
89
|
+
hasClipping = hasClipping || score < niceMin || score > niceMax;
|
|
90
|
+
fillRectCtx(leftPx, toY(score), w, getHeight(score), ctx, effectiveC);
|
|
91
|
+
lastCol = c;
|
|
171
92
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
93
|
+
lastMix = undefined;
|
|
94
|
+
lastCol = undefined;
|
|
95
|
+
for (const feature of features.values()) {
|
|
96
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
97
|
+
if (feature.get('summary')) {
|
|
98
|
+
const min = feature.get('minScore');
|
|
99
|
+
const c = colorCallback(feature, min);
|
|
100
|
+
const w = Math.max(rightPx - leftPx + fudgeFactor, minSize);
|
|
101
|
+
const effectiveC = crossingOrigin
|
|
102
|
+
? c
|
|
103
|
+
: c === lastCol
|
|
104
|
+
? lastMix
|
|
105
|
+
: (lastMix = Color(c).darken(0.4).toString());
|
|
106
|
+
fillRectCtx(leftPx, toY(min), w, getHeight(min), ctx, effectiveC);
|
|
107
|
+
lastCol = c;
|
|
176
108
|
}
|
|
177
|
-
finally { if (e_3) throw e_3.error; }
|
|
178
109
|
}
|
|
179
110
|
}
|
|
180
111
|
else {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
reducedFeatures.push(feature);
|
|
188
|
-
prevLeftPx = leftPx;
|
|
189
|
-
}
|
|
190
|
-
var score = feature.get('score');
|
|
191
|
-
var c = colorCallback(feature, score);
|
|
192
|
-
hasClipping = hasClipping || score < niceMin || score > niceMax;
|
|
193
|
-
var w = Math.max(rightPx - leftPx + fudgeFactor, minSize);
|
|
194
|
-
if (summaryScoreMode === 'max') {
|
|
195
|
-
var s = feature.get('summary') ? feature.get('maxScore') : score;
|
|
196
|
-
fillRectCtx(leftPx, toY(s), w, getHeight(s), ctx, c);
|
|
197
|
-
}
|
|
198
|
-
else if (summaryScoreMode === 'min') {
|
|
199
|
-
var s = feature.get('summary') ? feature.get('minScore') : score;
|
|
200
|
-
fillRectCtx(leftPx, toY(s), w, getHeight(s), ctx, c);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
fillRectCtx(leftPx, toY(score), w, getHeight(score), ctx, c);
|
|
204
|
-
}
|
|
112
|
+
for (const feature of features.values()) {
|
|
113
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
114
|
+
// create reduced features, avoiding multiple features per px
|
|
115
|
+
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
116
|
+
reducedFeatures.push(feature);
|
|
117
|
+
prevLeftPx = leftPx;
|
|
205
118
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
119
|
+
const score = feature.get('score');
|
|
120
|
+
const c = colorCallback(feature, score);
|
|
121
|
+
hasClipping = hasClipping || score < niceMin || score > niceMax;
|
|
122
|
+
const w = Math.max(rightPx - leftPx + fudgeFactor, minSize);
|
|
123
|
+
if (summaryScoreMode === 'max') {
|
|
124
|
+
const s = feature.get('summary') ? feature.get('maxScore') : score;
|
|
125
|
+
fillRectCtx(leftPx, toY(s), w, getHeight(s), ctx, c);
|
|
126
|
+
}
|
|
127
|
+
else if (summaryScoreMode === 'min') {
|
|
128
|
+
const s = feature.get('summary') ? feature.get('minScore') : score;
|
|
129
|
+
fillRectCtx(leftPx, toY(s), w, getHeight(s), ctx, c);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
fillRectCtx(leftPx, toY(score), w, getHeight(score), ctx, c);
|
|
211
133
|
}
|
|
212
|
-
finally { if (e_4) throw e_4.error; }
|
|
213
134
|
}
|
|
214
135
|
}
|
|
215
136
|
// second pass: draw clipping
|
|
@@ -217,195 +138,155 @@ function drawXY(ctx, props) {
|
|
|
217
138
|
ctx.save();
|
|
218
139
|
if (hasClipping) {
|
|
219
140
|
ctx.fillStyle = clipColor;
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
if (score > niceMax) {
|
|
227
|
-
fillRectCtx(leftPx, offset, w, clipHeight, ctx);
|
|
228
|
-
}
|
|
229
|
-
else if (score < niceMin && scaleOpts.scaleType !== 'log') {
|
|
230
|
-
fillRectCtx(leftPx, unadjustedHeight, w, clipHeight, ctx);
|
|
231
|
-
}
|
|
141
|
+
for (const feature of features.values()) {
|
|
142
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
143
|
+
const w = rightPx - leftPx + fudgeFactor;
|
|
144
|
+
const score = feature.get('score');
|
|
145
|
+
if (score > niceMax) {
|
|
146
|
+
fillRectCtx(leftPx, offset, w, clipHeight, ctx);
|
|
232
147
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
finally {
|
|
236
|
-
try {
|
|
237
|
-
if (_x && !_x.done && (_e = _w.return)) _e.call(_w);
|
|
148
|
+
else if (score < niceMin && scaleOpts.scaleType !== 'log') {
|
|
149
|
+
fillRectCtx(leftPx, unadjustedHeight, w, clipHeight, ctx);
|
|
238
150
|
}
|
|
239
|
-
finally { if (e_5) throw e_5.error; }
|
|
240
151
|
}
|
|
241
152
|
}
|
|
242
153
|
ctx.restore();
|
|
243
154
|
if (displayCrossHatches) {
|
|
244
155
|
ctx.lineWidth = 1;
|
|
245
156
|
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
246
|
-
ticks.values.forEach(
|
|
157
|
+
ticks.values.forEach(tick => {
|
|
247
158
|
ctx.beginPath();
|
|
248
159
|
ctx.moveTo(0, Math.round(toY(tick)));
|
|
249
160
|
ctx.lineTo(width, Math.round(toY(tick)));
|
|
250
161
|
ctx.stroke();
|
|
251
162
|
});
|
|
252
163
|
}
|
|
253
|
-
return { reducedFeatures
|
|
164
|
+
return { reducedFeatures };
|
|
254
165
|
}
|
|
255
166
|
exports.drawXY = drawXY;
|
|
256
167
|
function drawLine(ctx, props) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
var width = (region.end - region.start) / bpPerPx;
|
|
168
|
+
const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, } = props;
|
|
169
|
+
const [region] = regions;
|
|
170
|
+
const width = (region.end - region.start) / bpPerPx;
|
|
261
171
|
// the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
|
|
262
172
|
// wiggle display, and makes the height of the actual drawn area add
|
|
263
173
|
// "padding" to the top and bottom of the display
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
reducedFeatures.push(feature);
|
|
279
|
-
prevLeftPx = leftPx;
|
|
280
|
-
}
|
|
281
|
-
var score = feature.get('score');
|
|
282
|
-
var lowClipping = score < niceMin;
|
|
283
|
-
var highClipping = score > niceMax;
|
|
284
|
-
var w = rightPx - leftPx + fudgeFactor;
|
|
285
|
-
var c = colorCallback(feature, score);
|
|
286
|
-
ctx.beginPath();
|
|
287
|
-
ctx.strokeStyle = c;
|
|
288
|
-
var startPos = typeof lastVal !== 'undefined' ? lastVal : score;
|
|
289
|
-
if (!region.reversed) {
|
|
290
|
-
ctx.moveTo(leftPx, toY(startPos));
|
|
291
|
-
ctx.lineTo(leftPx, toY(score));
|
|
292
|
-
ctx.lineTo(rightPx, toY(score));
|
|
293
|
-
}
|
|
294
|
-
else {
|
|
295
|
-
ctx.moveTo(rightPx, toY(startPos));
|
|
296
|
-
ctx.lineTo(rightPx, toY(score));
|
|
297
|
-
ctx.lineTo(leftPx, toY(score));
|
|
298
|
-
}
|
|
299
|
-
ctx.stroke();
|
|
300
|
-
lastVal = score;
|
|
301
|
-
if (highClipping) {
|
|
302
|
-
ctx.fillStyle = clipColor;
|
|
303
|
-
ctx.fillRect(leftPx, offset, w, clipHeight);
|
|
304
|
-
}
|
|
305
|
-
else if (lowClipping && scaleOpts.scaleType !== 'log') {
|
|
306
|
-
ctx.fillStyle = clipColor;
|
|
307
|
-
ctx.fillRect(leftPx, height - clipHeight, w, height);
|
|
308
|
-
}
|
|
174
|
+
const height = unadjustedHeight - offset * 2;
|
|
175
|
+
const clipColor = (0, configuration_1.readConfObject)(config, 'clipColor');
|
|
176
|
+
const scale = (0, util_2.getScale)({ ...scaleOpts, range: [0, height] });
|
|
177
|
+
const [niceMin, niceMax] = scale.domain();
|
|
178
|
+
const toY = (n) => (0, util_1.clamp)(height - (scale(n) || 0), 0, height) + offset;
|
|
179
|
+
let lastVal;
|
|
180
|
+
let prevLeftPx = 0;
|
|
181
|
+
const reducedFeatures = [];
|
|
182
|
+
for (const feature of features.values()) {
|
|
183
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
184
|
+
// create reduced features, avoiding multiple features per px
|
|
185
|
+
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
186
|
+
reducedFeatures.push(feature);
|
|
187
|
+
prevLeftPx = leftPx;
|
|
309
188
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
189
|
+
const score = feature.get('score');
|
|
190
|
+
const lowClipping = score < niceMin;
|
|
191
|
+
const highClipping = score > niceMax;
|
|
192
|
+
const w = rightPx - leftPx + fudgeFactor;
|
|
193
|
+
const c = colorCallback(feature, score);
|
|
194
|
+
ctx.beginPath();
|
|
195
|
+
ctx.strokeStyle = c;
|
|
196
|
+
const startPos = typeof lastVal !== 'undefined' ? lastVal : score;
|
|
197
|
+
if (!region.reversed) {
|
|
198
|
+
ctx.moveTo(leftPx, toY(startPos));
|
|
199
|
+
ctx.lineTo(leftPx, toY(score));
|
|
200
|
+
ctx.lineTo(rightPx, toY(score));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
ctx.moveTo(rightPx, toY(startPos));
|
|
204
|
+
ctx.lineTo(rightPx, toY(score));
|
|
205
|
+
ctx.lineTo(leftPx, toY(score));
|
|
206
|
+
}
|
|
207
|
+
ctx.stroke();
|
|
208
|
+
lastVal = score;
|
|
209
|
+
if (highClipping) {
|
|
210
|
+
ctx.fillStyle = clipColor;
|
|
211
|
+
ctx.fillRect(leftPx, offset, w, clipHeight);
|
|
212
|
+
}
|
|
213
|
+
else if (lowClipping && scaleOpts.scaleType !== 'log') {
|
|
214
|
+
ctx.fillStyle = clipColor;
|
|
215
|
+
ctx.fillRect(leftPx, height - clipHeight, w, height);
|
|
315
216
|
}
|
|
316
|
-
finally { if (e_6) throw e_6.error; }
|
|
317
217
|
}
|
|
318
218
|
if (displayCrossHatches) {
|
|
319
219
|
ctx.lineWidth = 1;
|
|
320
220
|
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
321
|
-
values.forEach(
|
|
221
|
+
values.forEach(tick => {
|
|
322
222
|
ctx.beginPath();
|
|
323
223
|
ctx.moveTo(0, Math.round(toY(tick)));
|
|
324
224
|
ctx.lineTo(width, Math.round(toY(tick)));
|
|
325
225
|
ctx.stroke();
|
|
326
226
|
});
|
|
327
227
|
}
|
|
328
|
-
return { reducedFeatures
|
|
228
|
+
return { reducedFeatures };
|
|
329
229
|
}
|
|
330
230
|
exports.drawLine = drawLine;
|
|
331
231
|
function drawDensity(ctx, props) {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
232
|
+
const { features, regions, bpPerPx, scaleOpts, height, config } = props;
|
|
233
|
+
const [region] = regions;
|
|
234
|
+
const pivot = (0, configuration_1.readConfObject)(config, 'bicolorPivot');
|
|
235
|
+
const pivotValue = (0, configuration_1.readConfObject)(config, 'bicolorPivotValue');
|
|
236
|
+
const negColor = (0, configuration_1.readConfObject)(config, 'negColor');
|
|
237
|
+
const posColor = (0, configuration_1.readConfObject)(config, 'posColor');
|
|
238
|
+
const color = (0, configuration_1.readConfObject)(config, 'color');
|
|
239
|
+
const clipColor = (0, configuration_1.readConfObject)(config, 'clipColor');
|
|
240
|
+
const crossing = pivot !== 'none' && scaleOpts.scaleType !== 'log';
|
|
241
|
+
const scale = (0, util_2.getScale)({
|
|
242
|
+
...scaleOpts,
|
|
243
|
+
pivotValue: crossing ? pivotValue : undefined,
|
|
244
|
+
range: crossing ? [negColor, 'white', posColor] : ['white', posColor],
|
|
245
|
+
});
|
|
246
|
+
const scale2 = (0, util_2.getScale)({ ...scaleOpts, range: [0, height] });
|
|
247
|
+
let cb;
|
|
345
248
|
if (color === '#f0f') {
|
|
346
|
-
cb =
|
|
249
|
+
cb = (_feature, score) => scale(score);
|
|
347
250
|
}
|
|
348
251
|
else {
|
|
349
|
-
cb =
|
|
350
|
-
return (0, configuration_1.readConfObject)(config, 'color', { feature: feature, score: score });
|
|
351
|
-
};
|
|
252
|
+
cb = (feature, score) => (0, configuration_1.readConfObject)(config, 'color', { feature, score });
|
|
352
253
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
reducedFeatures.push(feature);
|
|
364
|
-
prevLeftPx = leftPx;
|
|
365
|
-
}
|
|
366
|
-
var score = feature.get('score');
|
|
367
|
-
hasClipping = hasClipping || score > niceMax || score < niceMin;
|
|
368
|
-
var w = rightPx - leftPx + fudgeFactor;
|
|
369
|
-
ctx.fillStyle = cb(feature, score);
|
|
370
|
-
ctx.fillRect(leftPx, 0, w, height);
|
|
254
|
+
const [niceMin, niceMax] = scale2.domain();
|
|
255
|
+
let prevLeftPx = 0;
|
|
256
|
+
let hasClipping = false;
|
|
257
|
+
const reducedFeatures = [];
|
|
258
|
+
for (const feature of features.values()) {
|
|
259
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
260
|
+
// create reduced features, avoiding multiple features per px
|
|
261
|
+
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
262
|
+
reducedFeatures.push(feature);
|
|
263
|
+
prevLeftPx = leftPx;
|
|
371
264
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
finally { if (e_7) throw e_7.error; }
|
|
265
|
+
const score = feature.get('score');
|
|
266
|
+
hasClipping = hasClipping || score > niceMax || score < niceMin;
|
|
267
|
+
const w = rightPx - leftPx + fudgeFactor;
|
|
268
|
+
ctx.fillStyle = cb(feature, score);
|
|
269
|
+
ctx.fillRect(leftPx, 0, w, height);
|
|
379
270
|
}
|
|
380
271
|
// second pass: draw clipping
|
|
381
272
|
// avoid persisting the red fillstyle with save/restore
|
|
382
273
|
ctx.save();
|
|
383
274
|
if (hasClipping) {
|
|
384
275
|
ctx.fillStyle = clipColor;
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
if (score > niceMax) {
|
|
392
|
-
fillRectCtx(leftPx, 0, w, clipHeight, ctx);
|
|
393
|
-
}
|
|
394
|
-
else if (score < niceMin && scaleOpts.scaleType !== 'log') {
|
|
395
|
-
fillRectCtx(leftPx, 0, w, clipHeight, ctx);
|
|
396
|
-
}
|
|
276
|
+
for (const feature of features.values()) {
|
|
277
|
+
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
278
|
+
const w = rightPx - leftPx + fudgeFactor;
|
|
279
|
+
const score = feature.get('score');
|
|
280
|
+
if (score > niceMax) {
|
|
281
|
+
fillRectCtx(leftPx, 0, w, clipHeight, ctx);
|
|
397
282
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
finally {
|
|
401
|
-
try {
|
|
402
|
-
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
283
|
+
else if (score < niceMin && scaleOpts.scaleType !== 'log') {
|
|
284
|
+
fillRectCtx(leftPx, 0, w, clipHeight, ctx);
|
|
403
285
|
}
|
|
404
|
-
finally { if (e_8) throw e_8.error; }
|
|
405
286
|
}
|
|
406
287
|
}
|
|
407
288
|
ctx.restore();
|
|
408
|
-
return { reducedFeatures
|
|
289
|
+
return { reducedFeatures };
|
|
409
290
|
}
|
|
410
291
|
exports.drawDensity = drawDensity;
|
|
411
292
|
//# sourceMappingURL=drawxy.js.map
|