@jbrowse/plugin-breakpoint-split-view 2.18.0 → 3.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/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +1 -2
- package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +2 -9
- package/dist/BreakpointAlignmentsFeatureDetail/index.js +17 -7
- package/dist/BreakpointSplitView/components/AlignmentConnections.d.ts +2 -3
- package/dist/BreakpointSplitView/components/AlignmentConnections.js +91 -113
- package/dist/BreakpointSplitView/components/Breakends.d.ts +2 -3
- package/dist/BreakpointSplitView/components/Breakends.js +67 -89
- package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -2
- package/dist/BreakpointSplitView/components/BreakpointSplitView.js +12 -16
- package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -2
- package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +9 -31
- package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
- package/dist/BreakpointSplitView/components/ExportSvgDialog.js +34 -73
- package/dist/BreakpointSplitView/components/Overlay.d.ts +2 -3
- package/dist/BreakpointSplitView/components/Overlay.js +7 -6
- package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +2 -3
- package/dist/BreakpointSplitView/components/PairedFeatures.js +47 -69
- package/dist/BreakpointSplitView/components/Translocations.d.ts +2 -3
- package/dist/BreakpointSplitView/components/Translocations.js +57 -79
- package/dist/BreakpointSplitView/index.js +17 -7
- package/dist/BreakpointSplitView/model.d.ts +19 -46
- package/dist/BreakpointSplitView/model.js +46 -64
- package/dist/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
- package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +2 -5
- package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
- package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +2 -23
- package/dist/BreakpointSplitView/types.d.ts +22 -0
- package/dist/BreakpointSplitView/types.js +2 -0
- package/dist/BreakpointSplitView/util.d.ts +11 -1
- package/dist/BreakpointSplitView/util.js +34 -0
- package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +1 -2
- package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +2 -6
- package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +2 -3
- package/esm/BreakpointSplitView/components/AlignmentConnections.js +91 -90
- package/esm/BreakpointSplitView/components/Breakends.d.ts +2 -3
- package/esm/BreakpointSplitView/components/Breakends.js +67 -66
- package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -2
- package/esm/BreakpointSplitView/components/BreakpointSplitView.js +12 -16
- package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -2
- package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +9 -8
- package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
- package/esm/BreakpointSplitView/components/ExportSvgDialog.js +34 -50
- package/esm/BreakpointSplitView/components/Overlay.d.ts +2 -3
- package/esm/BreakpointSplitView/components/Overlay.js +7 -6
- package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +2 -3
- package/esm/BreakpointSplitView/components/PairedFeatures.js +47 -46
- package/esm/BreakpointSplitView/components/Translocations.d.ts +2 -3
- package/esm/BreakpointSplitView/components/Translocations.js +57 -56
- package/esm/BreakpointSplitView/model.d.ts +19 -46
- package/esm/BreakpointSplitView/model.js +26 -53
- package/esm/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
- package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +2 -2
- package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
- package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +2 -23
- package/esm/BreakpointSplitView/types.d.ts +22 -0
- package/esm/BreakpointSplitView/types.js +1 -0
- package/esm/BreakpointSplitView/util.d.ts +11 -1
- package/esm/BreakpointSplitView/util.js +32 -1
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
2
3
|
import { getSession, getStrokeProps } from '@jbrowse/core/util';
|
|
3
4
|
import { useTheme } from '@mui/material';
|
|
4
5
|
import { observer } from 'mobx-react';
|
|
@@ -8,7 +9,7 @@ import { getPxFromCoordinate, heightFromSpecificLevel, useNextFrame, yPos, } fro
|
|
|
8
9
|
import { getLongReadOrientationAbnormal, getLongReadOrientationColorOrDefault, getPairedOrientationColor, isAbnormalOrientation, } from './getOrientationColor';
|
|
9
10
|
const [LEFT, , RIGHT] = [0, 1, 2, 3];
|
|
10
11
|
const AlignmentConnections = observer(function ({ model, trackId, parentRef, getTrackYPosOverride, }) {
|
|
11
|
-
const { views, showIntraviewLinks } = model;
|
|
12
|
+
const { interactiveOverlay, views, showIntraviewLinks } = model;
|
|
12
13
|
const theme = useTheme();
|
|
13
14
|
const session = getSession(model);
|
|
14
15
|
const snap = getSnapshot(model);
|
|
@@ -35,96 +36,96 @@ const AlignmentConnections = observer(function ({ model, trackId, parentRef, get
|
|
|
35
36
|
const rect = parentRef.current.getBoundingClientRect();
|
|
36
37
|
yOffset = rect.top;
|
|
37
38
|
}
|
|
38
|
-
return assembly ? (
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
if (!showIntraviewLinks && level1 === level2) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
const f1ref = assembly.getCanonicalRefName(f1.get('refName'));
|
|
51
|
-
const f2ref = assembly.getCanonicalRefName(f2.get('refName'));
|
|
52
|
-
if (!f1ref || !f2ref) {
|
|
53
|
-
throw new Error(`unable to find ref for ${f1ref || f2ref}`);
|
|
54
|
-
}
|
|
55
|
-
const r = {
|
|
56
|
-
pair_orientation: f1.get('pair_orientation'),
|
|
57
|
-
};
|
|
58
|
-
const s1 = f1.get('strand');
|
|
59
|
-
const s2 = f2.get('strand');
|
|
60
|
-
const sameRef = f1ref === f2ref;
|
|
61
|
-
const checkOrientation = sameRef;
|
|
62
|
-
let orientationColor = '';
|
|
63
|
-
let isAbnormal = false;
|
|
64
|
-
if (checkOrientation) {
|
|
65
|
-
if (hasPaired) {
|
|
66
|
-
orientationColor = getPairedOrientationColor(r);
|
|
67
|
-
isAbnormal = isAbnormalOrientation(r);
|
|
39
|
+
return assembly ? (_jsx("g", { fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
|
|
40
|
+
const ret = [];
|
|
41
|
+
for (let i = 0; i < chunk.length - 1; i++) {
|
|
42
|
+
const { layout: c1, feature: f1, level: level1 } = chunk[i];
|
|
43
|
+
const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
|
|
44
|
+
if (!c1 || !c2) {
|
|
45
|
+
console.warn('received null layout for a overlay feature');
|
|
46
|
+
return null;
|
|
68
47
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
isAbnormal = getLongReadOrientationAbnormal(s1, s2);
|
|
48
|
+
if (!showIntraviewLinks && level1 === level2) {
|
|
49
|
+
return null;
|
|
72
50
|
}
|
|
51
|
+
const f1ref = assembly.getCanonicalRefName(f1.get('refName'));
|
|
52
|
+
const f2ref = assembly.getCanonicalRefName(f2.get('refName'));
|
|
53
|
+
if (!f1ref || !f2ref) {
|
|
54
|
+
throw new Error(`unable to find ref for ${f1ref || f2ref}`);
|
|
55
|
+
}
|
|
56
|
+
const r = {
|
|
57
|
+
pair_orientation: f1.get('pair_orientation'),
|
|
58
|
+
};
|
|
59
|
+
const s1 = f1.get('strand');
|
|
60
|
+
const s2 = f2.get('strand');
|
|
61
|
+
const sameRef = f1ref === f2ref;
|
|
62
|
+
const checkOrientation = sameRef;
|
|
63
|
+
let orientationColor = '';
|
|
64
|
+
let isAbnormal = false;
|
|
65
|
+
if (checkOrientation) {
|
|
66
|
+
if (hasPaired) {
|
|
67
|
+
orientationColor = getPairedOrientationColor(r);
|
|
68
|
+
isAbnormal = isAbnormalOrientation(r);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
orientationColor = getLongReadOrientationColorOrDefault(s1, s2);
|
|
72
|
+
isAbnormal = getLongReadOrientationAbnormal(s1, s2);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
const p1 = c1[s1 === -1 ? LEFT : RIGHT];
|
|
76
|
+
const sn1 = s2 === -1;
|
|
77
|
+
const p2 = hasPaired ? c2[sn1 ? LEFT : RIGHT] : c2[sn1 ? RIGHT : LEFT];
|
|
78
|
+
const x1 = getPxFromCoordinate(views[level1], f1ref, p1);
|
|
79
|
+
const x2 = getPxFromCoordinate(views[level2], f2ref, p2);
|
|
80
|
+
const reversed1 = views[level1].pxToBp(x1).reversed;
|
|
81
|
+
const reversed2 = views[level2].pxToBp(x2).reversed;
|
|
82
|
+
const rf1 = reversed1 ? -1 : 1;
|
|
83
|
+
const rf2 = reversed2 ? -1 : 1;
|
|
84
|
+
const tracks = views.map(v => v.getTrack(trackId));
|
|
85
|
+
const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
|
|
86
|
+
yOffset;
|
|
87
|
+
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
88
|
+
yOffset;
|
|
89
|
+
const sameLevel = level1 === level2;
|
|
90
|
+
const abnormalSpecialRenderFlag = sameLevel && isAbnormal;
|
|
91
|
+
const trackHeight = abnormalSpecialRenderFlag
|
|
92
|
+
? tracks[level1].displays[0].height
|
|
93
|
+
: 0;
|
|
94
|
+
const pf1 = hasPaired ? -1 : 1;
|
|
95
|
+
const y0 = heightFromSpecificLevel(views, trackId, level1, getTrackYPosOverride);
|
|
96
|
+
const path = [
|
|
97
|
+
'M',
|
|
98
|
+
x1,
|
|
99
|
+
y1,
|
|
100
|
+
'C',
|
|
101
|
+
x1 + 200 * f1.get('strand') * rf1,
|
|
102
|
+
abnormalSpecialRenderFlag
|
|
103
|
+
? Math.min(y0 - yOffset + trackHeight, y1 + trackHeight)
|
|
104
|
+
: y1,
|
|
105
|
+
x2 - 200 * f2.get('strand') * rf2 * pf1,
|
|
106
|
+
abnormalSpecialRenderFlag
|
|
107
|
+
? Math.min(y0 - yOffset + trackHeight, y2 + trackHeight)
|
|
108
|
+
: y2,
|
|
109
|
+
x2,
|
|
110
|
+
y2,
|
|
111
|
+
].join(' ');
|
|
112
|
+
const id = `${f1.id()}-${f2.id()}`;
|
|
113
|
+
ret.push(_jsx("path", { d: path, "data-testid": "r1", pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: mouseoverElt === id ? 5 : 1, ...getStrokeProps(orientationColor || theme.palette.text.disabled), onClick: () => {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'BreakpointAlignmentsWidget', 'breakpointAlignments', {
|
|
116
|
+
featureData: {
|
|
117
|
+
feature1: (allFeatures.get(f1.id()) || { toJSON: () => { } }).toJSON(),
|
|
118
|
+
feature2: (allFeatures.get(f2.id()) || { toJSON: () => { } }).toJSON(),
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
(_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
|
|
122
|
+
}, onMouseOver: () => {
|
|
123
|
+
setMouseoverElt(id);
|
|
124
|
+
}, onMouseOut: () => {
|
|
125
|
+
setMouseoverElt(undefined);
|
|
126
|
+
} }, id));
|
|
73
127
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const p2 = hasPaired ? c2[sn1 ? LEFT : RIGHT] : c2[sn1 ? RIGHT : LEFT];
|
|
77
|
-
const x1 = getPxFromCoordinate(views[level1], f1ref, p1);
|
|
78
|
-
const x2 = getPxFromCoordinate(views[level2], f2ref, p2);
|
|
79
|
-
const reversed1 = views[level1].pxToBp(x1).reversed;
|
|
80
|
-
const reversed2 = views[level2].pxToBp(x2).reversed;
|
|
81
|
-
const rf1 = reversed1 ? -1 : 1;
|
|
82
|
-
const rf2 = reversed2 ? -1 : 1;
|
|
83
|
-
const tracks = views.map(v => v.getTrack(trackId));
|
|
84
|
-
const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
|
|
85
|
-
yOffset;
|
|
86
|
-
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
87
|
-
yOffset;
|
|
88
|
-
const sameLevel = level1 === level2;
|
|
89
|
-
const abnormalSpecialRenderFlag = sameLevel && isAbnormal;
|
|
90
|
-
const trackHeight = abnormalSpecialRenderFlag
|
|
91
|
-
? tracks[level1].displays[0].height
|
|
92
|
-
: 0;
|
|
93
|
-
const pf1 = hasPaired ? -1 : 1;
|
|
94
|
-
const y0 = heightFromSpecificLevel(views, trackId, level1, getTrackYPosOverride);
|
|
95
|
-
const path = [
|
|
96
|
-
'M',
|
|
97
|
-
x1,
|
|
98
|
-
y1,
|
|
99
|
-
'C',
|
|
100
|
-
x1 + 200 * f1.get('strand') * rf1,
|
|
101
|
-
abnormalSpecialRenderFlag
|
|
102
|
-
? Math.min(y0 - yOffset + trackHeight, y1 + trackHeight)
|
|
103
|
-
: y1,
|
|
104
|
-
x2 - 200 * f2.get('strand') * rf2 * pf1,
|
|
105
|
-
abnormalSpecialRenderFlag
|
|
106
|
-
? Math.min(y0 - yOffset + trackHeight, y2 + trackHeight)
|
|
107
|
-
: y2,
|
|
108
|
-
x2,
|
|
109
|
-
y2,
|
|
110
|
-
].join(' ');
|
|
111
|
-
const id = `${f1.id()}-${f2.id()}`;
|
|
112
|
-
ret.push(React.createElement("path", { d: path, key: id, "data-testid": "r1", strokeWidth: mouseoverElt === id ? 5 : 1, ...getStrokeProps(orientationColor || theme.palette.text.disabled), onClick: () => {
|
|
113
|
-
var _a, _b;
|
|
114
|
-
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'BreakpointAlignmentsWidget', 'breakpointAlignments', {
|
|
115
|
-
featureData: {
|
|
116
|
-
feature1: (allFeatures.get(f1.id()) || { toJSON: () => { } }).toJSON(),
|
|
117
|
-
feature2: (allFeatures.get(f2.id()) || { toJSON: () => { } }).toJSON(),
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
(_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
|
|
121
|
-
}, onMouseOver: () => {
|
|
122
|
-
setMouseoverElt(id);
|
|
123
|
-
}, onMouseOut: () => {
|
|
124
|
-
setMouseoverElt(undefined);
|
|
125
|
-
} }));
|
|
126
|
-
}
|
|
127
|
-
return ret;
|
|
128
|
-
}))) : null;
|
|
128
|
+
return ret;
|
|
129
|
+
}) })) : null;
|
|
129
130
|
});
|
|
130
131
|
export default AlignmentConnections;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { BreakpointViewModel } from '../model';
|
|
3
2
|
declare const Breakends: ({ model, trackId, parentRef: ref, getTrackYPosOverride, }: {
|
|
4
3
|
model: BreakpointViewModel;
|
|
5
4
|
trackId: string;
|
|
6
|
-
parentRef: React.RefObject<SVGSVGElement>;
|
|
5
|
+
parentRef: React.RefObject<SVGSVGElement | null>;
|
|
7
6
|
getTrackYPosOverride?: (trackId: string, level: number) => number;
|
|
8
|
-
}) =>
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
8
|
export default Breakends;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from 'react';
|
|
2
3
|
import { getSession } from '@jbrowse/core/util';
|
|
3
4
|
import { observer } from 'mobx-react';
|
|
4
5
|
import { getSnapshot } from 'mobx-state-tree';
|
|
@@ -6,7 +7,7 @@ import { findMatchingAlt, getMatchedBreakendFeatures } from './util';
|
|
|
6
7
|
import { getPxFromCoordinate, useNextFrame, yPos } from '../util';
|
|
7
8
|
const [LEFT] = [0, 1, 2, 3];
|
|
8
9
|
const Breakends = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
|
|
9
|
-
const { views } = model;
|
|
10
|
+
const { interactiveOverlay, views } = model;
|
|
10
11
|
const session = getSession(model);
|
|
11
12
|
const { assemblyManager } = session;
|
|
12
13
|
const totalFeatures = model.getTrackFeatures(trackId);
|
|
@@ -23,70 +24,70 @@ const Breakends = observer(function ({ model, trackId, parentRef: ref, getTrackY
|
|
|
23
24
|
const rect = ref.current.getBoundingClientRect();
|
|
24
25
|
yoff = rect.top;
|
|
25
26
|
}
|
|
26
|
-
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
return (_jsx("g", { stroke: "green", strokeWidth: 5, fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
|
|
28
|
+
const ret = [];
|
|
29
|
+
for (let i = 0; i < chunk.length - 1; i += 1) {
|
|
30
|
+
const { layout: c1, feature: f1, level: level1 } = chunk[i];
|
|
31
|
+
const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
|
|
32
|
+
const id = f1.id();
|
|
33
|
+
const relevantAlt = findMatchingAlt(f1, f2);
|
|
34
|
+
if (!c1 || !c2) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const f1origref = f1.get('refName');
|
|
38
|
+
const f2origref = f2.get('refName');
|
|
39
|
+
const f1ref = assembly.getCanonicalRefName(f1origref);
|
|
40
|
+
const f2ref = assembly.getCanonicalRefName(f2origref);
|
|
41
|
+
if (!f1ref || !f2ref) {
|
|
42
|
+
throw new Error(`unable to find ref for ${f1ref || f2ref}`);
|
|
43
|
+
}
|
|
44
|
+
const x1 = getPxFromCoordinate(views[level1], f1ref, c1[LEFT]);
|
|
45
|
+
const x2 = getPxFromCoordinate(views[level2], f2ref, c2[LEFT]);
|
|
46
|
+
const reversed1 = views[level1].pxToBp(x1).reversed;
|
|
47
|
+
const reversed2 = views[level2].pxToBp(x2).reversed;
|
|
48
|
+
const tracks = views.map(v => v.getTrack(trackId));
|
|
49
|
+
const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
|
|
50
|
+
yoff;
|
|
51
|
+
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
52
|
+
yoff;
|
|
53
|
+
if (!relevantAlt) {
|
|
54
|
+
console.warn('the relevant ALT allele was not found, cannot render');
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
const path = [
|
|
58
|
+
'M',
|
|
59
|
+
x1 -
|
|
60
|
+
20 *
|
|
61
|
+
(relevantAlt.Join === 'left' ? -1 : 1) *
|
|
62
|
+
(reversed1 ? -1 : 1),
|
|
63
|
+
y1,
|
|
64
|
+
'L',
|
|
65
|
+
x1,
|
|
66
|
+
y1,
|
|
67
|
+
'L',
|
|
68
|
+
x2,
|
|
69
|
+
y2,
|
|
70
|
+
'L',
|
|
71
|
+
x2 -
|
|
72
|
+
20 *
|
|
73
|
+
(relevantAlt.MateDirection === 'left' ? 1 : -1) *
|
|
74
|
+
(reversed2 ? -1 : 1),
|
|
75
|
+
y2,
|
|
76
|
+
].join(' ');
|
|
77
|
+
ret.push(_jsx("path", { d: path, "data-testid": "r2", pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
|
|
78
|
+
var _a, _b, _c;
|
|
79
|
+
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
|
|
80
|
+
featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
|
|
81
|
+
});
|
|
82
|
+
(_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
|
|
83
|
+
}, onMouseOver: () => {
|
|
84
|
+
setMouseoverElt(id);
|
|
85
|
+
}, onMouseOut: () => {
|
|
86
|
+
setMouseoverElt(undefined);
|
|
87
|
+
} }, JSON.stringify(path)));
|
|
88
|
+
}
|
|
35
89
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const f1ref = assembly.getCanonicalRefName(f1origref);
|
|
39
|
-
const f2ref = assembly.getCanonicalRefName(f2origref);
|
|
40
|
-
if (!f1ref || !f2ref) {
|
|
41
|
-
throw new Error(`unable to find ref for ${f1ref || f2ref}`);
|
|
42
|
-
}
|
|
43
|
-
const x1 = getPxFromCoordinate(views[level1], f1ref, c1[LEFT]);
|
|
44
|
-
const x2 = getPxFromCoordinate(views[level2], f2ref, c2[LEFT]);
|
|
45
|
-
const reversed1 = views[level1].pxToBp(x1).reversed;
|
|
46
|
-
const reversed2 = views[level2].pxToBp(x2).reversed;
|
|
47
|
-
const tracks = views.map(v => v.getTrack(trackId));
|
|
48
|
-
const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
|
|
49
|
-
yoff;
|
|
50
|
-
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
51
|
-
yoff;
|
|
52
|
-
if (!relevantAlt) {
|
|
53
|
-
console.warn('the relevant ALT allele was not found, cannot render');
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
const path = [
|
|
57
|
-
'M',
|
|
58
|
-
x1 -
|
|
59
|
-
20 *
|
|
60
|
-
(relevantAlt.Join === 'left' ? -1 : 1) *
|
|
61
|
-
(reversed1 ? -1 : 1),
|
|
62
|
-
y1,
|
|
63
|
-
'L',
|
|
64
|
-
x1,
|
|
65
|
-
y1,
|
|
66
|
-
'L',
|
|
67
|
-
x2,
|
|
68
|
-
y2,
|
|
69
|
-
'L',
|
|
70
|
-
x2 -
|
|
71
|
-
20 *
|
|
72
|
-
(relevantAlt.MateDirection === 'left' ? 1 : -1) *
|
|
73
|
-
(reversed2 ? -1 : 1),
|
|
74
|
-
y2,
|
|
75
|
-
].join(' ');
|
|
76
|
-
ret.push(React.createElement("path", { d: path, "data-testid": "r2", key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
|
|
77
|
-
var _a, _b, _c;
|
|
78
|
-
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
|
|
79
|
-
featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
|
|
80
|
-
});
|
|
81
|
-
(_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
|
|
82
|
-
}, onMouseOver: () => {
|
|
83
|
-
setMouseoverElt(id);
|
|
84
|
-
}, onMouseOut: () => {
|
|
85
|
-
setMouseoverElt(undefined);
|
|
86
|
-
} }));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return ret;
|
|
90
|
-
})));
|
|
90
|
+
return ret;
|
|
91
|
+
}) }));
|
|
91
92
|
});
|
|
92
93
|
export default Breakends;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { BreakpointViewModel } from '../model';
|
|
3
2
|
declare const BreakpointSplitView: ({ model, }: {
|
|
4
3
|
model: BreakpointViewModel;
|
|
5
|
-
}) =>
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export default BreakpointSplitView;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getEnv } from '@jbrowse/core/util';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { makeStyles } from 'tss-react/mui';
|
|
@@ -22,23 +22,19 @@ const BreakpointSplitViewLevels = observer(function ({ model, }) {
|
|
|
22
22
|
const { classes } = useStyles();
|
|
23
23
|
const { views } = model;
|
|
24
24
|
const { pluginManager } = getEnv(model);
|
|
25
|
-
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}))));
|
|
25
|
+
return (_jsx("div", { className: classes.content, children: _jsx("div", { className: classes.rel, children: views.map((view, idx) => {
|
|
26
|
+
const { ReactComponent } = pluginManager.getViewType(view.type);
|
|
27
|
+
const viewComponent = _jsx(ReactComponent, { model: view }, view.id);
|
|
28
|
+
return idx === views.length - 1
|
|
29
|
+
? viewComponent
|
|
30
|
+
: [
|
|
31
|
+
viewComponent,
|
|
32
|
+
_jsx("div", { className: classes.viewDivider }, `${view.id}-divider`),
|
|
33
|
+
];
|
|
34
|
+
}) }) }));
|
|
36
35
|
});
|
|
37
36
|
const BreakpointSplitView = observer(function ({ model, }) {
|
|
38
37
|
const { classes } = useStyles();
|
|
39
|
-
return (
|
|
40
|
-
React.createElement("div", { className: classes.container },
|
|
41
|
-
React.createElement(BreakpointSplitViewLevels, { model: model }),
|
|
42
|
-
React.createElement(BreakpointSplitViewOverlay, { model: model }))));
|
|
38
|
+
return (_jsx("div", { children: _jsxs("div", { className: classes.container, children: [_jsx(BreakpointSplitViewLevels, { model: model }), _jsx(BreakpointSplitViewOverlay, { model: model })] }) }));
|
|
43
39
|
});
|
|
44
40
|
export default BreakpointSplitView;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { BreakpointViewModel } from '../model';
|
|
3
2
|
declare const BreakpointSplitViewOverlay: ({ model, }: {
|
|
4
3
|
model: BreakpointViewModel;
|
|
5
|
-
}) =>
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export default BreakpointSplitViewOverlay;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from 'react';
|
|
2
3
|
import { observer } from 'mobx-react';
|
|
3
4
|
import { makeStyles } from 'tss-react/mui';
|
|
4
5
|
import Overlay from './Overlay';
|
|
@@ -12,16 +13,16 @@ const useStyles = makeStyles()({
|
|
|
12
13
|
fill: 'none',
|
|
13
14
|
},
|
|
14
15
|
},
|
|
16
|
+
base: {
|
|
17
|
+
pointerEvents: 'none',
|
|
18
|
+
width: '100%',
|
|
19
|
+
zIndex: 10,
|
|
20
|
+
},
|
|
15
21
|
});
|
|
16
22
|
const BreakpointSplitViewOverlay = observer(function ({ model, }) {
|
|
17
23
|
const { classes } = useStyles();
|
|
18
|
-
const { matchedTracks
|
|
24
|
+
const { matchedTracks } = model;
|
|
19
25
|
const ref = useRef(null);
|
|
20
|
-
return (
|
|
21
|
-
React.createElement("svg", { ref: ref, style: {
|
|
22
|
-
width: '100%',
|
|
23
|
-
zIndex: 10,
|
|
24
|
-
pointerEvents: interactToggled ? undefined : 'none',
|
|
25
|
-
} }, matchedTracks.map(track => (React.createElement(Overlay, { parentRef: ref, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId }))))));
|
|
26
|
+
return (_jsx("div", { className: classes.overlay, children: _jsx("svg", { ref: ref, className: classes.base, children: matchedTracks.map(track => (_jsx(Overlay, { parentRef: ref, model: model, trackId: track.configuration.trackId }, track.configuration.trackId))) }) }));
|
|
26
27
|
});
|
|
27
28
|
export default BreakpointSplitViewOverlay;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ExportSvgOptions } from '../model';
|
|
1
|
+
import type { ExportSvgOptions } from '../types';
|
|
3
2
|
export default function ExportSvgDialog({ model, handleClose, }: {
|
|
4
3
|
model: {
|
|
5
4
|
exportSvg(opts: ExportSvgOptions): Promise<void>;
|
|
6
5
|
};
|
|
7
6
|
handleClose: () => void;
|
|
8
|
-
}):
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
|
|
3
4
|
import { getSession, useLocalStorage } from '@jbrowse/core/util';
|
|
4
5
|
import { Button, Checkbox, CircularProgress, DialogActions, DialogContent, FormControlLabel, MenuItem, TextField, Typography, } from '@mui/material';
|
|
5
6
|
function LoadingMessage() {
|
|
6
|
-
return (
|
|
7
|
-
React.createElement(CircularProgress, { size: 20, style: { marginRight: 20 } }),
|
|
8
|
-
React.createElement(Typography, { display: "inline" }, "Creating SVG")));
|
|
7
|
+
return (_jsxs("div", { children: [_jsx(CircularProgress, { size: 20, style: { marginRight: 20 } }), _jsx(Typography, { display: "inline", children: "Creating SVG" })] }));
|
|
9
8
|
}
|
|
10
9
|
function TextField2({ children, ...rest }) {
|
|
11
|
-
return (
|
|
12
|
-
React.createElement(TextField, { ...rest }, children)));
|
|
10
|
+
return (_jsx("div", { children: _jsx(TextField, { ...rest, children: children }) }));
|
|
13
11
|
}
|
|
14
12
|
function useSvgLocal(key, val) {
|
|
15
13
|
return useLocalStorage(`svg-${key}`, val);
|
|
@@ -23,48 +21,34 @@ export default function ExportSvgDialog({ model, handleClose, }) {
|
|
|
23
21
|
const [filename, setFilename] = useSvgLocal('file', 'jbrowse.svg');
|
|
24
22
|
const [trackLabels, setTrackLabels] = useSvgLocal('tracklabels', 'offset');
|
|
25
23
|
const [themeName, setThemeName] = useSvgLocal('theme', session.themeName || 'default');
|
|
26
|
-
return (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
filename,
|
|
57
|
-
trackLabels,
|
|
58
|
-
themeName,
|
|
59
|
-
});
|
|
60
|
-
handleClose();
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
console.error(e);
|
|
64
|
-
setError(e);
|
|
65
|
-
}
|
|
66
|
-
finally {
|
|
67
|
-
setLoading(false);
|
|
68
|
-
}
|
|
69
|
-
} }, "Submit"))));
|
|
24
|
+
return (_jsxs(Dialog, { open: true, onClose: handleClose, title: "Export SVG", children: [_jsxs(DialogContent, { children: [error ? (_jsx(ErrorMessage, { error: error })) : loading ? (_jsx(LoadingMessage, {})) : null, _jsx(TextField2, { helperText: "filename", value: filename, onChange: event => {
|
|
25
|
+
setFilename(event.target.value);
|
|
26
|
+
} }), _jsxs(TextField2, { select: true, label: "Track label positioning", variant: "outlined", style: { width: 150 }, value: trackLabels, onChange: event => {
|
|
27
|
+
setTrackLabels(event.target.value);
|
|
28
|
+
}, children: [_jsx(MenuItem, { value: "offset", children: "Offset" }), _jsx(MenuItem, { value: "overlay", children: "Overlay" }), _jsx(MenuItem, { value: "left", children: "Left" }), _jsx(MenuItem, { value: "none", children: "None" })] }), _jsx("br", {}), session.allThemes ? (_jsx(TextField2, { select: true, label: "Theme", variant: "outlined", value: themeName, onChange: event => {
|
|
29
|
+
setThemeName(event.target.value);
|
|
30
|
+
}, children: Object.entries(session.allThemes()).map(([key, val]) => (_jsx(MenuItem, { value: key, children: val.name || '(Unknown name)' }, key))) })) : null, offscreenCanvas ? (_jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: rasterizeLayers, onChange: () => {
|
|
31
|
+
setRasterizeLayers(val => !val);
|
|
32
|
+
} }), label: "Rasterize canvas based tracks? File may be much larger if this is turned off" })) : (_jsx(Typography, { children: "Note: rasterizing layers not yet supported in this browser, so SVG size may be large" }))] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
33
|
+
handleClose();
|
|
34
|
+
}, children: "Cancel" }), _jsx(Button, { variant: "contained", color: "primary", type: "submit", onClick: async () => {
|
|
35
|
+
setLoading(true);
|
|
36
|
+
setError(undefined);
|
|
37
|
+
try {
|
|
38
|
+
await model.exportSvg({
|
|
39
|
+
rasterizeLayers,
|
|
40
|
+
filename,
|
|
41
|
+
trackLabels,
|
|
42
|
+
themeName,
|
|
43
|
+
});
|
|
44
|
+
handleClose();
|
|
45
|
+
}
|
|
46
|
+
catch (e) {
|
|
47
|
+
console.error(e);
|
|
48
|
+
setError(e);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
setLoading(false);
|
|
52
|
+
}
|
|
53
|
+
}, children: "Submit" })] })] }));
|
|
70
54
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { BreakpointViewModel } from '../model';
|
|
3
2
|
declare const Overlay: (props: {
|
|
4
|
-
parentRef: React.RefObject<SVGSVGElement>;
|
|
3
|
+
parentRef: React.RefObject<SVGSVGElement | null>;
|
|
5
4
|
model: BreakpointViewModel;
|
|
6
5
|
trackId: string;
|
|
7
6
|
getTrackYPosOverride?: (trackId: string, level: number) => number;
|
|
8
|
-
}) =>
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
8
|
export default Overlay;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
import AlignmentConnections from './AlignmentConnections';
|
|
4
4
|
import Breakends from './Breakends';
|
|
5
5
|
import PairedFeatures from './PairedFeatures';
|
|
6
6
|
import Translocations from './Translocations';
|
|
7
7
|
const Overlay = observer(function (props) {
|
|
8
|
-
var _a
|
|
8
|
+
var _a;
|
|
9
9
|
const { model, trackId } = props;
|
|
10
10
|
const tracks = model.getMatchedTracks(trackId);
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const type = (_a = tracks[0]) === null || _a === void 0 ? void 0 : _a.type;
|
|
12
|
+
if (type === 'AlignmentsTrack') {
|
|
13
|
+
return _jsx(AlignmentConnections, { ...props });
|
|
13
14
|
}
|
|
14
|
-
else if (
|
|
15
|
-
return model.hasTranslocations(trackId) ? (
|
|
15
|
+
else if (type === 'VariantTrack') {
|
|
16
|
+
return model.hasTranslocations(trackId) ? (_jsx(Translocations, { ...props })) : model.hasPairedFeatures(trackId) ? (_jsx(PairedFeatures, { ...props })) : (_jsx(Breakends, { ...props }));
|
|
16
17
|
}
|
|
17
18
|
else {
|
|
18
19
|
return null;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { BreakpointViewModel } from '../model';
|
|
3
2
|
declare const PairedFeatures: ({ model, trackId, parentRef: ref, getTrackYPosOverride, }: {
|
|
4
3
|
model: BreakpointViewModel;
|
|
5
4
|
trackId: string;
|
|
6
|
-
parentRef: React.RefObject<SVGSVGElement>;
|
|
5
|
+
parentRef: React.RefObject<SVGSVGElement | null>;
|
|
7
6
|
getTrackYPosOverride?: (trackId: string, level: number) => number;
|
|
8
|
-
}) =>
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
8
|
export default PairedFeatures;
|