@jbrowse/plugin-wiggle 2.6.3 → 2.7.1
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/CreateMultiWiggleExtension/index.js +14 -11
- package/dist/DensityRenderer/DensityRenderer.js +2 -2
- package/dist/LinePlotRenderer/LinePlotRenderer.js +2 -2
- package/dist/LinearWiggleDisplay/components/SetColorDialog.d.ts +6 -7
- package/dist/LinearWiggleDisplay/components/SetColorDialog.js +3 -3
- package/dist/LinearWiggleDisplay/components/Tooltip.js +1 -1
- package/dist/MultiDensityRenderer/MultiDensityRenderer.js +5 -8
- package/dist/MultiLineRenderer/MultiLineRenderer.js +5 -9
- package/dist/MultiLinearWiggleDisplay/components/DraggableDialog.d.ts +3 -4
- package/dist/MultiLinearWiggleDisplay/components/DraggableDialog.js +3 -3
- package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js +2 -96
- package/dist/MultiLinearWiggleDisplay/components/SourcesGrid.d.ts +8 -0
- package/dist/MultiLinearWiggleDisplay/components/SourcesGrid.js +138 -0
- package/dist/MultiLinearWiggleDisplay/components/Tooltip.d.ts +3 -2
- package/dist/MultiLinearWiggleDisplay/components/Tooltip.js +1 -1
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +2 -3
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +2 -4
- package/dist/MultiLinearWiggleDisplay/components/util.js +2 -4
- package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js +5 -5
- package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +5 -34
- package/dist/MultiWiggleAddTrackWidget/AddTrackWorkflow.js +16 -12
- package/dist/MultiWiggleRendering.d.ts +3 -4
- package/dist/MultiWiggleRendering.js +7 -5
- package/dist/MultiXYPlotRenderer/MultiXYPlotRenderer.js +5 -33
- package/dist/Tooltip.d.ts +5 -6
- package/dist/Tooltip.js +3 -3
- package/dist/WiggleRendering.d.ts +3 -4
- package/dist/WiggleRendering.js +3 -3
- package/dist/XYPlotRenderer/XYPlotRenderer.js +2 -27
- package/dist/drawDensity.d.ts +17 -0
- package/dist/drawDensity.js +66 -0
- package/dist/drawLine.d.ts +19 -0
- package/dist/drawLine.js +73 -0
- package/dist/drawXY.d.ts +19 -0
- package/dist/drawXY.js +164 -0
- package/dist/shared/YScaleBar.d.ts +2 -2
- package/dist/shared/YScaleBar.js +2 -1
- package/dist/shared/modelShared.d.ts +4 -1
- package/dist/util.d.ts +1 -0
- package/dist/util.js +17 -1
- package/esm/CreateMultiWiggleExtension/index.js +14 -11
- package/esm/DensityRenderer/DensityRenderer.js +1 -1
- package/esm/LinePlotRenderer/LinePlotRenderer.js +1 -1
- package/esm/LinearWiggleDisplay/components/SetColorDialog.d.ts +6 -7
- package/esm/LinearWiggleDisplay/components/SetColorDialog.js +3 -3
- package/esm/LinearWiggleDisplay/components/Tooltip.js +1 -1
- package/esm/MultiDensityRenderer/MultiDensityRenderer.js +4 -7
- package/esm/MultiLineRenderer/MultiLineRenderer.js +4 -8
- package/esm/MultiLinearWiggleDisplay/components/DraggableDialog.d.ts +3 -4
- package/esm/MultiLinearWiggleDisplay/components/DraggableDialog.js +3 -3
- package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js +2 -96
- package/esm/MultiLinearWiggleDisplay/components/SourcesGrid.d.ts +8 -0
- package/esm/MultiLinearWiggleDisplay/components/SourcesGrid.js +110 -0
- package/esm/MultiLinearWiggleDisplay/components/Tooltip.d.ts +3 -2
- package/esm/MultiLinearWiggleDisplay/components/Tooltip.js +1 -1
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +2 -3
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +2 -2
- package/esm/MultiLinearWiggleDisplay/components/util.js +2 -4
- package/esm/MultiRowLineRenderer/MultiRowLineRenderer.js +4 -4
- package/esm/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +4 -10
- package/esm/MultiWiggleAddTrackWidget/AddTrackWorkflow.js +17 -13
- package/esm/MultiWiggleRendering.d.ts +3 -4
- package/esm/MultiWiggleRendering.js +7 -5
- package/esm/MultiXYPlotRenderer/MultiXYPlotRenderer.js +4 -9
- package/esm/Tooltip.d.ts +5 -6
- package/esm/Tooltip.js +3 -3
- package/esm/WiggleRendering.d.ts +3 -4
- package/esm/WiggleRendering.js +3 -3
- package/esm/XYPlotRenderer/XYPlotRenderer.js +1 -3
- package/esm/drawDensity.d.ts +17 -0
- package/esm/drawDensity.js +62 -0
- package/esm/drawLine.d.ts +19 -0
- package/esm/drawLine.js +69 -0
- package/esm/drawXY.d.ts +19 -0
- package/esm/{drawxy.js → drawXY.js} +17 -140
- package/esm/shared/YScaleBar.d.ts +2 -2
- package/esm/shared/YScaleBar.js +2 -1
- package/esm/shared/modelShared.d.ts +4 -1
- package/esm/util.d.ts +1 -0
- package/esm/util.js +15 -0
- package/package.json +3 -4
- package/dist/drawxy.d.ts +0 -50
- package/dist/drawxy.js +0 -289
- package/esm/drawxy.d.ts +0 -50
package/esm/drawLine.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { readConfObject, } from '@jbrowse/core/configuration';
|
|
2
|
+
import { clamp, featureSpanPx } from '@jbrowse/core/util';
|
|
3
|
+
// locals
|
|
4
|
+
import { getScale } from './util';
|
|
5
|
+
const fudgeFactor = 0.3;
|
|
6
|
+
const clipHeight = 2;
|
|
7
|
+
export function drawLine(ctx, props) {
|
|
8
|
+
const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, } = props;
|
|
9
|
+
const [region] = regions;
|
|
10
|
+
const width = (region.end - region.start) / bpPerPx;
|
|
11
|
+
// the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
|
|
12
|
+
// wiggle display, and makes the height of the actual drawn area add
|
|
13
|
+
// "padding" to the top and bottom of the display
|
|
14
|
+
const height = unadjustedHeight - offset * 2;
|
|
15
|
+
const clipColor = readConfObject(config, 'clipColor');
|
|
16
|
+
const scale = getScale({ ...scaleOpts, range: [0, height] });
|
|
17
|
+
const [niceMin, niceMax] = scale.domain();
|
|
18
|
+
const toY = (n) => clamp(height - (scale(n) || 0), 0, height) + offset;
|
|
19
|
+
let lastVal;
|
|
20
|
+
let prevLeftPx = -Infinity;
|
|
21
|
+
const reducedFeatures = [];
|
|
22
|
+
for (const feature of features.values()) {
|
|
23
|
+
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
24
|
+
// create reduced features, avoiding multiple features per px
|
|
25
|
+
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
26
|
+
reducedFeatures.push(feature);
|
|
27
|
+
prevLeftPx = leftPx;
|
|
28
|
+
}
|
|
29
|
+
const score = feature.get('score');
|
|
30
|
+
const lowClipping = score < niceMin;
|
|
31
|
+
const highClipping = score > niceMax;
|
|
32
|
+
const w = rightPx - leftPx + fudgeFactor;
|
|
33
|
+
const c = colorCallback(feature, score);
|
|
34
|
+
ctx.beginPath();
|
|
35
|
+
ctx.strokeStyle = c;
|
|
36
|
+
const startPos = lastVal !== undefined ? lastVal : score;
|
|
37
|
+
if (!region.reversed) {
|
|
38
|
+
ctx.moveTo(leftPx, toY(startPos));
|
|
39
|
+
ctx.lineTo(leftPx, toY(score));
|
|
40
|
+
ctx.lineTo(rightPx, toY(score));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
ctx.moveTo(rightPx, toY(startPos));
|
|
44
|
+
ctx.lineTo(rightPx, toY(score));
|
|
45
|
+
ctx.lineTo(leftPx, toY(score));
|
|
46
|
+
}
|
|
47
|
+
ctx.stroke();
|
|
48
|
+
lastVal = score;
|
|
49
|
+
if (highClipping) {
|
|
50
|
+
ctx.fillStyle = clipColor;
|
|
51
|
+
ctx.fillRect(leftPx, offset, w, clipHeight);
|
|
52
|
+
}
|
|
53
|
+
else if (lowClipping && scaleOpts.scaleType !== 'log') {
|
|
54
|
+
ctx.fillStyle = clipColor;
|
|
55
|
+
ctx.fillRect(leftPx, height - clipHeight, w, height);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (displayCrossHatches) {
|
|
59
|
+
ctx.lineWidth = 1;
|
|
60
|
+
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
61
|
+
values.forEach(tick => {
|
|
62
|
+
ctx.beginPath();
|
|
63
|
+
ctx.moveTo(0, Math.round(toY(tick)));
|
|
64
|
+
ctx.lineTo(width, Math.round(toY(tick)));
|
|
65
|
+
ctx.stroke();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return { reducedFeatures };
|
|
69
|
+
}
|
package/esm/drawXY.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
+
import { Feature, Region } from '@jbrowse/core/util';
|
|
3
|
+
import { ScaleOpts } from './util';
|
|
4
|
+
export declare function drawXY(ctx: CanvasRenderingContext2D, props: {
|
|
5
|
+
features: Map<string, Feature> | Feature[];
|
|
6
|
+
bpPerPx: number;
|
|
7
|
+
regions: Region[];
|
|
8
|
+
scaleOpts: ScaleOpts;
|
|
9
|
+
height: number;
|
|
10
|
+
ticks: {
|
|
11
|
+
values: number[];
|
|
12
|
+
};
|
|
13
|
+
config: AnyConfigurationModel;
|
|
14
|
+
displayCrossHatches: boolean;
|
|
15
|
+
offset?: number;
|
|
16
|
+
colorCallback: (f: Feature, score: number) => string;
|
|
17
|
+
}): {
|
|
18
|
+
reducedFeatures: Feature[];
|
|
19
|
+
};
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
import { readConfObject, } from '@jbrowse/core/configuration';
|
|
2
|
+
import { colord } from '@jbrowse/core/util/colord';
|
|
2
3
|
import { clamp, featureSpanPx } from '@jbrowse/core/util';
|
|
3
4
|
// locals
|
|
4
|
-
import { getOrigin, getScale } from './util';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
if (color) {
|
|
16
|
-
ctx.fillStyle = color;
|
|
17
|
-
}
|
|
18
|
-
ctx.fillRect(x, y, width, height);
|
|
5
|
+
import { fillRectCtx, getOrigin, getScale } from './util';
|
|
6
|
+
function lighten(color, amount) {
|
|
7
|
+
const hslColor = color.toHsl();
|
|
8
|
+
const l = hslColor.l * (1 + amount);
|
|
9
|
+
return colord({ ...hslColor, l: clamp(l, 0, 100) });
|
|
10
|
+
}
|
|
11
|
+
function darken(color, amount) {
|
|
12
|
+
const hslColor = color.toHsl();
|
|
13
|
+
const l = hslColor.l * (1 - amount);
|
|
14
|
+
return colord({ ...hslColor, l: clamp(l, 0, 100) });
|
|
19
15
|
}
|
|
20
|
-
const fudgeFactor = 0.
|
|
16
|
+
const fudgeFactor = 0.3;
|
|
21
17
|
const clipHeight = 2;
|
|
22
18
|
export function drawXY(ctx, props) {
|
|
23
|
-
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback,
|
|
19
|
+
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, } = props;
|
|
24
20
|
const [region] = regions;
|
|
25
21
|
const width = (region.end - region.start) / bpPerPx;
|
|
26
22
|
// the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
|
|
@@ -58,7 +54,7 @@ export function drawXY(ctx, props) {
|
|
|
58
54
|
? c
|
|
59
55
|
: c === lastCol
|
|
60
56
|
? lastMix
|
|
61
|
-
: (lastMix =
|
|
57
|
+
: (lastMix = lighten(colord(c), 0.4).toHex());
|
|
62
58
|
fillRectCtx(leftPx, toY(max), w, getHeight(max), ctx, effectiveC);
|
|
63
59
|
lastCol = c;
|
|
64
60
|
}
|
|
@@ -75,8 +71,8 @@ export function drawXY(ctx, props) {
|
|
|
75
71
|
const effectiveC = crossingOrigin && summary
|
|
76
72
|
? c === lastCol
|
|
77
73
|
? lastMix
|
|
78
|
-
: (lastMix =
|
|
79
|
-
.mix(
|
|
74
|
+
: (lastMix = colord(colorCallback(feature, max))
|
|
75
|
+
.mix(colord(colorCallback(feature, min)))
|
|
80
76
|
.toString())
|
|
81
77
|
: c;
|
|
82
78
|
const w = Math.max(rightPx - leftPx + fudgeFactor, minSize);
|
|
@@ -101,7 +97,7 @@ export function drawXY(ctx, props) {
|
|
|
101
97
|
? c
|
|
102
98
|
: c === lastCol
|
|
103
99
|
? lastMix
|
|
104
|
-
: (lastMix =
|
|
100
|
+
: (lastMix = darken(colord(c), 0.4).toHex());
|
|
105
101
|
fillRectCtx(leftPx, toY(min), w, getHeight(min), ctx, effectiveC);
|
|
106
102
|
lastCol = c;
|
|
107
103
|
}
|
|
@@ -162,122 +158,3 @@ export function drawXY(ctx, props) {
|
|
|
162
158
|
}
|
|
163
159
|
return { reducedFeatures };
|
|
164
160
|
}
|
|
165
|
-
export function drawLine(ctx, props) {
|
|
166
|
-
const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, } = props;
|
|
167
|
-
const [region] = regions;
|
|
168
|
-
const width = (region.end - region.start) / bpPerPx;
|
|
169
|
-
// the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
|
|
170
|
-
// wiggle display, and makes the height of the actual drawn area add
|
|
171
|
-
// "padding" to the top and bottom of the display
|
|
172
|
-
const height = unadjustedHeight - offset * 2;
|
|
173
|
-
const clipColor = readConfObject(config, 'clipColor');
|
|
174
|
-
const scale = getScale({ ...scaleOpts, range: [0, height] });
|
|
175
|
-
const [niceMin, niceMax] = scale.domain();
|
|
176
|
-
const toY = (n) => clamp(height - (scale(n) || 0), 0, height) + offset;
|
|
177
|
-
let lastVal;
|
|
178
|
-
let prevLeftPx = -Infinity;
|
|
179
|
-
const reducedFeatures = [];
|
|
180
|
-
for (const feature of features.values()) {
|
|
181
|
-
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
182
|
-
// create reduced features, avoiding multiple features per px
|
|
183
|
-
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
184
|
-
reducedFeatures.push(feature);
|
|
185
|
-
prevLeftPx = leftPx;
|
|
186
|
-
}
|
|
187
|
-
const score = feature.get('score');
|
|
188
|
-
const lowClipping = score < niceMin;
|
|
189
|
-
const highClipping = score > niceMax;
|
|
190
|
-
const w = rightPx - leftPx + fudgeFactor;
|
|
191
|
-
const c = colorCallback(feature, score);
|
|
192
|
-
ctx.beginPath();
|
|
193
|
-
ctx.strokeStyle = c;
|
|
194
|
-
const startPos = lastVal !== undefined ? lastVal : score;
|
|
195
|
-
if (!region.reversed) {
|
|
196
|
-
ctx.moveTo(leftPx, toY(startPos));
|
|
197
|
-
ctx.lineTo(leftPx, toY(score));
|
|
198
|
-
ctx.lineTo(rightPx, toY(score));
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
ctx.moveTo(rightPx, toY(startPos));
|
|
202
|
-
ctx.lineTo(rightPx, toY(score));
|
|
203
|
-
ctx.lineTo(leftPx, toY(score));
|
|
204
|
-
}
|
|
205
|
-
ctx.stroke();
|
|
206
|
-
lastVal = score;
|
|
207
|
-
if (highClipping) {
|
|
208
|
-
ctx.fillStyle = clipColor;
|
|
209
|
-
ctx.fillRect(leftPx, offset, w, clipHeight);
|
|
210
|
-
}
|
|
211
|
-
else if (lowClipping && scaleOpts.scaleType !== 'log') {
|
|
212
|
-
ctx.fillStyle = clipColor;
|
|
213
|
-
ctx.fillRect(leftPx, height - clipHeight, w, height);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (displayCrossHatches) {
|
|
217
|
-
ctx.lineWidth = 1;
|
|
218
|
-
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
219
|
-
values.forEach(tick => {
|
|
220
|
-
ctx.beginPath();
|
|
221
|
-
ctx.moveTo(0, Math.round(toY(tick)));
|
|
222
|
-
ctx.lineTo(width, Math.round(toY(tick)));
|
|
223
|
-
ctx.stroke();
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
return { reducedFeatures };
|
|
227
|
-
}
|
|
228
|
-
export function drawDensity(ctx, props) {
|
|
229
|
-
const { features, regions, bpPerPx, scaleOpts, height, config } = props;
|
|
230
|
-
const [region] = regions;
|
|
231
|
-
const pivot = readConfObject(config, 'bicolorPivot');
|
|
232
|
-
const pivotValue = readConfObject(config, 'bicolorPivotValue');
|
|
233
|
-
const negColor = readConfObject(config, 'negColor');
|
|
234
|
-
const posColor = readConfObject(config, 'posColor');
|
|
235
|
-
const color = readConfObject(config, 'color');
|
|
236
|
-
const clipColor = readConfObject(config, 'clipColor');
|
|
237
|
-
const crossing = pivot !== 'none' && scaleOpts.scaleType !== 'log';
|
|
238
|
-
const scale = getScale({
|
|
239
|
-
...scaleOpts,
|
|
240
|
-
pivotValue: crossing ? pivotValue : undefined,
|
|
241
|
-
range: crossing ? [negColor, 'white', posColor] : ['white', posColor],
|
|
242
|
-
});
|
|
243
|
-
const scale2 = getScale({ ...scaleOpts, range: [0, height] });
|
|
244
|
-
const cb = color === '#f0f'
|
|
245
|
-
? (_, score) => scale(score)
|
|
246
|
-
: (feature, score) => readConfObject(config, 'color', { feature, score });
|
|
247
|
-
const [niceMin, niceMax] = scale2.domain();
|
|
248
|
-
let prevLeftPx = -Infinity;
|
|
249
|
-
let hasClipping = false;
|
|
250
|
-
const reducedFeatures = [];
|
|
251
|
-
for (const feature of features.values()) {
|
|
252
|
-
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
253
|
-
// create reduced features, avoiding multiple features per px
|
|
254
|
-
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
255
|
-
reducedFeatures.push(feature);
|
|
256
|
-
prevLeftPx = leftPx;
|
|
257
|
-
}
|
|
258
|
-
const score = feature.get('score');
|
|
259
|
-
hasClipping = hasClipping || score > niceMax || score < niceMin;
|
|
260
|
-
const w = rightPx - leftPx + fudgeFactor;
|
|
261
|
-
ctx.fillStyle = cb(feature, score);
|
|
262
|
-
ctx.fillRect(leftPx, 0, w, height);
|
|
263
|
-
}
|
|
264
|
-
// second pass: draw clipping
|
|
265
|
-
// avoid persisting the red fillstyle with save/restore
|
|
266
|
-
ctx.save();
|
|
267
|
-
if (hasClipping) {
|
|
268
|
-
ctx.fillStyle = clipColor;
|
|
269
|
-
for (const feature of features.values()) {
|
|
270
|
-
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
271
|
-
const w = rightPx - leftPx + fudgeFactor;
|
|
272
|
-
const score = feature.get('score');
|
|
273
|
-
if (score > niceMax) {
|
|
274
|
-
fillRectCtx(leftPx, 0, w, clipHeight, ctx);
|
|
275
|
-
}
|
|
276
|
-
else if (score < niceMin && scaleOpts.scaleType !== 'log') {
|
|
277
|
-
fillRectCtx(leftPx, 0, w, clipHeight, ctx);
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
ctx.restore();
|
|
282
|
-
return { reducedFeatures };
|
|
283
|
-
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { axisPropsFromTickScale } from 'react-d3-axis-mod';
|
|
3
3
|
type Ticks = ReturnType<typeof axisPropsFromTickScale>;
|
|
4
|
-
declare const
|
|
4
|
+
declare const YScaleBar: ({ model, orientation, }: {
|
|
5
5
|
model: {
|
|
6
6
|
ticks?: Ticks;
|
|
7
7
|
};
|
|
8
8
|
orientation?: string | undefined;
|
|
9
9
|
}) => React.JSX.Element | null;
|
|
10
|
-
export default
|
|
10
|
+
export default YScaleBar;
|
package/esm/shared/YScaleBar.js
CHANGED
|
@@ -2,8 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { useTheme } from '@mui/material';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { Axis, LEFT, RIGHT } from 'react-d3-axis-mod';
|
|
5
|
-
|
|
5
|
+
const YScaleBar = observer(function ({ model, orientation, }) {
|
|
6
6
|
const { ticks } = model;
|
|
7
7
|
const theme = useTheme();
|
|
8
8
|
return ticks ? (React.createElement(Axis, { ...ticks, shadow: 2, format: (n) => n, style: { orient: orientation === 'left' ? LEFT : RIGHT }, bg: theme.palette.background.default, fg: theme.palette.text.primary })) : null;
|
|
9
9
|
});
|
|
10
|
+
export default YScaleBar;
|
|
@@ -247,7 +247,10 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
247
247
|
readonly regionTooLargeReason: string;
|
|
248
248
|
} & {
|
|
249
249
|
regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
|
|
250
|
-
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
|
|
250
|
+
regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null; /**
|
|
251
|
+
* #getter
|
|
252
|
+
* subclasses can define these, as snpcoverage track does
|
|
253
|
+
*/
|
|
251
254
|
} & {
|
|
252
255
|
featureIdUnderMouse: string | undefined;
|
|
253
256
|
contextMenuFeature: Feature | undefined;
|
package/esm/util.d.ts
CHANGED
|
@@ -72,3 +72,4 @@ export declare function quantitativeStatsAutorun(self: {
|
|
|
72
72
|
}): void;
|
|
73
73
|
export declare function toP(s?: number): number;
|
|
74
74
|
export declare function round(value: number): number;
|
|
75
|
+
export declare function fillRectCtx(x: number, y: number, width: number, height: number, ctx: CanvasRenderingContext2D, color?: string): void;
|
package/esm/util.js
CHANGED
|
@@ -221,3 +221,18 @@ export function toP(s = 0) {
|
|
|
221
221
|
export function round(value) {
|
|
222
222
|
return Math.round(value * 1e5) / 1e5;
|
|
223
223
|
}
|
|
224
|
+
// avoid drawing negative width features for SVG exports
|
|
225
|
+
export function fillRectCtx(x, y, width, height, ctx, color) {
|
|
226
|
+
if (width < 0) {
|
|
227
|
+
x += width;
|
|
228
|
+
width = -width;
|
|
229
|
+
}
|
|
230
|
+
if (height < 0) {
|
|
231
|
+
y += height;
|
|
232
|
+
height = -height;
|
|
233
|
+
}
|
|
234
|
+
if (color) {
|
|
235
|
+
ctx.fillStyle = color;
|
|
236
|
+
}
|
|
237
|
+
ctx.fillRect(x, y, width, height);
|
|
238
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-wiggle",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.1",
|
|
4
4
|
"description": "JBrowse 2 wiggle adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -40,7 +40,6 @@
|
|
|
40
40
|
"@mui/icons-material": "^5.0.2",
|
|
41
41
|
"@popperjs/core": "^2.11.0",
|
|
42
42
|
"clone": "^2.1.2",
|
|
43
|
-
"color": "^3.1.1",
|
|
44
43
|
"d3-color": "^3.0.2",
|
|
45
44
|
"d3-scale": "^3.0.2",
|
|
46
45
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
"@mui/material": "^5.0.0",
|
|
57
56
|
"@mui/x-data-grid": "^6.0.1",
|
|
58
57
|
"mobx": "^6.0.0",
|
|
59
|
-
"mobx-react": "^
|
|
58
|
+
"mobx-react": "^9.0.0",
|
|
60
59
|
"mobx-state-tree": "^5.0.0",
|
|
61
60
|
"react": ">=16.8.0",
|
|
62
61
|
"rxjs": "^7.0.0",
|
|
@@ -68,5 +67,5 @@
|
|
|
68
67
|
"distModule": "esm/index.js",
|
|
69
68
|
"srcModule": "src/index.ts",
|
|
70
69
|
"module": "esm/index.js",
|
|
71
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "2cda1611eebd12517f2a3cfc1b612face27005d4"
|
|
72
71
|
}
|
package/dist/drawxy.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
-
import { Feature, Region } from '@jbrowse/core/util';
|
|
3
|
-
import { ScaleOpts } from './util';
|
|
4
|
-
export declare function drawXY(ctx: CanvasRenderingContext2D, props: {
|
|
5
|
-
features: Map<string, Feature> | Feature[];
|
|
6
|
-
bpPerPx: number;
|
|
7
|
-
regions: Region[];
|
|
8
|
-
scaleOpts: ScaleOpts;
|
|
9
|
-
height: number;
|
|
10
|
-
ticks: {
|
|
11
|
-
values: number[];
|
|
12
|
-
};
|
|
13
|
-
config: AnyConfigurationModel;
|
|
14
|
-
displayCrossHatches: boolean;
|
|
15
|
-
offset?: number;
|
|
16
|
-
colorCallback: (f: Feature, score: number) => string;
|
|
17
|
-
Color: typeof import('color');
|
|
18
|
-
}): {
|
|
19
|
-
reducedFeatures: Feature[];
|
|
20
|
-
};
|
|
21
|
-
export declare function drawLine(ctx: CanvasRenderingContext2D, props: {
|
|
22
|
-
features: Map<string, Feature> | Feature[];
|
|
23
|
-
regions: Region[];
|
|
24
|
-
bpPerPx: number;
|
|
25
|
-
scaleOpts: ScaleOpts;
|
|
26
|
-
height: number;
|
|
27
|
-
ticks: {
|
|
28
|
-
values: number[];
|
|
29
|
-
};
|
|
30
|
-
displayCrossHatches: boolean;
|
|
31
|
-
colorCallback: (f: Feature, score: number) => string;
|
|
32
|
-
config: AnyConfigurationModel;
|
|
33
|
-
offset?: number;
|
|
34
|
-
}): {
|
|
35
|
-
reducedFeatures: Feature[];
|
|
36
|
-
};
|
|
37
|
-
export declare function drawDensity(ctx: CanvasRenderingContext2D, props: {
|
|
38
|
-
features: Map<string, Feature> | Feature[];
|
|
39
|
-
regions: Region[];
|
|
40
|
-
bpPerPx: number;
|
|
41
|
-
scaleOpts: ScaleOpts;
|
|
42
|
-
height: number;
|
|
43
|
-
ticks: {
|
|
44
|
-
values: number[];
|
|
45
|
-
};
|
|
46
|
-
displayCrossHatches: boolean;
|
|
47
|
-
config: AnyConfigurationModel;
|
|
48
|
-
}): {
|
|
49
|
-
reducedFeatures: Feature[];
|
|
50
|
-
};
|