@jbrowse/plugin-dotplot-view 3.7.0 → 4.0.1
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.js +9 -12
- 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 +6 -4
- package/esm/DotplotDisplay/stateModelFactory.d.ts +143 -30
- package/esm/DotplotDisplay/stateModelFactory.js +5 -14
- package/esm/DotplotReadVsRef/DotplotReadVsRef.js +5 -6
- package/esm/DotplotReadVsRef/index.js +1 -1
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +30 -39
- package/esm/DotplotRenderer/DotplotRenderer.js +55 -22
- 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 +3 -3
- package/esm/DotplotRenderer/drawDotplot.js +5 -6
- package/esm/DotplotRenderer/index.js +4 -4
- package/esm/DotplotView/1dview.d.ts +25 -25
- package/esm/DotplotView/1dview.js +13 -3
- package/esm/DotplotView/components/Axes.d.ts +1 -1
- package/esm/DotplotView/components/Axes.js +31 -41
- package/esm/DotplotView/components/ColorBySelector.d.ts +1 -1
- package/esm/DotplotView/components/ColorBySelector.js +3 -4
- package/esm/DotplotView/components/DiagonalizationProgressDialog.d.ts +1 -1
- package/esm/DotplotView/components/DiagonalizationProgressDialog.js +1 -1
- package/esm/DotplotView/components/DotplotControls.d.ts +1 -1
- package/esm/DotplotView/components/DotplotControls.js +7 -8
- 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 +1 -1
- package/esm/DotplotView/components/DotplotTooltips.js +2 -2
- package/esm/DotplotView/components/DotplotView.d.ts +2 -2
- package/esm/DotplotView/components/DotplotView.js +23 -21
- package/esm/DotplotView/components/DotplotWarnings.d.ts +1 -1
- package/esm/DotplotView/components/DotplotWarnings.js +3 -3
- 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 -9
- 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 +1 -1
- package/esm/DotplotView/components/MinLengthSlider.js +7 -7
- package/esm/DotplotView/components/MouseInteractionLayer.d.ts +3 -3
- package/esm/DotplotView/components/MouseInteractionLayer.js +6 -4
- package/esm/DotplotView/components/OpacitySlider.d.ts +1 -1
- package/esm/DotplotView/components/OpacitySlider.js +5 -6
- package/esm/DotplotView/components/PanButtons.d.ts +1 -1
- package/esm/DotplotView/components/PanButtons.js +1 -1
- package/esm/DotplotView/components/SelectionContextMenu.d.ts +1 -1
- package/esm/DotplotView/components/WarningDialog.js +1 -1
- package/esm/DotplotView/components/util.d.ts +1 -1
- package/esm/DotplotView/components/util.js +17 -5
- package/esm/DotplotView/index.js +2 -2
- package/esm/DotplotView/model.d.ts +208 -90
- package/esm/DotplotView/model.js +118 -79
- 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 +2 -6
- package/esm/ServerSideSyntenyRendering.d.ts +1 -1
- package/esm/ServerSideSyntenyRendering.js +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +8 -11
- 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/DiagonalizeDotplotRpc.d.ts +0 -30
- package/dist/DiagonalizeDotplotRpc.js +0 -156
- 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 -52
- package/dist/DotplotDisplay/stateModelFactory.d.ts +0 -108
- package/dist/DotplotDisplay/stateModelFactory.js +0 -134
- 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 -65
- package/dist/DotplotRenderer/DotplotRenderer.js +0 -102
- package/dist/DotplotRenderer/clamp.d.ts +0 -7
- package/dist/DotplotRenderer/clamp.js +0 -62
- 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 -22
- package/dist/DotplotRenderer/drawDotplot.js +0 -209
- 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 -65
- package/dist/DotplotView/components/Axes.d.ts +0 -13
- package/dist/DotplotView/components/Axes.js +0 -107
- package/dist/DotplotView/components/ColorBySelector.d.ts +0 -5
- package/dist/DotplotView/components/ColorBySelector.js +0 -79
- package/dist/DotplotView/components/CursorIcon.d.ts +0 -3
- package/dist/DotplotView/components/CursorIcon.js +0 -15
- package/dist/DotplotView/components/DiagonalizationProgressDialog.d.ts +0 -6
- package/dist/DotplotView/components/DiagonalizationProgressDialog.js +0 -125
- package/dist/DotplotView/components/DotplotControls.d.ts +0 -5
- package/dist/DotplotView/components/DotplotControls.js +0 -187
- 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/DotplotTooltips.d.ts +0 -15
- package/dist/DotplotView/components/DotplotTooltips.js +0 -43
- package/dist/DotplotView/components/DotplotView.d.ts +0 -5
- package/dist/DotplotView/components/DotplotView.js +0 -100
- 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 -75
- 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/MinLengthSlider.d.ts +0 -5
- package/dist/DotplotView/components/MinLengthSlider.js +0 -44
- package/dist/DotplotView/components/MouseInteractionLayer.d.ts +0 -17
- package/dist/DotplotView/components/MouseInteractionLayer.js +0 -18
- package/dist/DotplotView/components/OpacitySlider.d.ts +0 -5
- package/dist/DotplotView/components/OpacitySlider.js +0 -43
- package/dist/DotplotView/components/PanButtons.d.ts +0 -5
- package/dist/DotplotView/components/PanButtons.js +0 -47
- package/dist/DotplotView/components/SelectionContextMenu.d.ts +0 -13
- package/dist/DotplotView/components/SelectionContextMenu.js +0 -42
- package/dist/DotplotView/components/SliderTooltip.d.ts +0 -2
- package/dist/DotplotView/components/SliderTooltip.js +0 -9
- package/dist/DotplotView/components/WarningDialog.d.ts +0 -16
- package/dist/DotplotView/components/WarningDialog.js +0 -39
- package/dist/DotplotView/components/hooks/useCtrlKeyTracking.d.ts +0 -1
- package/dist/DotplotView/components/hooks/useCtrlKeyTracking.js +0 -24
- package/dist/DotplotView/components/hooks/useCursorMode.d.ts +0 -7
- package/dist/DotplotView/components/hooks/useCursorMode.js +0 -19
- package/dist/DotplotView/components/hooks/useMouseCoordinates.d.ts +0 -29
- package/dist/DotplotView/components/hooks/useMouseCoordinates.js +0 -52
- package/dist/DotplotView/components/hooks/useMouseMoveHandler.d.ts +0 -6
- package/dist/DotplotView/components/hooks/useMouseMoveHandler.js +0 -27
- package/dist/DotplotView/components/hooks/useMouseUpHandler.d.ts +0 -3
- package/dist/DotplotView/components/hooks/useMouseUpHandler.js +0 -31
- package/dist/DotplotView/components/hooks/useWheelHandler.d.ts +0 -8
- package/dist/DotplotView/components/hooks/useWheelHandler.js +0 -47
- package/dist/DotplotView/components/util.d.ts +0 -14
- package/dist/DotplotView/components/util.js +0 -80
- package/dist/DotplotView/index.d.ts +0 -2
- package/dist/DotplotView/index.js +0 -52
- package/dist/DotplotView/model.d.ts +0 -440
- package/dist/DotplotView/model.js +0 -502
- 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 -48
- 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 -42
- 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,209 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.drawDotplot = drawDotplot;
|
|
4
|
-
const configuration_1 = require("@jbrowse/core/configuration");
|
|
5
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
6
|
-
const colors_1 = require("@jbrowse/core/ui/colors");
|
|
7
|
-
const Base1DUtils_1 = require("@jbrowse/core/util/Base1DUtils");
|
|
8
|
-
const colord_1 = require("@jbrowse/core/util/colord");
|
|
9
|
-
const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
|
|
10
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
11
|
-
const clamp_1 = require("./clamp");
|
|
12
|
-
const { parseCigar } = plugin_alignments_1.MismatchParser;
|
|
13
|
-
function hashString(str) {
|
|
14
|
-
let hash = 0;
|
|
15
|
-
for (let i = 0; i < str.length; i++) {
|
|
16
|
-
const char = str.charCodeAt(i);
|
|
17
|
-
hash = (hash << 5) - hash + char;
|
|
18
|
-
hash = hash & hash;
|
|
19
|
-
}
|
|
20
|
-
return Math.abs(hash);
|
|
21
|
-
}
|
|
22
|
-
function getQueryColor(queryName) {
|
|
23
|
-
const hash = hashString(queryName);
|
|
24
|
-
return colors_1.category10[hash % colors_1.category10.length];
|
|
25
|
-
}
|
|
26
|
-
function applyAlpha(color, alpha) {
|
|
27
|
-
if (alpha === 1) {
|
|
28
|
-
return color;
|
|
29
|
-
}
|
|
30
|
-
return (0, colord_1.colord)(color).alpha(alpha).toRgbString();
|
|
31
|
-
}
|
|
32
|
-
async function drawDotplot(ctx, props) {
|
|
33
|
-
var _a, _b;
|
|
34
|
-
const { config, views, height, drawCigar, theme, alpha = 1, minAlignmentLength = 0, colorBy: colorByOverride, } = props;
|
|
35
|
-
const color = (0, configuration_1.readConfObject)(config, 'color');
|
|
36
|
-
const posColor = (0, configuration_1.readConfObject)(config, 'posColor');
|
|
37
|
-
const negColor = (0, configuration_1.readConfObject)(config, 'negColor');
|
|
38
|
-
const colorBy = colorByOverride !== null && colorByOverride !== void 0 ? colorByOverride : (0, configuration_1.readConfObject)(config, 'colorBy');
|
|
39
|
-
const lineWidth = (0, configuration_1.readConfObject)(config, 'lineWidth');
|
|
40
|
-
const thresholds = (0, configuration_1.readConfObject)(config, 'thresholds');
|
|
41
|
-
const palette = (0, configuration_1.readConfObject)(config, 'thresholdsPalette');
|
|
42
|
-
const isCallback = config.color.isCallback;
|
|
43
|
-
const hview = views[0];
|
|
44
|
-
const vview = views[1];
|
|
45
|
-
const db1 = (_a = hview.dynamicBlocks.contentBlocks[0]) === null || _a === void 0 ? void 0 : _a.offsetPx;
|
|
46
|
-
const db2 = (_b = vview.dynamicBlocks.contentBlocks[0]) === null || _b === void 0 ? void 0 : _b.offsetPx;
|
|
47
|
-
const warnings = [];
|
|
48
|
-
ctx.lineWidth = lineWidth;
|
|
49
|
-
const { bpPerPx: hBpPerPx } = hview;
|
|
50
|
-
const { bpPerPx: vBpPerPx } = vview;
|
|
51
|
-
const hsnap = {
|
|
52
|
-
...(0, mobx_state_tree_1.getSnapshot)(hview),
|
|
53
|
-
staticBlocks: hview.staticBlocks,
|
|
54
|
-
width: hview.width,
|
|
55
|
-
};
|
|
56
|
-
const vsnap = {
|
|
57
|
-
...(0, mobx_state_tree_1.getSnapshot)(vview),
|
|
58
|
-
staticBlocks: vview.staticBlocks,
|
|
59
|
-
width: vview.width,
|
|
60
|
-
};
|
|
61
|
-
const t = (0, ui_1.createJBrowseTheme)(theme);
|
|
62
|
-
const features = hview.features || [];
|
|
63
|
-
let posColorWithAlpha;
|
|
64
|
-
let negColorWithAlpha;
|
|
65
|
-
let defaultColorWithAlpha;
|
|
66
|
-
const queryColorCache = new Map();
|
|
67
|
-
const getQueryColorWithAlpha = (queryName) => {
|
|
68
|
-
if (!queryColorCache.has(queryName)) {
|
|
69
|
-
const c = getQueryColor(queryName);
|
|
70
|
-
queryColorCache.set(queryName, applyAlpha(c, alpha));
|
|
71
|
-
}
|
|
72
|
-
return queryColorCache.get(queryName);
|
|
73
|
-
};
|
|
74
|
-
if (colorBy === 'strand') {
|
|
75
|
-
posColorWithAlpha = applyAlpha(posColor, alpha);
|
|
76
|
-
negColorWithAlpha = applyAlpha(negColor, alpha);
|
|
77
|
-
}
|
|
78
|
-
else if (colorBy === 'default' && !isCallback) {
|
|
79
|
-
const c = color === '#f0f' ? t.palette.text.primary : color;
|
|
80
|
-
defaultColorWithAlpha = applyAlpha(c, alpha);
|
|
81
|
-
}
|
|
82
|
-
for (const feature of features) {
|
|
83
|
-
const strand = feature.get('strand') || 1;
|
|
84
|
-
const fStart = feature.get('start');
|
|
85
|
-
const fEnd = feature.get('end');
|
|
86
|
-
if (minAlignmentLength > 0) {
|
|
87
|
-
const alignmentLength = Math.abs(fEnd - fStart);
|
|
88
|
-
if (alignmentLength < minAlignmentLength) {
|
|
89
|
-
continue;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
const refName = feature.get('refName');
|
|
93
|
-
const mate = feature.get('mate');
|
|
94
|
-
const mateRef = mate.refName;
|
|
95
|
-
const start = strand === 1 ? fStart : fEnd;
|
|
96
|
-
const end = strand === 1 ? fEnd : fStart;
|
|
97
|
-
let colorWithAlpha;
|
|
98
|
-
if (colorBy === 'strand') {
|
|
99
|
-
colorWithAlpha = strand === -1 ? negColorWithAlpha : posColorWithAlpha;
|
|
100
|
-
}
|
|
101
|
-
else if (colorBy === 'query') {
|
|
102
|
-
const queryName = refName;
|
|
103
|
-
colorWithAlpha = getQueryColorWithAlpha(queryName);
|
|
104
|
-
}
|
|
105
|
-
else if (colorBy === 'default' && !isCallback) {
|
|
106
|
-
colorWithAlpha = defaultColorWithAlpha;
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
let r = 'black';
|
|
110
|
-
if (colorBy === 'identity') {
|
|
111
|
-
const identity = feature.get('identity');
|
|
112
|
-
for (let i = 0; i < thresholds.length; i++) {
|
|
113
|
-
if (identity > +thresholds[i]) {
|
|
114
|
-
r = palette[i] || 'black';
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else if (colorBy === 'meanQueryIdentity') {
|
|
120
|
-
r = `hsl(${feature.get('meanScore') * 200},100%,40%)`;
|
|
121
|
-
}
|
|
122
|
-
else if (colorBy === 'mappingQuality') {
|
|
123
|
-
r = `hsl(${feature.get('mappingQual')},100%,40%)`;
|
|
124
|
-
}
|
|
125
|
-
else if (colorBy === 'default' && isCallback) {
|
|
126
|
-
r = (0, configuration_1.readConfObject)(config, 'color', { feature });
|
|
127
|
-
}
|
|
128
|
-
colorWithAlpha = applyAlpha(r, alpha);
|
|
129
|
-
}
|
|
130
|
-
ctx.fillStyle = colorWithAlpha;
|
|
131
|
-
ctx.strokeStyle = colorWithAlpha;
|
|
132
|
-
const b10 = (0, Base1DUtils_1.bpToPx)({ self: hsnap, refName, coord: start });
|
|
133
|
-
const b20 = (0, Base1DUtils_1.bpToPx)({ self: hsnap, refName, coord: end });
|
|
134
|
-
const e10 = (0, Base1DUtils_1.bpToPx)({ self: vsnap, refName: mateRef, coord: mate.start });
|
|
135
|
-
const e20 = (0, Base1DUtils_1.bpToPx)({ self: vsnap, refName: mateRef, coord: mate.end });
|
|
136
|
-
if (b10 !== undefined &&
|
|
137
|
-
b20 !== undefined &&
|
|
138
|
-
e10 !== undefined &&
|
|
139
|
-
e20 !== undefined) {
|
|
140
|
-
const b1 = b10.offsetPx - db1;
|
|
141
|
-
const b2 = b20.offsetPx - db1;
|
|
142
|
-
const e1 = e10.offsetPx - db2;
|
|
143
|
-
const e2 = e20.offsetPx - db2;
|
|
144
|
-
if (Math.abs(b1 - b2) <= 4 && Math.abs(e1 - e2) <= 4) {
|
|
145
|
-
ctx.beginPath();
|
|
146
|
-
ctx.arc(b1, height - e1, lineWidth / 2, 0, 2 * Math.PI);
|
|
147
|
-
ctx.fill();
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
let currX = b1;
|
|
151
|
-
let currY = e1;
|
|
152
|
-
const cigar = feature.get('CIGAR');
|
|
153
|
-
if (drawCigar && cigar) {
|
|
154
|
-
const cigarOps = parseCigar(cigar);
|
|
155
|
-
ctx.beginPath();
|
|
156
|
-
ctx.moveTo(currX, height - currY);
|
|
157
|
-
let lastDrawnX = currX;
|
|
158
|
-
let lastDrawnY = currX;
|
|
159
|
-
for (let i = 0; i < cigarOps.length; i += 2) {
|
|
160
|
-
const val = +cigarOps[i];
|
|
161
|
-
const op = cigarOps[i + 1];
|
|
162
|
-
if (op === 'M' || op === '=' || op === 'X') {
|
|
163
|
-
currX += (val / hBpPerPx) * strand;
|
|
164
|
-
currY += val / vBpPerPx;
|
|
165
|
-
}
|
|
166
|
-
else if (op === 'D' || op === 'N') {
|
|
167
|
-
currX += (val / hBpPerPx) * strand;
|
|
168
|
-
}
|
|
169
|
-
else if (op === 'I') {
|
|
170
|
-
currY += val / vBpPerPx;
|
|
171
|
-
}
|
|
172
|
-
currX = (0, clamp_1.clampWithWarnX)(currX, b1, b2, feature, warnings);
|
|
173
|
-
currY = (0, clamp_1.clampWithWarnY)(currY, e1, e2, feature, warnings);
|
|
174
|
-
if (Math.abs(currX - lastDrawnX) > 0.5 ||
|
|
175
|
-
Math.abs(currY - lastDrawnY) > 0.5) {
|
|
176
|
-
ctx.lineTo(currX, height - currY);
|
|
177
|
-
lastDrawnX = currX;
|
|
178
|
-
lastDrawnY = currY;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
ctx.stroke();
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
ctx.beginPath();
|
|
185
|
-
ctx.moveTo(b1, height - e1);
|
|
186
|
-
ctx.lineTo(b2, height - e2);
|
|
187
|
-
ctx.stroke();
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
if (warnings.length <= 5) {
|
|
193
|
-
if (b10 === undefined || b20 === undefined) {
|
|
194
|
-
warnings.push({
|
|
195
|
-
message: `feature at (X-coord: ${refName}:${start}-${end}) not plotted, fell outside of range`,
|
|
196
|
-
effect: 'feature not rendered',
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
warnings.push({
|
|
201
|
-
message: `feature at (Y-coord: ${mateRef}:${mate.start}-${mate.end}) not plotted, fell outside of range`,
|
|
202
|
-
effect: 'feature not rendered',
|
|
203
|
-
});
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
return { warnings };
|
|
209
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.default = DotplotRendererF;
|
|
7
|
-
const DotplotRenderer_1 = __importDefault(require("./DotplotRenderer"));
|
|
8
|
-
const DotplotRendering_1 = __importDefault(require("./components/DotplotRendering"));
|
|
9
|
-
const configSchema_1 = __importDefault(require("./configSchema"));
|
|
10
|
-
function DotplotRendererF(pluginManager) {
|
|
11
|
-
pluginManager.addRendererType(() => new DotplotRenderer_1.default({
|
|
12
|
-
name: 'DotplotRenderer',
|
|
13
|
-
configSchema: configSchema_1.default,
|
|
14
|
-
ReactComponent: DotplotRendering_1.default,
|
|
15
|
-
pluginManager,
|
|
16
|
-
}));
|
|
17
|
-
}
|
|
@@ -1,199 +0,0 @@
|
|
|
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]>;
|
|
9
|
-
}, {
|
|
10
|
-
features: undefined | import("@jbrowse/core/util").Feature[];
|
|
11
|
-
volatileWidth: number;
|
|
12
|
-
} & {
|
|
13
|
-
setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
14
|
-
setBpPerPx(val: number): void;
|
|
15
|
-
setVolatileWidth(width: number): void;
|
|
16
|
-
} & {
|
|
17
|
-
readonly width: number;
|
|
18
|
-
readonly assemblyNames: string[];
|
|
19
|
-
readonly displayedRegionsTotalPx: number;
|
|
20
|
-
readonly maxOffset: number;
|
|
21
|
-
readonly minOffset: number;
|
|
22
|
-
readonly totalBp: number;
|
|
23
|
-
} & {
|
|
24
|
-
readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
25
|
-
readonly staticBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
26
|
-
readonly currBp: number;
|
|
27
|
-
} & {
|
|
28
|
-
pxToBp(px: number): {
|
|
29
|
-
coord: number;
|
|
30
|
-
index: number;
|
|
31
|
-
refName: string;
|
|
32
|
-
oob: boolean;
|
|
33
|
-
assemblyName: string;
|
|
34
|
-
offset: number;
|
|
35
|
-
start: number;
|
|
36
|
-
end: number;
|
|
37
|
-
reversed?: boolean;
|
|
38
|
-
};
|
|
39
|
-
bpToPx({ refName, coord, regionNumber, }: {
|
|
40
|
-
refName: string;
|
|
41
|
-
coord: number;
|
|
42
|
-
regionNumber?: number;
|
|
43
|
-
}): number | undefined;
|
|
44
|
-
} & {
|
|
45
|
-
setFeatures(features: import("@jbrowse/core/util").Feature[]): void;
|
|
46
|
-
showAllRegions(): void;
|
|
47
|
-
zoomOut(): void;
|
|
48
|
-
zoomIn(): void;
|
|
49
|
-
zoomTo(bpPerPx: number, offset?: number): number;
|
|
50
|
-
scrollTo(offsetPx: number): number;
|
|
51
|
-
centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
|
|
52
|
-
scroll(distance: number): number;
|
|
53
|
-
} & {
|
|
54
|
-
moveTo(start?: import("@jbrowse/core/util/Base1DUtils").BpOffset, end?: import("@jbrowse/core/util/Base1DUtils").BpOffset): void;
|
|
55
|
-
} & {
|
|
56
|
-
setScaleFactor(n: number): void;
|
|
57
|
-
center(): void;
|
|
58
|
-
} & {
|
|
59
|
-
readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
60
|
-
readonly scaleFactor: number;
|
|
61
|
-
readonly maxBpPerPx: number;
|
|
62
|
-
readonly minBpPerPx: number;
|
|
63
|
-
readonly maxOffset: number;
|
|
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]>;
|
|
73
|
-
}, {
|
|
74
|
-
features: undefined | import("@jbrowse/core/util").Feature[];
|
|
75
|
-
volatileWidth: number;
|
|
76
|
-
} & {
|
|
77
|
-
setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
78
|
-
setBpPerPx(val: number): void;
|
|
79
|
-
setVolatileWidth(width: number): void;
|
|
80
|
-
} & {
|
|
81
|
-
readonly width: number;
|
|
82
|
-
readonly assemblyNames: string[];
|
|
83
|
-
readonly displayedRegionsTotalPx: number;
|
|
84
|
-
readonly maxOffset: number;
|
|
85
|
-
readonly minOffset: number;
|
|
86
|
-
readonly totalBp: number;
|
|
87
|
-
} & {
|
|
88
|
-
readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
89
|
-
readonly staticBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
90
|
-
readonly currBp: number;
|
|
91
|
-
} & {
|
|
92
|
-
pxToBp(px: number): {
|
|
93
|
-
coord: number;
|
|
94
|
-
index: number;
|
|
95
|
-
refName: string;
|
|
96
|
-
oob: boolean;
|
|
97
|
-
assemblyName: string;
|
|
98
|
-
offset: number;
|
|
99
|
-
start: number;
|
|
100
|
-
end: number;
|
|
101
|
-
reversed?: boolean;
|
|
102
|
-
};
|
|
103
|
-
bpToPx({ refName, coord, regionNumber, }: {
|
|
104
|
-
refName: string;
|
|
105
|
-
coord: number;
|
|
106
|
-
regionNumber?: number;
|
|
107
|
-
}): number | undefined;
|
|
108
|
-
} & {
|
|
109
|
-
setFeatures(features: import("@jbrowse/core/util").Feature[]): void;
|
|
110
|
-
showAllRegions(): void;
|
|
111
|
-
zoomOut(): void;
|
|
112
|
-
zoomIn(): void;
|
|
113
|
-
zoomTo(bpPerPx: number, offset?: number): number;
|
|
114
|
-
scrollTo(offsetPx: number): number;
|
|
115
|
-
centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
|
|
116
|
-
scroll(distance: number): number;
|
|
117
|
-
} & {
|
|
118
|
-
moveTo(start?: import("@jbrowse/core/util/Base1DUtils").BpOffset, end?: import("@jbrowse/core/util/Base1DUtils").BpOffset): void;
|
|
119
|
-
} & {
|
|
120
|
-
setScaleFactor(n: number): void;
|
|
121
|
-
center(): void;
|
|
122
|
-
} & {
|
|
123
|
-
readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
124
|
-
readonly scaleFactor: number;
|
|
125
|
-
readonly maxBpPerPx: number;
|
|
126
|
-
readonly minBpPerPx: number;
|
|
127
|
-
readonly maxOffset: number;
|
|
128
|
-
readonly minOffset: number;
|
|
129
|
-
} & {
|
|
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]>;
|
|
139
|
-
}, {
|
|
140
|
-
features: undefined | import("@jbrowse/core/util").Feature[];
|
|
141
|
-
volatileWidth: number;
|
|
142
|
-
} & {
|
|
143
|
-
setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
144
|
-
setBpPerPx(val: number): void;
|
|
145
|
-
setVolatileWidth(width: number): void;
|
|
146
|
-
} & {
|
|
147
|
-
readonly width: number;
|
|
148
|
-
readonly assemblyNames: string[];
|
|
149
|
-
readonly displayedRegionsTotalPx: number;
|
|
150
|
-
readonly maxOffset: number;
|
|
151
|
-
readonly minOffset: number;
|
|
152
|
-
readonly totalBp: number;
|
|
153
|
-
} & {
|
|
154
|
-
readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
155
|
-
readonly staticBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
156
|
-
readonly currBp: number;
|
|
157
|
-
} & {
|
|
158
|
-
pxToBp(px: number): {
|
|
159
|
-
coord: number;
|
|
160
|
-
index: number;
|
|
161
|
-
refName: string;
|
|
162
|
-
oob: boolean;
|
|
163
|
-
assemblyName: string;
|
|
164
|
-
offset: number;
|
|
165
|
-
start: number;
|
|
166
|
-
end: number;
|
|
167
|
-
reversed?: boolean;
|
|
168
|
-
};
|
|
169
|
-
bpToPx({ refName, coord, regionNumber, }: {
|
|
170
|
-
refName: string;
|
|
171
|
-
coord: number;
|
|
172
|
-
regionNumber?: number;
|
|
173
|
-
}): number | undefined;
|
|
174
|
-
} & {
|
|
175
|
-
setFeatures(features: import("@jbrowse/core/util").Feature[]): void;
|
|
176
|
-
showAllRegions(): void;
|
|
177
|
-
zoomOut(): void;
|
|
178
|
-
zoomIn(): void;
|
|
179
|
-
zoomTo(bpPerPx: number, offset?: number): number;
|
|
180
|
-
scrollTo(offsetPx: number): number;
|
|
181
|
-
centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
|
|
182
|
-
scroll(distance: number): number;
|
|
183
|
-
} & {
|
|
184
|
-
moveTo(start?: import("@jbrowse/core/util/Base1DUtils").BpOffset, end?: import("@jbrowse/core/util/Base1DUtils").BpOffset): void;
|
|
185
|
-
} & {
|
|
186
|
-
setScaleFactor(n: number): void;
|
|
187
|
-
center(): void;
|
|
188
|
-
} & {
|
|
189
|
-
readonly dynamicBlocks: import("@jbrowse/core/util/blockTypes").BlockSet;
|
|
190
|
-
readonly scaleFactor: number;
|
|
191
|
-
readonly maxBpPerPx: number;
|
|
192
|
-
readonly minBpPerPx: number;
|
|
193
|
-
readonly maxOffset: number;
|
|
194
|
-
readonly minOffset: number;
|
|
195
|
-
} & {
|
|
196
|
-
readonly width: any;
|
|
197
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
|
198
|
-
export { Dotplot1DView, DotplotHView, DotplotVView };
|
|
199
|
-
export type Dotplot1DViewModel = Instance<typeof Dotplot1DView>;
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DotplotVView = exports.DotplotHView = exports.Dotplot1DView = void 0;
|
|
7
|
-
const Base1DViewModel_1 = __importDefault(require("@jbrowse/core/util/Base1DViewModel"));
|
|
8
|
-
const calculateDynamicBlocks_1 = __importDefault(require("@jbrowse/core/util/calculateDynamicBlocks"));
|
|
9
|
-
const mobx_1 = require("mobx");
|
|
10
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
11
|
-
function x() { }
|
|
12
|
-
const Dotplot1DView = Base1DViewModel_1.default.extend(self => {
|
|
13
|
-
const scaleFactor = mobx_1.observable.box(1);
|
|
14
|
-
return {
|
|
15
|
-
views: {
|
|
16
|
-
get dynamicBlocks() {
|
|
17
|
-
return (0, calculateDynamicBlocks_1.default)(self, false, false);
|
|
18
|
-
},
|
|
19
|
-
get scaleFactor() {
|
|
20
|
-
return scaleFactor.get();
|
|
21
|
-
},
|
|
22
|
-
get maxBpPerPx() {
|
|
23
|
-
return self.totalBp / (self.width * 0.9);
|
|
24
|
-
},
|
|
25
|
-
get minBpPerPx() {
|
|
26
|
-
return 1 / 50;
|
|
27
|
-
},
|
|
28
|
-
get maxOffset() {
|
|
29
|
-
const leftPadding = 10;
|
|
30
|
-
return self.displayedRegionsTotalPx - leftPadding;
|
|
31
|
-
},
|
|
32
|
-
get minOffset() {
|
|
33
|
-
const rightPadding = 30;
|
|
34
|
-
return -self.width + rightPadding;
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
actions: {
|
|
38
|
-
setScaleFactor(n) {
|
|
39
|
-
scaleFactor.set(n);
|
|
40
|
-
},
|
|
41
|
-
center() {
|
|
42
|
-
const centerBp = self.totalBp / 2;
|
|
43
|
-
const centerPx = centerBp / self.bpPerPx;
|
|
44
|
-
self.scrollTo(centerPx - self.width / 2);
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
exports.Dotplot1DView = Dotplot1DView;
|
|
50
|
-
const DotplotHView = Dotplot1DView.extend(self => ({
|
|
51
|
-
views: {
|
|
52
|
-
get width() {
|
|
53
|
-
return (0, mobx_state_tree_1.getParent)(self).viewWidth;
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
}));
|
|
57
|
-
exports.DotplotHView = DotplotHView;
|
|
58
|
-
const DotplotVView = Dotplot1DView.extend(self => ({
|
|
59
|
-
views: {
|
|
60
|
-
get width() {
|
|
61
|
-
return (0, mobx_state_tree_1.getParent)(self).viewHeight;
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
}));
|
|
65
|
-
exports.DotplotVView = DotplotVView;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { DotplotViewModel } from '../model';
|
|
2
|
-
export declare const HorizontalAxis: ({ model, }: {
|
|
3
|
-
model: DotplotViewModel;
|
|
4
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
-
export declare const HorizontalAxisRaw: ({ model, }: {
|
|
6
|
-
model: DotplotViewModel;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare const VerticalAxis: ({ model, }: {
|
|
9
|
-
model: DotplotViewModel;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export declare const VerticalAxisRaw: ({ model, }: {
|
|
12
|
-
model: DotplotViewModel;
|
|
13
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VerticalAxisRaw = exports.VerticalAxis = exports.HorizontalAxisRaw = exports.HorizontalAxis = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const util_1 = require("@jbrowse/core/util");
|
|
6
|
-
const Base1DUtils_1 = require("@jbrowse/core/util/Base1DUtils");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
const mobx_react_1 = require("mobx-react");
|
|
9
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
10
|
-
const mui_1 = require("tss-react/mui");
|
|
11
|
-
const util_2 = require("./util");
|
|
12
|
-
const useStyles = (0, mui_1.makeStyles)()(() => ({
|
|
13
|
-
vtext: {
|
|
14
|
-
gridColumn: '1/2',
|
|
15
|
-
gridRow: '1/2',
|
|
16
|
-
pointerEvents: 'none',
|
|
17
|
-
userSelect: 'none',
|
|
18
|
-
},
|
|
19
|
-
htext: {
|
|
20
|
-
gridColumn: '2/2',
|
|
21
|
-
gridRow: '2/2',
|
|
22
|
-
pointerEvents: 'none',
|
|
23
|
-
userSelect: 'none',
|
|
24
|
-
},
|
|
25
|
-
}));
|
|
26
|
-
exports.HorizontalAxis = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
27
|
-
const { viewWidth, borderY } = model;
|
|
28
|
-
const { classes } = useStyles();
|
|
29
|
-
return ((0, jsx_runtime_1.jsx)("svg", { width: viewWidth, height: borderY, className: classes.htext, children: (0, jsx_runtime_1.jsx)(exports.HorizontalAxisRaw, { model: model }) }));
|
|
30
|
-
});
|
|
31
|
-
exports.HorizontalAxisRaw = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
32
|
-
const { viewWidth, borderX, borderY, hview, htextRotation, hticks } = model;
|
|
33
|
-
const { offsetPx, width, dynamicBlocks, bpPerPx } = hview;
|
|
34
|
-
const dblocks = dynamicBlocks.contentBlocks;
|
|
35
|
-
const hide = (0, util_2.getBlockLabelKeysToHide)(dblocks, viewWidth, offsetPx);
|
|
36
|
-
const theme = (0, material_1.useTheme)();
|
|
37
|
-
const hviewSnap = {
|
|
38
|
-
...(0, mobx_state_tree_1.getSnapshot)(hview),
|
|
39
|
-
width,
|
|
40
|
-
staticBlocks: hview.staticBlocks,
|
|
41
|
-
};
|
|
42
|
-
const ticks = hticks
|
|
43
|
-
.map(tick => {
|
|
44
|
-
var _a;
|
|
45
|
-
return [
|
|
46
|
-
tick,
|
|
47
|
-
(_a = (0, Base1DUtils_1.bpToPx)({
|
|
48
|
-
refName: tick.refName,
|
|
49
|
-
coord: tick.base,
|
|
50
|
-
self: hviewSnap,
|
|
51
|
-
})) === null || _a === void 0 ? void 0 : _a.offsetPx,
|
|
52
|
-
];
|
|
53
|
-
})
|
|
54
|
-
.filter(f => f[1] !== undefined)
|
|
55
|
-
.map(f => [f[0], f[1] - offsetPx]);
|
|
56
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [dblocks
|
|
57
|
-
.filter(region => !hide.has(region.key))
|
|
58
|
-
.map(region => {
|
|
59
|
-
const x = region.offsetPx;
|
|
60
|
-
const y = 0;
|
|
61
|
-
const xoff = Math.floor(x - hview.offsetPx);
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)("text", { transform: `rotate(${htextRotation},${xoff},${y})`, x: xoff, y: y + 1, fontSize: 11, dominantBaseline: "hanging", textAnchor: "end", ...(0, util_1.getFillProps)(theme.palette.text.primary), children: region.refName }, JSON.stringify(region)));
|
|
63
|
-
}), ticks.map(([tick, x]) => x > 0 && x < width ? ((0, jsx_runtime_1.jsx)("line", { x1: x, x2: x, y1: 0, y2: tick.type === 'major' ? 6 : 4, strokeWidth: 1, ...(0, util_1.getFillProps)(theme.palette.text.primary) }, `line-${JSON.stringify(tick)}`)) : null), ticks
|
|
64
|
-
.filter(t => t[0].type === 'major')
|
|
65
|
-
.map(([tick, x]) => x > 10 && x < width ? ((0, jsx_runtime_1.jsx)("text", { x: x - 7, y: 0, transform: `rotate(${htextRotation},${x},0)`, fontSize: 11, dominantBaseline: "middle", textAnchor: "end", ...(0, util_1.getFillProps)(theme.palette.text.primary), children: (0, util_1.getTickDisplayStr)(tick.base + 1, bpPerPx) }, `text-${JSON.stringify(tick)}`)) : null), (0, jsx_runtime_1.jsx)("text", { y: borderY - 12, x: (viewWidth - borderX) / 2, textAnchor: "middle", fontSize: 11, dominantBaseline: "hanging", ...(0, util_1.getFillProps)(theme.palette.text.primary), children: hview.assemblyNames.join(',') })] }));
|
|
66
|
-
});
|
|
67
|
-
exports.VerticalAxis = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
68
|
-
const { borderX, viewHeight } = model;
|
|
69
|
-
const { classes } = useStyles();
|
|
70
|
-
return ((0, jsx_runtime_1.jsx)("svg", { className: classes.vtext, width: borderX, height: viewHeight, children: (0, jsx_runtime_1.jsx)(exports.VerticalAxisRaw, { model: model }) }));
|
|
71
|
-
});
|
|
72
|
-
exports.VerticalAxisRaw = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
73
|
-
const { viewHeight, borderX, borderY, vview, vtextRotation, vticks } = model;
|
|
74
|
-
const { offsetPx, width, dynamicBlocks, bpPerPx } = vview;
|
|
75
|
-
const dblocks = dynamicBlocks.contentBlocks;
|
|
76
|
-
const hide = (0, util_2.getBlockLabelKeysToHide)(dblocks, viewHeight, offsetPx);
|
|
77
|
-
const theme = (0, material_1.useTheme)();
|
|
78
|
-
const vviewSnap = {
|
|
79
|
-
...(0, mobx_state_tree_1.getSnapshot)(vview),
|
|
80
|
-
width,
|
|
81
|
-
staticBlocks: vview.staticBlocks,
|
|
82
|
-
};
|
|
83
|
-
const ticks = vticks
|
|
84
|
-
.map(tick => {
|
|
85
|
-
var _a;
|
|
86
|
-
return [
|
|
87
|
-
tick,
|
|
88
|
-
(_a = (0, Base1DUtils_1.bpToPx)({
|
|
89
|
-
refName: tick.refName,
|
|
90
|
-
coord: tick.base,
|
|
91
|
-
self: vviewSnap,
|
|
92
|
-
})) === null || _a === void 0 ? void 0 : _a.offsetPx,
|
|
93
|
-
];
|
|
94
|
-
})
|
|
95
|
-
.filter(f => f[1] !== undefined)
|
|
96
|
-
.map(f => [f[0], f[1] - offsetPx]);
|
|
97
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [dblocks
|
|
98
|
-
.filter(region => !hide.has(region.key))
|
|
99
|
-
.map(region => {
|
|
100
|
-
const y = region.offsetPx;
|
|
101
|
-
const x = borderX;
|
|
102
|
-
const yoff = Math.floor(viewHeight - y + offsetPx);
|
|
103
|
-
return ((0, jsx_runtime_1.jsx)("text", { transform: `rotate(${vtextRotation},${x},${y})`, x: x, y: yoff, fontSize: 11, textAnchor: "end", ...(0, util_1.getFillProps)(theme.palette.text.primary), children: region.refName }, JSON.stringify(region)));
|
|
104
|
-
}), ticks.map(([tick, y]) => y > 0 ? ((0, jsx_runtime_1.jsx)("line", { y1: viewHeight - y, y2: viewHeight - y, x1: borderX, x2: borderX - (tick.type === 'major' ? 6 : 4), strokeWidth: 1, ...(0, util_1.getStrokeProps)(theme.palette.grey[400]) }, `line-${JSON.stringify(tick)}`)) : null), ticks
|
|
105
|
-
.filter(t => t[0].type === 'major')
|
|
106
|
-
.map(([tick, y]) => y > 10 && y < viewHeight ? ((0, jsx_runtime_1.jsx)("text", { y: viewHeight - y - 3, x: borderX - 7, textAnchor: "end", dominantBaseline: "hanging", fontSize: 11, ...(0, util_1.getFillProps)(theme.palette.text.primary), children: (0, util_1.getTickDisplayStr)(tick.base + 1, bpPerPx) }, `text-${JSON.stringify(tick)}`)) : null), (0, jsx_runtime_1.jsx)("text", { y: (viewHeight - borderY) / 2, x: 12, transform: `rotate(-90,12,${(viewHeight - borderY) / 2})`, textAnchor: "middle", fontSize: 11, ...(0, util_1.getFillProps)(theme.palette.text.primary), children: vview.assemblyNames.join(',') })] }));
|
|
107
|
-
});
|