@jbrowse/plugin-wiggle 3.1.0 → 3.3.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 +1 -1
- package/dist/LinearWiggleDisplay/model.d.ts +10 -10
- package/dist/MultiDensityRenderer/MultiDensityRenderer.js +2 -2
- package/dist/MultiLineRenderer/MultiLineRenderer.js +2 -2
- package/dist/MultiLinearWiggleDisplay/components/SourcesGrid.js +4 -4
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialog.d.ts +6 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialog.js +29 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogAuto.d.ts +7 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogAuto.js +79 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogManual.d.ts +7 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogManual.js +145 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/types.d.ts +7 -0
- package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/types.js +2 -0
- package/dist/MultiLinearWiggleDisplay/components/util.d.ts +3 -2
- package/dist/MultiLinearWiggleDisplay/model.d.ts +15 -9
- package/dist/MultiLinearWiggleDisplay/model.js +29 -15
- package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js +2 -2
- package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +2 -2
- package/dist/MultiXYPlotRenderer/MultiXYPlotRenderer.js +3 -3
- package/dist/WiggleBaseRenderer.d.ts +1 -0
- package/dist/WiggleBaseRenderer.js +4 -4
- package/dist/WiggleRPC/MultiWiggleClusterScoreMatrix.d.ts +14 -0
- package/dist/WiggleRPC/MultiWiggleClusterScoreMatrix.js +31 -0
- package/dist/WiggleRPC/MultiWiggleGetScoreMatrix.d.ts +2 -13
- package/dist/WiggleRPC/MultiWiggleGetScoreMatrix.js +5 -37
- package/dist/WiggleRPC/getScoreMatrix.d.ts +6 -0
- package/dist/WiggleRPC/getScoreMatrix.js +35 -0
- package/dist/WiggleRPC/rpcMethods.d.ts +1 -0
- package/dist/WiggleRPC/rpcMethods.js +1 -0
- package/dist/WiggleRPC/type.d.ts +0 -0
- package/dist/WiggleRPC/type.js +1 -0
- package/dist/WiggleRPC/types.d.ts +13 -0
- package/dist/WiggleRPC/types.js +2 -0
- package/dist/drawDensity.d.ts +1 -0
- package/dist/drawDensity.js +12 -2
- package/dist/drawLine.d.ts +1 -0
- package/dist/drawLine.js +9 -3
- package/dist/drawXY.js +8 -8
- package/dist/index.js +1 -0
- package/dist/shared/SharedWiggleMixin.d.ts +8 -8
- package/dist/shared/SharedWiggleMixin.js +11 -8
- package/esm/BigWigAdapter/BigWigAdapter.js +1 -1
- package/esm/LinearWiggleDisplay/model.d.ts +10 -10
- package/esm/MultiDensityRenderer/MultiDensityRenderer.js +3 -3
- package/esm/MultiLineRenderer/MultiLineRenderer.js +3 -3
- package/esm/MultiLinearWiggleDisplay/components/SourcesGrid.js +4 -4
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialog.d.ts +6 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialog.js +24 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogAuto.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogAuto.js +77 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogManual.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogManual.js +140 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/types.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/types.js +1 -0
- package/esm/MultiLinearWiggleDisplay/components/util.d.ts +3 -2
- package/esm/MultiLinearWiggleDisplay/model.d.ts +15 -9
- package/esm/MultiLinearWiggleDisplay/model.js +29 -15
- package/esm/MultiRowLineRenderer/MultiRowLineRenderer.js +3 -3
- package/esm/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +3 -3
- package/esm/MultiXYPlotRenderer/MultiXYPlotRenderer.js +4 -4
- package/esm/WiggleBaseRenderer.d.ts +1 -0
- package/esm/WiggleBaseRenderer.js +5 -5
- package/esm/WiggleRPC/MultiWiggleClusterScoreMatrix.d.ts +14 -0
- package/esm/WiggleRPC/MultiWiggleClusterScoreMatrix.js +24 -0
- package/esm/WiggleRPC/MultiWiggleGetScoreMatrix.d.ts +2 -13
- package/esm/WiggleRPC/MultiWiggleGetScoreMatrix.js +5 -37
- package/esm/WiggleRPC/getScoreMatrix.d.ts +6 -0
- package/esm/WiggleRPC/getScoreMatrix.js +32 -0
- package/esm/WiggleRPC/rpcMethods.d.ts +1 -0
- package/esm/WiggleRPC/rpcMethods.js +1 -0
- package/esm/WiggleRPC/type.d.ts +0 -0
- package/esm/WiggleRPC/type.js +1 -0
- package/esm/WiggleRPC/types.d.ts +13 -0
- package/esm/WiggleRPC/types.js +1 -0
- package/esm/drawDensity.d.ts +1 -0
- package/esm/drawDensity.js +12 -2
- package/esm/drawLine.d.ts +1 -0
- package/esm/drawLine.js +9 -3
- package/esm/drawXY.js +8 -8
- package/esm/index.js +2 -1
- package/esm/shared/SharedWiggleMixin.d.ts +8 -8
- package/esm/shared/SharedWiggleMixin.js +11 -8
- package/package.json +9 -9
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog.d.ts +0 -11
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog.js +0 -115
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog.d.ts +0 -11
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog.js +0 -109
|
@@ -1,47 +1,15 @@
|
|
|
1
|
-
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
2
1
|
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
3
|
-
import {
|
|
4
|
-
import { firstValueFrom, toArray } from 'rxjs';
|
|
2
|
+
import { getScoreMatrix } from './getScoreMatrix';
|
|
5
3
|
export class MultiWiggleGetScoreMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
6
4
|
constructor() {
|
|
7
5
|
super(...arguments);
|
|
8
6
|
this.name = 'MultiWiggleGetScoreMatrix';
|
|
9
7
|
}
|
|
10
8
|
async execute(args, rpcDriverClassName) {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const pm = this.pluginManager;
|
|
13
9
|
const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const bpScale = bpPerPx / resolution;
|
|
19
|
-
const r0 = regions[0];
|
|
20
|
-
const r0len = r0.end - r0.start;
|
|
21
|
-
const w = Math.floor(r0len / bpScale);
|
|
22
|
-
const feats = await firstValueFrom(dataAdapter.getFeatures(r0, deserializedArgs).pipe(toArray()));
|
|
23
|
-
const groups = groupBy(feats, f => f.get('source'));
|
|
24
|
-
const rows = {};
|
|
25
|
-
for (const source of sources) {
|
|
26
|
-
const { name } = source;
|
|
27
|
-
const features = groups[name] || [];
|
|
28
|
-
for (const feat of features) {
|
|
29
|
-
if (!rows[name]) {
|
|
30
|
-
rows[name] = {
|
|
31
|
-
name,
|
|
32
|
-
scores: new Array(w),
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
const fstart = feat.get('start');
|
|
36
|
-
const fend = feat.get('end');
|
|
37
|
-
const score = feat.get('score');
|
|
38
|
-
for (let i = fstart; i < fend; i += bpScale) {
|
|
39
|
-
if (i > r0.start && i < r0.end) {
|
|
40
|
-
(_a = rows[name].scores)[_b = Math.floor((i - r0.start) / bpScale)] || (_a[_b] = score);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return rows;
|
|
10
|
+
return getScoreMatrix({
|
|
11
|
+
args: deserializedArgs,
|
|
12
|
+
pluginManager: this.pluginManager,
|
|
13
|
+
});
|
|
46
14
|
}
|
|
47
15
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GetScoreMatrixArgs } from './types';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
|
+
export declare function getScoreMatrix({ pluginManager, args, }: {
|
|
4
|
+
args: GetScoreMatrixArgs;
|
|
5
|
+
pluginManager: PluginManager;
|
|
6
|
+
}): Promise<Record<string, number[]>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
2
|
+
import { groupBy } from '@jbrowse/core/util';
|
|
3
|
+
import { firstValueFrom, toArray } from 'rxjs';
|
|
4
|
+
export async function getScoreMatrix({ pluginManager, args, }) {
|
|
5
|
+
const { sources, regions, adapterConfig, sessionId, bpPerPx } = args;
|
|
6
|
+
const adapter = await getAdapter(pluginManager, sessionId, adapterConfig);
|
|
7
|
+
const dataAdapter = adapter.dataAdapter;
|
|
8
|
+
const r0 = regions[0];
|
|
9
|
+
const r0len = r0.end - r0.start;
|
|
10
|
+
const w = Math.floor(r0len / bpPerPx);
|
|
11
|
+
const feats = await firstValueFrom(dataAdapter.getFeatures(r0, args).pipe(toArray()));
|
|
12
|
+
const groups = groupBy(feats, f => f.get('source'));
|
|
13
|
+
const rows = {};
|
|
14
|
+
for (const source of sources) {
|
|
15
|
+
const { name } = source;
|
|
16
|
+
const features = groups[name] || [];
|
|
17
|
+
const arr = new Array(w).fill(0);
|
|
18
|
+
for (const feat of features) {
|
|
19
|
+
const fstart = feat.get('start');
|
|
20
|
+
const fend = feat.get('end');
|
|
21
|
+
const score = feat.get('score');
|
|
22
|
+
for (let i = fstart; i < fend; i += bpPerPx) {
|
|
23
|
+
const x = Math.floor((i - r0.start) / bpPerPx);
|
|
24
|
+
if (x >= 0 && x < w) {
|
|
25
|
+
arr[x] || (arr[x] = score);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
rows[name] = arr;
|
|
30
|
+
}
|
|
31
|
+
return rows;
|
|
32
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Source } from '../util';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import type { Region } from '@jbrowse/core/util';
|
|
4
|
+
export interface GetScoreMatrixArgs {
|
|
5
|
+
adapterConfig: AnyConfigurationModel;
|
|
6
|
+
stopToken?: string;
|
|
7
|
+
sessionId: string;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
regions: Region[];
|
|
10
|
+
bpPerPx: number;
|
|
11
|
+
sources: Source[];
|
|
12
|
+
statusCallback?: (arg: string) => void;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/drawDensity.d.ts
CHANGED
package/esm/drawDensity.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
2
2
|
import { featureSpanPx } from '@jbrowse/core/util';
|
|
3
|
+
import { checkStopToken } from '@jbrowse/core/util/stopToken';
|
|
3
4
|
import { fillRectCtx, getScale } from './util';
|
|
4
5
|
const fudgeFactor = 0.3;
|
|
5
6
|
const clipHeight = 2;
|
|
6
7
|
export function drawDensity(ctx, props) {
|
|
7
|
-
const { features, regions, bpPerPx, scaleOpts, height, config } = props;
|
|
8
|
+
const { stopToken, features, regions, bpPerPx, scaleOpts, height, config } = props;
|
|
8
9
|
const region = regions[0];
|
|
9
10
|
const pivot = readConfObject(config, 'bicolorPivot');
|
|
10
11
|
const pivotValue = readConfObject(config, 'bicolorPivotValue');
|
|
@@ -16,7 +17,7 @@ export function drawDensity(ctx, props) {
|
|
|
16
17
|
const scale = getScale({
|
|
17
18
|
...scaleOpts,
|
|
18
19
|
pivotValue: crossing ? pivotValue : undefined,
|
|
19
|
-
range: crossing ? [negColor, '
|
|
20
|
+
range: crossing ? [negColor, '#eee', posColor] : ['#eee', posColor],
|
|
20
21
|
});
|
|
21
22
|
const scale2 = getScale({ ...scaleOpts, range: [0, height] });
|
|
22
23
|
const cb = color === '#f0f'
|
|
@@ -28,7 +29,12 @@ export function drawDensity(ctx, props) {
|
|
|
28
29
|
let prevLeftPx = Number.NEGATIVE_INFINITY;
|
|
29
30
|
let hasClipping = false;
|
|
30
31
|
const reducedFeatures = [];
|
|
32
|
+
let start = performance.now();
|
|
31
33
|
for (const feature of features.values()) {
|
|
34
|
+
if (performance.now() - start > 400) {
|
|
35
|
+
checkStopToken(stopToken);
|
|
36
|
+
start = performance.now();
|
|
37
|
+
}
|
|
32
38
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
33
39
|
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
34
40
|
reducedFeatures.push(feature);
|
|
@@ -44,6 +50,10 @@ export function drawDensity(ctx, props) {
|
|
|
44
50
|
if (hasClipping) {
|
|
45
51
|
ctx.fillStyle = clipColor;
|
|
46
52
|
for (const feature of features.values()) {
|
|
53
|
+
if (performance.now() - start > 400) {
|
|
54
|
+
checkStopToken(stopToken);
|
|
55
|
+
start = performance.now();
|
|
56
|
+
}
|
|
47
57
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
48
58
|
const w = rightPx - leftPx + fudgeFactor;
|
|
49
59
|
const score = feature.get('score');
|
package/esm/drawLine.d.ts
CHANGED
package/esm/drawLine.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
2
2
|
import { clamp, featureSpanPx } from '@jbrowse/core/util';
|
|
3
|
+
import { checkStopToken } from '@jbrowse/core/util/stopToken';
|
|
3
4
|
import { getScale } from './util';
|
|
4
5
|
const fudgeFactor = 0.3;
|
|
5
6
|
const clipHeight = 2;
|
|
6
7
|
export function drawLine(ctx, props) {
|
|
7
|
-
const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, } = props;
|
|
8
|
+
const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, stopToken, } = props;
|
|
8
9
|
const region = regions[0];
|
|
9
10
|
const width = (region.end - region.start) / bpPerPx;
|
|
10
11
|
const height = unadjustedHeight - offset * 2;
|
|
@@ -17,7 +18,12 @@ export function drawLine(ctx, props) {
|
|
|
17
18
|
let lastVal;
|
|
18
19
|
let prevLeftPx = Number.NEGATIVE_INFINITY;
|
|
19
20
|
const reducedFeatures = [];
|
|
21
|
+
let start = performance.now();
|
|
20
22
|
for (const feature of features.values()) {
|
|
23
|
+
if (performance.now() - start > 400) {
|
|
24
|
+
checkStopToken(stopToken);
|
|
25
|
+
start = performance.now();
|
|
26
|
+
}
|
|
21
27
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
22
28
|
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
23
29
|
reducedFeatures.push(feature);
|
|
@@ -55,12 +61,12 @@ export function drawLine(ctx, props) {
|
|
|
55
61
|
if (displayCrossHatches) {
|
|
56
62
|
ctx.lineWidth = 1;
|
|
57
63
|
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
58
|
-
|
|
64
|
+
for (const tick of values) {
|
|
59
65
|
ctx.beginPath();
|
|
60
66
|
ctx.moveTo(0, Math.round(toY(tick)));
|
|
61
67
|
ctx.lineTo(width, Math.round(toY(tick)));
|
|
62
68
|
ctx.stroke();
|
|
63
|
-
}
|
|
69
|
+
}
|
|
64
70
|
}
|
|
65
71
|
return { reducedFeatures };
|
|
66
72
|
}
|
package/esm/drawXY.js
CHANGED
|
@@ -22,7 +22,7 @@ function darken(color, amount) {
|
|
|
22
22
|
const fudgeFactor = 0.3;
|
|
23
23
|
const clipHeight = 2;
|
|
24
24
|
export function drawXY(ctx, props) {
|
|
25
|
-
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, inverted, } = props;
|
|
25
|
+
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, inverted, stopToken, } = props;
|
|
26
26
|
const region = regions[0];
|
|
27
27
|
const width = (region.end - region.start) / bpPerPx;
|
|
28
28
|
const height = unadjustedHeight - offset * 2;
|
|
@@ -50,7 +50,7 @@ export function drawXY(ctx, props) {
|
|
|
50
50
|
start = performance.now();
|
|
51
51
|
for (const feature of features.values()) {
|
|
52
52
|
if (performance.now() - start > 400) {
|
|
53
|
-
checkStopToken();
|
|
53
|
+
checkStopToken(stopToken);
|
|
54
54
|
start = performance.now();
|
|
55
55
|
}
|
|
56
56
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
@@ -72,7 +72,7 @@ export function drawXY(ctx, props) {
|
|
|
72
72
|
start = performance.now();
|
|
73
73
|
for (const feature of features.values()) {
|
|
74
74
|
if (performance.now() - start > 400) {
|
|
75
|
-
checkStopToken();
|
|
75
|
+
checkStopToken(stopToken);
|
|
76
76
|
start = performance.now();
|
|
77
77
|
}
|
|
78
78
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
@@ -102,7 +102,7 @@ export function drawXY(ctx, props) {
|
|
|
102
102
|
start = performance.now();
|
|
103
103
|
for (const feature of features.values()) {
|
|
104
104
|
if (performance.now() - start > 400) {
|
|
105
|
-
checkStopToken();
|
|
105
|
+
checkStopToken(stopToken);
|
|
106
106
|
start = performance.now();
|
|
107
107
|
}
|
|
108
108
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
@@ -124,7 +124,7 @@ export function drawXY(ctx, props) {
|
|
|
124
124
|
start = performance.now();
|
|
125
125
|
for (const feature of features.values()) {
|
|
126
126
|
if (performance.now() - start > 400) {
|
|
127
|
-
checkStopToken();
|
|
127
|
+
checkStopToken(stopToken);
|
|
128
128
|
start = performance.now();
|
|
129
129
|
}
|
|
130
130
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
@@ -155,7 +155,7 @@ export function drawXY(ctx, props) {
|
|
|
155
155
|
start = performance.now();
|
|
156
156
|
for (const feature of features.values()) {
|
|
157
157
|
if (performance.now() - start > 400) {
|
|
158
|
-
checkStopToken();
|
|
158
|
+
checkStopToken(stopToken);
|
|
159
159
|
start = performance.now();
|
|
160
160
|
}
|
|
161
161
|
const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
|
|
@@ -173,12 +173,12 @@ export function drawXY(ctx, props) {
|
|
|
173
173
|
if (displayCrossHatches) {
|
|
174
174
|
ctx.lineWidth = 1;
|
|
175
175
|
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
176
|
-
ticks.values
|
|
176
|
+
for (const tick of ticks.values) {
|
|
177
177
|
ctx.beginPath();
|
|
178
178
|
ctx.moveTo(0, Math.round(toY(tick)));
|
|
179
179
|
ctx.lineTo(width, Math.round(toY(tick)));
|
|
180
180
|
ctx.stroke();
|
|
181
|
-
}
|
|
181
|
+
}
|
|
182
182
|
}
|
|
183
183
|
return { reducedFeatures };
|
|
184
184
|
}
|
package/esm/index.js
CHANGED
|
@@ -16,7 +16,7 @@ import MultiWiggleAddTrackWorkflowF from './MultiWiggleAddTrackWorkflow';
|
|
|
16
16
|
import MultiXYPlotRendererF from './MultiXYPlotRenderer';
|
|
17
17
|
import QuantitativeTrackF from './QuantitativeTrack';
|
|
18
18
|
import WiggleBaseRenderer from './WiggleBaseRenderer';
|
|
19
|
-
import { MultiWiggleGetScoreMatrix, MultiWiggleGetSources, WiggleGetGlobalQuantitativeStats, WiggleGetMultiRegionQuantitativeStats, } from './WiggleRPC/rpcMethods';
|
|
19
|
+
import { MultiWiggleClusterScoreMatrix, MultiWiggleGetScoreMatrix, MultiWiggleGetSources, WiggleGetGlobalQuantitativeStats, WiggleGetMultiRegionQuantitativeStats, } from './WiggleRPC/rpcMethods';
|
|
20
20
|
import XYPlotRendererF, { ReactComponent as XYPlotRendererReactComponent, XYPlotRenderer, configSchema as xyPlotRendererConfigSchema, } from './XYPlotRenderer';
|
|
21
21
|
import * as utils from './util';
|
|
22
22
|
export default class WigglePlugin extends Plugin {
|
|
@@ -55,6 +55,7 @@ export default class WigglePlugin extends Plugin {
|
|
|
55
55
|
pm.addRpcMethod(() => new WiggleGetMultiRegionQuantitativeStats(pm));
|
|
56
56
|
pm.addRpcMethod(() => new MultiWiggleGetSources(pm));
|
|
57
57
|
pm.addRpcMethod(() => new MultiWiggleGetScoreMatrix(pm));
|
|
58
|
+
pm.addRpcMethod(() => new MultiWiggleClusterScoreMatrix(pm));
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
export * from './util';
|
|
@@ -252,11 +252,11 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
252
252
|
setCrossHatches(cross: boolean): void;
|
|
253
253
|
} & {
|
|
254
254
|
readonly adapterTypeName: any;
|
|
255
|
-
readonly rendererTypeNameSimple:
|
|
255
|
+
readonly rendererTypeNameSimple: string;
|
|
256
256
|
readonly filters: undefined;
|
|
257
|
-
readonly scaleType:
|
|
258
|
-
readonly maxScore:
|
|
259
|
-
readonly minScore:
|
|
257
|
+
readonly scaleType: string;
|
|
258
|
+
readonly maxScore: number;
|
|
259
|
+
readonly minScore: number;
|
|
260
260
|
} & {
|
|
261
261
|
readonly adapterCapabilities: string[];
|
|
262
262
|
readonly rendererConfig: {
|
|
@@ -270,7 +270,7 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
270
270
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
|
|
271
271
|
} & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
|
|
272
272
|
} & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
|
|
273
|
-
readonly autoscaleType:
|
|
273
|
+
readonly autoscaleType: string;
|
|
274
274
|
} & {
|
|
275
275
|
readonly domain: number[] | undefined;
|
|
276
276
|
} & {
|
|
@@ -283,9 +283,9 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
|
|
|
283
283
|
scoreMin: number;
|
|
284
284
|
scoreMax: number;
|
|
285
285
|
} | undefined;
|
|
286
|
-
autoscaleType:
|
|
287
|
-
scaleType:
|
|
288
|
-
inverted:
|
|
286
|
+
autoscaleType: string;
|
|
287
|
+
scaleType: string;
|
|
288
|
+
inverted: boolean;
|
|
289
289
|
};
|
|
290
290
|
readonly canHaveFill: boolean;
|
|
291
291
|
readonly displayCrossHatchesSetting: boolean;
|
|
@@ -118,7 +118,7 @@ export default function SharedWiggleMixin(configSchema) {
|
|
|
118
118
|
},
|
|
119
119
|
get rendererTypeNameSimple() {
|
|
120
120
|
var _a;
|
|
121
|
-
return (_a = self.rendererTypeNameState) !== null && _a !== void 0 ? _a : getConf(self, 'defaultRendering');
|
|
121
|
+
return ((_a = self.rendererTypeNameState) !== null && _a !== void 0 ? _a : getConf(self, 'defaultRendering'));
|
|
122
122
|
},
|
|
123
123
|
get filters() {
|
|
124
124
|
return undefined;
|
|
@@ -189,12 +189,12 @@ export default function SharedWiggleMixin(configSchema) {
|
|
|
189
189
|
})
|
|
190
190
|
.views(self => ({
|
|
191
191
|
get filled() {
|
|
192
|
-
|
|
193
|
-
return fill !== null &&
|
|
192
|
+
var _a;
|
|
193
|
+
return ((_a = self.fill) !== null && _a !== void 0 ? _a : readConfObject(self.rendererConfig, 'filled'));
|
|
194
194
|
},
|
|
195
195
|
get summaryScoreModeSetting() {
|
|
196
|
-
|
|
197
|
-
return
|
|
196
|
+
var _a;
|
|
197
|
+
return ((_a = self.summaryScoreMode) !== null && _a !== void 0 ? _a : readConfObject(self.rendererConfig, 'summaryScoreMode'));
|
|
198
198
|
},
|
|
199
199
|
get scaleOpts() {
|
|
200
200
|
return {
|
|
@@ -209,8 +209,8 @@ export default function SharedWiggleMixin(configSchema) {
|
|
|
209
209
|
return self.rendererTypeName === 'XYPlotRenderer';
|
|
210
210
|
},
|
|
211
211
|
get displayCrossHatchesSetting() {
|
|
212
|
-
|
|
213
|
-
return
|
|
212
|
+
var _a;
|
|
213
|
+
return ((_a = self.displayCrossHatches) !== null && _a !== void 0 ? _a : readConfObject(self.rendererConfig, 'displayCrossHatches'));
|
|
214
214
|
},
|
|
215
215
|
get hasResolution() {
|
|
216
216
|
return self.adapterCapabilities.includes('hasResolution');
|
|
@@ -285,7 +285,10 @@ export default function SharedWiggleMixin(configSchema) {
|
|
|
285
285
|
onClick: () => {
|
|
286
286
|
getSession(self).queueDialog(handleClose => [
|
|
287
287
|
SetMinMaxDialog,
|
|
288
|
-
{
|
|
288
|
+
{
|
|
289
|
+
model: self,
|
|
290
|
+
handleClose,
|
|
291
|
+
},
|
|
289
292
|
]);
|
|
290
293
|
},
|
|
291
294
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-wiggle",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "JBrowse 2 wiggle adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@gmod/bbi": "^6.0.0",
|
|
40
|
-
"@jbrowse/core": "^3.
|
|
41
|
-
"@jbrowse/plugin-data-management": "^3.
|
|
42
|
-
"@jbrowse/plugin-linear-genome-view": "^3.
|
|
43
|
-
"@mui/icons-material": "^
|
|
44
|
-
"@mui/material": "^
|
|
45
|
-
"@mui/x-charts-vendor": "^
|
|
46
|
-
"@mui/x-data-grid": "^
|
|
40
|
+
"@jbrowse/core": "^3.3.0",
|
|
41
|
+
"@jbrowse/plugin-data-management": "^3.3.0",
|
|
42
|
+
"@jbrowse/plugin-linear-genome-view": "^3.3.0",
|
|
43
|
+
"@mui/icons-material": "^7.0.0",
|
|
44
|
+
"@mui/material": "^7.0.0",
|
|
45
|
+
"@mui/x-charts-vendor": "^8.0.0",
|
|
46
|
+
"@mui/x-data-grid": "^8.0.0",
|
|
47
47
|
"fast-deep-equal": "^3.1.3",
|
|
48
48
|
"mobx": "^6.0.0",
|
|
49
49
|
"mobx-react": "^9.0.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"distModule": "esm/index.js",
|
|
63
63
|
"srcModule": "src/index.ts",
|
|
64
64
|
"module": "esm/index.js",
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "0bb64d8cc7ecdd167515308b31eec3d9acbc59e4"
|
|
66
66
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Source } from '../types';
|
|
2
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
-
export default function ClusterDialog({ model, handleClose, }: {
|
|
4
|
-
model: {
|
|
5
|
-
sources?: Source[];
|
|
6
|
-
minorAlleleFrequencyFilter?: number;
|
|
7
|
-
adapterConfig: AnyConfigurationModel;
|
|
8
|
-
setLayout: (arg: Source[]) => void;
|
|
9
|
-
};
|
|
10
|
-
handleClose: () => void;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = ClusterDialog;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
10
|
-
const util_1 = require("@jbrowse/core/util");
|
|
11
|
-
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
12
|
-
const material_1 = require("@mui/material");
|
|
13
|
-
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
14
|
-
const file_saver_1 = require("file-saver");
|
|
15
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
16
|
-
const mui_1 = require("tss-react/mui");
|
|
17
|
-
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
18
|
-
textAreaFont: {
|
|
19
|
-
fontFamily: 'Courier New',
|
|
20
|
-
},
|
|
21
|
-
mgap: {
|
|
22
|
-
display: 'flex',
|
|
23
|
-
flexDirection: 'column',
|
|
24
|
-
gap: theme.spacing(4),
|
|
25
|
-
},
|
|
26
|
-
}));
|
|
27
|
-
function ClusterDialog({ model, handleClose, }) {
|
|
28
|
-
const { classes } = useStyles();
|
|
29
|
-
const [results, setResults] = (0, react_1.useState)();
|
|
30
|
-
const [error, setError] = (0, react_1.useState)();
|
|
31
|
-
const [paste, setPaste] = (0, react_1.useState)('');
|
|
32
|
-
const [useCompleteMethod, setUseCompleteMethod] = (0, react_1.useState)(false);
|
|
33
|
-
(0, react_1.useEffect)(() => {
|
|
34
|
-
;
|
|
35
|
-
(async () => {
|
|
36
|
-
try {
|
|
37
|
-
setError(undefined);
|
|
38
|
-
const view = (0, util_1.getContainingView)(model);
|
|
39
|
-
if (!view.initialized) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const { rpcManager } = (0, util_1.getSession)(model);
|
|
43
|
-
const { sources, minorAlleleFrequencyFilter, adapterConfig } = model;
|
|
44
|
-
const sessionId = (0, tracks_1.getRpcSessionId)(model);
|
|
45
|
-
const { bpPerPx } = view;
|
|
46
|
-
const ret = (await rpcManager.call(sessionId, 'MultiWiggleGetScoreMatrix', {
|
|
47
|
-
regions: view.dynamicBlocks.contentBlocks,
|
|
48
|
-
sources,
|
|
49
|
-
minorAlleleFrequencyFilter,
|
|
50
|
-
sessionId,
|
|
51
|
-
adapterConfig,
|
|
52
|
-
bpPerPx,
|
|
53
|
-
}));
|
|
54
|
-
const entries = Object.values(ret);
|
|
55
|
-
const keys = Object.keys(ret);
|
|
56
|
-
const clusterMethod = useCompleteMethod ? 'complete' : 'single';
|
|
57
|
-
const text = `try(library(fastcluster), silent=TRUE)
|
|
58
|
-
inputMatrix<-matrix(c(${entries.map(val => val.scores.join(',')).join(',\n')}
|
|
59
|
-
),nrow=${entries.length},byrow=TRUE)
|
|
60
|
-
rownames(inputMatrix)<-c(${keys.map(key => `'${key}'`).join(',')})
|
|
61
|
-
resultClusters<-hclust(dist(inputMatrix), method='${clusterMethod}')
|
|
62
|
-
cat(resultClusters$order,sep='\\n')`;
|
|
63
|
-
setResults(text);
|
|
64
|
-
}
|
|
65
|
-
catch (e) {
|
|
66
|
-
if (!(0, util_1.isAbortException)(e) && (0, mobx_state_tree_1.isAlive)(model)) {
|
|
67
|
-
console.error(e);
|
|
68
|
-
setError(e);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
})();
|
|
72
|
-
}, [model, useCompleteMethod]);
|
|
73
|
-
return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { open: true, title: "Cluster by score", onClose: handleClose, children: [(0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsxs)("div", { className: classes.mgap, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: "This page will produce an R script that will perform hierarchical clustering on the visible score data using `hclust`." }), (0, jsx_runtime_1.jsx)(material_1.Typography, { children: "You can then paste the results in this form to specify the row ordering." }), results ? ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", { children: ["Step 1:", ' ', (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
|
|
74
|
-
(0, file_saver_1.saveAs)(new Blob([results || ''], {
|
|
75
|
-
type: 'text/plain;charset=utf-8',
|
|
76
|
-
}), 'cluster.R');
|
|
77
|
-
}, children: "Download Rscript" }), ' ', "or", ' ', (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
|
|
78
|
-
(0, copy_to_clipboard_1.default)(results || '');
|
|
79
|
-
}, children: "Copy Rscript to clipboard" }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: useCompleteMethod, onChange: e => {
|
|
80
|
-
setUseCompleteMethod(e.target.checked);
|
|
81
|
-
} }), label: "Use 'complete' linkage method instead of 'single'" }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true, variant: "outlined", placeholder: "Step 2. Paste results from Rscript here (sequence of numbers, one per line, specifying the new ordering)", rows: 10, value: paste, onChange: event => {
|
|
82
|
-
setPaste(event.target.value);
|
|
83
|
-
}, slotProps: {
|
|
84
|
-
input: {
|
|
85
|
-
classes: {
|
|
86
|
-
input: classes.textAreaFont,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
} }) })] }) })) : ((0, jsx_runtime_1.jsx)(ui_1.LoadingEllipses, { variant: "h6", title: "Generating score matrix" })), error ? (0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error }) : null] }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { disabled: !results, variant: "contained", onClick: () => {
|
|
90
|
-
const { sources } = model;
|
|
91
|
-
if (sources) {
|
|
92
|
-
try {
|
|
93
|
-
model.setLayout(paste
|
|
94
|
-
.split('\n')
|
|
95
|
-
.map(t => t.trim())
|
|
96
|
-
.filter(f => !!f)
|
|
97
|
-
.map(r => +r)
|
|
98
|
-
.map(idx => {
|
|
99
|
-
const ret = sources[idx - 1];
|
|
100
|
-
if (!ret) {
|
|
101
|
-
throw new Error(`out of bounds at ${idx}`);
|
|
102
|
-
}
|
|
103
|
-
return ret;
|
|
104
|
-
}));
|
|
105
|
-
}
|
|
106
|
-
catch (e) {
|
|
107
|
-
console.error(e);
|
|
108
|
-
setError(e);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
handleClose();
|
|
112
|
-
}, children: "Apply clustering" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
113
|
-
handleClose();
|
|
114
|
-
}, children: "Cancel" })] })] }));
|
|
115
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Source } from '../types';
|
|
2
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
-
export default function ClusterDialog({ model, handleClose, }: {
|
|
4
|
-
model: {
|
|
5
|
-
sources?: Source[];
|
|
6
|
-
minorAlleleFrequencyFilter?: number;
|
|
7
|
-
adapterConfig: AnyConfigurationModel;
|
|
8
|
-
setLayout: (arg: Source[]) => void;
|
|
9
|
-
};
|
|
10
|
-
handleClose: () => void;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|