@jbrowse/plugin-wiggle 2.16.0 → 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/BigWigAdapter/BigWigAdapter.js +2 -1
- package/dist/BigWigAdapter/configSchema.d.ts +8 -0
- package/dist/BigWigAdapter/configSchema.js +8 -0
- 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/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +52 -44
- 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/BigWigAdapter/BigWigAdapter.js +2 -1
- package/esm/BigWigAdapter/configSchema.d.ts +8 -0
- package/esm/BigWigAdapter/configSchema.js +8 -0
- 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/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +52 -44
- 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
|
@@ -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;
|
|
@@ -100,8 +100,17 @@ function SharedWiggleMixin(configSchema) {
|
|
|
100
100
|
configuration: (0, configuration_1.ConfigurationReference)(configSchema),
|
|
101
101
|
}))
|
|
102
102
|
.volatile(() => ({
|
|
103
|
+
/**
|
|
104
|
+
* #volatile
|
|
105
|
+
*/
|
|
103
106
|
message: undefined,
|
|
107
|
+
/**
|
|
108
|
+
* #volatile
|
|
109
|
+
*/
|
|
104
110
|
stats: undefined,
|
|
111
|
+
/**
|
|
112
|
+
* #volatile
|
|
113
|
+
*/
|
|
105
114
|
statsFetchInProgress: undefined,
|
|
106
115
|
}))
|
|
107
116
|
.actions(self => ({
|
|
@@ -109,14 +118,16 @@ function SharedWiggleMixin(configSchema) {
|
|
|
109
118
|
* #action
|
|
110
119
|
*/
|
|
111
120
|
updateQuantitativeStats(stats) {
|
|
112
|
-
const { scoreMin, scoreMax } = stats;
|
|
121
|
+
const { currStatsBpPerPx, scoreMin, scoreMax } = stats;
|
|
113
122
|
const EPSILON = 0.000001;
|
|
114
|
-
if (!self.stats
|
|
115
|
-
self.stats
|
|
116
|
-
}
|
|
117
|
-
else if (Math.abs(self.stats.scoreMax - scoreMax) > EPSILON ||
|
|
123
|
+
if (!self.stats ||
|
|
124
|
+
Math.abs(self.stats.scoreMax - scoreMax) > EPSILON ||
|
|
118
125
|
Math.abs(self.stats.scoreMin - scoreMin) > EPSILON) {
|
|
119
|
-
self.stats = {
|
|
126
|
+
self.stats = {
|
|
127
|
+
currStatsBpPerPx,
|
|
128
|
+
scoreMin,
|
|
129
|
+
scoreMax,
|
|
130
|
+
};
|
|
120
131
|
}
|
|
121
132
|
},
|
|
122
133
|
/**
|
|
@@ -140,10 +151,10 @@ function SharedWiggleMixin(configSchema) {
|
|
|
140
151
|
/**
|
|
141
152
|
* #action
|
|
142
153
|
*/
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
154
|
+
setStatsLoading(aborter) {
|
|
155
|
+
if (self.statsFetchInProgress !== undefined &&
|
|
156
|
+
!self.statsFetchInProgress.signal.aborted) {
|
|
157
|
+
self.statsFetchInProgress.abort();
|
|
147
158
|
}
|
|
148
159
|
self.statsFetchInProgress = aborter;
|
|
149
160
|
},
|
package/dist/util.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { QuantitativeStats } from '@jbrowse/core/util/stats';
|
|
2
|
-
import { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
1
|
export declare const YSCALEBAR_LABEL_OFFSET = 5;
|
|
4
2
|
export interface ScaleOpts {
|
|
5
3
|
domain: number[];
|
|
@@ -27,14 +25,15 @@ export interface Source {
|
|
|
27
25
|
*/
|
|
28
26
|
export declare function getScale({ domain, range, scaleType, pivotValue, inverted, }: ScaleOpts): import("d3-scale").ScaleLinear<number, number, never> | import("d3-scale").ScaleLogarithmic<number, number, never> | import("d3-scale").ScaleQuantize<number, never>;
|
|
29
27
|
/**
|
|
30
|
-
* gets the origin for drawing the graph. for linear this is 0, for log this is
|
|
28
|
+
* gets the origin for drawing the graph. for linear this is 0, for log this is
|
|
29
|
+
* arbitrarily set to log(1)==0
|
|
31
30
|
*
|
|
32
31
|
* @param scaleType -
|
|
33
32
|
*/
|
|
34
|
-
export declare function getOrigin(scaleType: string):
|
|
33
|
+
export declare function getOrigin(scaleType: string): 1 | 0;
|
|
35
34
|
/**
|
|
36
|
-
* produces a "nice" domain that actually rounds down to 0 for the min
|
|
37
|
-
*
|
|
35
|
+
* produces a "nice" domain that actually rounds down to 0 for the min or 0 to
|
|
36
|
+
* the max depending on if all values are positive or negative
|
|
38
37
|
*
|
|
39
38
|
* @param object - containing attributes
|
|
40
39
|
* - domain [min,max]
|
|
@@ -48,29 +47,6 @@ export declare function getNiceDomain({ scaleType, domain, bounds, }: {
|
|
|
48
47
|
domain: readonly [number, number];
|
|
49
48
|
bounds: readonly [number | undefined, number | undefined];
|
|
50
49
|
}): [number, number];
|
|
51
|
-
export declare function getQuantitativeStats(self: {
|
|
52
|
-
adapterConfig: AnyConfigurationModel;
|
|
53
|
-
configuration: AnyConfigurationModel;
|
|
54
|
-
autoscaleType: string;
|
|
55
|
-
setMessage: (str: string) => void;
|
|
56
|
-
}, opts: {
|
|
57
|
-
headers?: Record<string, string>;
|
|
58
|
-
signal?: AbortSignal;
|
|
59
|
-
filters: string[];
|
|
60
|
-
}): Promise<QuantitativeStats>;
|
|
61
|
-
export declare function quantitativeStatsAutorun(self: {
|
|
62
|
-
featureDensityStatsReady: boolean;
|
|
63
|
-
regionTooLarge: boolean;
|
|
64
|
-
error: unknown;
|
|
65
|
-
setLoading: (aborter: AbortController) => void;
|
|
66
|
-
setError: (error: unknown) => void;
|
|
67
|
-
updateQuantitativeStats: (stats: QuantitativeStats, statsRegion: string) => void;
|
|
68
|
-
renderProps: () => Record<string, unknown>;
|
|
69
|
-
configuration: AnyConfigurationModel;
|
|
70
|
-
adapterConfig: AnyConfigurationModel;
|
|
71
|
-
autoscaleType: string;
|
|
72
|
-
setMessage: (str: string) => void;
|
|
73
|
-
}): void;
|
|
74
50
|
export declare function toP(s?: number): number;
|
|
75
51
|
export declare function round(value: number): number;
|
|
76
52
|
export declare function fillRectCtx(x: number, y: number, width: number, height: number, ctx: CanvasRenderingContext2D, color?: string): void;
|
package/dist/util.js
CHANGED
|
@@ -4,17 +4,10 @@ exports.YSCALEBAR_LABEL_OFFSET = void 0;
|
|
|
4
4
|
exports.getScale = getScale;
|
|
5
5
|
exports.getOrigin = getOrigin;
|
|
6
6
|
exports.getNiceDomain = getNiceDomain;
|
|
7
|
-
exports.getQuantitativeStats = getQuantitativeStats;
|
|
8
|
-
exports.quantitativeStatsAutorun = quantitativeStatsAutorun;
|
|
9
7
|
exports.toP = toP;
|
|
10
8
|
exports.round = round;
|
|
11
9
|
exports.fillRectCtx = fillRectCtx;
|
|
12
10
|
const d3_scale_1 = require("@mui/x-charts-vendor/d3-scale");
|
|
13
|
-
const mobx_1 = require("mobx");
|
|
14
|
-
const util_1 = require("@jbrowse/core/util");
|
|
15
|
-
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
16
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
17
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
18
11
|
exports.YSCALEBAR_LABEL_OFFSET = 5;
|
|
19
12
|
/**
|
|
20
13
|
* produces a d3-scale from arguments. applies a "nice domain" adjustment
|
|
@@ -55,7 +48,8 @@ function getScale({ domain = [], range = [], scaleType, pivotValue, inverted, })
|
|
|
55
48
|
return scale;
|
|
56
49
|
}
|
|
57
50
|
/**
|
|
58
|
-
* gets the origin for drawing the graph. for linear this is 0, for log this is
|
|
51
|
+
* gets the origin for drawing the graph. for linear this is 0, for log this is
|
|
52
|
+
* arbitrarily set to log(1)==0
|
|
59
53
|
*
|
|
60
54
|
* @param scaleType -
|
|
61
55
|
*/
|
|
@@ -78,8 +72,8 @@ function getOrigin(scaleType /* , pivot, stats */) {
|
|
|
78
72
|
return 0;
|
|
79
73
|
}
|
|
80
74
|
/**
|
|
81
|
-
* produces a "nice" domain that actually rounds down to 0 for the min
|
|
82
|
-
*
|
|
75
|
+
* produces a "nice" domain that actually rounds down to 0 for the min or 0 to
|
|
76
|
+
* the max depending on if all values are positive or negative
|
|
83
77
|
*
|
|
84
78
|
* @param object - containing attributes
|
|
85
79
|
* - domain [min,max]
|
|
@@ -132,96 +126,6 @@ function getNiceDomain({ scaleType, domain, bounds, }) {
|
|
|
132
126
|
scale.nice();
|
|
133
127
|
return scale.domain();
|
|
134
128
|
}
|
|
135
|
-
async function getQuantitativeStats(self, opts) {
|
|
136
|
-
const { rpcManager } = (0, util_1.getSession)(self);
|
|
137
|
-
const numStdDev = (0, configuration_1.getConf)(self, 'numStdDev') || 3;
|
|
138
|
-
const { adapterConfig, autoscaleType } = self;
|
|
139
|
-
const sessionId = (0, tracks_1.getRpcSessionId)(self);
|
|
140
|
-
const params = {
|
|
141
|
-
sessionId,
|
|
142
|
-
adapterConfig,
|
|
143
|
-
statusCallback: (message) => {
|
|
144
|
-
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
145
|
-
self.setMessage(message);
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
...opts,
|
|
149
|
-
};
|
|
150
|
-
if (autoscaleType === 'global' || autoscaleType === 'globalsd') {
|
|
151
|
-
const results = (await rpcManager.call(sessionId, 'WiggleGetGlobalQuantitativeStats', params));
|
|
152
|
-
const { scoreMin, scoreMean, scoreStdDev } = results;
|
|
153
|
-
// globalsd uses heuristic to avoid unnecessary scoreMin<0
|
|
154
|
-
// if the scoreMin is never less than 0
|
|
155
|
-
// helps with most coverage bigwigs just being >0
|
|
156
|
-
return autoscaleType === 'globalsd'
|
|
157
|
-
? {
|
|
158
|
-
...results,
|
|
159
|
-
scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
|
|
160
|
-
scoreMax: scoreMean + numStdDev * scoreStdDev,
|
|
161
|
-
}
|
|
162
|
-
: results;
|
|
163
|
-
}
|
|
164
|
-
if (autoscaleType === 'local' || autoscaleType === 'localsd') {
|
|
165
|
-
const { dynamicBlocks, bpPerPx } = (0, util_1.getContainingView)(self);
|
|
166
|
-
const results = (await rpcManager.call(sessionId, 'WiggleGetMultiRegionQuantitativeStats', {
|
|
167
|
-
...params,
|
|
168
|
-
regions: dynamicBlocks.contentBlocks.map(region => {
|
|
169
|
-
const { start, end } = region;
|
|
170
|
-
return {
|
|
171
|
-
...JSON.parse(JSON.stringify(region)),
|
|
172
|
-
start: Math.floor(start),
|
|
173
|
-
end: Math.ceil(end),
|
|
174
|
-
};
|
|
175
|
-
}),
|
|
176
|
-
bpPerPx,
|
|
177
|
-
}));
|
|
178
|
-
const { scoreMin, scoreMean, scoreStdDev } = results;
|
|
179
|
-
// localsd uses heuristic to avoid unnecessary scoreMin<0 if the
|
|
180
|
-
// scoreMin is never less than 0 helps with most coverage bigwigs
|
|
181
|
-
// just being >0
|
|
182
|
-
return autoscaleType === 'localsd'
|
|
183
|
-
? {
|
|
184
|
-
...results,
|
|
185
|
-
scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
|
|
186
|
-
scoreMax: scoreMean + numStdDev * scoreStdDev,
|
|
187
|
-
}
|
|
188
|
-
: results;
|
|
189
|
-
}
|
|
190
|
-
if (autoscaleType === 'zscale') {
|
|
191
|
-
return rpcManager.call(sessionId, 'WiggleGetGlobalQuantitativeStats', params);
|
|
192
|
-
}
|
|
193
|
-
throw new Error(`invalid autoscaleType '${autoscaleType}'`);
|
|
194
|
-
}
|
|
195
|
-
function quantitativeStatsAutorun(self) {
|
|
196
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(async () => {
|
|
197
|
-
try {
|
|
198
|
-
const aborter = new AbortController();
|
|
199
|
-
const view = (0, util_1.getContainingView)(self);
|
|
200
|
-
self.setLoading(aborter);
|
|
201
|
-
if (!view.initialized ||
|
|
202
|
-
!self.featureDensityStatsReady ||
|
|
203
|
-
self.regionTooLarge ||
|
|
204
|
-
self.error) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
const statsRegion = JSON.stringify(view.dynamicBlocks);
|
|
208
|
-
const wiggleStats = await getQuantitativeStats(self, {
|
|
209
|
-
signal: aborter.signal,
|
|
210
|
-
filters: [],
|
|
211
|
-
...self.renderProps(),
|
|
212
|
-
});
|
|
213
|
-
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
214
|
-
self.updateQuantitativeStats(wiggleStats, statsRegion);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
catch (e) {
|
|
218
|
-
if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(self)) {
|
|
219
|
-
console.error(e);
|
|
220
|
-
self.setError(e);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}, { delay: 1000 }));
|
|
224
|
-
}
|
|
225
129
|
function toP(s = 0) {
|
|
226
130
|
return +(+s).toPrecision(6);
|
|
227
131
|
}
|
|
@@ -42,10 +42,11 @@ class BigWigAdapter extends BaseFeatureDataAdapter {
|
|
|
42
42
|
return ObservableCreate(async (observer) => {
|
|
43
43
|
statusCallback('Downloading bigwig data');
|
|
44
44
|
const source = this.getConf('source');
|
|
45
|
+
const resolutionMultiplier = this.getConf('resolutionMultiplier');
|
|
45
46
|
const { bigwig } = await this.setup(opts);
|
|
46
47
|
const feats = await bigwig.getFeatures(refName, start, end, {
|
|
47
48
|
...opts,
|
|
48
|
-
basesPerSpan: bpPerPx / resolution,
|
|
49
|
+
basesPerSpan: (bpPerPx / resolution) * resolutionMultiplier,
|
|
49
50
|
});
|
|
50
51
|
for (const data of feats) {
|
|
51
52
|
if (source) {
|
|
@@ -17,5 +17,13 @@ declare const BigWigAdapter: import("@jbrowse/core/configuration/configurationSc
|
|
|
17
17
|
defaultValue: string;
|
|
18
18
|
description: string;
|
|
19
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* #slot
|
|
22
|
+
*/
|
|
23
|
+
resolutionMultiplier: {
|
|
24
|
+
type: string;
|
|
25
|
+
defaultValue: number;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
20
28
|
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
21
29
|
export default BigWigAdapter;
|
|
@@ -22,5 +22,13 @@ const BigWigAdapter = ConfigurationSchema('BigWigAdapter', {
|
|
|
22
22
|
defaultValue: '',
|
|
23
23
|
description: 'Used for multiwiggle',
|
|
24
24
|
},
|
|
25
|
+
/**
|
|
26
|
+
* #slot
|
|
27
|
+
*/
|
|
28
|
+
resolutionMultiplier: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
defaultValue: 1,
|
|
31
|
+
description: 'Initial resolution multiplier',
|
|
32
|
+
},
|
|
25
33
|
}, { explicitlyTyped: true });
|
|
26
34
|
export default BigWigAdapter;
|
|
@@ -5,7 +5,7 @@ import Tooltip from '../../Tooltip';
|
|
|
5
5
|
import { toP } from '../../util';
|
|
6
6
|
const en = (n) => n.toLocaleString('en-US');
|
|
7
7
|
const TooltipContents = React.forwardRef(function TooltipContents2({ feature }, ref) {
|
|
8
|
-
const start = feature.get('start');
|
|
8
|
+
const start = feature.get('start') + 1;
|
|
9
9
|
const end = feature.get('end');
|
|
10
10
|
const refName = feature.get('refName');
|
|
11
11
|
const name = feature.get('name');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
2
|
import { types } from 'mobx-state-tree';
|
|
3
3
|
// locals
|
|
4
|
-
import sharedWiggleConfigFactory from '
|
|
4
|
+
import sharedWiggleConfigFactory from '../shared/SharedWiggleConfigSchema';
|
|
5
5
|
/**
|
|
6
6
|
* #config LinearWiggleDisplay
|
|
7
7
|
* extends
|
|
@@ -2,4 +2,4 @@ import PluginManager from '@jbrowse/core/PluginManager';
|
|
|
2
2
|
export default function LinearWiggleDisplayF(pluginManager: PluginManager): void;
|
|
3
3
|
export { default as Tooltip } from './components/Tooltip';
|
|
4
4
|
export { default as ReactComponent } from './components/WiggleDisplayComponent';
|
|
5
|
-
export { default as modelFactory } from './
|
|
5
|
+
export { default as modelFactory } from './model';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
|
|
2
|
-
import configSchemaFactory from './
|
|
3
|
-
import modelFactory from './
|
|
2
|
+
import configSchemaFactory from './configSchema';
|
|
3
|
+
import modelFactory from './model';
|
|
4
4
|
import { lazy } from 'react';
|
|
5
5
|
export default function LinearWiggleDisplayF(pluginManager) {
|
|
6
6
|
pluginManager.addDisplayType(() => {
|
|
@@ -19,4 +19,4 @@ export default function LinearWiggleDisplayF(pluginManager) {
|
|
|
19
19
|
}
|
|
20
20
|
export { default as Tooltip } from './components/Tooltip';
|
|
21
21
|
export { default as ReactComponent } from './components/WiggleDisplayComponent';
|
|
22
|
-
export { default as modelFactory } from './
|
|
22
|
+
export { default as modelFactory } from './model';
|
|
@@ -49,7 +49,9 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
49
49
|
reload: () => void;
|
|
50
50
|
message: React.ReactNode;
|
|
51
51
|
filled?: boolean;
|
|
52
|
-
status
|
|
52
|
+
status? /**
|
|
53
|
+
* #getter
|
|
54
|
+
*/: string;
|
|
53
55
|
reactElement?: React.ReactElement;
|
|
54
56
|
};
|
|
55
57
|
}) => import("react").JSX.Element | undefined;
|
|
@@ -145,9 +147,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
145
147
|
error: unknown;
|
|
146
148
|
message: string | undefined;
|
|
147
149
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
148
|
-
onHorizontalScroll
|
|
149
|
-
* #getter
|
|
150
|
-
*/: () => void;
|
|
150
|
+
onHorizontalScroll?: () => void;
|
|
151
151
|
blockState?: Record<string, any>;
|
|
152
152
|
}>;
|
|
153
153
|
readonly DisplayBlurb: React.FC<{
|
|
@@ -252,19 +252,21 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
252
252
|
} & {
|
|
253
253
|
message: undefined | string;
|
|
254
254
|
stats: {
|
|
255
|
+
currStatsBpPerPx: number;
|
|
255
256
|
scoreMin: number;
|
|
256
257
|
scoreMax: number;
|
|
257
258
|
} | undefined;
|
|
258
259
|
statsFetchInProgress: undefined | AbortController;
|
|
259
260
|
} & {
|
|
260
261
|
updateQuantitativeStats(stats: {
|
|
262
|
+
currStatsBpPerPx: number;
|
|
261
263
|
scoreMin: number;
|
|
262
264
|
scoreMax: number;
|
|
263
265
|
}): void;
|
|
264
266
|
setColor(color?: string): void;
|
|
265
267
|
setPosColor(color?: string): void;
|
|
266
268
|
setNegColor(color?: string): void;
|
|
267
|
-
|
|
269
|
+
setStatsLoading(aborter: AbortController): void;
|
|
268
270
|
selectFeature(feature: import("@jbrowse/core/util").Feature): void;
|
|
269
271
|
setResolution(res: number): void;
|
|
270
272
|
setFill(fill: number): void;
|
|
@@ -306,6 +308,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
306
308
|
readonly scaleOpts: {
|
|
307
309
|
domain: number[] | undefined;
|
|
308
310
|
stats: {
|
|
311
|
+
currStatsBpPerPx: number;
|
|
309
312
|
scoreMin: number;
|
|
310
313
|
scoreMax: number;
|
|
311
314
|
} | undefined;
|
|
@@ -350,7 +353,16 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
350
353
|
* #getter
|
|
351
354
|
*/
|
|
352
355
|
readonly rendererTypeName: string;
|
|
356
|
+
/**
|
|
357
|
+
* #getter
|
|
358
|
+
* unused currently
|
|
359
|
+
*/
|
|
360
|
+
readonly quantitativeStatsRelevantToCurrentZoom: boolean;
|
|
353
361
|
} & {
|
|
362
|
+
/**
|
|
363
|
+
* #method
|
|
364
|
+
*/
|
|
365
|
+
adapterProps(): any;
|
|
354
366
|
/**
|
|
355
367
|
* #getter
|
|
356
368
|
*/
|
|
@@ -372,7 +384,11 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
372
384
|
/**
|
|
373
385
|
* #getter
|
|
374
386
|
*/
|
|
375
|
-
readonly fillSetting: 2 |
|
|
387
|
+
readonly fillSetting: 2 | 1 | 0;
|
|
388
|
+
/**
|
|
389
|
+
* #getter
|
|
390
|
+
*/
|
|
391
|
+
readonly quantitativeStatsReady: boolean;
|
|
376
392
|
} & {
|
|
377
393
|
/**
|
|
378
394
|
* #method
|