@jbrowse/plugin-wiggle 4.1.1 → 4.1.4
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/esm/BigWigAdapter/BigWigAdapter.d.ts +14 -0
- package/esm/BigWigAdapter/BigWigAdapter.js +6 -0
- package/esm/BigWigAdapter/configSchema.d.ts +2 -2
- package/esm/DensityRenderer/configSchema.d.ts +2 -2
- package/esm/LinePlotRenderer/configSchema.d.ts +3 -3
- package/esm/LinearWiggleDisplay/configSchema.d.ts +6 -6
- package/esm/LinearWiggleDisplay/model.d.ts +24 -8
- package/esm/MultiDensityRenderer/configSchema.d.ts +2 -2
- package/esm/MultiLineRenderer/configSchema.d.ts +3 -3
- package/esm/MultiLinearWiggleDisplay/components/IndividualScaleBars.js +3 -2
- package/esm/MultiLinearWiggleDisplay/components/MultiWiggleColorLegend.d.ts +10 -0
- package/esm/MultiLinearWiggleDisplay/components/MultiWiggleColorLegend.js +29 -0
- package/esm/MultiLinearWiggleDisplay/components/MultiWiggleLegendBar.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/MultiWiggleLegendBar.js +28 -0
- package/esm/MultiLinearWiggleDisplay/components/MultiWiggleLegendBarWrapper.d.ts +7 -0
- package/esm/MultiLinearWiggleDisplay/components/MultiWiggleLegendBarWrapper.js +18 -0
- package/esm/MultiLinearWiggleDisplay/components/RectBg.js +3 -1
- package/esm/MultiLinearWiggleDisplay/components/SvgTree.d.ts +5 -0
- package/esm/MultiLinearWiggleDisplay/components/SvgTree.js +19 -0
- package/esm/MultiLinearWiggleDisplay/components/TreeSidebar.d.ts +5 -0
- package/esm/MultiLinearWiggleDisplay/components/TreeSidebar.js +165 -0
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogAuto.js +2 -1
- package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/types.d.ts +2 -1
- package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +5 -2
- package/esm/MultiLinearWiggleDisplay/components/constants.d.ts +1 -0
- package/esm/MultiLinearWiggleDisplay/components/constants.js +1 -0
- package/esm/MultiLinearWiggleDisplay/components/treeTypes.d.ts +39 -0
- package/esm/MultiLinearWiggleDisplay/components/treeTypes.js +1 -0
- package/esm/MultiLinearWiggleDisplay/configSchema.d.ts +6 -6
- package/esm/MultiLinearWiggleDisplay/makeSidebarSvg.d.ts +9 -0
- package/esm/MultiLinearWiggleDisplay/makeSidebarSvg.js +13 -0
- package/esm/MultiLinearWiggleDisplay/model.d.ts +146 -25
- package/esm/MultiLinearWiggleDisplay/model.js +137 -5
- package/esm/MultiLinearWiggleDisplay/renderSvg.js +3 -1
- package/esm/MultiLinearWiggleDisplay/treeDrawingAutorun.d.ts +17 -0
- package/esm/MultiLinearWiggleDisplay/treeDrawingAutorun.js +77 -0
- package/esm/MultiQuantitativeTrack/configSchema.d.ts +8 -8
- package/esm/MultiRowLineRenderer/configSchema.d.ts +3 -3
- package/esm/MultiRowXYPlotRenderer/configSchema.d.ts +3 -3
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +3 -0
- package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +5 -1
- package/esm/MultiWiggleAdapter/configSchema.d.ts +2 -2
- package/esm/MultiXYPlotRenderer/configSchema.d.ts +3 -3
- package/esm/QuantitativeTrack/configSchema.d.ts +8 -8
- package/esm/WiggleRPC/MultiWiggleClusterScoreMatrix.d.ts +4 -1
- package/esm/WiggleRPC/executeClusterScoreMatrix.d.ts +4 -1
- package/esm/WiggleRPC/executeClusterScoreMatrix.js +8 -2
- package/esm/XYPlotRenderer/configSchema.d.ts +3 -3
- package/esm/configSchema.d.ts +2 -2
- package/esm/d3-hierarchy2/accessors.d.ts +2 -0
- package/esm/d3-hierarchy2/accessors.js +8 -0
- package/esm/d3-hierarchy2/array.d.ts +2 -0
- package/esm/d3-hierarchy2/array.js +15 -0
- package/esm/d3-hierarchy2/cluster.d.ts +8 -0
- package/esm/d3-hierarchy2/cluster.js +63 -0
- package/esm/d3-hierarchy2/constant.d.ts +2 -0
- package/esm/d3-hierarchy2/constant.js +8 -0
- package/esm/d3-hierarchy2/hierarchy/ancestors.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/ancestors.js +7 -0
- package/esm/d3-hierarchy2/hierarchy/count.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/count.js +12 -0
- package/esm/d3-hierarchy2/hierarchy/descendants.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/descendants.js +3 -0
- package/esm/d3-hierarchy2/hierarchy/each.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/each.js +7 -0
- package/esm/d3-hierarchy2/hierarchy/eachAfter.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/eachAfter.js +15 -0
- package/esm/d3-hierarchy2/hierarchy/eachBefore.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/eachBefore.js +12 -0
- package/esm/d3-hierarchy2/hierarchy/find.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/find.js +8 -0
- package/esm/d3-hierarchy2/hierarchy/index.d.ts +3 -0
- package/esm/d3-hierarchy2/hierarchy/index.js +78 -0
- package/esm/d3-hierarchy2/hierarchy/iterator.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/iterator.js +14 -0
- package/esm/d3-hierarchy2/hierarchy/leaves.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/leaves.js +9 -0
- package/esm/d3-hierarchy2/hierarchy/links.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/links.js +9 -0
- package/esm/d3-hierarchy2/hierarchy/path.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/path.js +26 -0
- package/esm/d3-hierarchy2/hierarchy/sort.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/sort.js +7 -0
- package/esm/d3-hierarchy2/hierarchy/sum.d.ts +1 -0
- package/esm/d3-hierarchy2/hierarchy/sum.js +8 -0
- package/esm/d3-hierarchy2/index.d.ts +15 -0
- package/esm/d3-hierarchy2/index.js +15 -0
- package/esm/d3-hierarchy2/lcg.d.ts +1 -0
- package/esm/d3-hierarchy2/lcg.js +7 -0
- package/esm/d3-hierarchy2/pack/enclose.d.ts +10 -0
- package/esm/d3-hierarchy2/pack/enclose.js +84 -0
- package/esm/d3-hierarchy2/pack/index.d.ts +7 -0
- package/esm/d3-hierarchy2/pack/index.js +68 -0
- package/esm/d3-hierarchy2/pack/siblings.d.ts +2 -0
- package/esm/d3-hierarchy2/pack/siblings.js +94 -0
- package/esm/d3-hierarchy2/partition.d.ts +6 -0
- package/esm/d3-hierarchy2/partition.js +42 -0
- package/esm/d3-hierarchy2/stratify.d.ts +9 -0
- package/esm/d3-hierarchy2/stratify.js +115 -0
- package/esm/d3-hierarchy2/tree.d.ts +8 -0
- package/esm/d3-hierarchy2/tree.js +153 -0
- package/esm/d3-hierarchy2/treemap/binary.d.ts +1 -0
- package/esm/d3-hierarchy2/treemap/binary.js +36 -0
- package/esm/d3-hierarchy2/treemap/dice.d.ts +1 -0
- package/esm/d3-hierarchy2/treemap/dice.js +7 -0
- package/esm/d3-hierarchy2/treemap/index.d.ts +17 -0
- package/esm/d3-hierarchy2/treemap/index.js +72 -0
- package/esm/d3-hierarchy2/treemap/resquarify.d.ts +5 -0
- package/esm/d3-hierarchy2/treemap/resquarify.js +28 -0
- package/esm/d3-hierarchy2/treemap/round.d.ts +1 -0
- package/esm/d3-hierarchy2/treemap/round.js +6 -0
- package/esm/d3-hierarchy2/treemap/slice.d.ts +1 -0
- package/esm/d3-hierarchy2/treemap/slice.js +7 -0
- package/esm/d3-hierarchy2/treemap/sliceDice.d.ts +1 -0
- package/esm/d3-hierarchy2/treemap/sliceDice.js +5 -0
- package/esm/d3-hierarchy2/treemap/squarify.d.ts +11 -0
- package/esm/d3-hierarchy2/treemap/squarify.js +46 -0
- package/esm/index.d.ts +3 -3
- package/esm/shared/SharedWiggleConfigSchema.d.ts +3 -3
- package/esm/shared/SharedWiggleMixin.d.ts +28 -10
- package/esm/shared/SharedWiggleMixin.js +13 -3
- package/package.json +7 -7
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
+
import { fromNewick } from '@gmod/hclust';
|
|
2
3
|
import { getConf } from '@jbrowse/core/configuration';
|
|
3
4
|
import { set1 as colors } from '@jbrowse/core/ui/colors';
|
|
4
5
|
import { getContainingView, getSession, max, measureText, } from '@jbrowse/core/util';
|
|
5
6
|
import { stopStopToken } from '@jbrowse/core/util/stopToken';
|
|
6
|
-
import { isAlive, types } from '@jbrowse/mobx-state-tree';
|
|
7
|
+
import { cast, isAlive, types } from '@jbrowse/mobx-state-tree';
|
|
7
8
|
import EqualizerIcon from '@mui/icons-material/Equalizer';
|
|
8
9
|
import VisibilityIcon from '@mui/icons-material/Visibility';
|
|
10
|
+
import { ascending } from '@mui/x-charts-vendor/d3-array';
|
|
9
11
|
import deepEqual from 'fast-deep-equal';
|
|
12
|
+
import { cluster, hierarchy } from "../d3-hierarchy2/index.js";
|
|
10
13
|
import SharedWiggleMixin from "../shared/SharedWiggleMixin.js";
|
|
11
14
|
import axisPropsFromTickScale from "../shared/axisPropsFromTickScale.js";
|
|
12
15
|
import { YSCALEBAR_LABEL_OFFSET, getScale } from "../util.js";
|
|
@@ -27,11 +30,18 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
27
30
|
type: types.literal('MultiLinearWiggleDisplay'),
|
|
28
31
|
layout: types.optional(types.frozen(), []),
|
|
29
32
|
showSidebar: true,
|
|
33
|
+
clusterTree: types.maybe(types.string),
|
|
34
|
+
treeAreaWidth: types.optional(types.number, 80),
|
|
35
|
+
showTreeSetting: types.maybe(types.boolean),
|
|
36
|
+
subtreeFilter: types.maybe(types.array(types.string)),
|
|
30
37
|
}))
|
|
31
38
|
.volatile(() => ({
|
|
32
39
|
sourcesLoadingStopToken: undefined,
|
|
33
40
|
featureUnderMouseVolatile: undefined,
|
|
34
41
|
sourcesVolatile: undefined,
|
|
42
|
+
hoveredTreeNode: undefined,
|
|
43
|
+
treeCanvas: undefined,
|
|
44
|
+
mouseoverCanvas: undefined,
|
|
35
45
|
}))
|
|
36
46
|
.actions(self => ({
|
|
37
47
|
setShowSidebar(arg) {
|
|
@@ -43,11 +53,40 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
43
53
|
}
|
|
44
54
|
self.sourcesLoadingStopToken = str;
|
|
45
55
|
},
|
|
46
|
-
setLayout(layout) {
|
|
56
|
+
setLayout(layout, clearTree = true) {
|
|
57
|
+
const orderChanged = clearTree &&
|
|
58
|
+
self.clusterTree &&
|
|
59
|
+
self.layout.length === layout.length &&
|
|
60
|
+
self.layout.some((source, idx) => source.name !== layout[idx]?.name);
|
|
47
61
|
self.layout = layout;
|
|
62
|
+
if (orderChanged) {
|
|
63
|
+
self.clusterTree = undefined;
|
|
64
|
+
}
|
|
48
65
|
},
|
|
49
66
|
clearLayout() {
|
|
50
67
|
self.layout = [];
|
|
68
|
+
self.clusterTree = undefined;
|
|
69
|
+
},
|
|
70
|
+
setClusterTree(tree) {
|
|
71
|
+
self.clusterTree = tree;
|
|
72
|
+
},
|
|
73
|
+
setTreeAreaWidth(width) {
|
|
74
|
+
self.treeAreaWidth = width;
|
|
75
|
+
},
|
|
76
|
+
setShowTree(arg) {
|
|
77
|
+
self.showTreeSetting = arg;
|
|
78
|
+
},
|
|
79
|
+
setSubtreeFilter(names) {
|
|
80
|
+
self.subtreeFilter = names ? cast(names) : undefined;
|
|
81
|
+
},
|
|
82
|
+
setHoveredTreeNode(node) {
|
|
83
|
+
self.hoveredTreeNode = node;
|
|
84
|
+
},
|
|
85
|
+
setTreeCanvasRef(ref) {
|
|
86
|
+
self.treeCanvas = ref || undefined;
|
|
87
|
+
},
|
|
88
|
+
setMouseoverCanvasRef(ref) {
|
|
89
|
+
self.mouseoverCanvas = ref || undefined;
|
|
51
90
|
},
|
|
52
91
|
setSources(sources) {
|
|
53
92
|
if (!deepEqual(sources, self.sourcesVolatile)) {
|
|
@@ -121,7 +160,7 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
121
160
|
get sources() {
|
|
122
161
|
const sources = Object.fromEntries(self.sourcesVolatile?.map(s => [s.name, s]) || []);
|
|
123
162
|
const iter = self.layout.length ? self.layout : self.sourcesVolatile;
|
|
124
|
-
|
|
163
|
+
let result = iter
|
|
125
164
|
?.map(s => ({
|
|
126
165
|
...sources[s.name],
|
|
127
166
|
...s,
|
|
@@ -131,6 +170,11 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
131
170
|
color: s.color ||
|
|
132
171
|
(!this.isMultiRow ? colors[i] || randomColor() : 'blue'),
|
|
133
172
|
}));
|
|
173
|
+
if (result && self.subtreeFilter?.length) {
|
|
174
|
+
const filterSet = new Set(self.subtreeFilter);
|
|
175
|
+
result = result.filter(s => filterSet.has(s.name));
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
134
178
|
},
|
|
135
179
|
get quantitativeStatsReady() {
|
|
136
180
|
const view = getContainingView(self);
|
|
@@ -140,6 +184,9 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
140
184
|
},
|
|
141
185
|
}))
|
|
142
186
|
.views(self => ({
|
|
187
|
+
get showTree() {
|
|
188
|
+
return self.showTreeSetting ?? true;
|
|
189
|
+
},
|
|
143
190
|
get rowHeight() {
|
|
144
191
|
const { sources, height, isMultiRow } = self;
|
|
145
192
|
return isMultiRow ? height / (sources?.length || 1) : height;
|
|
@@ -151,6 +198,62 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
151
198
|
return (getConf(self, 'minimalTicks') ||
|
|
152
199
|
this.rowHeightTooSmallForScalebar);
|
|
153
200
|
},
|
|
201
|
+
get root() {
|
|
202
|
+
const newick = self.clusterTree;
|
|
203
|
+
if (!newick) {
|
|
204
|
+
return undefined;
|
|
205
|
+
}
|
|
206
|
+
const tree = fromNewick(newick);
|
|
207
|
+
let root = hierarchy(tree, (d) => d.children)
|
|
208
|
+
.sum((d) => (d.children ? 0 : 1))
|
|
209
|
+
.sort((a, b) => ascending(a.data.height || 1, b.data.height || 1));
|
|
210
|
+
if (self.subtreeFilter?.length) {
|
|
211
|
+
const filterSet = new Set(self.subtreeFilter);
|
|
212
|
+
const getLeafNames = (node) => {
|
|
213
|
+
if (!node.children?.length) {
|
|
214
|
+
return [node.data.name];
|
|
215
|
+
}
|
|
216
|
+
return node.children.flatMap(child => getLeafNames(child));
|
|
217
|
+
};
|
|
218
|
+
const findSubtree = (node) => {
|
|
219
|
+
const leafNames = getLeafNames(node);
|
|
220
|
+
if (leafNames.length === filterSet.size &&
|
|
221
|
+
leafNames.every(name => filterSet.has(name))) {
|
|
222
|
+
return node;
|
|
223
|
+
}
|
|
224
|
+
if (node.children) {
|
|
225
|
+
for (const child of node.children) {
|
|
226
|
+
const found = findSubtree(child);
|
|
227
|
+
if (found) {
|
|
228
|
+
return found;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return undefined;
|
|
233
|
+
};
|
|
234
|
+
const subtree = findSubtree(root);
|
|
235
|
+
if (subtree) {
|
|
236
|
+
root = subtree;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return root;
|
|
240
|
+
},
|
|
241
|
+
}))
|
|
242
|
+
.views(self => ({
|
|
243
|
+
get totalHeight() {
|
|
244
|
+
return self.rowHeight * (self.sources?.length || 1);
|
|
245
|
+
},
|
|
246
|
+
get hierarchy() {
|
|
247
|
+
const r = self.root;
|
|
248
|
+
if (!r || !self.sources?.length) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
const clust = cluster();
|
|
252
|
+
clust.size([self.rowHeight * self.sources.length, self.treeAreaWidth]);
|
|
253
|
+
clust.separation(() => 1);
|
|
254
|
+
clust(r);
|
|
255
|
+
return r;
|
|
256
|
+
},
|
|
154
257
|
}))
|
|
155
258
|
.views(self => {
|
|
156
259
|
const { renderProps: superRenderProps } = self;
|
|
@@ -276,6 +379,29 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
276
379
|
self.setShowSidebar(!self.showSidebar);
|
|
277
380
|
},
|
|
278
381
|
},
|
|
382
|
+
...(self.isMultiRow
|
|
383
|
+
? [
|
|
384
|
+
{
|
|
385
|
+
label: `Show tree${!self.clusterTree ? ' (run clustering first)' : ''}`,
|
|
386
|
+
type: 'checkbox',
|
|
387
|
+
checked: self.showTree,
|
|
388
|
+
disabled: !self.clusterTree,
|
|
389
|
+
onClick: () => {
|
|
390
|
+
self.setShowTree(!self.showTree);
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
...(self.subtreeFilter?.length
|
|
394
|
+
? [
|
|
395
|
+
{
|
|
396
|
+
label: 'Clear subtree filter',
|
|
397
|
+
onClick: () => {
|
|
398
|
+
self.setSubtreeFilter(undefined);
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
]
|
|
402
|
+
: []),
|
|
403
|
+
]
|
|
404
|
+
: []),
|
|
279
405
|
...(self.graphType
|
|
280
406
|
? [
|
|
281
407
|
{
|
|
@@ -370,12 +496,14 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
370
496
|
;
|
|
371
497
|
(async () => {
|
|
372
498
|
try {
|
|
373
|
-
const [{ getMultiWiggleSourcesAutorun }, { getQuantitativeStatsAutorun },] = await Promise.all([
|
|
499
|
+
const [{ getMultiWiggleSourcesAutorun }, { getQuantitativeStatsAutorun }, { setupTreeDrawingAutorun },] = await Promise.all([
|
|
374
500
|
import("../getMultiWiggleSourcesAutorun.js"),
|
|
375
501
|
import("../getQuantitativeStatsAutorun.js"),
|
|
502
|
+
import("./treeDrawingAutorun.js"),
|
|
376
503
|
]);
|
|
377
504
|
getQuantitativeStatsAutorun(self);
|
|
378
505
|
getMultiWiggleSourcesAutorun(self);
|
|
506
|
+
setupTreeDrawingAutorun(self);
|
|
379
507
|
}
|
|
380
508
|
catch (e) {
|
|
381
509
|
if (isAlive(self)) {
|
|
@@ -395,11 +523,15 @@ export function stateModelFactory(_pluginManager, configSchema) {
|
|
|
395
523
|
if (!snap) {
|
|
396
524
|
return snap;
|
|
397
525
|
}
|
|
398
|
-
const { layout, showSidebar, ...rest } = snap;
|
|
526
|
+
const { layout, showSidebar, clusterTree, treeAreaWidth, showTreeSetting, subtreeFilter, ...rest } = snap;
|
|
399
527
|
return {
|
|
400
528
|
...rest,
|
|
401
529
|
...(layout?.length ? { layout } : {}),
|
|
402
530
|
...(!showSidebar ? { showSidebar } : {}),
|
|
531
|
+
...(clusterTree !== undefined ? { clusterTree } : {}),
|
|
532
|
+
...(treeAreaWidth !== 80 ? { treeAreaWidth } : {}),
|
|
533
|
+
...(showTreeSetting !== undefined ? { showTreeSetting } : {}),
|
|
534
|
+
...(subtreeFilter?.length ? { subtreeFilter } : {}),
|
|
403
535
|
};
|
|
404
536
|
});
|
|
405
537
|
}
|
|
@@ -3,8 +3,10 @@ import { getContainingView } from '@jbrowse/core/util';
|
|
|
3
3
|
import { when } from 'mobx';
|
|
4
4
|
import { isReadyOrHasError } from "../svgExportUtil.js";
|
|
5
5
|
import YScaleBars from "./components/YScaleBars.js";
|
|
6
|
+
import { makeSidebarSvg } from "./makeSidebarSvg.js";
|
|
6
7
|
export async function renderSvg(self, opts, superRenderSvg) {
|
|
7
8
|
await when(() => isReadyOrHasError(self));
|
|
8
9
|
const { offsetPx } = getContainingView(self);
|
|
9
|
-
|
|
10
|
+
const sidebarSvg = await makeSidebarSvg(self);
|
|
11
|
+
return (_jsxs(_Fragment, { children: [_jsx("g", { id: "data-layer", children: await superRenderSvg(opts) }), _jsx("g", { transform: `translate(${Math.max(-offsetPx, 0)})`, children: _jsx(YScaleBars, { model: self, orientation: "left", exportSVG: true }) }), sidebarSvg] }));
|
|
10
12
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Source } from '../util.ts';
|
|
2
|
+
import type { ClusterHierarchyNode, HoveredTreeNode } from './components/treeTypes.ts';
|
|
3
|
+
interface TreeDrawingModel {
|
|
4
|
+
treeCanvas?: HTMLCanvasElement;
|
|
5
|
+
mouseoverCanvas?: HTMLCanvasElement;
|
|
6
|
+
hierarchy?: ClusterHierarchyNode;
|
|
7
|
+
treeAreaWidth: number;
|
|
8
|
+
height: number;
|
|
9
|
+
scrollTop: number;
|
|
10
|
+
rowHeight: number;
|
|
11
|
+
totalHeight: number;
|
|
12
|
+
hoveredTreeNode?: HoveredTreeNode;
|
|
13
|
+
sources?: Source[];
|
|
14
|
+
isMinimized: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function setupTreeDrawingAutorun(self: TreeDrawingModel): void;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { getContainingView } from '@jbrowse/core/util';
|
|
2
|
+
import { addDisposer, isAlive } from '@jbrowse/mobx-state-tree';
|
|
3
|
+
import { autorun } from 'mobx';
|
|
4
|
+
export function setupTreeDrawingAutorun(self) {
|
|
5
|
+
addDisposer(self, autorun(function treeDrawAutorun() {
|
|
6
|
+
if (!isAlive(self) || self.isMinimized) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const { treeCanvas, hierarchy, treeAreaWidth, height, scrollTop, totalHeight: _totalHeight, } = self;
|
|
10
|
+
if (!treeCanvas || !hierarchy) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const ctx = treeCanvas.getContext('2d');
|
|
14
|
+
if (!ctx) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
ctx.resetTransform();
|
|
18
|
+
ctx.scale(2, 2);
|
|
19
|
+
ctx.clearRect(0, 0, treeAreaWidth, height);
|
|
20
|
+
ctx.translate(0, -scrollTop);
|
|
21
|
+
ctx.strokeStyle = '#0008';
|
|
22
|
+
ctx.lineWidth = 1;
|
|
23
|
+
ctx.beginPath();
|
|
24
|
+
for (const link of hierarchy.links()) {
|
|
25
|
+
const { source, target } = link;
|
|
26
|
+
const sy = source.x;
|
|
27
|
+
const ty = target.x;
|
|
28
|
+
const tx = target.y;
|
|
29
|
+
const sx = source.y;
|
|
30
|
+
ctx.moveTo(sx, sy);
|
|
31
|
+
ctx.lineTo(sx, ty);
|
|
32
|
+
ctx.moveTo(sx, ty);
|
|
33
|
+
ctx.lineTo(tx, ty);
|
|
34
|
+
}
|
|
35
|
+
ctx.stroke();
|
|
36
|
+
}, {
|
|
37
|
+
name: 'TreeDraw',
|
|
38
|
+
}));
|
|
39
|
+
addDisposer(self, autorun(function treeHoverAutorun() {
|
|
40
|
+
if (!isAlive(self) || self.isMinimized) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const { mouseoverCanvas, hierarchy, rowHeight, hoveredTreeNode, height, scrollTop, sources, totalHeight, } = self;
|
|
44
|
+
if (!mouseoverCanvas) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const ctx = mouseoverCanvas.getContext('2d');
|
|
48
|
+
if (!ctx) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const view = getContainingView(self);
|
|
52
|
+
const viewWidth = view.width;
|
|
53
|
+
ctx.clearRect(0, 0, viewWidth, height);
|
|
54
|
+
if (hierarchy && hoveredTreeNode && sources) {
|
|
55
|
+
ctx.save();
|
|
56
|
+
ctx.translate(0, -scrollTop);
|
|
57
|
+
ctx.fillStyle = 'rgba(255,165,0,0.2)';
|
|
58
|
+
const descendantSet = new Set(hoveredTreeNode.descendantNames);
|
|
59
|
+
for (let i = 0, l = sources.length; i < l; i++) {
|
|
60
|
+
const source = sources[i];
|
|
61
|
+
if (descendantSet.has(source.name)) {
|
|
62
|
+
const y = (i + 0.5) * rowHeight;
|
|
63
|
+
ctx.fillRect(0, y - rowHeight / 2, viewWidth, rowHeight);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const { node } = hoveredTreeNode;
|
|
67
|
+
ctx.fillStyle = 'rgba(255,165,0,0.8)';
|
|
68
|
+
ctx.beginPath();
|
|
69
|
+
ctx.arc(node.y, node.x, 4, 0, 2 * Math.PI);
|
|
70
|
+
ctx.fill();
|
|
71
|
+
ctx.strokeStyle = 'rgba(255,140,0,1)';
|
|
72
|
+
ctx.lineWidth = 1;
|
|
73
|
+
ctx.stroke();
|
|
74
|
+
ctx.restore();
|
|
75
|
+
}
|
|
76
|
+
}, { name: 'TreeHover' }));
|
|
77
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
declare const configSchema: (pluginManager: PluginManager) => import("
|
|
2
|
+
declare const configSchema: (pluginManager: PluginManager) => import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
3
3
|
name: {
|
|
4
4
|
description: string;
|
|
5
5
|
type: string;
|
|
@@ -31,7 +31,7 @@ declare const configSchema: (pluginManager: PluginManager) => import("node_modul
|
|
|
31
31
|
defaultValue: string;
|
|
32
32
|
};
|
|
33
33
|
adapter: import("@jbrowse/mobx-state-tree").IAnyModelType;
|
|
34
|
-
textSearching: import("
|
|
34
|
+
textSearching: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
35
35
|
indexingAttributes: {
|
|
36
36
|
type: string;
|
|
37
37
|
description: string;
|
|
@@ -43,9 +43,9 @@ declare const configSchema: (pluginManager: PluginManager) => import("node_modul
|
|
|
43
43
|
defaultValue: string[];
|
|
44
44
|
};
|
|
45
45
|
textSearchAdapter: import("@jbrowse/mobx-state-tree").IAnyModelType;
|
|
46
|
-
}, import("
|
|
46
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
47
47
|
displays: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
|
|
48
|
-
formatDetails: import("
|
|
48
|
+
formatDetails: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
49
49
|
feature: {
|
|
50
50
|
type: string;
|
|
51
51
|
description: string;
|
|
@@ -68,8 +68,8 @@ declare const configSchema: (pluginManager: PluginManager) => import("node_modul
|
|
|
68
68
|
defaultValue: number;
|
|
69
69
|
description: string;
|
|
70
70
|
};
|
|
71
|
-
}, import("
|
|
72
|
-
formatAbout: import("
|
|
71
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
72
|
+
formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
73
73
|
config: {
|
|
74
74
|
type: string;
|
|
75
75
|
description: string;
|
|
@@ -80,6 +80,6 @@ declare const configSchema: (pluginManager: PluginManager) => import("node_modul
|
|
|
80
80
|
type: string;
|
|
81
81
|
defaultValue: boolean;
|
|
82
82
|
};
|
|
83
|
-
}, import("
|
|
84
|
-
}, import("
|
|
83
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
84
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "trackId">>, undefined>>;
|
|
85
85
|
export default configSchema;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const configSchema: import("
|
|
1
|
+
declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
displayCrossHatches: {
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
@@ -10,7 +10,7 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
10
10
|
description: string;
|
|
11
11
|
defaultValue: string;
|
|
12
12
|
};
|
|
13
|
-
}, import("
|
|
13
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
14
14
|
color: {
|
|
15
15
|
type: string;
|
|
16
16
|
description: string;
|
|
@@ -45,5 +45,5 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
45
45
|
defaultValue: number;
|
|
46
46
|
description: string;
|
|
47
47
|
};
|
|
48
|
-
}, import("
|
|
48
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>, undefined>>;
|
|
49
49
|
export default configSchema;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const configSchema: import("
|
|
1
|
+
declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
filled: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: boolean;
|
|
@@ -18,7 +18,7 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
18
18
|
type: string;
|
|
19
19
|
defaultValue: number;
|
|
20
20
|
};
|
|
21
|
-
}, import("
|
|
21
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
22
22
|
color: {
|
|
23
23
|
type: string;
|
|
24
24
|
description: string;
|
|
@@ -53,5 +53,5 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
53
53
|
defaultValue: number;
|
|
54
54
|
description: string;
|
|
55
55
|
};
|
|
56
|
-
}, import("
|
|
56
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>, undefined>>;
|
|
57
57
|
export default configSchema;
|
|
@@ -5,6 +5,9 @@ import type { AugmentedRegion as Region } from '@jbrowse/core/util/types';
|
|
|
5
5
|
interface WiggleOptions extends BaseOptions {
|
|
6
6
|
resolution?: number;
|
|
7
7
|
staticBlocks?: Region[];
|
|
8
|
+
sources?: {
|
|
9
|
+
name: string;
|
|
10
|
+
}[];
|
|
8
11
|
}
|
|
9
12
|
interface AdapterEntry {
|
|
10
13
|
dataAdapter: BaseFeatureDataAdapter;
|
|
@@ -87,7 +87,11 @@ export default class MultiWiggleAdapter extends BaseFeatureDataAdapter {
|
|
|
87
87
|
}
|
|
88
88
|
getFeatures(region, opts = {}) {
|
|
89
89
|
return ObservableCreate(async (observer) => {
|
|
90
|
-
|
|
90
|
+
let adapters = await this.getAdapters();
|
|
91
|
+
if (opts.sources?.length) {
|
|
92
|
+
const sourceNames = new Set(opts.sources.map(s => s.name));
|
|
93
|
+
adapters = adapters.filter(adp => sourceNames.has(adp.source));
|
|
94
|
+
}
|
|
91
95
|
merge(...adapters.map(adp => {
|
|
92
96
|
const { source, dataAdapter } = adp;
|
|
93
97
|
return dataAdapter.getFeatures(region, opts).pipe(map(f => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const MultiWiggleAdapter: import("
|
|
1
|
+
declare const MultiWiggleAdapter: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
subadapters: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: never[];
|
|
@@ -9,5 +9,5 @@ declare const MultiWiggleAdapter: import("node_modules/@jbrowse/core/src/configu
|
|
|
9
9
|
description: string;
|
|
10
10
|
defaultValue: never[];
|
|
11
11
|
};
|
|
12
|
-
}, import("
|
|
12
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
13
13
|
export default MultiWiggleAdapter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const configSchema: import("
|
|
1
|
+
declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
filled: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: boolean;
|
|
@@ -18,7 +18,7 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
18
18
|
type: string;
|
|
19
19
|
defaultValue: number;
|
|
20
20
|
};
|
|
21
|
-
}, import("
|
|
21
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
22
22
|
color: {
|
|
23
23
|
type: string;
|
|
24
24
|
description: string;
|
|
@@ -53,5 +53,5 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
53
53
|
defaultValue: number;
|
|
54
54
|
description: string;
|
|
55
55
|
};
|
|
56
|
-
}, import("
|
|
56
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>, undefined>>;
|
|
57
57
|
export default configSchema;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
declare function configSchemaFactory(pluginManager: PluginManager): import("
|
|
2
|
+
declare function configSchemaFactory(pluginManager: PluginManager): import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
3
3
|
name: {
|
|
4
4
|
description: string;
|
|
5
5
|
type: string;
|
|
@@ -31,7 +31,7 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("node
|
|
|
31
31
|
defaultValue: string;
|
|
32
32
|
};
|
|
33
33
|
adapter: import("@jbrowse/mobx-state-tree").IAnyModelType;
|
|
34
|
-
textSearching: import("
|
|
34
|
+
textSearching: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
35
35
|
indexingAttributes: {
|
|
36
36
|
type: string;
|
|
37
37
|
description: string;
|
|
@@ -43,9 +43,9 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("node
|
|
|
43
43
|
defaultValue: string[];
|
|
44
44
|
};
|
|
45
45
|
textSearchAdapter: import("@jbrowse/mobx-state-tree").IAnyModelType;
|
|
46
|
-
}, import("
|
|
46
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
47
47
|
displays: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IAnyModelType>;
|
|
48
|
-
formatDetails: import("
|
|
48
|
+
formatDetails: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
49
49
|
feature: {
|
|
50
50
|
type: string;
|
|
51
51
|
description: string;
|
|
@@ -68,8 +68,8 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("node
|
|
|
68
68
|
defaultValue: number;
|
|
69
69
|
description: string;
|
|
70
70
|
};
|
|
71
|
-
}, import("
|
|
72
|
-
formatAbout: import("
|
|
71
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
72
|
+
formatAbout: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
73
73
|
config: {
|
|
74
74
|
type: string;
|
|
75
75
|
description: string;
|
|
@@ -80,6 +80,6 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("node
|
|
|
80
80
|
type: string;
|
|
81
81
|
defaultValue: boolean;
|
|
82
82
|
};
|
|
83
|
-
}, import("
|
|
84
|
-
}, import("
|
|
83
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
84
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "trackId">>, undefined>>;
|
|
85
85
|
export default configSchemaFactory;
|
|
@@ -2,5 +2,8 @@ import RpcMethodTypeWithFiltersAndRenameRegions from '@jbrowse/core/pluggableEle
|
|
|
2
2
|
import type { GetScoreMatrixArgs } from './types.ts';
|
|
3
3
|
export declare class MultiWiggleClusterScoreMatrix extends RpcMethodTypeWithFiltersAndRenameRegions {
|
|
4
4
|
name: string;
|
|
5
|
-
execute(args: GetScoreMatrixArgs, rpcDriverClassName: string): Promise<
|
|
5
|
+
execute(args: GetScoreMatrixArgs, rpcDriverClassName: string): Promise<{
|
|
6
|
+
order: number[];
|
|
7
|
+
tree: string;
|
|
8
|
+
}>;
|
|
6
9
|
}
|
|
@@ -3,4 +3,7 @@ import type PluginManager from '@jbrowse/core/PluginManager';
|
|
|
3
3
|
export declare function executeClusterScoreMatrix({ pluginManager, args, }: {
|
|
4
4
|
pluginManager: PluginManager;
|
|
5
5
|
args: GetScoreMatrixArgs;
|
|
6
|
-
}): Promise<
|
|
6
|
+
}): Promise<{
|
|
7
|
+
order: number[];
|
|
8
|
+
tree: string;
|
|
9
|
+
}>;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import { clusterData } from '@gmod/hclust';
|
|
1
|
+
import { clusterData, toNewick } from '@gmod/hclust';
|
|
2
2
|
import { getScoreMatrix } from "./getScoreMatrix.js";
|
|
3
3
|
export async function executeClusterScoreMatrix({ pluginManager, args, }) {
|
|
4
4
|
const matrix = await getScoreMatrix({
|
|
5
5
|
pluginManager,
|
|
6
6
|
args,
|
|
7
7
|
});
|
|
8
|
-
|
|
8
|
+
const sampleLabels = Object.keys(matrix);
|
|
9
|
+
const result = await clusterData({
|
|
9
10
|
data: Object.values(matrix),
|
|
11
|
+
sampleLabels,
|
|
10
12
|
stopToken: args.stopToken,
|
|
11
13
|
onProgress: a => {
|
|
12
14
|
args.statusCallback?.(a);
|
|
13
15
|
},
|
|
14
16
|
});
|
|
17
|
+
return {
|
|
18
|
+
order: result.order,
|
|
19
|
+
tree: toNewick(result.tree),
|
|
20
|
+
};
|
|
15
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const configSchema: import("
|
|
1
|
+
declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
filled: {
|
|
3
3
|
type: string;
|
|
4
4
|
defaultValue: boolean;
|
|
@@ -18,7 +18,7 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
18
18
|
type: string;
|
|
19
19
|
defaultValue: number;
|
|
20
20
|
};
|
|
21
|
-
}, import("
|
|
21
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
22
22
|
color: {
|
|
23
23
|
type: string;
|
|
24
24
|
description: string;
|
|
@@ -53,5 +53,5 @@ declare const configSchema: import("node_modules/@jbrowse/core/src/configuration
|
|
|
53
53
|
defaultValue: number;
|
|
54
54
|
description: string;
|
|
55
55
|
};
|
|
56
|
-
}, import("
|
|
56
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>, undefined>>;
|
|
57
57
|
export default configSchema;
|
package/esm/configSchema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const WiggleRenderer: import("
|
|
1
|
+
declare const WiggleRenderer: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
color: {
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
@@ -33,5 +33,5 @@ declare const WiggleRenderer: import("node_modules/@jbrowse/core/src/configurati
|
|
|
33
33
|
defaultValue: number;
|
|
34
34
|
description: string;
|
|
35
35
|
};
|
|
36
|
-
}, import("
|
|
36
|
+
}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
37
37
|
export default WiggleRenderer;
|