@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
|
@@ -1,91 +1,49 @@
|
|
|
1
1
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
2
2
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
3
|
+
import { category10 } from '@jbrowse/core/ui/colors';
|
|
3
4
|
import { bpToPx } from '@jbrowse/core/util/Base1DUtils';
|
|
5
|
+
import { colord } from '@jbrowse/core/util/colord';
|
|
6
|
+
import { getSnapshot } from '@jbrowse/mobx-state-tree';
|
|
4
7
|
import { MismatchParser } from '@jbrowse/plugin-alignments';
|
|
5
|
-
import {
|
|
8
|
+
import { clampWithWarnX, clampWithWarnY } from "./clamp.js";
|
|
6
9
|
const { parseCigar } = MismatchParser;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
function hashString(str) {
|
|
11
|
+
let hash = 0;
|
|
12
|
+
for (let i = 0; i < str.length; i++) {
|
|
13
|
+
const char = str.charCodeAt(i);
|
|
14
|
+
hash = (hash << 5) - hash + char;
|
|
15
|
+
hash = hash & hash;
|
|
16
|
+
}
|
|
17
|
+
return Math.abs(hash);
|
|
18
|
+
}
|
|
19
|
+
function getQueryColor(queryName) {
|
|
20
|
+
const hash = hashString(queryName);
|
|
21
|
+
return category10[hash % category10.length];
|
|
22
|
+
}
|
|
23
|
+
function applyAlpha(color, alpha) {
|
|
24
|
+
if (alpha === 1) {
|
|
25
|
+
return color;
|
|
26
|
+
}
|
|
27
|
+
return colord(color).alpha(alpha).toRgbString();
|
|
15
28
|
}
|
|
16
29
|
export async function drawDotplot(ctx, props) {
|
|
17
|
-
|
|
18
|
-
const { config, views, height, drawCigar, theme } = props;
|
|
30
|
+
const { config, views, height, drawCigar, theme, alpha = 1, minAlignmentLength = 0, colorBy: colorByOverride, } = props;
|
|
19
31
|
const color = readConfObject(config, 'color');
|
|
20
32
|
const posColor = readConfObject(config, 'posColor');
|
|
21
33
|
const negColor = readConfObject(config, 'negColor');
|
|
22
|
-
const colorBy = readConfObject(config, 'colorBy');
|
|
34
|
+
const colorBy = colorByOverride ?? readConfObject(config, 'colorBy');
|
|
23
35
|
const lineWidth = readConfObject(config, 'lineWidth');
|
|
24
36
|
const thresholds = readConfObject(config, 'thresholds');
|
|
25
37
|
const palette = readConfObject(config, 'thresholdsPalette');
|
|
26
38
|
const isCallback = config.color.isCallback;
|
|
27
39
|
const hview = views[0];
|
|
28
40
|
const vview = views[1];
|
|
29
|
-
const db1 =
|
|
30
|
-
const db2 =
|
|
41
|
+
const db1 = hview.dynamicBlocks.contentBlocks[0]?.offsetPx;
|
|
42
|
+
const db2 = vview.dynamicBlocks.contentBlocks[0]?.offsetPx;
|
|
31
43
|
const warnings = [];
|
|
32
44
|
ctx.lineWidth = lineWidth;
|
|
33
45
|
const { bpPerPx: hBpPerPx } = hview;
|
|
34
46
|
const { bpPerPx: vBpPerPx } = vview;
|
|
35
|
-
function clampWithWarnX(num, min, max, feature) {
|
|
36
|
-
const strand = feature.get('strand') || 1;
|
|
37
|
-
if (strand === -1) {
|
|
38
|
-
;
|
|
39
|
-
[max, min] = [min, max];
|
|
40
|
-
}
|
|
41
|
-
if (num < min - fudgeFactor) {
|
|
42
|
-
let start = feature.get('start');
|
|
43
|
-
let end = feature.get('end');
|
|
44
|
-
const refName = feature.get('refName');
|
|
45
|
-
if (strand === -1) {
|
|
46
|
-
;
|
|
47
|
-
[end, start] = [start, end];
|
|
48
|
-
}
|
|
49
|
-
warnings.push({
|
|
50
|
-
message: `feature at (X ${refName}:${start}-${end}) ${r} ${lt}`,
|
|
51
|
-
effect: 'clipped the feature',
|
|
52
|
-
});
|
|
53
|
-
return min;
|
|
54
|
-
}
|
|
55
|
-
if (num > max + fudgeFactor) {
|
|
56
|
-
const strand = feature.get('strand') || 1;
|
|
57
|
-
const start = strand === 1 ? feature.get('start') : feature.get('end');
|
|
58
|
-
const end = strand === 1 ? feature.get('end') : feature.get('start');
|
|
59
|
-
const refName = feature.get('refName');
|
|
60
|
-
warnings.push({
|
|
61
|
-
message: `feature at (X ${refName}:${start}-${end}) ${r} ${gt}`,
|
|
62
|
-
effect: 'clipped the feature',
|
|
63
|
-
});
|
|
64
|
-
return max;
|
|
65
|
-
}
|
|
66
|
-
return num;
|
|
67
|
-
}
|
|
68
|
-
function clampWithWarnY(num, min, max, feature) {
|
|
69
|
-
if (num < min - fudgeFactor) {
|
|
70
|
-
const mate = feature.get('mate');
|
|
71
|
-
const { refName, start, end } = mate;
|
|
72
|
-
warnings.push({
|
|
73
|
-
message: `feature at (Y ${refName}:${start}-${end}) ${r} ${lt}`,
|
|
74
|
-
effect: 'clipped the feature',
|
|
75
|
-
});
|
|
76
|
-
return min;
|
|
77
|
-
}
|
|
78
|
-
if (num > max + fudgeFactor) {
|
|
79
|
-
const mate = feature.get('mate');
|
|
80
|
-
const { refName, start, end } = mate;
|
|
81
|
-
warnings.push({
|
|
82
|
-
message: `feature at (Y ${refName}:${start}-${end}) ${r} ${gt}`,
|
|
83
|
-
effect: 'clipped the feature',
|
|
84
|
-
});
|
|
85
|
-
return max;
|
|
86
|
-
}
|
|
87
|
-
return num;
|
|
88
|
-
}
|
|
89
47
|
const hsnap = {
|
|
90
48
|
...getSnapshot(hview),
|
|
91
49
|
staticBlocks: hview.staticBlocks,
|
|
@@ -97,41 +55,76 @@ export async function drawDotplot(ctx, props) {
|
|
|
97
55
|
width: vview.width,
|
|
98
56
|
};
|
|
99
57
|
const t = createJBrowseTheme(theme);
|
|
100
|
-
|
|
58
|
+
const features = hview.features || [];
|
|
59
|
+
let posColorWithAlpha;
|
|
60
|
+
let negColorWithAlpha;
|
|
61
|
+
let defaultColorWithAlpha;
|
|
62
|
+
const queryColorCache = new Map();
|
|
63
|
+
const getQueryColorWithAlpha = (queryName) => {
|
|
64
|
+
if (!queryColorCache.has(queryName)) {
|
|
65
|
+
const c = getQueryColor(queryName);
|
|
66
|
+
queryColorCache.set(queryName, applyAlpha(c, alpha));
|
|
67
|
+
}
|
|
68
|
+
return queryColorCache.get(queryName);
|
|
69
|
+
};
|
|
70
|
+
if (colorBy === 'strand') {
|
|
71
|
+
posColorWithAlpha = applyAlpha(posColor, alpha);
|
|
72
|
+
negColorWithAlpha = applyAlpha(negColor, alpha);
|
|
73
|
+
}
|
|
74
|
+
else if (colorBy === 'default' && !isCallback) {
|
|
75
|
+
const c = color === '#f0f' ? t.palette.text.primary : color;
|
|
76
|
+
defaultColorWithAlpha = applyAlpha(c, alpha);
|
|
77
|
+
}
|
|
78
|
+
for (const feature of features) {
|
|
101
79
|
const strand = feature.get('strand') || 1;
|
|
102
|
-
const
|
|
103
|
-
const
|
|
80
|
+
const fStart = feature.get('start');
|
|
81
|
+
const fEnd = feature.get('end');
|
|
82
|
+
if (minAlignmentLength > 0) {
|
|
83
|
+
const alignmentLength = Math.abs(fEnd - fStart);
|
|
84
|
+
if (alignmentLength < minAlignmentLength) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
104
88
|
const refName = feature.get('refName');
|
|
105
89
|
const mate = feature.get('mate');
|
|
106
90
|
const mateRef = mate.refName;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
r = palette[i] || 'black';
|
|
113
|
-
break;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
else if (colorBy === 'meanQueryIdentity') {
|
|
118
|
-
r = `hsl(${feature.get('meanScore') * 200},100%,40%)`;
|
|
91
|
+
const start = strand === 1 ? fStart : fEnd;
|
|
92
|
+
const end = strand === 1 ? fEnd : fStart;
|
|
93
|
+
let colorWithAlpha;
|
|
94
|
+
if (colorBy === 'strand') {
|
|
95
|
+
colorWithAlpha = strand === -1 ? negColorWithAlpha : posColorWithAlpha;
|
|
119
96
|
}
|
|
120
|
-
else if (colorBy === '
|
|
121
|
-
|
|
97
|
+
else if (colorBy === 'query') {
|
|
98
|
+
const queryName = refName;
|
|
99
|
+
colorWithAlpha = getQueryColorWithAlpha(queryName);
|
|
122
100
|
}
|
|
123
|
-
else if (colorBy === '
|
|
124
|
-
|
|
101
|
+
else if (colorBy === 'default' && !isCallback) {
|
|
102
|
+
colorWithAlpha = defaultColorWithAlpha;
|
|
125
103
|
}
|
|
126
|
-
else
|
|
127
|
-
r =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
104
|
+
else {
|
|
105
|
+
let r = 'black';
|
|
106
|
+
if (colorBy === 'identity') {
|
|
107
|
+
const identity = feature.get('identity');
|
|
108
|
+
for (let i = 0; i < thresholds.length; i++) {
|
|
109
|
+
if (identity > +thresholds[i]) {
|
|
110
|
+
r = palette[i] || 'black';
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (colorBy === 'meanQueryIdentity') {
|
|
116
|
+
r = `hsl(${feature.get('meanScore') * 200},100%,40%)`;
|
|
117
|
+
}
|
|
118
|
+
else if (colorBy === 'mappingQuality') {
|
|
119
|
+
r = `hsl(${feature.get('mappingQual')},100%,40%)`;
|
|
120
|
+
}
|
|
121
|
+
else if (colorBy === 'default' && isCallback) {
|
|
122
|
+
r = readConfObject(config, 'color', { feature });
|
|
123
|
+
}
|
|
124
|
+
colorWithAlpha = applyAlpha(r, alpha);
|
|
132
125
|
}
|
|
133
|
-
ctx.fillStyle =
|
|
134
|
-
ctx.strokeStyle =
|
|
126
|
+
ctx.fillStyle = colorWithAlpha;
|
|
127
|
+
ctx.strokeStyle = colorWithAlpha;
|
|
135
128
|
const b10 = bpToPx({ self: hsnap, refName, coord: start });
|
|
136
129
|
const b20 = bpToPx({ self: hsnap, refName, coord: end });
|
|
137
130
|
const e10 = bpToPx({ self: vsnap, refName: mateRef, coord: mate.start });
|
|
@@ -145,7 +138,9 @@ export async function drawDotplot(ctx, props) {
|
|
|
145
138
|
const e1 = e10.offsetPx - db2;
|
|
146
139
|
const e2 = e20.offsetPx - db2;
|
|
147
140
|
if (Math.abs(b1 - b2) <= 4 && Math.abs(e1 - e2) <= 4) {
|
|
148
|
-
|
|
141
|
+
ctx.beginPath();
|
|
142
|
+
ctx.arc(b1, height - e1, lineWidth / 2, 0, 2 * Math.PI);
|
|
143
|
+
ctx.fill();
|
|
149
144
|
}
|
|
150
145
|
else {
|
|
151
146
|
let currX = b1;
|
|
@@ -170,8 +165,8 @@ export async function drawDotplot(ctx, props) {
|
|
|
170
165
|
else if (op === 'I') {
|
|
171
166
|
currY += val / vBpPerPx;
|
|
172
167
|
}
|
|
173
|
-
currX = clampWithWarnX(currX, b1, b2, feature);
|
|
174
|
-
currY = clampWithWarnY(currY, e1, e2, feature);
|
|
168
|
+
currX = clampWithWarnX(currX, b1, b2, feature, warnings);
|
|
169
|
+
currY = clampWithWarnY(currY, e1, e2, feature, warnings);
|
|
175
170
|
if (Math.abs(currX - lastDrawnX) > 0.5 ||
|
|
176
171
|
Math.abs(currY - lastDrawnY) > 0.5) {
|
|
177
172
|
ctx.lineTo(currX, height - currY);
|
|
@@ -193,13 +188,13 @@ export async function drawDotplot(ctx, props) {
|
|
|
193
188
|
if (warnings.length <= 5) {
|
|
194
189
|
if (b10 === undefined || b20 === undefined) {
|
|
195
190
|
warnings.push({
|
|
196
|
-
message: `feature at (X ${refName}:${start}-${end}) not plotted, fell outside of range`,
|
|
191
|
+
message: `feature at (X-coord: ${refName}:${start}-${end}) not plotted, fell outside of range`,
|
|
197
192
|
effect: 'feature not rendered',
|
|
198
193
|
});
|
|
199
194
|
}
|
|
200
195
|
else {
|
|
201
196
|
warnings.push({
|
|
202
|
-
message: `feature at (Y ${mateRef}:${mate.start}-${mate.end}) not plotted, fell outside of range`,
|
|
197
|
+
message: `feature at (Y-coord: ${mateRef}:${mate.start}-${mate.end}) not plotted, fell outside of range`,
|
|
203
198
|
effect: 'feature not rendered',
|
|
204
199
|
});
|
|
205
200
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import configSchema from
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import DotplotRenderer from "./DotplotRenderer.js";
|
|
3
|
+
import configSchema from "./configSchema.js";
|
|
4
4
|
export default function DotplotRendererF(pluginManager) {
|
|
5
5
|
pluginManager.addRendererType(() => new DotplotRenderer({
|
|
6
6
|
name: 'DotplotRenderer',
|
|
7
7
|
configSchema: configSchema,
|
|
8
|
-
ReactComponent,
|
|
8
|
+
ReactComponent: lazy(() => import("./components/DotplotRendering.js")),
|
|
9
9
|
pluginManager,
|
|
10
10
|
}));
|
|
11
11
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Instance } from 'mobx-state-tree';
|
|
2
|
-
declare const Dotplot1DView: import("mobx-state-tree").IModelType<{
|
|
3
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4
|
-
displayedRegions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
|
|
5
|
-
bpPerPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
6
|
-
offsetPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
7
|
-
interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
8
|
-
minimumBlockWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
1
|
+
import type { Instance } from '@jbrowse/mobx-state-tree';
|
|
2
|
+
declare const Dotplot1DView: import("@jbrowse/mobx-state-tree").IModelType<{
|
|
3
|
+
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
4
|
+
displayedRegions: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
|
|
5
|
+
bpPerPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
|
|
6
|
+
offsetPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
|
|
7
|
+
interRegionPaddingWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
8
|
+
minimumBlockWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
9
9
|
}, {
|
|
10
10
|
features: undefined | import("@jbrowse/core/util").Feature[];
|
|
11
11
|
volatileWidth: number;
|
|
@@ -62,14 +62,14 @@ declare const Dotplot1DView: import("mobx-state-tree").IModelType<{
|
|
|
62
62
|
readonly minBpPerPx: number;
|
|
63
63
|
readonly maxOffset: number;
|
|
64
64
|
readonly minOffset: number;
|
|
65
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
66
|
-
declare const DotplotHView: import("mobx-state-tree").IModelType<{
|
|
67
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
68
|
-
displayedRegions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
|
|
69
|
-
bpPerPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
70
|
-
offsetPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
71
|
-
interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
72
|
-
minimumBlockWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
65
|
+
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|
|
66
|
+
declare const DotplotHView: import("@jbrowse/mobx-state-tree").IModelType<{
|
|
67
|
+
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
68
|
+
displayedRegions: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
|
|
69
|
+
bpPerPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
|
|
70
|
+
offsetPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
|
|
71
|
+
interRegionPaddingWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
72
|
+
minimumBlockWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
73
73
|
}, {
|
|
74
74
|
features: undefined | import("@jbrowse/core/util").Feature[];
|
|
75
75
|
volatileWidth: number;
|
|
@@ -128,14 +128,14 @@ declare const DotplotHView: import("mobx-state-tree").IModelType<{
|
|
|
128
128
|
readonly minOffset: number;
|
|
129
129
|
} & {
|
|
130
130
|
readonly width: any;
|
|
131
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
132
|
-
declare const DotplotVView: import("mobx-state-tree").IModelType<{
|
|
133
|
-
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
134
|
-
displayedRegions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
|
|
135
|
-
bpPerPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
136
|
-
offsetPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
137
|
-
interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
138
|
-
minimumBlockWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
131
|
+
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|
|
132
|
+
declare const DotplotVView: import("@jbrowse/mobx-state-tree").IModelType<{
|
|
133
|
+
id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
134
|
+
displayedRegions: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IType<import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[], import("@jbrowse/core/util").Region[]>, [undefined]>;
|
|
135
|
+
bpPerPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
|
|
136
|
+
offsetPx: import("@jbrowse/mobx-state-tree").IType<number | undefined, number, number>;
|
|
137
|
+
interRegionPaddingWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
138
|
+
minimumBlockWidth: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
139
139
|
}, {
|
|
140
140
|
features: undefined | import("@jbrowse/core/util").Feature[];
|
|
141
141
|
volatileWidth: number;
|
|
@@ -194,6 +194,6 @@ declare const DotplotVView: import("mobx-state-tree").IModelType<{
|
|
|
194
194
|
readonly minOffset: number;
|
|
195
195
|
} & {
|
|
196
196
|
readonly width: any;
|
|
197
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
197
|
+
}, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
|
|
198
198
|
export { Dotplot1DView, DotplotHView, DotplotVView };
|
|
199
199
|
export type Dotplot1DViewModel = Instance<typeof Dotplot1DView>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Base1DView from '@jbrowse/core/util/Base1DViewModel';
|
|
2
2
|
import calculateDynamicBlocks from '@jbrowse/core/util/calculateDynamicBlocks';
|
|
3
|
+
import { getParent } from '@jbrowse/mobx-state-tree';
|
|
3
4
|
import { observable } from 'mobx';
|
|
4
|
-
import { getParent } from 'mobx-state-tree';
|
|
5
5
|
function x() { }
|
|
6
6
|
const Dotplot1DView = Base1DView.extend(self => {
|
|
7
7
|
const scaleFactor = observable.box(1);
|
|
@@ -14,16 +14,28 @@ const Dotplot1DView = Base1DView.extend(self => {
|
|
|
14
14
|
return scaleFactor.get();
|
|
15
15
|
},
|
|
16
16
|
get maxBpPerPx() {
|
|
17
|
-
return self.totalBp / (self.width
|
|
17
|
+
return self.totalBp / (self.width * 0.9);
|
|
18
18
|
},
|
|
19
19
|
get minBpPerPx() {
|
|
20
20
|
return 1 / 50;
|
|
21
21
|
},
|
|
22
22
|
get maxOffset() {
|
|
23
|
-
|
|
23
|
+
const contentPx = self.displayedRegionsTotalPx;
|
|
24
|
+
const viewWidth = self.width;
|
|
25
|
+
if (contentPx <= viewWidth) {
|
|
26
|
+
return (contentPx - viewWidth) / 2;
|
|
27
|
+
}
|
|
28
|
+
const leftPadding = 10;
|
|
29
|
+
return contentPx - leftPadding;
|
|
24
30
|
},
|
|
25
31
|
get minOffset() {
|
|
26
|
-
|
|
32
|
+
const contentPx = self.displayedRegionsTotalPx;
|
|
33
|
+
const viewWidth = self.width;
|
|
34
|
+
if (contentPx <= viewWidth) {
|
|
35
|
+
return (contentPx - viewWidth) / 2;
|
|
36
|
+
}
|
|
37
|
+
const rightPadding = 30;
|
|
38
|
+
return -viewWidth + rightPadding;
|
|
27
39
|
},
|
|
28
40
|
},
|
|
29
41
|
actions: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getFillProps, getStrokeProps, getTickDisplayStr, } from '@jbrowse/core/util';
|
|
3
3
|
import { bpToPx } from '@jbrowse/core/util/Base1DUtils';
|
|
4
|
+
import { makeStyles } from '@jbrowse/core/util/tss-react';
|
|
5
|
+
import { getSnapshot } from '@jbrowse/mobx-state-tree';
|
|
4
6
|
import { useTheme } from '@mui/material';
|
|
5
7
|
import { observer } from 'mobx-react';
|
|
6
|
-
import {
|
|
7
|
-
import { makeStyles } from 'tss-react/mui';
|
|
8
|
-
import { getBlockLabelKeysToHide } from './util';
|
|
8
|
+
import { getBlockLabelKeysToHide } from "./util.js";
|
|
9
9
|
const useStyles = makeStyles()(() => ({
|
|
10
10
|
vtext: {
|
|
11
11
|
gridColumn: '1/2',
|
|
@@ -20,12 +20,12 @@ const useStyles = makeStyles()(() => ({
|
|
|
20
20
|
userSelect: 'none',
|
|
21
21
|
},
|
|
22
22
|
}));
|
|
23
|
-
export const HorizontalAxis = observer(function ({ model, }) {
|
|
23
|
+
export const HorizontalAxis = observer(function HorizontalAxis({ model, }) {
|
|
24
24
|
const { viewWidth, borderY } = model;
|
|
25
25
|
const { classes } = useStyles();
|
|
26
26
|
return (_jsx("svg", { width: viewWidth, height: borderY, className: classes.htext, children: _jsx(HorizontalAxisRaw, { model: model }) }));
|
|
27
27
|
});
|
|
28
|
-
export const HorizontalAxisRaw = observer(function ({ model, }) {
|
|
28
|
+
export const HorizontalAxisRaw = observer(function HorizontalAxisRaw({ model, }) {
|
|
29
29
|
const { viewWidth, borderX, borderY, hview, htextRotation, hticks } = model;
|
|
30
30
|
const { offsetPx, width, dynamicBlocks, bpPerPx } = hview;
|
|
31
31
|
const dblocks = dynamicBlocks.contentBlocks;
|
|
@@ -37,36 +37,31 @@ export const HorizontalAxisRaw = observer(function ({ model, }) {
|
|
|
37
37
|
staticBlocks: hview.staticBlocks,
|
|
38
38
|
};
|
|
39
39
|
const ticks = hticks
|
|
40
|
-
.map(tick =>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
tick,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
})) === null || _a === void 0 ? void 0 : _a.offsetPx,
|
|
49
|
-
];
|
|
50
|
-
})
|
|
40
|
+
.map(tick => [
|
|
41
|
+
tick,
|
|
42
|
+
bpToPx({
|
|
43
|
+
refName: tick.refName,
|
|
44
|
+
coord: tick.base,
|
|
45
|
+
self: hviewSnap,
|
|
46
|
+
})?.offsetPx,
|
|
47
|
+
])
|
|
51
48
|
.filter(f => f[1] !== undefined)
|
|
52
49
|
.map(f => [f[0], f[1] - offsetPx]);
|
|
53
50
|
return (_jsxs(_Fragment, { children: [dblocks
|
|
54
51
|
.filter(region => !hide.has(region.key))
|
|
55
52
|
.map(region => {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (_jsx("text", { transform: `rotate(${htextRotation},${xoff},${y})`, x: xoff, y: y + 1, fontSize: 11, dominantBaseline: "hanging", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, JSON.stringify(region)));
|
|
60
|
-
}), ticks.map(([tick, x]) => x > 0 && x < width ? (_jsx("line", { x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, ...getFillProps(theme.palette.text.primary) }, `line-${JSON.stringify(tick)}`)) : null), ticks
|
|
53
|
+
const xoff = Math.floor(region.offsetPx - hview.offsetPx);
|
|
54
|
+
return (_jsx("text", { transform: `rotate(${htextRotation},${xoff},0)`, x: xoff, y: 1, fontSize: 11, dominantBaseline: "hanging", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, region.key));
|
|
55
|
+
}), ticks.map(([tick, x], idx) => x > 0 && x < width ? (_jsx("line", { x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, ...getStrokeProps(theme.palette.text.primary) }, `line-${tick.refName}-${tick.base}-${idx}`)) : null), ticks
|
|
61
56
|
.filter(t => t[0].type === 'major')
|
|
62
|
-
.map(([tick, x]) => x > 10 && x < width ? (_jsx("text", { x: x - 7, y: 0, transform: `rotate(${htextRotation},${x},0)`, fontSize: 11, dominantBaseline: "middle", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${
|
|
57
|
+
.map(([tick, x], idx) => x > 10 && x < width ? (_jsx("text", { x: x - 7, y: 0, transform: `rotate(${htextRotation},${x},0)`, fontSize: 11, dominantBaseline: "middle", textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${tick.refName}-${tick.base}-${idx}`)) : null), _jsx("text", { y: borderY - 12, x: (viewWidth - borderX) / 2, textAnchor: "middle", fontSize: 11, dominantBaseline: "hanging", ...getFillProps(theme.palette.text.primary), children: hview.assemblyNames.join(',') })] }));
|
|
63
58
|
});
|
|
64
|
-
export const VerticalAxis = observer(function ({ model, }) {
|
|
59
|
+
export const VerticalAxis = observer(function VerticalAxis({ model, }) {
|
|
65
60
|
const { borderX, viewHeight } = model;
|
|
66
61
|
const { classes } = useStyles();
|
|
67
62
|
return (_jsx("svg", { className: classes.vtext, width: borderX, height: viewHeight, children: _jsx(VerticalAxisRaw, { model: model }) }));
|
|
68
63
|
});
|
|
69
|
-
export const VerticalAxisRaw = observer(function ({ model, }) {
|
|
64
|
+
export const VerticalAxisRaw = observer(function VerticalAxisRaw({ model, }) {
|
|
70
65
|
const { viewHeight, borderX, borderY, vview, vtextRotation, vticks } = model;
|
|
71
66
|
const { offsetPx, width, dynamicBlocks, bpPerPx } = vview;
|
|
72
67
|
const dblocks = dynamicBlocks.contentBlocks;
|
|
@@ -78,27 +73,22 @@ export const VerticalAxisRaw = observer(function ({ model, }) {
|
|
|
78
73
|
staticBlocks: vview.staticBlocks,
|
|
79
74
|
};
|
|
80
75
|
const ticks = vticks
|
|
81
|
-
.map(tick =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
tick,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
})) === null || _a === void 0 ? void 0 : _a.offsetPx,
|
|
90
|
-
];
|
|
91
|
-
})
|
|
76
|
+
.map(tick => [
|
|
77
|
+
tick,
|
|
78
|
+
bpToPx({
|
|
79
|
+
refName: tick.refName,
|
|
80
|
+
coord: tick.base,
|
|
81
|
+
self: vviewSnap,
|
|
82
|
+
})?.offsetPx,
|
|
83
|
+
])
|
|
92
84
|
.filter(f => f[1] !== undefined)
|
|
93
85
|
.map(f => [f[0], f[1] - offsetPx]);
|
|
94
86
|
return (_jsxs(_Fragment, { children: [dblocks
|
|
95
87
|
.filter(region => !hide.has(region.key))
|
|
96
88
|
.map(region => {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return (_jsx("text", { transform: `rotate(${vtextRotation},${x},${y})`, x: x, y: yoff, fontSize: 11, textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, JSON.stringify(region)));
|
|
101
|
-
}), ticks.map(([tick, y]) => y > 0 ? (_jsx("line", { y1: viewHeight - y, y2: viewHeight - y, x1: borderX, x2: borderX - (tick.type === 'major' ? 6 : 4), strokeWidth: 1, ...getStrokeProps(theme.palette.grey[400]) }, `line-${JSON.stringify(tick)}`)) : null), ticks
|
|
89
|
+
const yoff = Math.floor(viewHeight - region.offsetPx + offsetPx);
|
|
90
|
+
return (_jsx("text", { transform: `rotate(${vtextRotation},${borderX},${region.offsetPx})`, x: borderX, y: yoff, fontSize: 11, textAnchor: "end", ...getFillProps(theme.palette.text.primary), children: region.refName }, region.key));
|
|
91
|
+
}), ticks.map(([tick, y], idx) => y > 0 && y < viewHeight ? (_jsx("line", { y1: viewHeight - y, y2: viewHeight - y, x1: borderX, x2: borderX - (tick.type === 'major' ? 6 : 4), strokeWidth: 1, ...getStrokeProps(theme.palette.text.primary) }, `line-${tick.refName}-${tick.base}-${idx}`)) : null), ticks
|
|
102
92
|
.filter(t => t[0].type === 'major')
|
|
103
|
-
.map(([tick, y]) => y > 10 && y < viewHeight ? (_jsx("text", { y: viewHeight - y - 3, x: borderX - 7, textAnchor: "end", dominantBaseline: "hanging", fontSize: 11, ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${
|
|
93
|
+
.map(([tick, y], idx) => y > 10 && y < viewHeight ? (_jsx("text", { y: viewHeight - y - 3, x: borderX - 7, textAnchor: "end", dominantBaseline: "hanging", fontSize: 11, ...getFillProps(theme.palette.text.primary), children: getTickDisplayStr(tick.base + 1, bpPerPx) }, `text-${tick.refName}-${tick.base}-${idx}`)) : null), _jsx("text", { y: (viewHeight - borderY) / 2, x: 12, transform: `rotate(-90,12,${(viewHeight - borderY) / 2})`, textAnchor: "middle", fontSize: 11, ...getFillProps(theme.palette.text.primary), children: vview.assemblyNames.join(',') })] }));
|
|
104
94
|
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
|
|
3
|
+
import PaletteIcon from '@mui/icons-material/Palette';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
const ColorBySelector = observer(function ColorBySelector({ model, }) {
|
|
6
|
+
const firstDisplay = model.tracks[0]?.displays[0];
|
|
7
|
+
const colorBy = firstDisplay?.colorBy ?? 'default';
|
|
8
|
+
const setColorBy = (value) => {
|
|
9
|
+
for (const track of model.tracks) {
|
|
10
|
+
for (const display of track.displays) {
|
|
11
|
+
;
|
|
12
|
+
display.setColorBy(value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return (_jsx(CascadingMenuButton, { menuItems: [
|
|
17
|
+
{
|
|
18
|
+
label: 'Default',
|
|
19
|
+
type: 'radio',
|
|
20
|
+
checked: colorBy === 'default',
|
|
21
|
+
onClick: () => {
|
|
22
|
+
setColorBy('default');
|
|
23
|
+
},
|
|
24
|
+
helpText: 'Use the default color scheme specified in the track configuration. This respects the color settings defined in the config file.',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Identity',
|
|
28
|
+
type: 'radio',
|
|
29
|
+
checked: colorBy === 'identity',
|
|
30
|
+
onClick: () => {
|
|
31
|
+
setColorBy('identity');
|
|
32
|
+
},
|
|
33
|
+
helpText: 'Color alignments by sequence identity percentage. Higher identity matches appear in warmer colors, while lower identity matches appear cooler. Useful for identifying highly conserved vs. divergent regions.',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Mean Query Identity',
|
|
37
|
+
type: 'radio',
|
|
38
|
+
checked: colorBy === 'meanQueryIdentity',
|
|
39
|
+
onClick: () => {
|
|
40
|
+
setColorBy('meanQueryIdentity');
|
|
41
|
+
},
|
|
42
|
+
helpText: 'Color alignments based on the mean identity across the query sequence. This provides a smoothed view of overall alignment quality, reducing noise from local variations. For instance, a single long query of e.g. a contig of an assembly, when aligned to the target, may get split into many smaller "hits". This score aggregates across them, and colors them all the same. Similar code exists in the program dotPlotly',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: 'Mapping Quality',
|
|
46
|
+
type: 'radio',
|
|
47
|
+
checked: colorBy === 'mappingQuality',
|
|
48
|
+
onClick: () => {
|
|
49
|
+
setColorBy('mappingQuality');
|
|
50
|
+
},
|
|
51
|
+
helpText: 'Color alignments by mapping quality score (MAPQ). Higher quality mappings (more unique/confident) appear in darker colors. Useful for identifying ambiguous or multi-mapping regions.',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: 'Strand',
|
|
55
|
+
type: 'radio',
|
|
56
|
+
checked: colorBy === 'strand',
|
|
57
|
+
onClick: () => {
|
|
58
|
+
setColorBy('strand');
|
|
59
|
+
},
|
|
60
|
+
helpText: 'Color alignments by strand orientation. Forward strand alignments and reverse strand alignments are shown in different colors, making it easy to identify inversions and strand-specific patterns.',
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: 'Query',
|
|
64
|
+
type: 'radio',
|
|
65
|
+
checked: colorBy === 'query',
|
|
66
|
+
onClick: () => {
|
|
67
|
+
setColorBy('query');
|
|
68
|
+
},
|
|
69
|
+
helpText: 'Color alignments by query sequence name. Each unique query sequence is assigned a consistent color based on its name, making it easy to visually distinguish between different sequences.',
|
|
70
|
+
},
|
|
71
|
+
], children: _jsx(PaletteIcon, {}) }));
|
|
72
|
+
});
|
|
73
|
+
export default ColorBySelector;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DotplotViewModel } from '../model.ts';
|
|
2
|
+
declare const DiagonalizationProgressDialog: ({ handleClose, model, }: {
|
|
3
|
+
handleClose: () => void;
|
|
4
|
+
model: Pick<DotplotViewModel, "tracks" | "hview" | "vview" | "id" | "type" | "displayName">;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default DiagonalizationProgressDialog;
|