@jbrowse/plugin-wiggle 2.16.1 → 2.17.0
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/LinearWiggleDisplay/components/Tooltip.js +1 -1
- package/dist/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
- package/dist/LinearWiggleDisplay/{models/configSchema.js → configSchema.js} +2 -2
- package/dist/LinearWiggleDisplay/index.d.ts +1 -1
- package/dist/LinearWiggleDisplay/index.js +3 -3
- package/{esm/LinearWiggleDisplay/models → dist/LinearWiggleDisplay}/model.d.ts +22 -6
- package/dist/LinearWiggleDisplay/{models/model.js → model.js} +82 -47
- package/dist/LinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +2 -1
- package/dist/MultiLinearWiggleDisplay/components/ColorLegend.d.ts +1 -1
- package/dist/MultiLinearWiggleDisplay/components/ScoreLegend.d.ts +1 -1
- package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
- package/dist/MultiLinearWiggleDisplay/components/YScaleBars.d.ts +1 -1
- package/dist/MultiLinearWiggleDisplay/components/util.d.ts +1 -1
- package/dist/MultiLinearWiggleDisplay/{models/configSchema.js → configSchema.js} +2 -2
- package/dist/MultiLinearWiggleDisplay/index.js +2 -2
- package/dist/MultiLinearWiggleDisplay/{models/model.d.ts → model.d.ts} +30 -12
- package/dist/MultiLinearWiggleDisplay/{models/model.js → model.js} +118 -87
- package/dist/MultiLinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +1 -1
- package/dist/MultiRowXYPlotRenderer/configSchema.js +1 -1
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +1 -1
- package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js +4 -2
- package/dist/MultiXYPlotRenderer/configSchema.js +1 -1
- package/dist/WiggleBaseRenderer.d.ts +1 -1
- package/dist/XYPlotRenderer/configSchema.js +1 -1
- package/dist/getMultiWiggleSourcesAutorun.d.ts +17 -0
- package/dist/getMultiWiggleSourcesAutorun.js +35 -0
- package/dist/getQuantitativeStats.d.ts +13 -0
- package/dist/getQuantitativeStats.js +78 -0
- package/dist/getQuantitativeStatsAutorun.d.ts +13 -0
- package/dist/getQuantitativeStatsAutorun.js +37 -0
- package/dist/index.d.ts +2 -2
- package/{esm/shared/modelShared.d.ts → dist/shared/SharedWiggleMixin.d.ts} +17 -3
- package/dist/shared/{modelShared.js → SharedWiggleMixin.js} +21 -10
- package/dist/util.d.ts +5 -29
- package/dist/util.js +4 -100
- package/esm/LinearWiggleDisplay/components/Tooltip.js +1 -1
- package/esm/LinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
- package/esm/LinearWiggleDisplay/{models/configSchema.js → configSchema.js} +1 -1
- package/esm/LinearWiggleDisplay/index.d.ts +1 -1
- package/esm/LinearWiggleDisplay/index.js +3 -3
- package/{dist/LinearWiggleDisplay/models → esm/LinearWiggleDisplay}/model.d.ts +22 -6
- package/esm/LinearWiggleDisplay/{models/model.js → model.js} +82 -47
- package/esm/LinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +2 -1
- package/esm/MultiLinearWiggleDisplay/components/ColorLegend.d.ts +1 -1
- package/esm/MultiLinearWiggleDisplay/components/ScoreLegend.d.ts +1 -1
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.d.ts +1 -1
- package/esm/MultiLinearWiggleDisplay/components/YScaleBars.d.ts +1 -1
- package/esm/MultiLinearWiggleDisplay/components/util.d.ts +1 -1
- package/esm/MultiLinearWiggleDisplay/{models/configSchema.js → configSchema.js} +1 -1
- package/esm/MultiLinearWiggleDisplay/index.js +2 -2
- package/esm/MultiLinearWiggleDisplay/{models/model.d.ts → model.d.ts} +30 -12
- package/esm/MultiLinearWiggleDisplay/{models/model.js → model.js} +119 -88
- package/esm/MultiLinearWiggleDisplay/{models/renderSvg.js → renderSvg.js} +1 -1
- package/esm/MultiRowXYPlotRenderer/configSchema.js +1 -1
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +1 -1
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +4 -2
- package/esm/MultiXYPlotRenderer/configSchema.js +1 -1
- package/esm/WiggleBaseRenderer.d.ts +1 -1
- package/esm/XYPlotRenderer/configSchema.js +1 -1
- package/esm/getMultiWiggleSourcesAutorun.d.ts +17 -0
- package/esm/getMultiWiggleSourcesAutorun.js +32 -0
- package/esm/getQuantitativeStats.d.ts +13 -0
- package/esm/getQuantitativeStats.js +75 -0
- package/esm/getQuantitativeStatsAutorun.d.ts +13 -0
- package/esm/getQuantitativeStatsAutorun.js +34 -0
- package/esm/index.d.ts +2 -2
- package/{dist/shared/modelShared.d.ts → esm/shared/SharedWiggleMixin.d.ts} +17 -3
- package/esm/shared/{modelShared.js → SharedWiggleMixin.js} +21 -10
- package/esm/util.d.ts +5 -29
- package/esm/util.js +4 -98
- package/package.json +2 -2
- /package/dist/LinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/dist/LinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
- /package/dist/MultiLinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/dist/MultiLinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
- /package/dist/shared/{configShared.d.ts → SharedWiggleConfigSchema.d.ts} +0 -0
- /package/dist/shared/{configShared.js → SharedWiggleConfigSchema.js} +0 -0
- /package/esm/LinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/esm/LinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
- /package/esm/MultiLinearWiggleDisplay/{models/configSchema.d.ts → configSchema.d.ts} +0 -0
- /package/esm/MultiLinearWiggleDisplay/{models/renderSvg.d.ts → renderSvg.d.ts} +0 -0
- /package/esm/shared/{configShared.d.ts → SharedWiggleConfigSchema.d.ts} +0 -0
- /package/esm/shared/{configShared.js → SharedWiggleConfigSchema.js} +0 -0
|
@@ -29,21 +29,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
exports.stateModelFactory = stateModelFactory;
|
|
30
30
|
const react_1 = require("react");
|
|
31
31
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
32
|
-
const mobx_1 = require("mobx");
|
|
33
32
|
const react_d3_axis_mod_1 = require("react-d3-axis-mod");
|
|
34
33
|
const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
35
34
|
// jbrowse imports
|
|
36
35
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
37
36
|
const util_1 = require("@jbrowse/core/util");
|
|
38
|
-
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
39
37
|
const colors_1 = require("@jbrowse/core/ui/colors");
|
|
40
38
|
// locals
|
|
41
|
-
const util_2 = require("
|
|
42
|
-
const
|
|
39
|
+
const util_2 = require("../util");
|
|
40
|
+
const SharedWiggleMixin_1 = __importDefault(require("../shared/SharedWiggleMixin"));
|
|
43
41
|
const randomColor = () => '#000000'.replaceAll('0', () => (~~(Math.random() * 16)).toString(16));
|
|
44
42
|
// lazies
|
|
45
|
-
const Tooltip = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('
|
|
46
|
-
const SetColorDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('
|
|
43
|
+
const Tooltip = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/Tooltip'))));
|
|
44
|
+
const SetColorDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SetColorDialog'))));
|
|
47
45
|
// using a map because it preserves order
|
|
48
46
|
const rendererTypes = new Map([
|
|
49
47
|
['xyplot', 'MultiXYPlotRenderer'],
|
|
@@ -59,7 +57,7 @@ const rendererTypes = new Map([
|
|
|
59
57
|
*/
|
|
60
58
|
function stateModelFactory(pluginManager, configSchema) {
|
|
61
59
|
return mobx_state_tree_1.types
|
|
62
|
-
.compose('MultiLinearWiggleDisplay', (0,
|
|
60
|
+
.compose('MultiLinearWiggleDisplay', (0, SharedWiggleMixin_1.default)(configSchema), mobx_state_tree_1.types.model({
|
|
63
61
|
/**
|
|
64
62
|
* #property
|
|
65
63
|
*/
|
|
@@ -159,6 +157,9 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
159
157
|
get needsCustomLegend() {
|
|
160
158
|
return self.rendererTypeName === 'MultiDensityRenderer';
|
|
161
159
|
},
|
|
160
|
+
/**
|
|
161
|
+
* #getter
|
|
162
|
+
*/
|
|
162
163
|
get canHaveFill() {
|
|
163
164
|
return (self.rendererTypeName === 'MultiXYPlotRenderer' ||
|
|
164
165
|
self.rendererTypeName === 'MultiRowXYPlotRenderer');
|
|
@@ -197,6 +198,16 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
197
198
|
(!this.isMultiRow ? colors_1.set1[i] || randomColor() : 'blue'),
|
|
198
199
|
}));
|
|
199
200
|
},
|
|
201
|
+
/**
|
|
202
|
+
* #getter
|
|
203
|
+
*/
|
|
204
|
+
get quantitativeStatsReady() {
|
|
205
|
+
const view = (0, util_1.getContainingView)(self);
|
|
206
|
+
return (view.initialized &&
|
|
207
|
+
self.featureDensityStatsReady &&
|
|
208
|
+
!self.regionTooLarge &&
|
|
209
|
+
!self.error);
|
|
210
|
+
},
|
|
200
211
|
}))
|
|
201
212
|
.views(self => ({
|
|
202
213
|
/**
|
|
@@ -218,42 +229,6 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
218
229
|
get useMinimalTicks() {
|
|
219
230
|
return ((0, configuration_1.getConf)(self, 'minimalTicks') || this.rowHeightTooSmallForScalebar);
|
|
220
231
|
},
|
|
221
|
-
}))
|
|
222
|
-
.views(self => ({
|
|
223
|
-
/**
|
|
224
|
-
* #getter
|
|
225
|
-
*/
|
|
226
|
-
get ticks() {
|
|
227
|
-
const { scaleType, domain, isMultiRow, rowHeight, useMinimalTicks } = self;
|
|
228
|
-
if (!domain) {
|
|
229
|
-
return undefined;
|
|
230
|
-
}
|
|
231
|
-
const offset = isMultiRow ? 0 : util_2.YSCALEBAR_LABEL_OFFSET;
|
|
232
|
-
const ticks = (0, react_d3_axis_mod_1.axisPropsFromTickScale)((0, util_2.getScale)({
|
|
233
|
-
scaleType,
|
|
234
|
-
domain,
|
|
235
|
-
range: [rowHeight - offset, offset],
|
|
236
|
-
inverted: (0, configuration_1.getConf)(self, 'inverted'),
|
|
237
|
-
}), 4);
|
|
238
|
-
return useMinimalTicks ? { ...ticks, values: domain } : ticks;
|
|
239
|
-
},
|
|
240
|
-
/**
|
|
241
|
-
* #getter
|
|
242
|
-
*/
|
|
243
|
-
get colors() {
|
|
244
|
-
return [
|
|
245
|
-
'red',
|
|
246
|
-
'blue',
|
|
247
|
-
'green',
|
|
248
|
-
'orange',
|
|
249
|
-
'purple',
|
|
250
|
-
'cyan',
|
|
251
|
-
'pink',
|
|
252
|
-
'darkblue',
|
|
253
|
-
'darkred',
|
|
254
|
-
'pink',
|
|
255
|
-
];
|
|
256
|
-
},
|
|
257
232
|
}))
|
|
258
233
|
.views(self => {
|
|
259
234
|
const { renderProps: superRenderProps } = self;
|
|
@@ -261,58 +236,114 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
261
236
|
/**
|
|
262
237
|
* #method
|
|
263
238
|
*/
|
|
264
|
-
|
|
239
|
+
adapterProps() {
|
|
265
240
|
const superProps = superRenderProps();
|
|
266
|
-
const { displayCrossHatches, filters, height, resolution, rpcDriverName, scaleOpts, stats, sources, ticks, rendererConfig: config, } = self;
|
|
267
241
|
return {
|
|
268
242
|
...superProps,
|
|
269
|
-
notReady: superProps.notReady || !sources || !stats,
|
|
270
243
|
displayModel: self,
|
|
271
|
-
config,
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
rpcDriverName,
|
|
277
|
-
scaleOpts,
|
|
278
|
-
sources,
|
|
279
|
-
ticks,
|
|
280
|
-
onMouseMove: (_, f) => {
|
|
281
|
-
self.setFeatureUnderMouse(f);
|
|
282
|
-
},
|
|
283
|
-
onMouseLeave: () => {
|
|
284
|
-
self.setFeatureUnderMouse(undefined);
|
|
285
|
-
},
|
|
244
|
+
config: self.rendererConfig,
|
|
245
|
+
filters: self.filters,
|
|
246
|
+
resolution: self.resolution,
|
|
247
|
+
rpcDriverName: self.rpcDriverName,
|
|
248
|
+
sources: self.sources,
|
|
286
249
|
};
|
|
287
250
|
},
|
|
288
251
|
/**
|
|
289
252
|
* #getter
|
|
290
253
|
*/
|
|
291
|
-
get
|
|
292
|
-
|
|
254
|
+
get ticks() {
|
|
255
|
+
const { scaleType, domain, isMultiRow, rowHeight, useMinimalTicks } = self;
|
|
256
|
+
if (!domain) {
|
|
257
|
+
return undefined;
|
|
258
|
+
}
|
|
259
|
+
const offset = isMultiRow ? 0 : util_2.YSCALEBAR_LABEL_OFFSET;
|
|
260
|
+
const ticks = (0, react_d3_axis_mod_1.axisPropsFromTickScale)((0, util_2.getScale)({
|
|
261
|
+
scaleType,
|
|
262
|
+
domain,
|
|
263
|
+
range: [rowHeight - offset, offset],
|
|
264
|
+
inverted: (0, configuration_1.getConf)(self, 'inverted'),
|
|
265
|
+
}), 4);
|
|
266
|
+
return useMinimalTicks ? { ...ticks, values: domain } : ticks;
|
|
293
267
|
},
|
|
294
268
|
/**
|
|
295
269
|
* #getter
|
|
296
270
|
*/
|
|
297
|
-
get
|
|
298
|
-
return
|
|
271
|
+
get colors() {
|
|
272
|
+
return [
|
|
273
|
+
'red',
|
|
274
|
+
'blue',
|
|
275
|
+
'green',
|
|
276
|
+
'orange',
|
|
277
|
+
'purple',
|
|
278
|
+
'cyan',
|
|
279
|
+
'pink',
|
|
280
|
+
'darkblue',
|
|
281
|
+
'darkred',
|
|
282
|
+
'pink',
|
|
283
|
+
];
|
|
299
284
|
},
|
|
300
285
|
/**
|
|
301
286
|
* #getter
|
|
287
|
+
* unused currently
|
|
302
288
|
*/
|
|
303
|
-
get
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
else if (self.minSize === 1) {
|
|
308
|
-
return 1;
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
return 2;
|
|
312
|
-
}
|
|
289
|
+
get quantitativeStatsRelevantToCurrentZoom() {
|
|
290
|
+
var _a;
|
|
291
|
+
const view = (0, util_1.getContainingView)(self);
|
|
292
|
+
return ((_a = self.stats) === null || _a === void 0 ? void 0 : _a.currStatsBpPerPx) === view.bpPerPx;
|
|
313
293
|
},
|
|
314
294
|
};
|
|
315
295
|
})
|
|
296
|
+
.views(self => ({
|
|
297
|
+
/**
|
|
298
|
+
* #method
|
|
299
|
+
*/
|
|
300
|
+
renderProps() {
|
|
301
|
+
const superProps = self.adapterProps();
|
|
302
|
+
return {
|
|
303
|
+
...superProps,
|
|
304
|
+
notReady: superProps.notReady || !self.sources || !self.stats,
|
|
305
|
+
displayModel: self,
|
|
306
|
+
rpcDriverName: self.rpcDriverName,
|
|
307
|
+
displayCrossHatches: self.displayCrossHatches,
|
|
308
|
+
height: self.height,
|
|
309
|
+
ticks: self.ticks,
|
|
310
|
+
stats: self.stats,
|
|
311
|
+
scaleOpts: self.scaleOpts,
|
|
312
|
+
onMouseMove: (_, f) => {
|
|
313
|
+
self.setFeatureUnderMouse(f);
|
|
314
|
+
},
|
|
315
|
+
onMouseLeave: () => {
|
|
316
|
+
self.setFeatureUnderMouse(undefined);
|
|
317
|
+
},
|
|
318
|
+
};
|
|
319
|
+
},
|
|
320
|
+
/**
|
|
321
|
+
* #getter
|
|
322
|
+
*/
|
|
323
|
+
get hasResolution() {
|
|
324
|
+
return self.adapterCapabilities.includes('hasResolution');
|
|
325
|
+
},
|
|
326
|
+
/**
|
|
327
|
+
* #getter
|
|
328
|
+
*/
|
|
329
|
+
get hasGlobalStats() {
|
|
330
|
+
return self.adapterCapabilities.includes('hasGlobalStats');
|
|
331
|
+
},
|
|
332
|
+
/**
|
|
333
|
+
* #getter
|
|
334
|
+
*/
|
|
335
|
+
get fillSetting() {
|
|
336
|
+
if (self.filled) {
|
|
337
|
+
return 0;
|
|
338
|
+
}
|
|
339
|
+
else if (self.minSize === 1) {
|
|
340
|
+
return 1;
|
|
341
|
+
}
|
|
342
|
+
else {
|
|
343
|
+
return 2;
|
|
344
|
+
}
|
|
345
|
+
},
|
|
346
|
+
}))
|
|
316
347
|
.views(self => {
|
|
317
348
|
const { trackMenuItems: superTrackMenuItems } = self;
|
|
318
349
|
const hasRenderings = (0, configuration_1.getConf)(self, 'defaultRendering');
|
|
@@ -395,20 +426,20 @@ function stateModelFactory(pluginManager, configSchema) {
|
|
|
395
426
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
396
427
|
;
|
|
397
428
|
(async () => {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}));
|
|
429
|
+
try {
|
|
430
|
+
const [{ getMultiWiggleSourcesAutorun }, { getQuantitativeStatsAutorun },] = await Promise.all([
|
|
431
|
+
Promise.resolve().then(() => __importStar(require('../getMultiWiggleSourcesAutorun'))),
|
|
432
|
+
Promise.resolve().then(() => __importStar(require('../getQuantitativeStatsAutorun'))),
|
|
433
|
+
]);
|
|
434
|
+
getQuantitativeStatsAutorun(self);
|
|
435
|
+
getMultiWiggleSourcesAutorun(self);
|
|
436
|
+
}
|
|
437
|
+
catch (e) {
|
|
408
438
|
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
409
|
-
|
|
439
|
+
console.error(e);
|
|
440
|
+
(0, util_1.getSession)(self).notifyError(`${e}`, e);
|
|
410
441
|
}
|
|
411
|
-
}
|
|
442
|
+
}
|
|
412
443
|
})();
|
|
413
444
|
},
|
|
414
445
|
/**
|
|
@@ -7,7 +7,7 @@ exports.renderSvg = renderSvg;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const util_1 = require("@jbrowse/core/util");
|
|
9
9
|
const mobx_1 = require("mobx");
|
|
10
|
-
const YScaleBars_1 = __importDefault(require("
|
|
10
|
+
const YScaleBars_1 = __importDefault(require("./components/YScaleBars"));
|
|
11
11
|
async function renderSvg(self, opts, superRenderSvg) {
|
|
12
12
|
await (0, mobx_1.when)(() => !!self.stats && !!self.regionCannotBeRenderedText);
|
|
13
13
|
const { offsetPx } = (0, util_1.getContainingView)(self);
|
|
@@ -21,7 +21,7 @@ export default class MultiWiggleAdapter extends BaseFeatureDataAdapter {
|
|
|
21
21
|
getMultiRegionFeatureDensityStats(_regions: Region[]): Promise<{
|
|
22
22
|
featureDensity: number;
|
|
23
23
|
}>;
|
|
24
|
-
getSources(): Promise<{
|
|
24
|
+
getSources(_regions: Region[]): Promise<{
|
|
25
25
|
name: string;
|
|
26
26
|
__name: unknown;
|
|
27
27
|
}[]>;
|
|
@@ -67,11 +67,13 @@ class MultiWiggleAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
|
|
|
67
67
|
}
|
|
68
68
|
// always render bigwig instead of calculating a feature density for it
|
|
69
69
|
async getMultiRegionFeatureDensityStats(_regions) {
|
|
70
|
-
return {
|
|
70
|
+
return {
|
|
71
|
+
featureDensity: 0,
|
|
72
|
+
};
|
|
71
73
|
}
|
|
72
74
|
// in another adapter type, this could be dynamic depending on region or
|
|
73
75
|
// something, but it is static for this particular multi-wiggle adapter type
|
|
74
|
-
async getSources() {
|
|
76
|
+
async getSources(_regions) {
|
|
75
77
|
const adapters = await this.getAdapters();
|
|
76
78
|
return adapters.map(({ dataAdapter, source, name, ...rest }) => ({
|
|
77
79
|
name: source,
|
|
@@ -54,4 +54,4 @@ export default abstract class WiggleBaseRenderer extends FeatureRendererType {
|
|
|
54
54
|
*/
|
|
55
55
|
abstract draw<T extends RenderArgsDeserializedWithFeatures>(ctx: CanvasRenderingContext2D, props: T): Promise<Record<string, unknown> | undefined>;
|
|
56
56
|
}
|
|
57
|
-
export {
|
|
57
|
+
export type { RenderArgsSerialized, RenderResults, ResultsDeserialized, ResultsSerialized, } from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
+
export interface Source {
|
|
3
|
+
name: string;
|
|
4
|
+
color?: string;
|
|
5
|
+
group?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function getMultiWiggleSourcesAutorun(self: {
|
|
8
|
+
quantitativeStatsReady: boolean;
|
|
9
|
+
configuration: AnyConfigurationModel;
|
|
10
|
+
adapterConfig: AnyConfigurationModel;
|
|
11
|
+
autoscaleType: string;
|
|
12
|
+
adapterProps: () => Record<string, unknown>;
|
|
13
|
+
setStatsLoading: (aborter: AbortController) => void;
|
|
14
|
+
setError: (error: unknown) => void;
|
|
15
|
+
setMessage: (str: string) => void;
|
|
16
|
+
setSources: (sources: Source[]) => void;
|
|
17
|
+
}): void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMultiWiggleSourcesAutorun = getMultiWiggleSourcesAutorun;
|
|
4
|
+
const mobx_1 = require("mobx");
|
|
5
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
6
|
+
// jbrowse
|
|
7
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
|
+
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
9
|
+
function getMultiWiggleSourcesAutorun(self) {
|
|
10
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
11
|
+
try {
|
|
12
|
+
const { rpcManager } = (0, util_1.getSession)(self);
|
|
13
|
+
const { adapterConfig } = self;
|
|
14
|
+
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
15
|
+
const view = (0, util_1.getContainingView)(self);
|
|
16
|
+
if (!view.initialized) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const sources = (await rpcManager.call(sessionId, 'MultiWiggleGetSources', {
|
|
20
|
+
regions: view.staticBlocks.contentBlocks,
|
|
21
|
+
sessionId,
|
|
22
|
+
adapterConfig,
|
|
23
|
+
}));
|
|
24
|
+
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
25
|
+
self.setSources(sources);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(self)) {
|
|
30
|
+
console.error(e);
|
|
31
|
+
(0, util_1.getSession)(self).notifyError(`${e}`, e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}));
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QuantitativeStats } from '@jbrowse/core/util/stats';
|
|
2
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
export declare function getQuantitativeStats(self: {
|
|
4
|
+
adapterConfig: AnyConfigurationModel;
|
|
5
|
+
configuration: AnyConfigurationModel;
|
|
6
|
+
autoscaleType: string;
|
|
7
|
+
setMessage: (str: string) => void;
|
|
8
|
+
}, opts: {
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
filters: string[];
|
|
12
|
+
currStatsBpPerPx: number;
|
|
13
|
+
}): Promise<QuantitativeStats>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getQuantitativeStats = getQuantitativeStats;
|
|
4
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
+
// jbrowse
|
|
6
|
+
const util_1 = require("@jbrowse/core/util");
|
|
7
|
+
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
8
|
+
const configuration_1 = require("@jbrowse/core/configuration");
|
|
9
|
+
async function getQuantitativeStats(self, opts) {
|
|
10
|
+
const { rpcManager } = (0, util_1.getSession)(self);
|
|
11
|
+
const numStdDev = (0, configuration_1.getConf)(self, 'numStdDev') || 3;
|
|
12
|
+
const { adapterConfig, autoscaleType } = self;
|
|
13
|
+
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
14
|
+
const { currStatsBpPerPx } = opts;
|
|
15
|
+
const params = {
|
|
16
|
+
sessionId,
|
|
17
|
+
adapterConfig,
|
|
18
|
+
statusCallback: (message) => {
|
|
19
|
+
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
20
|
+
self.setMessage(message);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
...opts,
|
|
24
|
+
};
|
|
25
|
+
if (autoscaleType === 'global' || autoscaleType === 'globalsd') {
|
|
26
|
+
const results = (await rpcManager.call(sessionId, 'WiggleGetGlobalQuantitativeStats', params));
|
|
27
|
+
const { scoreMin, scoreMean, scoreStdDev } = results;
|
|
28
|
+
// globalsd uses heuristic to avoid unnecessary scoreMin<0
|
|
29
|
+
//
|
|
30
|
+
// if the scoreMin is never less than 0 helps with most coverage bigwigs
|
|
31
|
+
// just being >0
|
|
32
|
+
return autoscaleType === 'globalsd'
|
|
33
|
+
? {
|
|
34
|
+
...results,
|
|
35
|
+
scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
|
|
36
|
+
scoreMax: scoreMean + numStdDev * scoreStdDev,
|
|
37
|
+
currStatsBpPerPx,
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
...results,
|
|
41
|
+
currStatsBpPerPx,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (autoscaleType === 'local' || autoscaleType === 'localsd') {
|
|
45
|
+
const { dynamicBlocks, bpPerPx } = (0, util_1.getContainingView)(self);
|
|
46
|
+
const results = (await rpcManager.call(sessionId, 'WiggleGetMultiRegionQuantitativeStats', {
|
|
47
|
+
...params,
|
|
48
|
+
regions: dynamicBlocks.contentBlocks.map(region => {
|
|
49
|
+
const { start, end } = region;
|
|
50
|
+
return {
|
|
51
|
+
...JSON.parse(JSON.stringify(region)),
|
|
52
|
+
start: Math.floor(start),
|
|
53
|
+
end: Math.ceil(end),
|
|
54
|
+
};
|
|
55
|
+
}),
|
|
56
|
+
bpPerPx,
|
|
57
|
+
}));
|
|
58
|
+
const { scoreMin, scoreMean, scoreStdDev } = results;
|
|
59
|
+
// localsd uses heuristic to avoid unnecessary scoreMin<0 if the
|
|
60
|
+
// scoreMin is never less than 0 helps with most coverage bigwigs
|
|
61
|
+
// just being >0
|
|
62
|
+
return autoscaleType === 'localsd'
|
|
63
|
+
? {
|
|
64
|
+
...results,
|
|
65
|
+
scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
|
|
66
|
+
scoreMax: scoreMean + numStdDev * scoreStdDev,
|
|
67
|
+
currStatsBpPerPx,
|
|
68
|
+
}
|
|
69
|
+
: {
|
|
70
|
+
...results,
|
|
71
|
+
currStatsBpPerPx,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (autoscaleType === 'zscale') {
|
|
75
|
+
return rpcManager.call(sessionId, 'WiggleGetGlobalQuantitativeStats', params);
|
|
76
|
+
}
|
|
77
|
+
throw new Error(`invalid autoscaleType '${autoscaleType}'`);
|
|
78
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { QuantitativeStats } from '@jbrowse/core/util/stats';
|
|
2
|
+
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
export declare function getQuantitativeStatsAutorun(self: {
|
|
4
|
+
quantitativeStatsReady: boolean;
|
|
5
|
+
configuration: AnyConfigurationModel;
|
|
6
|
+
adapterConfig: AnyConfigurationModel;
|
|
7
|
+
autoscaleType: string;
|
|
8
|
+
adapterProps: () => Record<string, unknown>;
|
|
9
|
+
setStatsLoading: (aborter: AbortController) => void;
|
|
10
|
+
setError: (error: unknown) => void;
|
|
11
|
+
setMessage: (str: string) => void;
|
|
12
|
+
updateQuantitativeStats: (stats: QuantitativeStats, region: string) => void;
|
|
13
|
+
}): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getQuantitativeStatsAutorun = getQuantitativeStatsAutorun;
|
|
4
|
+
const mobx_1 = require("mobx");
|
|
5
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
6
|
+
// jbrowse
|
|
7
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
|
+
// locals
|
|
9
|
+
const getQuantitativeStats_1 = require("./getQuantitativeStats");
|
|
10
|
+
function getQuantitativeStatsAutorun(self) {
|
|
11
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
12
|
+
try {
|
|
13
|
+
const view = (0, util_1.getContainingView)(self);
|
|
14
|
+
const aborter = new AbortController();
|
|
15
|
+
self.setStatsLoading(aborter);
|
|
16
|
+
if (!self.quantitativeStatsReady) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const statsRegion = JSON.stringify(view.dynamicBlocks);
|
|
20
|
+
const wiggleStats = await (0, getQuantitativeStats_1.getQuantitativeStats)(self, {
|
|
21
|
+
signal: aborter.signal,
|
|
22
|
+
filters: [],
|
|
23
|
+
currStatsBpPerPx: view.bpPerPx,
|
|
24
|
+
...self.adapterProps(),
|
|
25
|
+
});
|
|
26
|
+
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
27
|
+
self.updateQuantitativeStats(wiggleStats, statsRegion);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
console.error(e);
|
|
32
|
+
if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(self)) {
|
|
33
|
+
self.setError(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, { delay: 1000 }));
|
|
37
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export default class WigglePlugin extends Plugin {
|
|
|
9
9
|
install(pm: PluginManager): void;
|
|
10
10
|
exports: {
|
|
11
11
|
LinearWiggleDisplayReactComponent: (props: {
|
|
12
|
-
model: import("./LinearWiggleDisplay/
|
|
12
|
+
model: import("./LinearWiggleDisplay/model").WiggleDisplayModel;
|
|
13
13
|
}) => import("react").JSX.Element;
|
|
14
14
|
XYPlotRendererReactComponent: (props: {
|
|
15
15
|
regions: import("@jbrowse/core/util/types").Region[];
|
|
@@ -84,5 +84,5 @@ export default class WigglePlugin extends Plugin {
|
|
|
84
84
|
export * from './util';
|
|
85
85
|
export { default as WiggleRendering } from './WiggleRendering';
|
|
86
86
|
export { Tooltip, ReactComponent as LinearWiggleDisplayReactComponent, modelFactory as linearWiggleDisplayModelFactory, } from './LinearWiggleDisplay';
|
|
87
|
-
export {
|
|
87
|
+
export type { TooltipContentsComponent } from './Tooltip';
|
|
88
88
|
export { default as WiggleBaseRenderer } from './WiggleBaseRenderer';
|
|
@@ -195,7 +195,9 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
195
195
|
message: string | undefined;
|
|
196
196
|
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
197
197
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
198
|
-
type: import("mobx-state-tree"
|
|
198
|
+
type: import("mobx-state-tree" /**
|
|
199
|
+
* #action
|
|
200
|
+
*/).ISimpleType<string>;
|
|
199
201
|
rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
|
|
200
202
|
}, {
|
|
201
203
|
rendererTypeName: string;
|
|
@@ -284,17 +286,28 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
284
286
|
renderSvg(opts: import("@jbrowse/plugin-linear-genome-view").ExportSvgDisplayOptions): Promise<import("react").JSX.Element>;
|
|
285
287
|
afterAttach(): void;
|
|
286
288
|
} & {
|
|
289
|
+
/**
|
|
290
|
+
* #volatile
|
|
291
|
+
*/
|
|
287
292
|
message: undefined | string;
|
|
293
|
+
/**
|
|
294
|
+
* #volatile
|
|
295
|
+
*/
|
|
288
296
|
stats: {
|
|
297
|
+
currStatsBpPerPx: number;
|
|
289
298
|
scoreMin: number;
|
|
290
299
|
scoreMax: number;
|
|
291
300
|
} | undefined;
|
|
301
|
+
/**
|
|
302
|
+
* #volatile
|
|
303
|
+
*/
|
|
292
304
|
statsFetchInProgress: undefined | AbortController;
|
|
293
305
|
} & {
|
|
294
306
|
/**
|
|
295
307
|
* #action
|
|
296
308
|
*/
|
|
297
309
|
updateQuantitativeStats(stats: {
|
|
310
|
+
currStatsBpPerPx: number;
|
|
298
311
|
scoreMin: number;
|
|
299
312
|
scoreMax: number;
|
|
300
313
|
}): void;
|
|
@@ -313,7 +326,7 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
313
326
|
/**
|
|
314
327
|
* #action
|
|
315
328
|
*/
|
|
316
|
-
|
|
329
|
+
setStatsLoading(aborter: AbortController): void;
|
|
317
330
|
/**
|
|
318
331
|
* #action
|
|
319
332
|
* this overrides the BaseLinearDisplayModel to avoid popping up a
|
|
@@ -436,6 +449,7 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
436
449
|
readonly scaleOpts: {
|
|
437
450
|
domain: number[] | undefined;
|
|
438
451
|
stats: {
|
|
452
|
+
currStatsBpPerPx: number;
|
|
439
453
|
scoreMin: number;
|
|
440
454
|
scoreMax: number;
|
|
441
455
|
} | undefined;
|
|
@@ -585,8 +599,8 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
585
599
|
};
|
|
586
600
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
|
|
587
601
|
}>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
|
|
588
|
-
type: string;
|
|
589
602
|
id: string;
|
|
603
|
+
type: string;
|
|
590
604
|
configuration: import("mobx-state-tree").ModelSnapshotType<Record<string, any>>;
|
|
591
605
|
heightPreConfig: number | undefined;
|
|
592
606
|
rpcDriverName: string | undefined;
|