@jbrowse/plugin-wiggle 3.1.0 → 3.2.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/ClusterDialog/ClusterDialog.d.ts +6 -0
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialog.js +29 -0
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogAuto.d.ts +7 -0
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogAuto.js +76 -0
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogManual.d.ts +7 -0
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogManual.js +155 -0
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog/types.d.ts +7 -0
- package/dist/MultiLinearWiggleDisplay/components/ClusterDialog/types.js +2 -0
- package/dist/MultiLinearWiggleDisplay/components/SourcesGrid.js +2 -2
- package/dist/MultiLinearWiggleDisplay/model.d.ts +15 -9
- package/dist/MultiLinearWiggleDisplay/model.js +28 -14
- 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 +3 -3
- package/dist/WiggleRPC/MultiWiggleClusterScoreMatrix.d.ts +14 -0
- package/dist/WiggleRPC/MultiWiggleClusterScoreMatrix.js +34 -0
- package/dist/WiggleRPC/MultiWiggleGetScoreMatrix.d.ts +2 -13
- package/dist/WiggleRPC/MultiWiggleGetScoreMatrix.js +5 -37
- package/dist/WiggleRPC/cluster.d.ts +17 -0
- package/dist/WiggleRPC/cluster.js +84 -0
- 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/ClusterDialog/ClusterDialog.d.ts +6 -0
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialog.js +24 -0
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogAuto.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogAuto.js +74 -0
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogManual.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog/ClusterDialogManual.js +150 -0
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog/types.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/ClusterDialog/types.js +1 -0
- package/esm/MultiLinearWiggleDisplay/components/SourcesGrid.js +2 -2
- package/esm/MultiLinearWiggleDisplay/model.d.ts +15 -9
- package/esm/MultiLinearWiggleDisplay/model.js +28 -14
- 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 +4 -4
- package/esm/WiggleRPC/MultiWiggleClusterScoreMatrix.d.ts +14 -0
- package/esm/WiggleRPC/MultiWiggleClusterScoreMatrix.js +27 -0
- package/esm/WiggleRPC/MultiWiggleGetScoreMatrix.d.ts +2 -13
- package/esm/WiggleRPC/MultiWiggleGetScoreMatrix.js +5 -37
- package/esm/WiggleRPC/cluster.d.ts +17 -0
- package/esm/WiggleRPC/cluster.js +79 -0
- 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 +5 -5
- 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
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
+
import type { GetScoreMatrixArgs } from './types';
|
|
3
|
+
export declare class MultiWiggleClusterScoreMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
4
|
+
name: string;
|
|
5
|
+
execute(args: GetScoreMatrixArgs, rpcDriverClassName: string): Promise<{
|
|
6
|
+
clusters: {
|
|
7
|
+
height: number;
|
|
8
|
+
indexes: number[];
|
|
9
|
+
} | undefined;
|
|
10
|
+
distances: number[][];
|
|
11
|
+
order: number[];
|
|
12
|
+
clustersGivenK: number[][][];
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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.MultiWiggleClusterScoreMatrix = void 0;
|
|
7
|
+
const RpcMethodTypeWithFiltersAndRenameRegions_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions"));
|
|
8
|
+
const cluster_1 = require("./cluster");
|
|
9
|
+
const getScoreMatrix_1 = require("./getScoreMatrix");
|
|
10
|
+
class MultiWiggleClusterScoreMatrix extends RpcMethodTypeWithFiltersAndRenameRegions_1.default {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.name = 'MultiWiggleClusterScoreMatrix';
|
|
14
|
+
}
|
|
15
|
+
async execute(args, rpcDriverClassName) {
|
|
16
|
+
const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
|
|
17
|
+
const matrix = await (0, getScoreMatrix_1.getScoreMatrix)({
|
|
18
|
+
pluginManager: this.pluginManager,
|
|
19
|
+
args: deserializedArgs,
|
|
20
|
+
});
|
|
21
|
+
return (0, cluster_1.clusterData)({
|
|
22
|
+
data: Object.values(matrix),
|
|
23
|
+
stopToken: deserializedArgs.stopToken,
|
|
24
|
+
onProgress: a => {
|
|
25
|
+
var _a;
|
|
26
|
+
(_a = deserializedArgs.statusCallback) === null || _a === void 0 ? void 0 : _a.call(deserializedArgs, `${toP(a * 100)}%`);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.MultiWiggleClusterScoreMatrix = MultiWiggleClusterScoreMatrix;
|
|
32
|
+
function toP(n) {
|
|
33
|
+
return Number.parseFloat(n.toPrecision(3));
|
|
34
|
+
}
|
|
@@ -1,17 +1,6 @@
|
|
|
1
1
|
import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions';
|
|
2
|
-
import {
|
|
3
|
-
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
2
|
+
import type { GetScoreMatrixArgs } from './types';
|
|
4
3
|
export declare class MultiWiggleGetScoreMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
5
4
|
name: string;
|
|
6
|
-
execute(args:
|
|
7
|
-
adapterConfig: AnyConfigurationModel;
|
|
8
|
-
stopToken?: string;
|
|
9
|
-
sessionId: string;
|
|
10
|
-
headers?: Record<string, string>;
|
|
11
|
-
regions: Region[];
|
|
12
|
-
bpPerPx: number;
|
|
13
|
-
}, rpcDriverClassName: string): Promise<Record<string, {
|
|
14
|
-
name: string;
|
|
15
|
-
scores: string[];
|
|
16
|
-
}>>;
|
|
5
|
+
execute(args: GetScoreMatrixArgs, rpcDriverClassName: string): Promise<Record<string, number[]>>;
|
|
17
6
|
}
|
|
@@ -4,51 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.MultiWiggleGetScoreMatrix = void 0;
|
|
7
|
-
const dataAdapterCache_1 = require("@jbrowse/core/data_adapters/dataAdapterCache");
|
|
8
7
|
const RpcMethodTypeWithFiltersAndRenameRegions_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions"));
|
|
9
|
-
const
|
|
10
|
-
const rxjs_1 = require("rxjs");
|
|
8
|
+
const getScoreMatrix_1 = require("./getScoreMatrix");
|
|
11
9
|
class MultiWiggleGetScoreMatrix extends RpcMethodTypeWithFiltersAndRenameRegions_1.default {
|
|
12
10
|
constructor() {
|
|
13
11
|
super(...arguments);
|
|
14
12
|
this.name = 'MultiWiggleGetScoreMatrix';
|
|
15
13
|
}
|
|
16
14
|
async execute(args, rpcDriverClassName) {
|
|
17
|
-
var _a, _b;
|
|
18
|
-
const pm = this.pluginManager;
|
|
19
15
|
const deserializedArgs = await this.deserializeArguments(args, rpcDriverClassName);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const bpScale = bpPerPx / resolution;
|
|
25
|
-
const r0 = regions[0];
|
|
26
|
-
const r0len = r0.end - r0.start;
|
|
27
|
-
const w = Math.floor(r0len / bpScale);
|
|
28
|
-
const feats = await (0, rxjs_1.firstValueFrom)(dataAdapter.getFeatures(r0, deserializedArgs).pipe((0, rxjs_1.toArray)()));
|
|
29
|
-
const groups = (0, util_1.groupBy)(feats, f => f.get('source'));
|
|
30
|
-
const rows = {};
|
|
31
|
-
for (const source of sources) {
|
|
32
|
-
const { name } = source;
|
|
33
|
-
const features = groups[name] || [];
|
|
34
|
-
for (const feat of features) {
|
|
35
|
-
if (!rows[name]) {
|
|
36
|
-
rows[name] = {
|
|
37
|
-
name,
|
|
38
|
-
scores: new Array(w),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
const fstart = feat.get('start');
|
|
42
|
-
const fend = feat.get('end');
|
|
43
|
-
const score = feat.get('score');
|
|
44
|
-
for (let i = fstart; i < fend; i += bpScale) {
|
|
45
|
-
if (i > r0.start && i < r0.end) {
|
|
46
|
-
(_a = rows[name].scores)[_b = Math.floor((i - r0.start) / bpScale)] || (_a[_b] = score);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return rows;
|
|
16
|
+
return (0, getScoreMatrix_1.getScoreMatrix)({
|
|
17
|
+
args: deserializedArgs,
|
|
18
|
+
pluginManager: this.pluginManager,
|
|
19
|
+
});
|
|
52
20
|
}
|
|
53
21
|
}
|
|
54
22
|
exports.MultiWiggleGetScoreMatrix = MultiWiggleGetScoreMatrix;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function euclideanDistance(a: number[], b: number[]): number;
|
|
2
|
+
export declare function averageDistance(setA: number[], setB: number[], distances: number[][]): number;
|
|
3
|
+
export declare function clusterData({ data, distance, linkage, onProgress, stopToken, }: {
|
|
4
|
+
data: number[][];
|
|
5
|
+
distance?: (a: number[], b: number[]) => number;
|
|
6
|
+
linkage?: (a: number[], b: number[], distances: number[][]) => number;
|
|
7
|
+
onProgress?: (a: number) => void;
|
|
8
|
+
stopToken?: string;
|
|
9
|
+
}): {
|
|
10
|
+
clusters: {
|
|
11
|
+
height: number;
|
|
12
|
+
indexes: number[];
|
|
13
|
+
} | undefined;
|
|
14
|
+
distances: number[][];
|
|
15
|
+
order: number[];
|
|
16
|
+
clustersGivenK: number[][][];
|
|
17
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.euclideanDistance = euclideanDistance;
|
|
4
|
+
exports.averageDistance = averageDistance;
|
|
5
|
+
exports.clusterData = clusterData;
|
|
6
|
+
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
7
|
+
function euclideanDistance(a, b) {
|
|
8
|
+
const size = Math.min(a.length, b.length);
|
|
9
|
+
let sum = 0;
|
|
10
|
+
for (let index = 0; index < size; index++) {
|
|
11
|
+
sum += (a[index] - b[index]) * (a[index] - b[index]);
|
|
12
|
+
}
|
|
13
|
+
return Math.sqrt(sum);
|
|
14
|
+
}
|
|
15
|
+
function averageDistance(setA, setB, distances) {
|
|
16
|
+
let distance = 0;
|
|
17
|
+
for (const a of setA) {
|
|
18
|
+
for (const b of setB) {
|
|
19
|
+
distance += distances[a][b];
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return distance / setA.length / setB.length;
|
|
23
|
+
}
|
|
24
|
+
function updateProgress(stepNumber, stepProgress, onProgress) {
|
|
25
|
+
onProgress(stepNumber / 2 + stepProgress / 2);
|
|
26
|
+
}
|
|
27
|
+
function clusterData({ data, distance = euclideanDistance, linkage = averageDistance, onProgress, stopToken, }) {
|
|
28
|
+
const distances = data.map((datum, index) => {
|
|
29
|
+
if (onProgress) {
|
|
30
|
+
updateProgress(0, index / (data.length - 1), onProgress);
|
|
31
|
+
}
|
|
32
|
+
return data.map(otherDatum => distance(datum, otherDatum));
|
|
33
|
+
});
|
|
34
|
+
const clusters = data.map((_datum, index) => ({
|
|
35
|
+
height: 0,
|
|
36
|
+
indexes: [Number(index)],
|
|
37
|
+
}));
|
|
38
|
+
let clustersGivenK = [];
|
|
39
|
+
let start = performance.now();
|
|
40
|
+
for (let iteration = 0; iteration < data.length; iteration++) {
|
|
41
|
+
if (performance.now() - start > 2000) {
|
|
42
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
43
|
+
start = performance.now();
|
|
44
|
+
}
|
|
45
|
+
if (onProgress) {
|
|
46
|
+
updateProgress(1, (iteration + 1) / data.length, onProgress);
|
|
47
|
+
}
|
|
48
|
+
clustersGivenK.push(clusters.map(cluster => cluster.indexes));
|
|
49
|
+
if (iteration >= data.length - 1) {
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
let nearestDistance = Infinity;
|
|
53
|
+
let nearestRow = 0;
|
|
54
|
+
let nearestCol = 0;
|
|
55
|
+
for (let row = 0; row < clusters.length; row++) {
|
|
56
|
+
for (let col = row + 1; col < clusters.length; col++) {
|
|
57
|
+
const distance = linkage(clusters[row].indexes, clusters[col].indexes, distances);
|
|
58
|
+
if (distance < nearestDistance) {
|
|
59
|
+
nearestDistance = distance;
|
|
60
|
+
nearestRow = row;
|
|
61
|
+
nearestCol = col;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const newCluster = {
|
|
66
|
+
indexes: [
|
|
67
|
+
...clusters[nearestRow].indexes,
|
|
68
|
+
...clusters[nearestCol].indexes,
|
|
69
|
+
],
|
|
70
|
+
height: nearestDistance,
|
|
71
|
+
children: [clusters[nearestRow], clusters[nearestCol]],
|
|
72
|
+
};
|
|
73
|
+
clusters.splice(Math.max(nearestRow, nearestCol), 1);
|
|
74
|
+
clusters.splice(Math.min(nearestRow, nearestCol), 1);
|
|
75
|
+
clusters.push(newCluster);
|
|
76
|
+
}
|
|
77
|
+
clustersGivenK = [[], ...clustersGivenK.reverse()];
|
|
78
|
+
return {
|
|
79
|
+
clusters: clusters[0],
|
|
80
|
+
distances: distances,
|
|
81
|
+
order: clusters[0].indexes,
|
|
82
|
+
clustersGivenK: clustersGivenK,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -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,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getScoreMatrix = getScoreMatrix;
|
|
4
|
+
const dataAdapterCache_1 = require("@jbrowse/core/data_adapters/dataAdapterCache");
|
|
5
|
+
const util_1 = require("@jbrowse/core/util");
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
async function getScoreMatrix({ pluginManager, args, }) {
|
|
8
|
+
const { sources, regions, adapterConfig, sessionId, bpPerPx } = args;
|
|
9
|
+
const adapter = await (0, dataAdapterCache_1.getAdapter)(pluginManager, sessionId, adapterConfig);
|
|
10
|
+
const dataAdapter = adapter.dataAdapter;
|
|
11
|
+
const r0 = regions[0];
|
|
12
|
+
const r0len = r0.end - r0.start;
|
|
13
|
+
const w = Math.floor(r0len / bpPerPx);
|
|
14
|
+
const feats = await (0, rxjs_1.firstValueFrom)(dataAdapter.getFeatures(r0, args).pipe((0, rxjs_1.toArray)()));
|
|
15
|
+
const groups = (0, util_1.groupBy)(feats, f => f.get('source'));
|
|
16
|
+
const rows = {};
|
|
17
|
+
for (const source of sources) {
|
|
18
|
+
const { name } = source;
|
|
19
|
+
const features = groups[name] || [];
|
|
20
|
+
const arr = new Array(w).fill(0);
|
|
21
|
+
for (const feat of features) {
|
|
22
|
+
const fstart = feat.get('start');
|
|
23
|
+
const fend = feat.get('end');
|
|
24
|
+
const score = feat.get('score');
|
|
25
|
+
for (let i = fstart; i < fend; i += bpPerPx) {
|
|
26
|
+
const x = Math.floor((i - r0.start) / bpPerPx);
|
|
27
|
+
if (x >= 0 && x < w) {
|
|
28
|
+
arr[x] || (arr[x] = score);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
rows[name] = arr;
|
|
33
|
+
}
|
|
34
|
+
return rows;
|
|
35
|
+
}
|
|
@@ -18,3 +18,4 @@ __exportStar(require("./MultiWiggleGetSources"), exports);
|
|
|
18
18
|
__exportStar(require("./WiggleGetMultiRegionQuantitativeStats"), exports);
|
|
19
19
|
__exportStar(require("./WiggleGetGlobalQuantitativeStats"), exports);
|
|
20
20
|
__exportStar(require("./MultiWiggleGetScoreMatrix"), exports);
|
|
21
|
+
__exportStar(require("./MultiWiggleClusterScoreMatrix"), exports);
|
|
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
|
+
}
|
package/dist/drawDensity.d.ts
CHANGED
package/dist/drawDensity.js
CHANGED
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.drawDensity = drawDensity;
|
|
4
4
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
|
+
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
6
7
|
const util_2 = require("./util");
|
|
7
8
|
const fudgeFactor = 0.3;
|
|
8
9
|
const clipHeight = 2;
|
|
9
10
|
function drawDensity(ctx, props) {
|
|
10
|
-
const { features, regions, bpPerPx, scaleOpts, height, config } = props;
|
|
11
|
+
const { stopToken, features, regions, bpPerPx, scaleOpts, height, config } = props;
|
|
11
12
|
const region = regions[0];
|
|
12
13
|
const pivot = (0, configuration_1.readConfObject)(config, 'bicolorPivot');
|
|
13
14
|
const pivotValue = (0, configuration_1.readConfObject)(config, 'bicolorPivotValue');
|
|
@@ -19,7 +20,7 @@ function drawDensity(ctx, props) {
|
|
|
19
20
|
const scale = (0, util_2.getScale)({
|
|
20
21
|
...scaleOpts,
|
|
21
22
|
pivotValue: crossing ? pivotValue : undefined,
|
|
22
|
-
range: crossing ? [negColor, '
|
|
23
|
+
range: crossing ? [negColor, '#eee', posColor] : ['#eee', posColor],
|
|
23
24
|
});
|
|
24
25
|
const scale2 = (0, util_2.getScale)({ ...scaleOpts, range: [0, height] });
|
|
25
26
|
const cb = color === '#f0f'
|
|
@@ -31,7 +32,12 @@ function drawDensity(ctx, props) {
|
|
|
31
32
|
let prevLeftPx = Number.NEGATIVE_INFINITY;
|
|
32
33
|
let hasClipping = false;
|
|
33
34
|
const reducedFeatures = [];
|
|
35
|
+
let start = performance.now();
|
|
34
36
|
for (const feature of features.values()) {
|
|
37
|
+
if (performance.now() - start > 400) {
|
|
38
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
39
|
+
start = performance.now();
|
|
40
|
+
}
|
|
35
41
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
36
42
|
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
37
43
|
reducedFeatures.push(feature);
|
|
@@ -47,6 +53,10 @@ function drawDensity(ctx, props) {
|
|
|
47
53
|
if (hasClipping) {
|
|
48
54
|
ctx.fillStyle = clipColor;
|
|
49
55
|
for (const feature of features.values()) {
|
|
56
|
+
if (performance.now() - start > 400) {
|
|
57
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
58
|
+
start = performance.now();
|
|
59
|
+
}
|
|
50
60
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
51
61
|
const w = rightPx - leftPx + fudgeFactor;
|
|
52
62
|
const score = feature.get('score');
|
package/dist/drawLine.d.ts
CHANGED
package/dist/drawLine.js
CHANGED
|
@@ -3,11 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.drawLine = drawLine;
|
|
4
4
|
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
|
+
const stopToken_1 = require("@jbrowse/core/util/stopToken");
|
|
6
7
|
const util_2 = require("./util");
|
|
7
8
|
const fudgeFactor = 0.3;
|
|
8
9
|
const clipHeight = 2;
|
|
9
10
|
function drawLine(ctx, props) {
|
|
10
|
-
const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, } = props;
|
|
11
|
+
const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, stopToken, } = props;
|
|
11
12
|
const region = regions[0];
|
|
12
13
|
const width = (region.end - region.start) / bpPerPx;
|
|
13
14
|
const height = unadjustedHeight - offset * 2;
|
|
@@ -20,7 +21,12 @@ function drawLine(ctx, props) {
|
|
|
20
21
|
let lastVal;
|
|
21
22
|
let prevLeftPx = Number.NEGATIVE_INFINITY;
|
|
22
23
|
const reducedFeatures = [];
|
|
24
|
+
let start = performance.now();
|
|
23
25
|
for (const feature of features.values()) {
|
|
26
|
+
if (performance.now() - start > 400) {
|
|
27
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
28
|
+
start = performance.now();
|
|
29
|
+
}
|
|
24
30
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
25
31
|
if (Math.floor(leftPx) !== Math.floor(prevLeftPx)) {
|
|
26
32
|
reducedFeatures.push(feature);
|
|
@@ -58,12 +64,12 @@ function drawLine(ctx, props) {
|
|
|
58
64
|
if (displayCrossHatches) {
|
|
59
65
|
ctx.lineWidth = 1;
|
|
60
66
|
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
61
|
-
|
|
67
|
+
for (const tick of values) {
|
|
62
68
|
ctx.beginPath();
|
|
63
69
|
ctx.moveTo(0, Math.round(toY(tick)));
|
|
64
70
|
ctx.lineTo(width, Math.round(toY(tick)));
|
|
65
71
|
ctx.stroke();
|
|
66
|
-
}
|
|
72
|
+
}
|
|
67
73
|
}
|
|
68
74
|
return { reducedFeatures };
|
|
69
75
|
}
|
package/dist/drawXY.js
CHANGED
|
@@ -25,7 +25,7 @@ function darken(color, amount) {
|
|
|
25
25
|
const fudgeFactor = 0.3;
|
|
26
26
|
const clipHeight = 2;
|
|
27
27
|
function drawXY(ctx, props) {
|
|
28
|
-
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, inverted, } = props;
|
|
28
|
+
const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, inverted, stopToken, } = props;
|
|
29
29
|
const region = regions[0];
|
|
30
30
|
const width = (region.end - region.start) / bpPerPx;
|
|
31
31
|
const height = unadjustedHeight - offset * 2;
|
|
@@ -53,7 +53,7 @@ function drawXY(ctx, props) {
|
|
|
53
53
|
start = performance.now();
|
|
54
54
|
for (const feature of features.values()) {
|
|
55
55
|
if (performance.now() - start > 400) {
|
|
56
|
-
(0, stopToken_1.checkStopToken)();
|
|
56
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
57
57
|
start = performance.now();
|
|
58
58
|
}
|
|
59
59
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
@@ -75,7 +75,7 @@ function drawXY(ctx, props) {
|
|
|
75
75
|
start = performance.now();
|
|
76
76
|
for (const feature of features.values()) {
|
|
77
77
|
if (performance.now() - start > 400) {
|
|
78
|
-
(0, stopToken_1.checkStopToken)();
|
|
78
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
79
79
|
start = performance.now();
|
|
80
80
|
}
|
|
81
81
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
@@ -105,7 +105,7 @@ function drawXY(ctx, props) {
|
|
|
105
105
|
start = performance.now();
|
|
106
106
|
for (const feature of features.values()) {
|
|
107
107
|
if (performance.now() - start > 400) {
|
|
108
|
-
(0, stopToken_1.checkStopToken)();
|
|
108
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
109
109
|
start = performance.now();
|
|
110
110
|
}
|
|
111
111
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
@@ -127,7 +127,7 @@ function drawXY(ctx, props) {
|
|
|
127
127
|
start = performance.now();
|
|
128
128
|
for (const feature of features.values()) {
|
|
129
129
|
if (performance.now() - start > 400) {
|
|
130
|
-
(0, stopToken_1.checkStopToken)();
|
|
130
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
131
131
|
start = performance.now();
|
|
132
132
|
}
|
|
133
133
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
@@ -158,7 +158,7 @@ function drawXY(ctx, props) {
|
|
|
158
158
|
start = performance.now();
|
|
159
159
|
for (const feature of features.values()) {
|
|
160
160
|
if (performance.now() - start > 400) {
|
|
161
|
-
(0, stopToken_1.checkStopToken)();
|
|
161
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
162
162
|
start = performance.now();
|
|
163
163
|
}
|
|
164
164
|
const [leftPx, rightPx] = (0, util_1.featureSpanPx)(feature, region, bpPerPx);
|
|
@@ -176,12 +176,12 @@ function drawXY(ctx, props) {
|
|
|
176
176
|
if (displayCrossHatches) {
|
|
177
177
|
ctx.lineWidth = 1;
|
|
178
178
|
ctx.strokeStyle = 'rgba(200,200,200,0.5)';
|
|
179
|
-
ticks.values
|
|
179
|
+
for (const tick of ticks.values) {
|
|
180
180
|
ctx.beginPath();
|
|
181
181
|
ctx.moveTo(0, Math.round(toY(tick)));
|
|
182
182
|
ctx.lineTo(width, Math.round(toY(tick)));
|
|
183
183
|
ctx.stroke();
|
|
184
|
-
}
|
|
184
|
+
}
|
|
185
185
|
}
|
|
186
186
|
return { reducedFeatures };
|
|
187
187
|
}
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,7 @@ class WigglePlugin extends Plugin_1.default {
|
|
|
97
97
|
pm.addRpcMethod(() => new rpcMethods_1.WiggleGetMultiRegionQuantitativeStats(pm));
|
|
98
98
|
pm.addRpcMethod(() => new rpcMethods_1.MultiWiggleGetSources(pm));
|
|
99
99
|
pm.addRpcMethod(() => new rpcMethods_1.MultiWiggleGetScoreMatrix(pm));
|
|
100
|
+
pm.addRpcMethod(() => new rpcMethods_1.MultiWiggleClusterScoreMatrix(pm));
|
|
100
101
|
}
|
|
101
102
|
}
|
|
102
103
|
exports.default = WigglePlugin;
|
|
@@ -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;
|
|
@@ -154,7 +154,7 @@ function SharedWiggleMixin(configSchema) {
|
|
|
154
154
|
},
|
|
155
155
|
get rendererTypeNameSimple() {
|
|
156
156
|
var _a;
|
|
157
|
-
return (_a = self.rendererTypeNameState) !== null && _a !== void 0 ? _a : (0, configuration_1.getConf)(self, 'defaultRendering');
|
|
157
|
+
return ((_a = self.rendererTypeNameState) !== null && _a !== void 0 ? _a : (0, configuration_1.getConf)(self, 'defaultRendering'));
|
|
158
158
|
},
|
|
159
159
|
get filters() {
|
|
160
160
|
return undefined;
|
|
@@ -225,12 +225,12 @@ function SharedWiggleMixin(configSchema) {
|
|
|
225
225
|
})
|
|
226
226
|
.views(self => ({
|
|
227
227
|
get filled() {
|
|
228
|
-
|
|
229
|
-
return fill !== null &&
|
|
228
|
+
var _a;
|
|
229
|
+
return ((_a = self.fill) !== null && _a !== void 0 ? _a : (0, configuration_1.readConfObject)(self.rendererConfig, 'filled'));
|
|
230
230
|
},
|
|
231
231
|
get summaryScoreModeSetting() {
|
|
232
|
-
|
|
233
|
-
return
|
|
232
|
+
var _a;
|
|
233
|
+
return ((_a = self.summaryScoreMode) !== null && _a !== void 0 ? _a : (0, configuration_1.readConfObject)(self.rendererConfig, 'summaryScoreMode'));
|
|
234
234
|
},
|
|
235
235
|
get scaleOpts() {
|
|
236
236
|
return {
|
|
@@ -245,8 +245,8 @@ function SharedWiggleMixin(configSchema) {
|
|
|
245
245
|
return self.rendererTypeName === 'XYPlotRenderer';
|
|
246
246
|
},
|
|
247
247
|
get displayCrossHatchesSetting() {
|
|
248
|
-
|
|
249
|
-
return
|
|
248
|
+
var _a;
|
|
249
|
+
return ((_a = self.displayCrossHatches) !== null && _a !== void 0 ? _a : (0, configuration_1.readConfObject)(self.rendererConfig, 'displayCrossHatches'));
|
|
250
250
|
},
|
|
251
251
|
get hasResolution() {
|
|
252
252
|
return self.adapterCapabilities.includes('hasResolution');
|
|
@@ -321,7 +321,10 @@ function SharedWiggleMixin(configSchema) {
|
|
|
321
321
|
onClick: () => {
|
|
322
322
|
(0, util_1.getSession)(self).queueDialog(handleClose => [
|
|
323
323
|
SetMinMaxDialog,
|
|
324
|
-
{
|
|
324
|
+
{
|
|
325
|
+
model: self,
|
|
326
|
+
handleClose,
|
|
327
|
+
},
|
|
325
328
|
]);
|
|
326
329
|
},
|
|
327
330
|
},
|
|
@@ -40,7 +40,7 @@ class BigWigAdapter extends BaseFeatureDataAdapter {
|
|
|
40
40
|
}
|
|
41
41
|
getFeatures(region, opts = {}) {
|
|
42
42
|
const { refName, start, end } = region;
|
|
43
|
-
const { bpPerPx = 0,
|
|
43
|
+
const { bpPerPx = 0, resolution = 1, stopToken, statusCallback = () => { }, } = opts;
|
|
44
44
|
return ObservableCreate(async (observer) => {
|
|
45
45
|
const source = this.getConf('source');
|
|
46
46
|
const resolutionMultiplier = this.getConf('resolutionMultiplier');
|
|
@@ -258,11 +258,11 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
258
258
|
setCrossHatches(cross: boolean): void;
|
|
259
259
|
} & {
|
|
260
260
|
readonly adapterTypeName: any;
|
|
261
|
-
readonly rendererTypeNameSimple:
|
|
261
|
+
readonly rendererTypeNameSimple: string;
|
|
262
262
|
readonly filters: undefined;
|
|
263
|
-
readonly scaleType:
|
|
264
|
-
readonly maxScore:
|
|
265
|
-
readonly minScore:
|
|
263
|
+
readonly scaleType: string;
|
|
264
|
+
readonly maxScore: number;
|
|
265
|
+
readonly minScore: number;
|
|
266
266
|
} & {
|
|
267
267
|
readonly adapterCapabilities: string[];
|
|
268
268
|
readonly rendererConfig: {
|
|
@@ -276,7 +276,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
276
276
|
} & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
|
|
277
277
|
} & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
|
|
278
278
|
} & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
|
|
279
|
-
readonly autoscaleType:
|
|
279
|
+
readonly autoscaleType: string;
|
|
280
280
|
} & {
|
|
281
281
|
readonly domain: number[] | undefined;
|
|
282
282
|
} & {
|
|
@@ -289,9 +289,9 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
289
289
|
scoreMin: number;
|
|
290
290
|
scoreMax: number;
|
|
291
291
|
} | undefined;
|
|
292
|
-
autoscaleType:
|
|
293
|
-
scaleType:
|
|
294
|
-
inverted:
|
|
292
|
+
autoscaleType: string;
|
|
293
|
+
scaleType: string;
|
|
294
|
+
inverted: boolean;
|
|
295
295
|
};
|
|
296
296
|
readonly canHaveFill: boolean;
|
|
297
297
|
readonly displayCrossHatchesSetting: boolean;
|
|
@@ -328,7 +328,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
328
328
|
readonly rendererTypeName: string;
|
|
329
329
|
readonly quantitativeStatsRelevantToCurrentZoom: boolean;
|
|
330
330
|
readonly graphType: boolean;
|
|
331
|
-
readonly inverted:
|
|
331
|
+
readonly inverted: boolean;
|
|
332
332
|
} & {
|
|
333
333
|
adapterProps(): any;
|
|
334
334
|
readonly ticks: {
|
|
@@ -374,7 +374,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
374
374
|
} | {
|
|
375
375
|
label: string;
|
|
376
376
|
type: string;
|
|
377
|
-
checked:
|
|
377
|
+
checked: boolean;
|
|
378
378
|
onClick: () => void;
|
|
379
379
|
icon?: undefined;
|
|
380
380
|
subMenu?: undefined;
|