@jbrowse/plugin-dotplot-view 3.6.5 → 4.0.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/esm/ComparativeRenderer/index.d.ts +10 -10
- package/esm/ComparativeRenderer/index.js +4 -17
- package/esm/DiagonalizeDotplotRpc.d.ts +30 -0
- package/esm/DiagonalizeDotplotRpc.js +147 -0
- package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +1 -1
- package/esm/DotplotDisplay/index.d.ts +3 -3
- package/esm/DotplotDisplay/index.js +4 -4
- package/esm/DotplotDisplay/renderDotplotBlock.d.ts +2 -1
- package/esm/DotplotDisplay/renderDotplotBlock.js +9 -4
- package/esm/DotplotDisplay/stateModelFactory.d.ts +148 -29
- package/esm/DotplotDisplay/stateModelFactory.js +17 -11
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js +5 -6
- package/esm/DotplotReadVsRef/index.js +1 -1
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +30 -48
- package/esm/DotplotRenderer/DotplotRenderer.js +55 -22
- package/esm/DotplotRenderer/clamp.d.ts +7 -0
- package/esm/DotplotRenderer/clamp.js +58 -0
- package/esm/DotplotRenderer/components/DotplotRendering.d.ts +1 -1
- package/esm/DotplotRenderer/components/DotplotRendering.js +1 -1
- package/esm/DotplotRenderer/configSchema.d.ts +3 -3
- package/esm/DotplotRenderer/configSchema.js +1 -1
- package/esm/DotplotRenderer/drawDotplot.d.ts +7 -6
- package/esm/DotplotRenderer/drawDotplot.js +95 -100
- package/esm/DotplotRenderer/index.js +4 -4
- package/esm/DotplotView/1dview.d.ts +25 -25
- package/esm/DotplotView/1dview.js +16 -4
- package/esm/DotplotView/components/Axes.d.ts +1 -1
- package/esm/DotplotView/components/Axes.js +31 -41
- package/esm/DotplotView/components/ColorBySelector.d.ts +5 -0
- package/esm/DotplotView/components/ColorBySelector.js +73 -0
- package/esm/DotplotView/components/DiagonalizationProgressDialog.d.ts +6 -0
- package/esm/DotplotView/components/DiagonalizationProgressDialog.js +123 -0
- package/esm/DotplotView/components/DotplotControls.d.ts +1 -1
- package/esm/DotplotView/components/DotplotControls.js +53 -15
- package/esm/DotplotView/components/DotplotGrid.d.ts +6 -0
- package/esm/DotplotView/components/{Grid.js → DotplotGrid.js} +19 -20
- package/esm/DotplotView/components/DotplotGridWrapper.d.ts +6 -0
- package/esm/DotplotView/components/DotplotGridWrapper.js +8 -0
- package/esm/DotplotView/components/DotplotTooltipClick.d.ts +2 -2
- package/esm/DotplotView/components/DotplotTooltipClick.js +4 -4
- package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +1 -1
- package/esm/DotplotView/components/DotplotTooltipMouseover.js +2 -2
- package/esm/DotplotView/components/DotplotTooltips.d.ts +15 -0
- package/esm/DotplotView/components/DotplotTooltips.js +7 -0
- package/esm/DotplotView/components/DotplotView.d.ts +2 -2
- package/esm/DotplotView/components/DotplotView.js +31 -171
- package/esm/DotplotView/components/DotplotWarnings.d.ts +1 -1
- package/esm/DotplotView/components/DotplotWarnings.js +7 -7
- package/esm/DotplotView/components/ExportSvgDialog.d.ts +1 -1
- package/esm/DotplotView/components/Header.d.ts +1 -1
- package/esm/DotplotView/components/Header.js +5 -5
- package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +6 -5
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +2 -3
- package/esm/DotplotView/components/ImportForm/TrackSelector.d.ts +10 -1
- package/esm/DotplotView/components/ImportForm/TrackSelector.js +8 -4
- package/esm/DotplotView/components/ImportForm/index.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/index.js +4 -10
- package/esm/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.js +2 -2
- package/esm/DotplotView/components/ImportForm/selectors/PifGzSelector.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/selectors/PifGzSelector.js +2 -2
- package/esm/DotplotView/components/ImportForm/selectors/SwapAssemblies.js +3 -3
- package/esm/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.d.ts +1 -1
- package/esm/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.js +3 -3
- package/esm/DotplotView/components/ImportForm/selectors/index.d.ts +3 -3
- package/esm/DotplotView/components/ImportForm/selectors/index.js +3 -3
- package/esm/DotplotView/components/MinLengthSlider.d.ts +5 -0
- package/esm/DotplotView/components/MinLengthSlider.js +39 -0
- package/esm/DotplotView/components/MouseInteractionLayer.d.ts +17 -0
- package/esm/DotplotView/components/MouseInteractionLayer.js +14 -0
- package/esm/DotplotView/components/OpacitySlider.d.ts +5 -0
- package/esm/DotplotView/components/OpacitySlider.js +37 -0
- package/esm/DotplotView/components/PanButtons.d.ts +1 -1
- package/esm/DotplotView/components/PanButtons.js +1 -1
- package/esm/DotplotView/components/SelectionContextMenu.d.ts +13 -0
- package/esm/DotplotView/components/SelectionContextMenu.js +39 -0
- package/esm/DotplotView/components/SliderTooltip.d.ts +2 -0
- package/esm/DotplotView/components/SliderTooltip.js +6 -0
- package/esm/DotplotView/components/WarningDialog.js +1 -1
- package/esm/DotplotView/components/hooks/useCtrlKeyTracking.d.ts +1 -0
- package/esm/DotplotView/components/hooks/useCtrlKeyTracking.js +21 -0
- package/esm/DotplotView/components/hooks/useCursorMode.d.ts +7 -0
- package/esm/DotplotView/components/hooks/useCursorMode.js +16 -0
- package/esm/DotplotView/components/hooks/useMouseCoordinates.d.ts +29 -0
- package/esm/DotplotView/components/hooks/useMouseCoordinates.js +49 -0
- package/esm/DotplotView/components/hooks/useMouseMoveHandler.d.ts +6 -0
- package/esm/DotplotView/components/hooks/useMouseMoveHandler.js +24 -0
- package/esm/DotplotView/components/hooks/useMouseUpHandler.d.ts +3 -0
- package/esm/DotplotView/components/hooks/useMouseUpHandler.js +28 -0
- package/esm/DotplotView/components/hooks/useWheelHandler.d.ts +8 -0
- package/esm/DotplotView/components/hooks/useWheelHandler.js +44 -0
- package/esm/DotplotView/components/util.d.ts +1 -1
- package/esm/DotplotView/components/util.js +18 -8
- package/esm/DotplotView/index.js +2 -2
- package/esm/DotplotView/model.d.ts +213 -90
- package/esm/DotplotView/model.js +147 -93
- package/esm/DotplotView/svgcomponents/SVGDotplotView.d.ts +1 -1
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +5 -6
- package/esm/DotplotView/types.d.ts +7 -1
- package/esm/LaunchDotplotView.js +6 -36
- package/esm/ServerSideRenderedBlockContent.js +6 -27
- package/esm/ServerSideSyntenyRendering.d.ts +1 -1
- package/esm/ServerSideSyntenyRendering.js +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +9 -10
- package/esm/util.d.ts +1 -1
- package/package.json +28 -35
- package/dist/ComparativeRenderer/index.d.ts +0 -22
- package/dist/ComparativeRenderer/index.js +0 -53
- package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +0 -6
- package/dist/DotplotDisplay/components/DotplotDisplay.js +0 -18
- package/dist/DotplotDisplay/index.d.ts +0 -5
- package/dist/DotplotDisplay/index.js +0 -36
- package/dist/DotplotDisplay/renderDotplotBlock.d.ts +0 -11
- package/dist/DotplotDisplay/renderDotplotBlock.js +0 -49
- package/dist/DotplotDisplay/stateModelFactory.d.ts +0 -102
- package/dist/DotplotDisplay/stateModelFactory.js +0 -119
- package/dist/DotplotReadVsRef/DotplotReadVsRef.d.ts +0 -3
- package/dist/DotplotReadVsRef/DotplotReadVsRef.js +0 -100
- package/dist/DotplotReadVsRef/index.d.ts +0 -2
- package/dist/DotplotReadVsRef/index.js +0 -41
- package/dist/DotplotRenderer/ComparativeRenderRpc.d.ts +0 -22
- package/dist/DotplotRenderer/ComparativeRenderRpc.js +0 -53
- package/dist/DotplotRenderer/DotplotRenderer.d.ts +0 -74
- package/dist/DotplotRenderer/DotplotRenderer.js +0 -102
- package/dist/DotplotRenderer/components/DotplotRendering.d.ts +0 -3
- package/dist/DotplotRenderer/components/DotplotRendering.js +0 -9
- package/dist/DotplotRenderer/configSchema.d.ts +0 -40
- package/dist/DotplotRenderer/configSchema.js +0 -57
- package/dist/DotplotRenderer/drawDotplot.d.ts +0 -21
- package/dist/DotplotRenderer/drawDotplot.js +0 -213
- package/dist/DotplotRenderer/index.d.ts +0 -2
- package/dist/DotplotRenderer/index.js +0 -17
- package/dist/DotplotView/1dview.d.ts +0 -199
- package/dist/DotplotView/1dview.js +0 -63
- package/dist/DotplotView/components/Axes.d.ts +0 -13
- package/dist/DotplotView/components/Axes.js +0 -107
- package/dist/DotplotView/components/CursorIcon.d.ts +0 -3
- package/dist/DotplotView/components/CursorIcon.js +0 -15
- package/dist/DotplotView/components/DotplotControls.d.ts +0 -5
- package/dist/DotplotView/components/DotplotControls.js +0 -115
- package/dist/DotplotView/components/DotplotTooltipClick.d.ts +0 -10
- package/dist/DotplotView/components/DotplotTooltipClick.js +0 -17
- package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +0 -9
- package/dist/DotplotView/components/DotplotTooltipMouseover.js +0 -16
- package/dist/DotplotView/components/DotplotView.d.ts +0 -5
- package/dist/DotplotView/components/DotplotView.js +0 -275
- package/dist/DotplotView/components/DotplotWarnings.d.ts +0 -5
- package/dist/DotplotView/components/DotplotWarnings.js +0 -53
- package/dist/DotplotView/components/ExportSvgDialog.d.ts +0 -7
- package/dist/DotplotView/components/ExportSvgDialog.js +0 -53
- package/dist/DotplotView/components/Grid.d.ts +0 -9
- package/dist/DotplotView/components/Grid.js +0 -47
- package/dist/DotplotView/components/Header.d.ts +0 -9
- package/dist/DotplotView/components/Header.js +0 -33
- package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +0 -7
- package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +0 -78
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -7
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +0 -42
- package/dist/DotplotView/components/ImportForm/TrackSelector.d.ts +0 -7
- package/dist/DotplotView/components/ImportForm/TrackSelector.js +0 -23
- package/dist/DotplotView/components/ImportForm/getAdapter.d.ts +0 -117
- package/dist/DotplotView/components/ImportForm/getAdapter.js +0 -68
- package/dist/DotplotView/components/ImportForm/index.d.ts +0 -5
- package/dist/DotplotView/components/ImportForm/index.js +0 -76
- package/dist/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.d.ts +0 -3
- package/dist/DotplotView/components/ImportForm/selectors/AnchorsFileSelector.js +0 -23
- package/dist/DotplotView/components/ImportForm/selectors/PifGzSelector.d.ts +0 -3
- package/dist/DotplotView/components/ImportForm/selectors/PifGzSelector.js +0 -13
- package/dist/DotplotView/components/ImportForm/selectors/SelectorTypes.d.ts +0 -23
- package/dist/DotplotView/components/ImportForm/selectors/SelectorTypes.js +0 -10
- package/dist/DotplotView/components/ImportForm/selectors/SwapAssemblies.d.ts +0 -13
- package/dist/DotplotView/components/ImportForm/selectors/SwapAssemblies.js +0 -32
- package/dist/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.d.ts +0 -3
- package/dist/DotplotView/components/ImportForm/selectors/SyntenyFileSelector.js +0 -24
- package/dist/DotplotView/components/ImportForm/selectors/index.d.ts +0 -3
- package/dist/DotplotView/components/ImportForm/selectors/index.js +0 -12
- package/dist/DotplotView/components/ImportForm/util.d.ts +0 -10
- package/dist/DotplotView/components/ImportForm/util.js +0 -24
- package/dist/DotplotView/components/PanButtons.d.ts +0 -5
- package/dist/DotplotView/components/PanButtons.js +0 -47
- package/dist/DotplotView/components/WarningDialog.d.ts +0 -16
- package/dist/DotplotView/components/WarningDialog.js +0 -39
- package/dist/DotplotView/components/util.d.ts +0 -14
- package/dist/DotplotView/components/util.js +0 -82
- package/dist/DotplotView/index.d.ts +0 -2
- package/dist/DotplotView/index.js +0 -52
- package/dist/DotplotView/model.d.ts +0 -435
- package/dist/DotplotView/model.js +0 -487
- package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +0 -4
- package/dist/DotplotView/svgcomponents/SVGBackground.js +0 -10
- package/dist/DotplotView/svgcomponents/SVGDotplotView.d.ts +0 -2
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +0 -30
- package/dist/DotplotView/types.d.ts +0 -12
- package/dist/DotplotView/types.js +0 -2
- package/dist/LaunchDotplotView.d.ts +0 -2
- package/dist/LaunchDotplotView.js +0 -43
- package/dist/ServerSideRenderedBlockContent.d.ts +0 -12
- package/dist/ServerSideRenderedBlockContent.js +0 -65
- package/dist/ServerSideSyntenyRendering.d.ts +0 -13
- package/dist/ServerSideSyntenyRendering.js +0 -23
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -40
- package/dist/util.d.ts +0 -9
- package/dist/util.js +0 -7
- package/esm/DotplotRenderer/ComparativeRenderRpc.d.ts +0 -22
- package/esm/DotplotRenderer/ComparativeRenderRpc.js +0 -47
- package/esm/DotplotView/components/Grid.d.ts +0 -9
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
|
|
4
|
+
import { getSession } from '@jbrowse/core/util';
|
|
5
|
+
import { createStopToken, stopStopToken } from '@jbrowse/core/util/stopToken';
|
|
6
|
+
import { Button, DialogActions, DialogContent, LinearProgress, Typography, } from '@mui/material';
|
|
7
|
+
import { transaction } from 'mobx';
|
|
8
|
+
import { observer } from 'mobx-react';
|
|
9
|
+
async function runDiagonalization({ model, session, stopToken, setProgress, setMessage, }) {
|
|
10
|
+
setProgress(0);
|
|
11
|
+
setMessage('Preparing diagonalization...');
|
|
12
|
+
const track = model.tracks[0];
|
|
13
|
+
if (!track) {
|
|
14
|
+
throw new Error('No tracks found');
|
|
15
|
+
}
|
|
16
|
+
const display = track.displays[0];
|
|
17
|
+
if (!display) {
|
|
18
|
+
throw new Error('No display found');
|
|
19
|
+
}
|
|
20
|
+
const result = (await session.rpcManager.call(model.id, 'DiagonalizeDotplot', {
|
|
21
|
+
sessionId: `diagonalize-${Date.now()}`,
|
|
22
|
+
view: {
|
|
23
|
+
hview: model.hview,
|
|
24
|
+
vview: model.vview,
|
|
25
|
+
},
|
|
26
|
+
adapterConfig: display.adapterConfig,
|
|
27
|
+
stopToken,
|
|
28
|
+
statusCallback: (msg) => {
|
|
29
|
+
setMessage(msg);
|
|
30
|
+
if (msg.includes('Initializing')) {
|
|
31
|
+
setProgress(5);
|
|
32
|
+
}
|
|
33
|
+
else if (msg.includes('Getting renderer')) {
|
|
34
|
+
setProgress(10);
|
|
35
|
+
}
|
|
36
|
+
else if (msg.includes('Fetching features')) {
|
|
37
|
+
setProgress(20);
|
|
38
|
+
}
|
|
39
|
+
else if (msg.includes('Extracting')) {
|
|
40
|
+
setProgress(30);
|
|
41
|
+
}
|
|
42
|
+
else if (msg.includes('Running diagonalization')) {
|
|
43
|
+
setProgress(40);
|
|
44
|
+
}
|
|
45
|
+
else if (msg.includes('Grouping')) {
|
|
46
|
+
setProgress(50);
|
|
47
|
+
}
|
|
48
|
+
else if (msg.includes('Determining')) {
|
|
49
|
+
setProgress(65);
|
|
50
|
+
}
|
|
51
|
+
else if (msg.includes('Sorting')) {
|
|
52
|
+
setProgress(80);
|
|
53
|
+
}
|
|
54
|
+
else if (msg.includes('Building')) {
|
|
55
|
+
setProgress(90);
|
|
56
|
+
}
|
|
57
|
+
else if (msg.includes('complete')) {
|
|
58
|
+
setProgress(100);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
62
|
+
setMessage('Applying new layout...');
|
|
63
|
+
setProgress(95);
|
|
64
|
+
if (result.newRegions.length > 0) {
|
|
65
|
+
transaction(() => {
|
|
66
|
+
model.vview.setDisplayedRegions(result.newRegions);
|
|
67
|
+
});
|
|
68
|
+
setProgress(100);
|
|
69
|
+
setMessage(`Diagonalization complete! Reordered ${result.stats.regionsReordered} regions, reversed ${result.stats.regionsReversed}`);
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw new Error('No regions to reorder');
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const DiagonalizationProgressDialog = observer(function DiagonalizationProgressDialog({ handleClose, model, }) {
|
|
77
|
+
const [progress, setProgress] = useState(0);
|
|
78
|
+
const [message, setMessage] = useState('Ready to start diagonalization');
|
|
79
|
+
const [error, setError] = useState();
|
|
80
|
+
const [isRunning, setIsRunning] = useState(false);
|
|
81
|
+
const [stopToken, setStopToken] = useState();
|
|
82
|
+
const handleStart = async () => {
|
|
83
|
+
const session = getSession(model);
|
|
84
|
+
const token = createStopToken();
|
|
85
|
+
setStopToken(token);
|
|
86
|
+
try {
|
|
87
|
+
setIsRunning(true);
|
|
88
|
+
await runDiagonalization({
|
|
89
|
+
model,
|
|
90
|
+
session,
|
|
91
|
+
stopToken: token,
|
|
92
|
+
setProgress,
|
|
93
|
+
setMessage,
|
|
94
|
+
});
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
handleClose();
|
|
97
|
+
}, 2000);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
console.error(err);
|
|
101
|
+
setError(err);
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
setIsRunning(false);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const handleCancel = () => {
|
|
108
|
+
if (stopToken) {
|
|
109
|
+
stopStopToken(stopToken);
|
|
110
|
+
setStopToken(undefined);
|
|
111
|
+
}
|
|
112
|
+
handleClose();
|
|
113
|
+
};
|
|
114
|
+
const handleDialogClose = () => {
|
|
115
|
+
if (!isRunning) {
|
|
116
|
+
handleClose();
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
return (_jsxs(Dialog, { open: true, title: "Diagonalize Dotplot", onClose: handleDialogClose, maxWidth: "lg", children: [_jsxs(DialogContent, { style: { minWidth: 400 }, children: [message ? _jsx(Typography, { children: message }) : null, error ? _jsx(ErrorMessage, { error: error }) : null, isRunning ? (_jsxs(_Fragment, { children: [_jsx(LinearProgress, { variant: "determinate", value: progress, style: { marginTop: 16 }, color: error ? 'error' : 'primary' }), _jsxs(Typography, { variant: "caption", color: "textSecondary", style: { marginTop: 8, display: 'block' }, children: [Math.round(progress), "% complete"] })] })) : null] }), _jsxs(DialogActions, { children: [!isRunning ? (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: handleClose, color: "secondary", variant: "contained", children: "Cancel" }), _jsx(Button, { onClick: () => {
|
|
120
|
+
handleStart();
|
|
121
|
+
}, color: "primary", variant: "contained", children: "Start" })] })) : null, isRunning ? (_jsx(Button, { onClick: handleCancel, color: "secondary", variant: "contained", children: "Cancel" })) : null] })] }));
|
|
122
|
+
});
|
|
123
|
+
export default DiagonalizationProgressDialog;
|
|
@@ -1,41 +1,61 @@
|
|
|
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
|
+
import { lazy, useState } from 'react';
|
|
2
3
|
import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
|
|
3
4
|
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons';
|
|
4
|
-
import
|
|
5
|
-
import CropLandscapeIcon from '@mui/icons-material/CropLandscape';
|
|
5
|
+
import { getSession } from '@jbrowse/core/util';
|
|
6
6
|
import MoreVert from '@mui/icons-material/MoreVert';
|
|
7
|
-
import
|
|
7
|
+
import ShuffleIcon from '@mui/icons-material/Shuffle';
|
|
8
8
|
import ZoomIn from '@mui/icons-material/ZoomIn';
|
|
9
9
|
import ZoomOut from '@mui/icons-material/ZoomOut';
|
|
10
10
|
import { IconButton } from '@mui/material';
|
|
11
11
|
import { observer } from 'mobx-react';
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import ColorBySelector from "./ColorBySelector.js";
|
|
13
|
+
import { CursorMouse, CursorMove } from "./CursorIcon.js";
|
|
14
|
+
import MinLengthSlider from "./MinLengthSlider.js";
|
|
15
|
+
import OpacitySlider from "./OpacitySlider.js";
|
|
16
|
+
const DiagonalizationProgressDialog = lazy(() => import("./DiagonalizationProgressDialog.js"));
|
|
17
|
+
const DotplotControls = observer(function DotplotControls({ model, }) {
|
|
18
|
+
const [showDynamicControls, setShowDynamicControls] = useState(true);
|
|
19
|
+
const hasDisplays = model.tracks[0]?.displays[0];
|
|
20
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '4px' }, children: [_jsx(IconButton, { onClick: () => {
|
|
15
21
|
model.zoomOut();
|
|
16
22
|
}, children: _jsx(ZoomOut, {}) }), _jsx(IconButton, { onClick: () => {
|
|
17
23
|
model.zoomIn();
|
|
18
24
|
}, children: _jsx(ZoomIn, {}) }), _jsx(IconButton, { onClick: () => model.activateTrackSelector(), title: "Open track selector", children: _jsx(TrackSelectorIcon, {}) }), _jsx(CascadingMenuButton, { menuItems: [
|
|
19
25
|
{
|
|
20
26
|
label: 'Square view - same bp per pixel',
|
|
21
|
-
icon: CropDinIcon,
|
|
22
27
|
onClick: () => {
|
|
23
28
|
model.squareView();
|
|
24
29
|
},
|
|
30
|
+
helpText: 'Makes both views use the same zoom level (bp per pixel), adjusting to the average of each. This ensures features are displayed at comparable scales for easier visual comparison.',
|
|
25
31
|
},
|
|
26
32
|
{
|
|
27
33
|
label: 'Rectangular view - same total bp',
|
|
28
|
-
icon: CropLandscapeIcon,
|
|
29
34
|
onClick: () => {
|
|
30
35
|
model.squareViewProportional();
|
|
31
36
|
},
|
|
37
|
+
helpText: 'Adjusts zoom levels proportionally so both views show the same total number of base pairs. This accounts for different view widths while maintaining the same total genomic span.',
|
|
32
38
|
},
|
|
33
39
|
{
|
|
34
40
|
label: 'Show all regions',
|
|
35
|
-
icon: SettingsOverscanIcon,
|
|
36
41
|
onClick: () => {
|
|
37
42
|
model.showAllRegions();
|
|
38
43
|
},
|
|
44
|
+
helpText: 'Zooms out to display all genome assemblies in their entirety. Useful for getting a high-level overview or resetting the view after zooming into specific regions.',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: 'Re-order chromosomes',
|
|
48
|
+
icon: ShuffleIcon,
|
|
49
|
+
onClick: () => {
|
|
50
|
+
getSession(model).queueDialog(handleClose => [
|
|
51
|
+
DiagonalizationProgressDialog,
|
|
52
|
+
{
|
|
53
|
+
handleClose,
|
|
54
|
+
model,
|
|
55
|
+
},
|
|
56
|
+
]);
|
|
57
|
+
},
|
|
58
|
+
helpText: 'Diagonalization algorithmically reorders and reorients chromosomes to minimize crossing synteny lines, creating a more diagonal pattern. This makes it easier to identify large-scale genomic rearrangements, inversions, and translocations. The process runs on the webworker for better performance.',
|
|
39
59
|
},
|
|
40
60
|
{
|
|
41
61
|
type: 'checkbox',
|
|
@@ -44,6 +64,7 @@ const DotplotControls = observer(function ({ model, }) {
|
|
|
44
64
|
onClick: () => {
|
|
45
65
|
model.setDrawCigar(!model.drawCigar);
|
|
46
66
|
},
|
|
67
|
+
helpText: 'Toggle detailed CIGAR string visualization showing matches, insertions, and deletions in alignments. Disable for a cleaner view that shows only broad syntenic blocks.',
|
|
47
68
|
},
|
|
48
69
|
{
|
|
49
70
|
label: 'Show pan buttons',
|
|
@@ -52,48 +73,64 @@ const DotplotControls = observer(function ({ model, }) {
|
|
|
52
73
|
onClick: () => {
|
|
53
74
|
model.setShowPanButtons(!model.showPanButtons);
|
|
54
75
|
},
|
|
76
|
+
helpText: 'Show or hide directional pan buttons that allow you to navigate the dotplot view by clicking arrows. Useful for precise navigation without using mouse drag.',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: 'Show dynamic controls',
|
|
80
|
+
type: 'checkbox',
|
|
81
|
+
checked: showDynamicControls,
|
|
82
|
+
onClick: () => {
|
|
83
|
+
setShowDynamicControls(!showDynamicControls);
|
|
84
|
+
},
|
|
85
|
+
helpText: 'Toggle visibility of dynamic controls like opacity and minimum length sliders. These controls allow you to adjust dotplot visualization parameters in real-time.',
|
|
55
86
|
},
|
|
56
87
|
{
|
|
57
88
|
label: 'Click and drag mode',
|
|
89
|
+
helpText: 'Configure how clicking and dragging behaves in the dotplot view. Choose between panning and region selection as the default action.',
|
|
58
90
|
subMenu: [
|
|
59
91
|
{
|
|
60
|
-
label: 'Pan by default
|
|
92
|
+
label: 'Pan by default',
|
|
61
93
|
icon: CursorMove,
|
|
62
94
|
type: 'radio',
|
|
63
95
|
checked: model.cursorMode === 'move',
|
|
64
96
|
onClick: () => {
|
|
65
97
|
model.setCursorMode('move');
|
|
66
98
|
},
|
|
99
|
+
helpText: 'Click and drag to pan the view. Hold Ctrl/Cmd while dragging to select a region for zooming or creating a linear synteny view.',
|
|
67
100
|
},
|
|
68
101
|
{
|
|
69
|
-
label: 'Select region by default
|
|
102
|
+
label: 'Select region by default',
|
|
70
103
|
icon: CursorMouse,
|
|
71
104
|
type: 'radio',
|
|
72
105
|
checked: model.cursorMode === 'crosshair',
|
|
73
106
|
onClick: () => {
|
|
74
107
|
model.setCursorMode('crosshair');
|
|
75
108
|
},
|
|
109
|
+
helpText: 'Click and drag to select a region for zooming or creating a linear synteny view. Hold Ctrl/Cmd while dragging to pan the view instead.',
|
|
76
110
|
},
|
|
77
111
|
],
|
|
78
112
|
},
|
|
79
113
|
{
|
|
80
114
|
label: 'Wheel scroll mode',
|
|
115
|
+
helpText: 'Configure how mouse wheel scrolling behaves in the dotplot view.',
|
|
81
116
|
subMenu: [
|
|
82
117
|
{
|
|
83
|
-
label: '
|
|
118
|
+
label: 'Pan view',
|
|
84
119
|
type: 'radio',
|
|
85
120
|
checked: model.wheelMode === 'pan',
|
|
86
121
|
onClick: () => {
|
|
87
122
|
model.setWheelMode('pan');
|
|
88
123
|
},
|
|
124
|
+
helpText: 'Mouse wheel scrolling will pan the view up/down. Useful for navigating through the genome without changing zoom level.',
|
|
89
125
|
},
|
|
90
126
|
{
|
|
91
|
-
label: '
|
|
127
|
+
label: 'Zoom view',
|
|
92
128
|
type: 'radio',
|
|
93
129
|
checked: model.wheelMode === 'zoom',
|
|
94
130
|
onClick: () => {
|
|
95
131
|
model.setWheelMode('zoom');
|
|
96
132
|
},
|
|
133
|
+
helpText: 'Mouse wheel scrolling will zoom in/out of the view. Provides quick zoom control for detailed inspection of regions.',
|
|
97
134
|
},
|
|
98
135
|
{
|
|
99
136
|
label: 'Disable',
|
|
@@ -102,9 +139,10 @@ const DotplotControls = observer(function ({ model, }) {
|
|
|
102
139
|
onClick: () => {
|
|
103
140
|
model.setWheelMode('none');
|
|
104
141
|
},
|
|
142
|
+
helpText: 'Mouse wheel scrolling will be disabled for the dotplot view. Use this to prevent accidental zoom or pan when scrolling the page.',
|
|
105
143
|
},
|
|
106
144
|
],
|
|
107
145
|
},
|
|
108
|
-
], children: _jsx(MoreVert, {}) })] }));
|
|
146
|
+
], children: _jsx(MoreVert, {}) }), _jsx(ColorBySelector, { model: model }), hasDisplays && showDynamicControls ? (_jsxs(_Fragment, { children: [_jsx(OpacitySlider, { model: model }), _jsx(MinLengthSlider, { model: model })] })) : null] }));
|
|
109
147
|
});
|
|
110
148
|
export default DotplotControls;
|
|
@@ -2,10 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { getFillProps, getStrokeProps } from '@jbrowse/core/util';
|
|
3
3
|
import { useTheme } from '@mui/material';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
5
|
-
|
|
5
|
+
const DotplotGrid = observer(function DotplotGrid({ model, children, }) {
|
|
6
6
|
const { viewWidth, viewHeight, hview, vview } = model;
|
|
7
7
|
const hblocks = hview.dynamicBlocks.contentBlocks;
|
|
8
8
|
const vblocks = vview.dynamicBlocks.contentBlocks;
|
|
9
|
+
const theme = useTheme();
|
|
9
10
|
if (!hblocks.length || !vblocks.length) {
|
|
10
11
|
return null;
|
|
11
12
|
}
|
|
@@ -13,31 +14,29 @@ export const GridRaw = observer(function ({ model, children, }) {
|
|
|
13
14
|
const vtop = vview.displayedRegionsTotalPx - vview.offsetPx;
|
|
14
15
|
const hbottom = hblocks[0].offsetPx - hview.offsetPx;
|
|
15
16
|
const vbottom = vblocks[0].offsetPx - vview.offsetPx;
|
|
16
|
-
const theme = useTheme();
|
|
17
17
|
const stroke = theme.palette.divider;
|
|
18
18
|
const rx = Math.max(hbottom, 0);
|
|
19
19
|
const ry = Math.max(viewHeight - vtop, 0);
|
|
20
20
|
const w = Math.min(htop - hbottom, viewWidth);
|
|
21
21
|
const h = Math.min(viewHeight - vbottom - ry, viewHeight);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const hlines = hblocks.filter((region, idx) => {
|
|
23
|
+
const x = Math.floor(region.offsetPx - hview.offsetPx);
|
|
24
|
+
const prevX = idx > 0 ? Math.floor(hblocks[idx - 1].offsetPx - hview.offsetPx) : null;
|
|
25
|
+
return x !== prevX;
|
|
26
|
+
});
|
|
27
|
+
const vlines = vblocks.filter((region, idx) => {
|
|
28
|
+
const y = Math.floor(viewHeight - (region.offsetPx - vview.offsetPx));
|
|
29
|
+
const prevY = idx > 0
|
|
30
|
+
? Math.floor(viewHeight - (vblocks[idx - 1].offsetPx - vview.offsetPx))
|
|
31
|
+
: null;
|
|
32
|
+
return y !== prevY;
|
|
33
|
+
});
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx("rect", { x: rx, y: ry, width: w, height: h, ...getFillProps(theme.palette.background.default) }), _jsxs("g", { children: [hlines.map(region => {
|
|
25
35
|
const x = region.offsetPx - hview.offsetPx;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
lastx = x;
|
|
29
|
-
}
|
|
30
|
-
return render ? (_jsx("line", { x1: x, y1: 0, x2: x, y2: viewHeight, ...getStrokeProps(stroke) }, JSON.stringify(region))) : null;
|
|
31
|
-
}), vblocks.map(region => {
|
|
36
|
+
return (_jsx("line", { x1: x, y1: 0, x2: x, y2: viewHeight, ...getStrokeProps(stroke) }, region.key));
|
|
37
|
+
}), vlines.map(region => {
|
|
32
38
|
const y = viewHeight - (region.offsetPx - vview.offsetPx);
|
|
33
|
-
|
|
34
|
-
if (render) {
|
|
35
|
-
lasty = y;
|
|
36
|
-
}
|
|
37
|
-
return render ? (_jsx("line", { x1: 0, y1: y, x2: viewWidth, y2: y, ...getStrokeProps(stroke) }, JSON.stringify(region))) : null;
|
|
39
|
+
return (_jsx("line", { x1: 0, y1: y, x2: viewWidth, y2: y, ...getStrokeProps(stroke) }, region.key));
|
|
38
40
|
}), _jsx("line", { x1: htop, y1: 0, x2: htop, y2: viewHeight, ...getStrokeProps(stroke) }), _jsx("line", { x1: 0, y1: viewHeight - vtop, x2: viewWidth, y2: viewHeight - vtop, ...getStrokeProps(stroke) })] }), children] }));
|
|
39
41
|
});
|
|
40
|
-
export default
|
|
41
|
-
const { viewWidth, viewHeight } = model;
|
|
42
|
-
return (_jsx("svg", { width: viewWidth, height: viewHeight, style: { background: 'rgba(0,0,0,0.12)' }, children: _jsx(GridRaw, { model: model, children: children }) }));
|
|
43
|
-
}
|
|
42
|
+
export default DotplotGrid;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { observer } from 'mobx-react';
|
|
3
|
+
import DotplotGrid from "./DotplotGrid.js";
|
|
4
|
+
const DotplotGridWrapper = observer(function DotplotGridWrapper({ model, children, }) {
|
|
5
|
+
const { viewWidth, viewHeight } = model;
|
|
6
|
+
return (_jsx("svg", { width: viewWidth, height: viewHeight, style: { background: 'rgba(0,0,0,0.12)' }, children: _jsx(DotplotGrid, { model: model, children: children }) }));
|
|
7
|
+
});
|
|
8
|
+
export default DotplotGridWrapper;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { DotplotViewModel } from '../model';
|
|
1
|
+
import type { DotplotViewModel } from '../model.ts';
|
|
2
2
|
type Coord = [number, number] | undefined;
|
|
3
|
-
|
|
3
|
+
declare const DotplotTooltipClick: ({ model, mousedown, mousedownClient, xdistance, ydistance, }: {
|
|
4
4
|
model: DotplotViewModel;
|
|
5
5
|
mousedown: Coord;
|
|
6
6
|
mousedownClient: Coord;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
|
-
import { locstr } from
|
|
5
|
-
|
|
4
|
+
import { locstr } from "./util.js";
|
|
5
|
+
const DotplotTooltipClick = observer(function DotplotTooltipClick({ model, mousedown, mousedownClient, xdistance, ydistance, }) {
|
|
6
6
|
const { hview, vview, viewHeight } = model;
|
|
7
|
-
const x = (
|
|
8
|
-
const y = (
|
|
7
|
+
const x = (mousedownClient?.[0] || 0) - (xdistance < 0 ? 0 : 0);
|
|
8
|
+
const y = (mousedownClient?.[1] || 0) - (ydistance < 0 ? 0 : 0);
|
|
9
9
|
return mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (_jsxs(BaseTooltip, { placement: xdistance < 0 ? 'right' : 'left', clientPoint: { x, y }, children: [`x - ${locstr(mousedown[0], hview)}`, _jsx("br", {}), `y - ${locstr(viewHeight - mousedown[1], vview)}`, _jsx("br", {})] })) : null;
|
|
10
10
|
});
|
|
11
11
|
export default DotplotTooltipClick;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
|
-
import { locstr } from
|
|
5
|
-
const DotplotTooltipMouseover = observer(function ({ model, mouserect, mouserectClient, xdistance, }) {
|
|
4
|
+
import { locstr } from "./util.js";
|
|
5
|
+
const DotplotTooltipMouseover = observer(function DotplotTooltipMouseover({ model, mouserect, mouserectClient, xdistance, }) {
|
|
6
6
|
const { hview, vview, viewHeight } = model;
|
|
7
7
|
return mouserect ? (_jsxs(BaseTooltip, { placement: xdistance < 0 ? 'left' : 'right', clientPoint: mouserectClient
|
|
8
8
|
? { x: mouserectClient[0], y: mouserectClient[1] }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DotplotViewModel } from '../model.ts';
|
|
2
|
+
type Coord = [number, number] | undefined;
|
|
3
|
+
interface DotplotTooltipsProps {
|
|
4
|
+
model: DotplotViewModel;
|
|
5
|
+
mouseOvered: boolean;
|
|
6
|
+
validSelect: boolean;
|
|
7
|
+
mouserect: Coord;
|
|
8
|
+
mouserectClient: Coord;
|
|
9
|
+
xdistance: number;
|
|
10
|
+
mousedown: Coord;
|
|
11
|
+
mousedownClient: Coord;
|
|
12
|
+
ydistance: number;
|
|
13
|
+
}
|
|
14
|
+
export default function DotplotTooltips({ model, mouseOvered, validSelect, mouserect, mouserectClient, xdistance, mousedown, mousedownClient, ydistance, }: DotplotTooltipsProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, lazy } from 'react';
|
|
3
|
+
const TooltipWhereClicked = lazy(() => import("./DotplotTooltipClick.js"));
|
|
4
|
+
const TooltipWhereMouseovered = lazy(() => import("./DotplotTooltipMouseover.js"));
|
|
5
|
+
export default function DotplotTooltips({ model, mouseOvered, validSelect, mouserect, mouserectClient, xdistance, mousedown, mousedownClient, ydistance, }) {
|
|
6
|
+
return (_jsxs(_Fragment, { children: [mouseOvered && validSelect ? (_jsx(Suspense, { fallback: null, children: _jsx(TooltipWhereMouseovered, { model: model, mouserect: mouserect, mouserectClient: mouserectClient, xdistance: xdistance }) })) : null, validSelect ? (_jsx(Suspense, { fallback: null, children: _jsx(TooltipWhereClicked, { model: model, mousedown: mousedown, mousedownClient: mousedownClient, xdistance: xdistance, ydistance: ydistance }) })) : null] }));
|
|
7
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DotplotViewModel } from '../model';
|
|
2
|
-
declare const DotplotView: ({ model }: {
|
|
1
|
+
import type { DotplotViewModel } from '../model.ts';
|
|
2
|
+
declare const DotplotView: ({ model, }: {
|
|
3
3
|
model: DotplotViewModel;
|
|
4
4
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export default DotplotView;
|