@jbrowse/plugin-variants 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/ChordVariantDisplay/models/configSchema.d.ts +2 -2
- package/esm/LDDisplay/SharedLDConfigSchema.d.ts +3 -3
- package/esm/LDDisplay/components/LDDisplayComponent.js +3 -1
- package/esm/LDDisplay/components/LinesConnectingMatrixToGenomicPosition.d.ts +0 -9
- package/esm/LDDisplay/components/LinesConnectingMatrixToGenomicPosition.js +3 -29
- package/esm/LDDisplay/components/VariantLabels.d.ts +5 -0
- package/esm/LDDisplay/components/VariantLabels.js +27 -0
- package/esm/LDDisplay/components/Wrapper.d.ts +8 -0
- package/esm/LDDisplay/components/Wrapper.js +16 -0
- package/esm/LDDisplay/configSchema1.d.ts +6 -6
- package/esm/LDDisplay/configSchema2.d.ts +6 -6
- package/esm/LDDisplay/renderSvg.js +3 -1
- package/esm/LDRenderer/LDRenderer.js +3 -3
- package/esm/LDRenderer/configSchema.d.ts +2 -2
- package/esm/LDRenderer/makeImageData.d.ts +2 -2
- package/esm/LDRenderer/makeImageData.js +4 -5
- package/esm/LDTrack/configSchema.d.ts +8 -8
- package/esm/LinearVariantDisplay/configSchema.d.ts +3 -3
- package/esm/LinearVariantDisplay/model.d.ts +18 -8
- package/esm/MultiLinearVariantDisplay/configSchema.d.ts +6 -6
- package/esm/MultiLinearVariantDisplay/model.d.ts +72 -18
- package/esm/MultiLinearVariantMatrixDisplay/configSchema.d.ts +5 -5
- package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +76 -20
- package/esm/MultiLinearVariantMatrixRenderer/configSchema.d.ts +1 -1
- package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +8 -11
- package/esm/MultiLinearVariantRenderer/configSchema.d.ts +1 -1
- package/esm/MultiLinearVariantRenderer/makeImageData.js +8 -11
- package/esm/PlinkLDAdapter/configSchema.d.ts +2 -2
- package/esm/PlinkLDAdapter/configSchemaTabix.d.ts +4 -4
- package/esm/SplitVcfTabixAdapter/configSchema.d.ts +2 -2
- package/esm/StructuralVariantChordRenderer/configSchema.d.ts +2 -2
- package/esm/VariantFeatureWidget/configSchema.d.ts +1 -1
- package/esm/VariantFeatureWidget/stateModelFactory.d.ts +2 -2
- package/esm/VariantRPC/MultiVariantGetGenotypeMatrix.js +4 -1
- package/esm/VariantRPC/MultiVariantGetSimplifiedFeatures.js +3 -3
- package/esm/VariantRPC/executeClusterGenotypeMatrix.js +6 -3
- package/esm/VariantRPC/getGenotypeMatrix.d.ts +2 -3
- package/esm/VariantRPC/getGenotypeMatrix.js +4 -5
- package/esm/VariantRPC/getLDMatrix.d.ts +2 -3
- package/esm/VariantRPC/getLDMatrix.js +5 -6
- package/esm/VariantRPC/getPhasedGenotypeMatrix.d.ts +2 -3
- package/esm/VariantRPC/getPhasedGenotypeMatrix.js +4 -5
- package/esm/VariantTrack/configSchema.d.ts +8 -8
- package/esm/VcfAdapter/configSchema.d.ts +2 -2
- package/esm/VcfTabixAdapter/configSchema.d.ts +4 -4
- package/esm/shared/MultiVariantBaseModel.d.ts +76 -20
- package/esm/shared/MultiVariantBaseModel.js +53 -3
- package/esm/shared/SharedVariantConfigSchema.d.ts +3 -3
- package/esm/shared/components/RectBg.js +3 -1
- package/esm/shared/components/TreeSidebar.js +38 -5
- package/esm/shared/components/types.d.ts +2 -0
- package/esm/shared/constants.d.ts +1 -0
- package/esm/shared/constants.js +1 -0
- package/esm/shared/makeSidebarSvg.js +3 -2
- package/esm/shared/minorAlleleFrequencyUtils.d.ts +2 -2
- package/esm/shared/minorAlleleFrequencyUtils.js +2 -2
- package/package.json +8 -8
|
@@ -4,9 +4,10 @@ import { ResizeHandle } from '@jbrowse/core/ui';
|
|
|
4
4
|
import { getContainingView } from '@jbrowse/core/util';
|
|
5
5
|
import Flatbush from '@jbrowse/core/util/flatbush';
|
|
6
6
|
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
7
|
-
import { alpha } from '@mui/material';
|
|
7
|
+
import { Menu, MenuItem, alpha } from '@mui/material';
|
|
8
8
|
import { autorun } from 'mobx';
|
|
9
9
|
import { observer } from 'mobx-react';
|
|
10
|
+
import { SIDEBAR_BACKGROUND_OPACITY } from "../constants.js";
|
|
10
11
|
const useStyles = makeStyles()(theme => ({
|
|
11
12
|
resizeHandle: {
|
|
12
13
|
position: 'absolute',
|
|
@@ -23,7 +24,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
23
24
|
position: 'absolute',
|
|
24
25
|
top: 0,
|
|
25
26
|
left: 0,
|
|
26
|
-
background: alpha(theme.palette.background.paper,
|
|
27
|
+
background: alpha(theme.palette.background.paper, SIDEBAR_BACKGROUND_OPACITY),
|
|
27
28
|
},
|
|
28
29
|
}));
|
|
29
30
|
function getDescendantNames(node) {
|
|
@@ -37,6 +38,7 @@ const TreeSidebar = observer(function TreeSidebar({ model, }) {
|
|
|
37
38
|
const { width: viewWidth } = getContainingView(model);
|
|
38
39
|
const [nodeIndex, setNodeIndex] = useState(null);
|
|
39
40
|
const [nodeData, setNodeData] = useState([]);
|
|
41
|
+
const [menuAnchor, setMenuAnchor] = useState(null);
|
|
40
42
|
const { hierarchy, treeAreaWidth, height, scrollTop, showTree, sources } = model;
|
|
41
43
|
const treeCanvasRef = useCallback((ref) => {
|
|
42
44
|
model.setTreeCanvasRef(ref);
|
|
@@ -47,7 +49,7 @@ const TreeSidebar = observer(function TreeSidebar({ model, }) {
|
|
|
47
49
|
useEffect(() => {
|
|
48
50
|
return autorun(function treeSpatialIndexAutorun() {
|
|
49
51
|
const { treeAreaWidth: _t, hierarchy: h, totalHeight: th } = model;
|
|
50
|
-
|
|
52
|
+
th;
|
|
51
53
|
if (!h) {
|
|
52
54
|
setNodeIndex(null);
|
|
53
55
|
setNodeData([]);
|
|
@@ -88,6 +90,27 @@ const TreeSidebar = observer(function TreeSidebar({ model, }) {
|
|
|
88
90
|
const handleMouseLeave = useCallback(() => {
|
|
89
91
|
model.setHoveredTreeNode(undefined);
|
|
90
92
|
}, [model]);
|
|
93
|
+
const handleClick = useCallback((event) => {
|
|
94
|
+
if (!hierarchy || !nodeIndex) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
98
|
+
const x = event.clientX - rect.left;
|
|
99
|
+
const y = event.clientY - rect.top + scrollTop;
|
|
100
|
+
const results = nodeIndex.search(x, y, x, y);
|
|
101
|
+
const node = results.length > 0 ? nodeData[results[0]] : undefined;
|
|
102
|
+
if (node) {
|
|
103
|
+
const descendantNames = getDescendantNames(node);
|
|
104
|
+
setMenuAnchor({
|
|
105
|
+
x: event.clientX,
|
|
106
|
+
y: event.clientY,
|
|
107
|
+
names: descendantNames,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, [hierarchy, nodeIndex, nodeData, scrollTop]);
|
|
111
|
+
const handleCloseMenu = useCallback(() => {
|
|
112
|
+
setMenuAnchor(null);
|
|
113
|
+
}, []);
|
|
91
114
|
if (!hierarchy || !showTree || !sources?.length) {
|
|
92
115
|
return null;
|
|
93
116
|
}
|
|
@@ -108,12 +131,14 @@ const TreeSidebar = observer(function TreeSidebar({ model, }) {
|
|
|
108
131
|
left: 0,
|
|
109
132
|
pointerEvents: 'none',
|
|
110
133
|
} }), _jsx("canvas", { ref: mouseoverCanvasRef, width: viewWidth, height: height, style: {
|
|
134
|
+
width: viewWidth,
|
|
135
|
+
height,
|
|
111
136
|
position: 'absolute',
|
|
112
137
|
top: 0,
|
|
113
138
|
left: 0,
|
|
114
139
|
zIndex: 1,
|
|
115
140
|
pointerEvents: 'none',
|
|
116
|
-
} }), _jsx("div", { onMouseMove: handleMouseMove, onMouseLeave: handleMouseLeave, style: {
|
|
141
|
+
} }), _jsx("div", { onMouseMove: handleMouseMove, onMouseLeave: handleMouseLeave, onClick: handleClick, style: {
|
|
117
142
|
position: 'absolute',
|
|
118
143
|
top: 0,
|
|
119
144
|
left: 0,
|
|
@@ -126,6 +151,14 @@ const TreeSidebar = observer(function TreeSidebar({ model, }) {
|
|
|
126
151
|
return undefined;
|
|
127
152
|
}, className: classes.resizeHandle, style: {
|
|
128
153
|
left: treeAreaWidth,
|
|
129
|
-
}, vertical: true })
|
|
154
|
+
}, vertical: true }), _jsxs(Menu, { open: !!menuAnchor, onClose: handleCloseMenu, anchorReference: "anchorPosition", anchorPosition: menuAnchor ? { top: menuAnchor.y, left: menuAnchor.x } : undefined, children: [model.subtreeFilter?.length ? (_jsx(MenuItem, { onClick: () => {
|
|
155
|
+
model.setSubtreeFilter(undefined);
|
|
156
|
+
handleCloseMenu();
|
|
157
|
+
}, children: "Clear subtree filter" })) : null, _jsxs(MenuItem, { onClick: () => {
|
|
158
|
+
if (menuAnchor) {
|
|
159
|
+
model.setSubtreeFilter(menuAnchor.names);
|
|
160
|
+
}
|
|
161
|
+
handleCloseMenu();
|
|
162
|
+
}, children: ["Show only subtree (", menuAnchor?.names.length, " samples)"] })] })] }));
|
|
130
163
|
});
|
|
131
164
|
export default TreeSidebar;
|
|
@@ -18,10 +18,12 @@ export interface TreeSidebarModel {
|
|
|
18
18
|
scrollTop: number;
|
|
19
19
|
showTree: boolean;
|
|
20
20
|
sources?: Source[];
|
|
21
|
+
subtreeFilter?: string[];
|
|
21
22
|
setTreeCanvasRef: (ref: HTMLCanvasElement | null) => void;
|
|
22
23
|
setMouseoverCanvasRef: (ref: HTMLCanvasElement | null) => void;
|
|
23
24
|
setHoveredTreeNode: (node?: HoveredTreeNode) => void;
|
|
24
25
|
setTreeAreaWidth: (width: number) => void;
|
|
26
|
+
setSubtreeFilter: (names?: string[]) => void;
|
|
25
27
|
}
|
|
26
28
|
export interface LegendBarModel {
|
|
27
29
|
id: string;
|
package/esm/shared/constants.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getContainingView } from '@jbrowse/core/util';
|
|
3
|
+
import RectBg from "./components/RectBg.js";
|
|
3
4
|
import SvgTree from "./components/SvgTree.js";
|
|
4
5
|
import LegendBar from "../shared/components/MultiVariantLegendBar.js";
|
|
5
6
|
export async function makeSidebarSvg(self) {
|
|
6
7
|
const { offsetPx } = getContainingView(self);
|
|
7
8
|
const { hierarchy, showTree, treeAreaWidth, availableHeight } = self;
|
|
8
|
-
return (_jsxs("g", { id: "tree-layer", "data-testid": "tree-layer", transform: `translate(${Math.max(-offsetPx, 0)})`, clipPath: "url(#sidebarClip)", children: [_jsx("clipPath", { id: "sidebarClip", children: _jsx("rect", { x: "0", y: "0", width: "100%", height: availableHeight }) }), _jsx("g", { id: "legend-layer", transform: `translate(${showTree && hierarchy ? treeAreaWidth : 0})`, children: _jsx(LegendBar, { model: self, orientation: "left", exportSVG: true }) }), showTree ? _jsx(SvgTree, { model: self }) : null] }));
|
|
9
|
+
return (_jsxs("g", { id: "tree-layer", "data-testid": "tree-layer", transform: `translate(${Math.max(-offsetPx, 0)})`, clipPath: "url(#sidebarClip)", children: [_jsx("clipPath", { id: "sidebarClip", children: _jsx("rect", { x: "0", y: "0", width: "100%", height: availableHeight }) }), _jsx("g", { id: "legend-layer", transform: `translate(${showTree && hierarchy ? treeAreaWidth : 0})`, children: _jsx(LegendBar, { model: self, orientation: "left", exportSVG: true }) }), showTree && hierarchy ? (_jsxs(_Fragment, { children: [_jsx(RectBg, { x: 0, y: 0, width: treeAreaWidth, height: availableHeight }), _jsx(SvgTree, { model: self })] })) : null] }));
|
|
9
10
|
}
|
|
@@ -3,11 +3,11 @@ import type { Feature, LastStopTokenCheck } from '@jbrowse/core/util';
|
|
|
3
3
|
export declare function calculateAlleleCountsFast(feature: VcfFeature): Record<string, number>;
|
|
4
4
|
export declare function calculateAlleleCounts(genotypes: Record<string, string>, cacheSplit: Record<string, string[]>): Record<string, number>;
|
|
5
5
|
export declare function calculateMinorAlleleFrequency(alleleCounts: Record<string, number>): number;
|
|
6
|
-
export declare function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter,
|
|
6
|
+
export declare function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopTokenCheck, genotypesCache, splitCache, }: {
|
|
7
7
|
features: Iterable<Feature>;
|
|
8
8
|
minorAlleleFrequencyFilter: number;
|
|
9
9
|
lengthCutoffFilter: number;
|
|
10
|
-
|
|
10
|
+
stopTokenCheck?: LastStopTokenCheck;
|
|
11
11
|
genotypesCache?: Map<string, Record<string, string>>;
|
|
12
12
|
splitCache?: Record<string, string[]>;
|
|
13
13
|
}): {
|
|
@@ -275,7 +275,7 @@ function getMostFrequentAlt(alleleCounts) {
|
|
|
275
275
|
}
|
|
276
276
|
return mostFrequentAlt;
|
|
277
277
|
}
|
|
278
|
-
export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter,
|
|
278
|
+
export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorAlleleFrequencyFilter, lengthCutoffFilter, stopTokenCheck, genotypesCache, splitCache = {}, }) {
|
|
279
279
|
const results = [];
|
|
280
280
|
for (const feature of features) {
|
|
281
281
|
if (feature.get('end') - feature.get('start') <= lengthCutoffFilter) {
|
|
@@ -301,7 +301,7 @@ export function getFeaturesThatPassMinorAlleleFrequencyFilter({ features, minorA
|
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
-
checkStopToken2(
|
|
304
|
+
checkStopToken2(stopTokenCheck);
|
|
305
305
|
}
|
|
306
306
|
return results;
|
|
307
307
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-variants",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "JBrowse 2 variant adapters, tracks, etc.",
|
|
6
6
|
"keywords": [
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"@gmod/tabix": "^3.2.2",
|
|
27
27
|
"@gmod/vcf": "^7.0.0",
|
|
28
28
|
"@jbrowse/mobx-state-tree": "^5.5.0",
|
|
29
|
-
"@mui/icons-material": "^7.3.
|
|
30
|
-
"@mui/material": "^7.3.
|
|
29
|
+
"@mui/icons-material": "^7.3.8",
|
|
30
|
+
"@mui/material": "^7.3.8",
|
|
31
31
|
"@mui/x-charts-vendor": "^8.26.0",
|
|
32
|
-
"@mui/x-data-grid": "^8.
|
|
32
|
+
"@mui/x-data-grid": "^8.27.1",
|
|
33
33
|
"@types/file-saver-es": "^2.0.3",
|
|
34
34
|
"copy-to-clipboard": "^3.3.3",
|
|
35
35
|
"escape-html": "^1.0.3",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"mobx": "^6.15.0",
|
|
39
39
|
"mobx-react": "^9.2.1",
|
|
40
40
|
"rxjs": "^7.8.2",
|
|
41
|
-
"@jbrowse/
|
|
42
|
-
"@jbrowse/
|
|
43
|
-
"@jbrowse/
|
|
44
|
-
"@jbrowse/
|
|
41
|
+
"@jbrowse/plugin-circular-view": "^4.1.4",
|
|
42
|
+
"@jbrowse/core": "^4.1.4",
|
|
43
|
+
"@jbrowse/plugin-linear-genome-view": "^4.1.4",
|
|
44
|
+
"@jbrowse/sv-core": "^4.1.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=18.0.0"
|