@jbrowse/plugin-linear-comparative-view 2.9.0 → 2.10.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/dist/LGVSyntenyDisplay/configSchemaF.d.ts +2 -0
- package/dist/LGVSyntenyDisplay/configSchemaF.js +2 -0
- package/dist/LGVSyntenyDisplay/model.d.ts +18 -7
- package/dist/LGVSyntenyDisplay/model.js +13 -3
- package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +35 -27
- package/dist/LinearComparativeDisplay/stateModelFactory.js +2 -0
- package/dist/LinearComparativeView/model.d.ts +27 -12
- package/dist/LinearComparativeView/model.js +2 -0
- package/dist/LinearReadVsRef/index.js +26 -2
- package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +185 -96
- package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +13 -0
- package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +57 -0
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +1 -3
- package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +19 -51
- package/dist/LinearSyntenyDisplay/model.d.ts +27 -17
- package/dist/LinearSyntenyDisplay/model.js +2 -1
- package/dist/LinearSyntenyView/model.d.ts +119 -54
- package/dist/LinearSyntenyView/model.js +8 -1
- package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +6 -6
- package/dist/SyntenyTrack/configSchema.js +2 -0
- package/esm/LGVSyntenyDisplay/configSchemaF.d.ts +2 -0
- package/esm/LGVSyntenyDisplay/configSchemaF.js +2 -0
- package/esm/LGVSyntenyDisplay/model.d.ts +18 -7
- package/esm/LGVSyntenyDisplay/model.js +13 -3
- package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +35 -27
- package/esm/LinearComparativeDisplay/stateModelFactory.js +2 -0
- package/esm/LinearComparativeView/model.d.ts +27 -12
- package/esm/LinearComparativeView/model.js +2 -0
- package/esm/LinearReadVsRef/index.js +2 -1
- package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +186 -97
- package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +13 -0
- package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +51 -0
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.d.ts +1 -3
- package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +18 -30
- package/esm/LinearSyntenyDisplay/model.d.ts +27 -17
- package/esm/LinearSyntenyDisplay/model.js +2 -1
- package/esm/LinearSyntenyView/model.d.ts +119 -54
- package/esm/LinearSyntenyView/model.js +8 -1
- package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +6 -6
- package/esm/SyntenyTrack/configSchema.js +2 -0
- package/package.json +4 -5
|
@@ -29,16 +29,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const mobx_react_1 = require("mobx-react");
|
|
31
31
|
const util_1 = require("@jbrowse/core/util");
|
|
32
|
+
const mobx_1 = require("mobx");
|
|
33
|
+
const mui_1 = require("tss-react/mui");
|
|
32
34
|
// locals
|
|
33
35
|
const SyntenyTooltip_1 = __importDefault(require("./SyntenyTooltip"));
|
|
34
36
|
const drawSynteny_1 = require("../drawSynteny");
|
|
37
|
+
const SyntenyContextMenu_1 = __importDefault(require("./SyntenyContextMenu"));
|
|
38
|
+
const useStyles = (0, mui_1.makeStyles)()({
|
|
39
|
+
pix: {
|
|
40
|
+
imageRendering: 'pixelated',
|
|
41
|
+
pointerEvents: 'none',
|
|
42
|
+
visibility: 'hidden',
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
},
|
|
45
|
+
rel: {
|
|
46
|
+
position: 'relative',
|
|
47
|
+
},
|
|
48
|
+
abs: {
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
},
|
|
51
|
+
none: {
|
|
52
|
+
pointEvents: 'none',
|
|
53
|
+
},
|
|
54
|
+
});
|
|
35
55
|
const LinearSyntenyRendering = (0, mobx_react_1.observer)(function ({ model, }) {
|
|
36
|
-
const
|
|
56
|
+
const { classes, cx } = useStyles();
|
|
57
|
+
const xOffset = (0, react_1.useRef)(0);
|
|
58
|
+
const currScrollFrame = (0, react_1.useRef)();
|
|
37
59
|
const view = (0, util_1.getContainingView)(model);
|
|
38
60
|
const height = view.middleComparativeHeight;
|
|
39
61
|
const width = view.width;
|
|
62
|
+
const [anchorEl, setAnchorEl] = (0, react_1.useState)();
|
|
40
63
|
const [tooltip, setTooltip] = (0, react_1.useState)('');
|
|
41
64
|
const [currX, setCurrX] = (0, react_1.useState)();
|
|
65
|
+
const [mouseCurrDownX, setMouseCurrDownX] = (0, react_1.useState)();
|
|
66
|
+
const [mouseInitialDownX, setMouseInitialDownX] = (0, react_1.useState)();
|
|
42
67
|
const [currY, setCurrY] = (0, react_1.useState)();
|
|
43
68
|
// these useCallbacks avoid new refs from being created on any mouseover, etc.
|
|
44
69
|
const k1 = (0, react_1.useCallback)((ref) => model.setMouseoverCanvasRef(ref),
|
|
@@ -53,108 +78,172 @@ const LinearSyntenyRendering = (0, mobx_react_1.observer)(function ({ model, })
|
|
|
53
78
|
const k4 = (0, react_1.useCallback)((ref) => model.setCigarClickMapCanvasRef(ref),
|
|
54
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
80
|
[model, height, width]);
|
|
56
|
-
return (react_1.default.createElement("div", {
|
|
57
|
-
react_1.default.createElement("canvas", { ref: k1, width: width, height: height,
|
|
58
|
-
react_1.default.createElement("canvas", { ref: k2,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const ref2 = model.cigarClickMapCanvas;
|
|
62
|
-
if (!ref1 || !ref2) {
|
|
63
|
-
return;
|
|
81
|
+
return (react_1.default.createElement("div", { className: classes.rel },
|
|
82
|
+
react_1.default.createElement("canvas", { ref: k1, width: width, height: height, className: cx(classes.abs, classes.none) }),
|
|
83
|
+
react_1.default.createElement("canvas", { ref: k2, onWheel: event => {
|
|
84
|
+
if (Math.abs(event.deltaY) < Math.abs(event.deltaX)) {
|
|
85
|
+
xOffset.current += event.deltaX;
|
|
64
86
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
87
|
+
if (currScrollFrame.current === undefined) {
|
|
88
|
+
currScrollFrame.current = requestAnimationFrame(() => {
|
|
89
|
+
(0, mobx_1.transaction)(() => {
|
|
90
|
+
for (const v of view.views) {
|
|
91
|
+
v.horizontalScroll(xOffset.current);
|
|
92
|
+
}
|
|
93
|
+
xOffset.current = 0;
|
|
94
|
+
currScrollFrame.current = undefined;
|
|
95
|
+
});
|
|
96
|
+
});
|
|
70
97
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
98
|
+
}, onMouseMove: event => {
|
|
99
|
+
var _a;
|
|
100
|
+
if (mouseCurrDownX !== undefined) {
|
|
101
|
+
xOffset.current += mouseCurrDownX - event.clientX;
|
|
102
|
+
setMouseCurrDownX(event.clientX);
|
|
103
|
+
if (currScrollFrame.current === undefined) {
|
|
104
|
+
currScrollFrame.current = requestAnimationFrame(() => {
|
|
105
|
+
(0, mobx_1.transaction)(() => {
|
|
106
|
+
for (const v of view.views) {
|
|
107
|
+
v.horizontalScroll(xOffset.current);
|
|
108
|
+
}
|
|
109
|
+
xOffset.current = 0;
|
|
110
|
+
currScrollFrame.current = undefined;
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
}
|
|
83
114
|
}
|
|
84
|
-
else
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
const unitMultiplier2 = Math.floor(drawSynteny_1.MAX_COLOR_RANGE / cigar.length);
|
|
90
|
-
const cigarIdx = (0, drawSynteny_1.getId)(r2, g2, b2, unitMultiplier2);
|
|
91
|
-
const l1 = f1.end - f1.start;
|
|
92
|
-
const l2 = f2.end - f2.start;
|
|
93
|
-
const identity = f1.identity;
|
|
94
|
-
const n1 = f1.name;
|
|
95
|
-
const n2 = f2.name;
|
|
96
|
-
const tooltip = [
|
|
97
|
-
`Loc1: ${(0, util_1.assembleLocString)(f1)}`,
|
|
98
|
-
`Loc2: ${(0, util_1.assembleLocString)(f2)}`,
|
|
99
|
-
`Inverted: ${f1.strand === -1}`,
|
|
100
|
-
`Query len: ${l1}`,
|
|
101
|
-
`Target len: ${l2}`,
|
|
102
|
-
];
|
|
103
|
-
if (identity) {
|
|
104
|
-
tooltip.push(`Identity: ${identity}`);
|
|
115
|
+
else {
|
|
116
|
+
const ref1 = model.clickMapCanvas;
|
|
117
|
+
const ref2 = model.cigarClickMapCanvas;
|
|
118
|
+
if (!ref1 || !ref2) {
|
|
119
|
+
return;
|
|
105
120
|
}
|
|
106
|
-
|
|
107
|
-
|
|
121
|
+
const rect = ref1.getBoundingClientRect();
|
|
122
|
+
const ctx1 = ref1.getContext('2d');
|
|
123
|
+
const ctx2 = ref2.getContext('2d');
|
|
124
|
+
if (!ctx1 || !ctx2) {
|
|
125
|
+
return;
|
|
108
126
|
}
|
|
109
|
-
|
|
110
|
-
|
|
127
|
+
const { clientX, clientY } = event;
|
|
128
|
+
const x = clientX - rect.left;
|
|
129
|
+
const y = clientY - rect.top;
|
|
130
|
+
setCurrX(clientX);
|
|
131
|
+
setCurrY(clientY);
|
|
132
|
+
const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
|
|
133
|
+
const [r2, g2, b2] = ctx2.getImageData(x, y, 1, 1).data;
|
|
134
|
+
const unitMultiplier = Math.floor(drawSynteny_1.MAX_COLOR_RANGE / model.numFeats);
|
|
135
|
+
const id = (0, drawSynteny_1.getId)(r1, g1, b1, unitMultiplier);
|
|
136
|
+
model.setMouseoverId((_a = model.featPositions[id]) === null || _a === void 0 ? void 0 : _a.f.id());
|
|
137
|
+
if (id === -1) {
|
|
138
|
+
setTooltip('');
|
|
139
|
+
}
|
|
140
|
+
else if (model.featPositions[id]) {
|
|
141
|
+
const { f, cigar } = model.featPositions[id];
|
|
142
|
+
const unitMultiplier2 = Math.floor(drawSynteny_1.MAX_COLOR_RANGE / cigar.length);
|
|
143
|
+
const cigarIdx = (0, drawSynteny_1.getId)(r2, g2, b2, unitMultiplier2);
|
|
144
|
+
setTooltip(getTooltip(f, cigar[cigarIdx], cigar[cigarIdx + 1]));
|
|
111
145
|
}
|
|
112
|
-
setTooltip(tooltip.join('<br/>'));
|
|
113
|
-
}
|
|
114
|
-
}, onMouseLeave: () => model.setMouseoverId(undefined), onClick: event => {
|
|
115
|
-
const ref1 = model.clickMapCanvas;
|
|
116
|
-
const ref2 = model.cigarClickMapCanvas;
|
|
117
|
-
if (!ref1 || !ref2) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
const rect = ref1.getBoundingClientRect();
|
|
121
|
-
const ctx1 = ref1.getContext('2d');
|
|
122
|
-
const ctx2 = ref2.getContext('2d');
|
|
123
|
-
if (!ctx1 || !ctx2) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const x = event.clientX - rect.left;
|
|
127
|
-
const y = event.clientY - rect.top;
|
|
128
|
-
const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
|
|
129
|
-
const unitMultiplier = Math.floor(drawSynteny_1.MAX_COLOR_RANGE / model.numFeats);
|
|
130
|
-
const id = (0, drawSynteny_1.getId)(r1, g1, b1, unitMultiplier);
|
|
131
|
-
const f = model.featPositions[id];
|
|
132
|
-
if (!f) {
|
|
133
|
-
return;
|
|
134
146
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
147
|
+
}, onMouseLeave: () => {
|
|
148
|
+
model.setMouseoverId(undefined);
|
|
149
|
+
setMouseInitialDownX(undefined);
|
|
150
|
+
setMouseCurrDownX(undefined);
|
|
151
|
+
}, onMouseDown: evt => {
|
|
152
|
+
setMouseCurrDownX(evt.clientX);
|
|
153
|
+
setMouseInitialDownX(evt.clientX);
|
|
154
|
+
}, onMouseUp: evt => {
|
|
155
|
+
setMouseCurrDownX(undefined);
|
|
156
|
+
if (mouseInitialDownX !== undefined &&
|
|
157
|
+
Math.abs(evt.clientX - mouseInitialDownX) < 5) {
|
|
158
|
+
onSyntenyClick(evt, model);
|
|
144
159
|
}
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
react_1.default.createElement("canvas", { ref: k4, style: {
|
|
153
|
-
imageRendering: 'pixelated',
|
|
154
|
-
pointerEvents: 'none',
|
|
155
|
-
visibility: 'hidden',
|
|
156
|
-
position: 'absolute',
|
|
157
|
-
}, width: width, height: height }),
|
|
158
|
-
model.mouseoverId && tooltip && currX && currY ? (react_1.default.createElement(SyntenyTooltip_1.default, { x: currX, y: currY, title: tooltip })) : null));
|
|
160
|
+
}, onContextMenu: evt => {
|
|
161
|
+
onSyntenyContextClick(evt, model, setAnchorEl);
|
|
162
|
+
}, "data-testid": "synteny_canvas", className: classes.abs, width: width, height: height }),
|
|
163
|
+
react_1.default.createElement("canvas", { ref: k3, className: classes.pix, width: width, height: height }),
|
|
164
|
+
react_1.default.createElement("canvas", { ref: k4, className: classes.pix, width: width, height: height }),
|
|
165
|
+
model.mouseoverId && tooltip && currX && currY ? (react_1.default.createElement(SyntenyTooltip_1.default, { title: tooltip })) : null,
|
|
166
|
+
anchorEl ? (react_1.default.createElement(SyntenyContextMenu_1.default, { model: model, anchorEl: anchorEl, onClose: () => setAnchorEl(undefined) })) : null));
|
|
159
167
|
});
|
|
168
|
+
function onSyntenyClick(event, model) {
|
|
169
|
+
const ref1 = model.clickMapCanvas;
|
|
170
|
+
const ref2 = model.cigarClickMapCanvas;
|
|
171
|
+
if (!ref1 || !ref2) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const rect = ref1.getBoundingClientRect();
|
|
175
|
+
const ctx1 = ref1.getContext('2d');
|
|
176
|
+
const ctx2 = ref2.getContext('2d');
|
|
177
|
+
if (!ctx1 || !ctx2) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
const x = event.clientX - rect.left;
|
|
181
|
+
const y = event.clientY - rect.top;
|
|
182
|
+
const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
|
|
183
|
+
const unitMultiplier = Math.floor(drawSynteny_1.MAX_COLOR_RANGE / model.numFeats);
|
|
184
|
+
const id = (0, drawSynteny_1.getId)(r1, g1, b1, unitMultiplier);
|
|
185
|
+
const feat = model.featPositions[id];
|
|
186
|
+
if (feat) {
|
|
187
|
+
const { f } = feat;
|
|
188
|
+
model.setClickId(f.id());
|
|
189
|
+
const session = (0, util_1.getSession)(model);
|
|
190
|
+
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
191
|
+
session.showWidget(session.addWidget('SyntenyFeatureWidget', 'syntenyFeature', {
|
|
192
|
+
featureData: {
|
|
193
|
+
feature1: f.toJSON(),
|
|
194
|
+
feature2: f.get('mate'),
|
|
195
|
+
},
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return feat;
|
|
200
|
+
}
|
|
201
|
+
function onSyntenyContextClick(event, model, setAnchorEl) {
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
const ref1 = model.clickMapCanvas;
|
|
204
|
+
const ref2 = model.cigarClickMapCanvas;
|
|
205
|
+
if (!ref1 || !ref2) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const rect = ref1.getBoundingClientRect();
|
|
209
|
+
const ctx1 = ref1.getContext('2d');
|
|
210
|
+
const ctx2 = ref2.getContext('2d');
|
|
211
|
+
if (!ctx1 || !ctx2) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const { clientX, clientY } = event;
|
|
215
|
+
const x = clientX - rect.left;
|
|
216
|
+
const y = clientY - rect.top;
|
|
217
|
+
const [r1, g1, b1] = ctx1.getImageData(x, y, 1, 1).data;
|
|
218
|
+
const unitMultiplier = Math.floor(drawSynteny_1.MAX_COLOR_RANGE / model.numFeats);
|
|
219
|
+
const id = (0, drawSynteny_1.getId)(r1, g1, b1, unitMultiplier);
|
|
220
|
+
const f = model.featPositions[id];
|
|
221
|
+
if (f) {
|
|
222
|
+
model.setClickId(f.f.id());
|
|
223
|
+
setAnchorEl({ clientX, clientY, feature: f });
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
function getTooltip(f, cigarOp, cigarOpLen) {
|
|
227
|
+
// @ts-expect-error
|
|
228
|
+
const f1 = f.toJSON();
|
|
229
|
+
const f2 = f1.mate;
|
|
230
|
+
const l1 = f1.end - f1.start;
|
|
231
|
+
const l2 = f2.end - f2.start;
|
|
232
|
+
const identity = f1.identity;
|
|
233
|
+
const n1 = f1.name;
|
|
234
|
+
const n2 = f2.name;
|
|
235
|
+
return [
|
|
236
|
+
`Loc1: ${(0, util_1.assembleLocString)(f1)}`,
|
|
237
|
+
`Loc2: ${(0, util_1.assembleLocString)(f2)}`,
|
|
238
|
+
`Inverted: ${f1.strand === -1}`,
|
|
239
|
+
`Query len: ${l1.toLocaleString('en-US')}`,
|
|
240
|
+
`Target len: ${l2.toLocaleString('en-US')}`,
|
|
241
|
+
identity ? `Identity: ${identity.toPrecision(2)}` : '',
|
|
242
|
+
cigarOp ? `CIGAR operator: ${cigarOp}${cigarOpLen}` : '',
|
|
243
|
+
n1 ? `Name 1: ${n1}` : '',
|
|
244
|
+
n2 ? `Name 1: ${n2}` : '',
|
|
245
|
+
]
|
|
246
|
+
.filter(f => !!f)
|
|
247
|
+
.join('<br/>');
|
|
248
|
+
}
|
|
160
249
|
exports.default = LinearSyntenyRendering;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { LinearSyntenyDisplayModel } from '../model';
|
|
3
|
+
interface ClickCoord {
|
|
4
|
+
clientX: number;
|
|
5
|
+
clientY: number;
|
|
6
|
+
feature: any;
|
|
7
|
+
}
|
|
8
|
+
export default function SyntenyContextMenu({ model, onClose, anchorEl, }: {
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
model: LinearSyntenyDisplayModel;
|
|
11
|
+
anchorEl: ClickCoord;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const util_1 = require("@jbrowse/core/util");
|
|
8
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
9
|
+
function SyntenyContextMenu({ model, onClose, anchorEl, }) {
|
|
10
|
+
const view = (0, util_1.getContainingView)(model);
|
|
11
|
+
const { clientX, clientY, feature } = anchorEl;
|
|
12
|
+
return (react_1.default.createElement(ui_1.Menu, { onMenuItemClick: (event, callback) => {
|
|
13
|
+
callback(event);
|
|
14
|
+
onClose();
|
|
15
|
+
}, anchorEl: {
|
|
16
|
+
nodeType: 1,
|
|
17
|
+
getBoundingClientRect: () => {
|
|
18
|
+
const x = clientX;
|
|
19
|
+
const y = clientY;
|
|
20
|
+
return {
|
|
21
|
+
top: y,
|
|
22
|
+
left: x,
|
|
23
|
+
bottom: y,
|
|
24
|
+
right: x,
|
|
25
|
+
width: 0,
|
|
26
|
+
height: 0,
|
|
27
|
+
x,
|
|
28
|
+
y,
|
|
29
|
+
toJSON() { },
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
}, onClose: onClose, open: Boolean(anchorEl), menuItems: [
|
|
33
|
+
{
|
|
34
|
+
label: 'Center on feature',
|
|
35
|
+
onClick: () => {
|
|
36
|
+
const { f } = feature;
|
|
37
|
+
const start = f.get('start');
|
|
38
|
+
const end = f.get('end');
|
|
39
|
+
const refName = f.get('refName');
|
|
40
|
+
const mate = f.get('mate');
|
|
41
|
+
view.views[0]
|
|
42
|
+
.navToLocString(`${refName}:${start}-${end}`)
|
|
43
|
+
.catch(e => {
|
|
44
|
+
console.error(e);
|
|
45
|
+
(0, util_1.getSession)(model).notify(`${e}`, 'error');
|
|
46
|
+
});
|
|
47
|
+
view.views[1]
|
|
48
|
+
.navToLocString(`${mate.refName}:${mate.start}-${mate.end}`)
|
|
49
|
+
.catch(e => {
|
|
50
|
+
console.error(e);
|
|
51
|
+
(0, util_1.getSession)(model).notify(`${e}`, 'error');
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
] }));
|
|
56
|
+
}
|
|
57
|
+
exports.default = SyntenyContextMenu;
|
|
@@ -1,33 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const react_1 =
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
27
7
|
const mobx_react_1 = require("mobx-react");
|
|
28
8
|
const material_1 = require("@mui/material");
|
|
29
9
|
const mui_1 = require("tss-react/mui");
|
|
30
|
-
const
|
|
10
|
+
const react_2 = require("@floating-ui/react");
|
|
31
11
|
const ui_1 = require("@jbrowse/core/ui");
|
|
32
12
|
function round(value) {
|
|
33
13
|
return Math.round(value * 1e5) / 1e5;
|
|
@@ -49,34 +29,22 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
|
49
29
|
wordWrap: 'break-word',
|
|
50
30
|
},
|
|
51
31
|
}));
|
|
52
|
-
const SyntenyTooltip = (0, mobx_react_1.observer)(function ({
|
|
53
|
-
|
|
54
|
-
const
|
|
32
|
+
const SyntenyTooltip = (0, mobx_react_1.observer)(function ({ title }) {
|
|
33
|
+
var _a, _b;
|
|
34
|
+
const theme = (0, material_1.useTheme)();
|
|
55
35
|
const { classes } = useStyles();
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
toJSON() { },
|
|
69
|
-
};
|
|
70
|
-
},
|
|
71
|
-
}), [x, y, width]);
|
|
72
|
-
const { styles, attributes } = (0, react_popper_1.usePopper)(virtElement, anchorEl);
|
|
73
|
-
return title ? (react_1.default.createElement(material_1.Portal, null,
|
|
74
|
-
react_1.default.createElement("div", { ref: ref => {
|
|
75
|
-
setWidth((ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect().width) || 0);
|
|
76
|
-
setAnchorEl(ref);
|
|
77
|
-
}, className: classes.tooltip,
|
|
78
|
-
// zIndex needed to go over widget drawer
|
|
79
|
-
style: { ...styles.popper, zIndex: 100000 }, ...attributes.popper },
|
|
36
|
+
const { refs, floatingStyles, context } = (0, react_2.useFloating)({
|
|
37
|
+
placement: 'right',
|
|
38
|
+
});
|
|
39
|
+
const clientPoint = (0, react_2.useClientPoint)(context);
|
|
40
|
+
const { getFloatingProps } = (0, react_2.useInteractions)([clientPoint]);
|
|
41
|
+
const popperTheme = (_a = theme === null || theme === void 0 ? void 0 : theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
|
|
42
|
+
return title ? (react_1.default.createElement(material_1.Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
|
|
43
|
+
react_1.default.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
|
|
44
|
+
...floatingStyles,
|
|
45
|
+
zIndex: 100000,
|
|
46
|
+
pointerEvents: 'none',
|
|
47
|
+
}, ...getFloatingProps() },
|
|
80
48
|
react_1.default.createElement(ui_1.SanitizedHTML, { html: title })))) : null;
|
|
81
49
|
});
|
|
82
50
|
exports.default = SyntenyTooltip;
|
|
@@ -5,7 +5,7 @@ import { Feature } from '@jbrowse/core/util';
|
|
|
5
5
|
interface Pos {
|
|
6
6
|
offsetPx: number;
|
|
7
7
|
}
|
|
8
|
-
interface FeatPos {
|
|
8
|
+
export interface FeatPos {
|
|
9
9
|
p11: Pos;
|
|
10
10
|
p12: Pos;
|
|
11
11
|
p21: Pos;
|
|
@@ -15,7 +15,8 @@ interface FeatPos {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* #stateModel LinearSyntenyDisplay
|
|
18
|
-
* extends
|
|
18
|
+
* extends
|
|
19
|
+
* - [LinearComparativeDisplay](../linearcomparativedisplay)
|
|
19
20
|
*/
|
|
20
21
|
declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): import("mobx-state-tree").IModelType<{
|
|
21
22
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
@@ -77,17 +78,20 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
77
78
|
rendererTypeName: string;
|
|
78
79
|
error: unknown;
|
|
79
80
|
message: string | undefined;
|
|
80
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
81
|
-
* #action
|
|
82
|
-
*/
|
|
81
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
83
82
|
}> | null;
|
|
84
83
|
readonly adapterConfig: any;
|
|
85
84
|
readonly parentTrack: any;
|
|
86
|
-
renderProps(): any;
|
|
85
|
+
renderProps(): any; /**
|
|
86
|
+
* #getter
|
|
87
|
+
*/
|
|
87
88
|
readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
|
|
88
89
|
readonly DisplayMessageComponent: import("react").FC<any> | undefined;
|
|
89
90
|
trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
90
|
-
readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
|
|
91
|
+
readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[]; /**
|
|
92
|
+
* #getter
|
|
93
|
+
* used for synteny svg rendering
|
|
94
|
+
*/
|
|
91
95
|
regionCannotBeRendered(): null;
|
|
92
96
|
} & {
|
|
93
97
|
setMessage(arg?: string | undefined): void;
|
|
@@ -154,17 +158,20 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
154
158
|
rendererTypeName: string;
|
|
155
159
|
error: unknown;
|
|
156
160
|
message: string | undefined;
|
|
157
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
158
|
-
* #action
|
|
159
|
-
*/
|
|
161
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
160
162
|
}> | null;
|
|
161
163
|
readonly adapterConfig: any;
|
|
162
164
|
readonly parentTrack: any;
|
|
163
|
-
renderProps(): any;
|
|
165
|
+
renderProps(): any; /**
|
|
166
|
+
* #getter
|
|
167
|
+
*/
|
|
164
168
|
readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
|
|
165
169
|
readonly DisplayMessageComponent: import("react").FC<any> | undefined;
|
|
166
170
|
trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
167
|
-
readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
|
|
171
|
+
readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[]; /**
|
|
172
|
+
* #getter
|
|
173
|
+
* used for synteny svg rendering
|
|
174
|
+
*/
|
|
168
175
|
regionCannotBeRendered(): null;
|
|
169
176
|
} & {
|
|
170
177
|
setMessage(arg?: string | undefined): void;
|
|
@@ -226,17 +233,20 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
|
|
|
226
233
|
rendererTypeName: string;
|
|
227
234
|
error: unknown;
|
|
228
235
|
message: string | undefined;
|
|
229
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
230
|
-
* #action
|
|
231
|
-
*/
|
|
236
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
232
237
|
}> | null;
|
|
233
238
|
readonly adapterConfig: any;
|
|
234
239
|
readonly parentTrack: any;
|
|
235
|
-
renderProps(): any;
|
|
240
|
+
renderProps(): any; /**
|
|
241
|
+
* #getter
|
|
242
|
+
*/
|
|
236
243
|
readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
|
|
237
244
|
readonly DisplayMessageComponent: import("react").FC<any> | undefined;
|
|
238
245
|
trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
|
|
239
|
-
readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
|
|
246
|
+
readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[]; /**
|
|
247
|
+
* #getter
|
|
248
|
+
* used for synteny svg rendering
|
|
249
|
+
*/
|
|
240
250
|
regionCannotBeRendered(): null;
|
|
241
251
|
} & {
|
|
242
252
|
setMessage(arg?: string | undefined): void;
|
|
@@ -32,7 +32,8 @@ const configuration_1 = require("@jbrowse/core/configuration");
|
|
|
32
32
|
const stateModelFactory_1 = __importDefault(require("../LinearComparativeDisplay/stateModelFactory"));
|
|
33
33
|
/**
|
|
34
34
|
* #stateModel LinearSyntenyDisplay
|
|
35
|
-
* extends
|
|
35
|
+
* extends
|
|
36
|
+
* - [LinearComparativeDisplay](../linearcomparativedisplay)
|
|
36
37
|
*/
|
|
37
38
|
function stateModelFactory(configSchema) {
|
|
38
39
|
return mobx_state_tree_1.types
|