@jbrowse/plugin-breakpoint-split-view 2.17.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 +6 -3
- package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +5 -11
- package/dist/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
- package/dist/BreakpointAlignmentsFeatureDetail/index.js +18 -8
- package/dist/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
- package/dist/BreakpointSplitView/BreakpointSplitView.js +41 -90
- package/dist/BreakpointSplitView/components/AlignmentConnections.d.ts +3 -4
- package/dist/BreakpointSplitView/components/AlignmentConnections.js +93 -124
- package/dist/BreakpointSplitView/components/Breakends.d.ts +3 -4
- package/dist/BreakpointSplitView/components/Breakends.js +67 -92
- package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +2 -3
- package/dist/BreakpointSplitView/components/BreakpointSplitView.js +13 -17
- package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +2 -3
- package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +10 -39
- package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
- package/dist/BreakpointSplitView/components/ExportSvgDialog.js +35 -76
- package/dist/BreakpointSplitView/components/Overlay.d.ts +3 -4
- package/dist/BreakpointSplitView/components/Overlay.js +8 -9
- package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +3 -4
- package/dist/BreakpointSplitView/components/PairedFeatures.js +47 -72
- package/dist/BreakpointSplitView/components/Translocations.d.ts +3 -4
- package/dist/BreakpointSplitView/components/Translocations.js +57 -86
- package/dist/BreakpointSplitView/components/getOrientationColor.js +0 -8
- package/dist/BreakpointSplitView/components/util.d.ts +1 -1
- package/dist/BreakpointSplitView/components/util.js +12 -12
- package/dist/BreakpointSplitView/index.d.ts +1 -1
- package/dist/BreakpointSplitView/index.js +19 -10
- package/dist/BreakpointSplitView/model.d.ts +23 -108
- package/dist/BreakpointSplitView/model.js +50 -153
- package/dist/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
- package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +3 -6
- package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
- package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +6 -30
- package/dist/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
- package/dist/BreakpointSplitView/svgcomponents/util.js +0 -1
- package/dist/BreakpointSplitView/types.d.ts +22 -0
- package/dist/BreakpointSplitView/types.js +2 -0
- package/dist/BreakpointSplitView/util.d.ts +12 -2
- package/dist/BreakpointSplitView/util.js +34 -8
- package/dist/index.d.ts +1 -1
- package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +6 -3
- package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +5 -8
- package/esm/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
- package/esm/BreakpointAlignmentsFeatureDetail/index.js +1 -1
- package/esm/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
- package/esm/BreakpointSplitView/BreakpointSplitView.js +41 -90
- package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +3 -4
- package/esm/BreakpointSplitView/components/AlignmentConnections.js +94 -102
- package/esm/BreakpointSplitView/components/Breakends.d.ts +3 -4
- package/esm/BreakpointSplitView/components/Breakends.js +68 -70
- package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +2 -3
- package/esm/BreakpointSplitView/components/BreakpointSplitView.js +13 -17
- package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +2 -3
- package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +10 -16
- package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
- package/esm/BreakpointSplitView/components/ExportSvgDialog.js +35 -53
- package/esm/BreakpointSplitView/components/Overlay.d.ts +3 -4
- package/esm/BreakpointSplitView/components/Overlay.js +8 -9
- package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +3 -4
- package/esm/BreakpointSplitView/components/PairedFeatures.js +48 -50
- package/esm/BreakpointSplitView/components/Translocations.d.ts +3 -4
- package/esm/BreakpointSplitView/components/Translocations.js +58 -64
- package/esm/BreakpointSplitView/components/getOrientationColor.js +0 -8
- package/esm/BreakpointSplitView/components/util.d.ts +1 -1
- package/esm/BreakpointSplitView/components/util.js +12 -12
- package/esm/BreakpointSplitView/index.d.ts +1 -1
- package/esm/BreakpointSplitView/index.js +2 -3
- package/esm/BreakpointSplitView/model.d.ts +23 -108
- package/esm/BreakpointSplitView/model.js +30 -142
- package/esm/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
- package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +3 -3
- package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
- package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +6 -30
- package/esm/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
- package/esm/BreakpointSplitView/svgcomponents/util.js +0 -1
- package/esm/BreakpointSplitView/types.d.ts +22 -0
- package/esm/BreakpointSplitView/types.js +1 -0
- package/esm/BreakpointSplitView/util.d.ts +12 -2
- package/esm/BreakpointSplitView/util.js +33 -10
- package/esm/index.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,20 +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
|
-
import Translocations from './Translocations';
|
|
6
5
|
import PairedFeatures from './PairedFeatures';
|
|
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
|
-
if (
|
|
13
|
-
return
|
|
11
|
+
const type = (_a = tracks[0]) === null || _a === void 0 ? void 0 : _a.type;
|
|
12
|
+
if (type === 'AlignmentsTrack') {
|
|
13
|
+
return _jsx(AlignmentConnections, { ...props });
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return model.hasTranslocations(trackId) ? (React.createElement(Translocations, { ...props })) : model.hasPairedFeatures(trackId) ? (React.createElement(PairedFeatures, { ...props })) : (React.createElement(Breakends, { ...props }));
|
|
15
|
+
else if (type === 'VariantTrack') {
|
|
16
|
+
return model.hasTranslocations(trackId) ? (_jsx(Translocations, { ...props })) : model.hasPairedFeatures(trackId) ? (_jsx(PairedFeatures, { ...props })) : (_jsx(Breakends, { ...props }));
|
|
18
17
|
}
|
|
19
18
|
else {
|
|
20
19
|
return null;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BreakpointViewModel } from '../model';
|
|
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;
|
|
@@ -1,13 +1,13 @@
|
|
|
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';
|
|
5
|
-
// locals
|
|
6
6
|
import { getMatchedPairedFeatures } from './util';
|
|
7
|
-
import {
|
|
7
|
+
import { getPxFromCoordinate, useNextFrame, yPos } from '../util';
|
|
8
8
|
const [LEFT] = [0, 1, 2, 3];
|
|
9
9
|
const PairedFeatures = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
|
|
10
|
-
const { views } = model;
|
|
10
|
+
const { interactiveOverlay, views } = model;
|
|
11
11
|
const session = getSession(model);
|
|
12
12
|
const { assemblyManager } = session;
|
|
13
13
|
const totalFeatures = model.getTrackFeatures(trackId);
|
|
@@ -24,52 +24,50 @@ const PairedFeatures = observer(function ({ model, trackId, parentRef: ref, getT
|
|
|
24
24
|
const rect = ref.current.getBoundingClientRect();
|
|
25
25
|
yoff = rect.top;
|
|
26
26
|
}
|
|
27
|
-
return (
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
if (!c1 || !c2) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const f1origref = f1.get('refName');
|
|
37
|
+
const f2origref = f2.get('refName');
|
|
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 tracks = views.map(v => v.getTrack(trackId));
|
|
46
|
+
const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
|
|
47
|
+
yoff;
|
|
48
|
+
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
49
|
+
yoff;
|
|
50
|
+
const path = [
|
|
51
|
+
'M',
|
|
52
|
+
x1,
|
|
53
|
+
y1,
|
|
54
|
+
'L',
|
|
55
|
+
x2,
|
|
56
|
+
y2,
|
|
57
|
+
].join(' ');
|
|
58
|
+
ret.push(_jsx("path", { d: path, "data-testid": "r2", pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
|
|
61
|
+
featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
|
|
62
|
+
});
|
|
63
|
+
(_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
|
|
64
|
+
}, onMouseOver: () => {
|
|
65
|
+
setMouseoverElt(id);
|
|
66
|
+
}, onMouseOut: () => {
|
|
67
|
+
setMouseoverElt(undefined);
|
|
68
|
+
} }, JSON.stringify(path)));
|
|
37
69
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const f1ref = assembly.getCanonicalRefName(f1origref);
|
|
41
|
-
const f2ref = assembly.getCanonicalRefName(f2origref);
|
|
42
|
-
if (!f1ref || !f2ref) {
|
|
43
|
-
throw new Error(`unable to find ref for ${f1ref || f2ref}`);
|
|
44
|
-
}
|
|
45
|
-
const x1 = getPxFromCoordinate(views[level1], f1ref, c1[LEFT]);
|
|
46
|
-
const x2 = getPxFromCoordinate(views[level2], f2ref, c2[LEFT]);
|
|
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
|
-
const path = [
|
|
53
|
-
'M', // move to
|
|
54
|
-
x1,
|
|
55
|
-
y1,
|
|
56
|
-
'L', // line to
|
|
57
|
-
x2,
|
|
58
|
-
y2,
|
|
59
|
-
].join(' ');
|
|
60
|
-
ret.push(React.createElement("path", { d: path, "data-testid": "r2", key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
|
|
61
|
-
var _a, _b, _c;
|
|
62
|
-
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
|
|
63
|
-
featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
|
|
64
|
-
});
|
|
65
|
-
(_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
|
|
66
|
-
}, onMouseOver: () => {
|
|
67
|
-
setMouseoverElt(id);
|
|
68
|
-
}, onMouseOut: () => {
|
|
69
|
-
setMouseoverElt(undefined);
|
|
70
|
-
} }));
|
|
71
|
-
}
|
|
72
|
-
return ret;
|
|
73
|
-
})));
|
|
70
|
+
return ret;
|
|
71
|
+
}) }));
|
|
74
72
|
});
|
|
75
73
|
export default PairedFeatures;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BreakpointViewModel } from '../model';
|
|
1
|
+
import type { BreakpointViewModel } from '../model';
|
|
3
2
|
declare const Translocations: ({ 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 Translocations;
|
|
@@ -1,10 +1,10 @@
|
|
|
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';
|
|
5
|
-
// locals
|
|
6
6
|
import { getMatchedTranslocationFeatures } from './util';
|
|
7
|
-
import {
|
|
7
|
+
import { getPxFromCoordinate, useNextFrame, yPos } from '../util';
|
|
8
8
|
const [LEFT] = [0, 1, 2, 3];
|
|
9
9
|
function str(s) {
|
|
10
10
|
if (s === '+') {
|
|
@@ -18,7 +18,7 @@ function str(s) {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
const Translocations = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
|
|
21
|
-
const { views } = model;
|
|
21
|
+
const { interactiveOverlay, views } = model;
|
|
22
22
|
const session = getSession(model);
|
|
23
23
|
const { assemblyManager } = session;
|
|
24
24
|
const totalFeatures = model.getTrackFeatures(trackId);
|
|
@@ -35,69 +35,63 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
|
|
|
35
35
|
const rect = ref.current.getBoundingClientRect();
|
|
36
36
|
yOffset = rect.top;
|
|
37
37
|
}
|
|
38
|
-
// we hardcode the TRA to go to the "other view" and if there is none, we
|
|
39
|
-
// just return null here note: would need to do processing of the INFO
|
|
40
|
-
// CHR2/END and see which view could contain those coordinates to really do
|
|
41
|
-
// it properly
|
|
42
38
|
if (views.length < 2) {
|
|
43
39
|
return null;
|
|
44
40
|
}
|
|
45
|
-
return (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
41
|
+
return (_jsx("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
const ret = [];
|
|
44
|
+
for (const { layout: c1, feature: f1, level: level1 } of chunk) {
|
|
45
|
+
const level2 = level1 === 0 ? 1 : 0;
|
|
46
|
+
const id = f1.id();
|
|
47
|
+
if (!c1) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const info = f1.get('INFO');
|
|
51
|
+
const chr2 = info.CHR2[0];
|
|
52
|
+
const end2 = info.END[0];
|
|
53
|
+
const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split('');
|
|
54
|
+
const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
|
|
55
|
+
const r = getPxFromCoordinate(views[level2], chr2, end2);
|
|
56
|
+
if (r) {
|
|
57
|
+
const c2 = [r, 0, r + 1, 0];
|
|
58
|
+
const x1 = getPxFromCoordinate(views[level1], f1.get('refName'), c1[LEFT]);
|
|
59
|
+
const x2 = r;
|
|
60
|
+
const reversed1 = views[level1].pxToBp(x1).reversed;
|
|
61
|
+
const reversed2 = views[level2].pxToBp(x2).reversed;
|
|
62
|
+
const tracks = views.map(v => v.getTrack(trackId));
|
|
63
|
+
const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
|
|
64
|
+
yOffset;
|
|
65
|
+
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
66
|
+
yOffset;
|
|
67
|
+
const path = [
|
|
68
|
+
'M',
|
|
69
|
+
x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
|
|
70
|
+
y1,
|
|
71
|
+
'L',
|
|
72
|
+
x1,
|
|
73
|
+
y1,
|
|
74
|
+
'L',
|
|
75
|
+
x2,
|
|
76
|
+
y2,
|
|
77
|
+
'L',
|
|
78
|
+
x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
|
|
79
|
+
y2,
|
|
80
|
+
].join(' ');
|
|
81
|
+
ret.push(_jsx("path", { d: path, pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
|
|
84
|
+
featureData: (totalFeatures.get(id) || { toJSON: () => { } }).toJSON(),
|
|
85
|
+
});
|
|
86
|
+
(_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
|
|
87
|
+
}, onMouseOver: () => {
|
|
88
|
+
setMouseoverElt(id);
|
|
89
|
+
}, onMouseOut: () => {
|
|
90
|
+
setMouseoverElt(undefined);
|
|
91
|
+
} }, JSON.stringify(path)));
|
|
92
|
+
}
|
|
55
93
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const end2 = info.END[0];
|
|
59
|
-
const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split(''); // not all files have STRANDS
|
|
60
|
-
const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
|
|
61
|
-
const r = getPxFromCoordinate(views[level2], chr2, end2);
|
|
62
|
-
if (r) {
|
|
63
|
-
const c2 = [r, 0, r + 1, 0];
|
|
64
|
-
const x1 = getPxFromCoordinate(views[level1], f1.get('refName'), c1[LEFT]);
|
|
65
|
-
const x2 = r;
|
|
66
|
-
const reversed1 = views[level1].pxToBp(x1).reversed;
|
|
67
|
-
const reversed2 = views[level2].pxToBp(x2).reversed;
|
|
68
|
-
const tracks = views.map(v => v.getTrack(trackId));
|
|
69
|
-
const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
|
|
70
|
-
yOffset;
|
|
71
|
-
const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
|
|
72
|
-
yOffset;
|
|
73
|
-
const path = [
|
|
74
|
-
'M', // move to
|
|
75
|
-
x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
|
|
76
|
-
y1,
|
|
77
|
-
'L', // line to
|
|
78
|
-
x1,
|
|
79
|
-
y1,
|
|
80
|
-
'L', // line to as const
|
|
81
|
-
x2,
|
|
82
|
-
y2,
|
|
83
|
-
'L', // line to
|
|
84
|
-
x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
|
|
85
|
-
y2,
|
|
86
|
-
].join(' ');
|
|
87
|
-
ret.push(React.createElement("path", { d: path, key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
|
|
88
|
-
var _a, _b;
|
|
89
|
-
const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
|
|
90
|
-
featureData: (totalFeatures.get(id) || { toJSON: () => { } }).toJSON(),
|
|
91
|
-
});
|
|
92
|
-
(_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
|
|
93
|
-
}, onMouseOver: () => {
|
|
94
|
-
setMouseoverElt(id);
|
|
95
|
-
}, onMouseOut: () => {
|
|
96
|
-
setMouseoverElt(undefined);
|
|
97
|
-
} }));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return ret;
|
|
101
|
-
})));
|
|
94
|
+
return ret;
|
|
95
|
+
}) }));
|
|
102
96
|
});
|
|
103
97
|
export default Translocations;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { alpha } from '@mui/material';
|
|
2
|
-
// orientation definitions from igv.js, see also
|
|
3
|
-
// https://software.broadinstitute.org/software/igv/interpreting_pair_orientations
|
|
4
2
|
export const orientationTypes = {
|
|
5
3
|
fr: {
|
|
6
4
|
F1R2: 'LR',
|
|
@@ -39,12 +37,6 @@ export const pairMap = {
|
|
|
39
37
|
RR: 'color_pair_rr',
|
|
40
38
|
RL: 'color_pair_rl',
|
|
41
39
|
};
|
|
42
|
-
// manually calculated by running
|
|
43
|
-
// const color = require('color')
|
|
44
|
-
// Object.fromEntries(Object.entries(fillColor).map(([key,val])=>{
|
|
45
|
-
// return [key, color(val).darken('0.3').hex()]
|
|
46
|
-
// }))
|
|
47
|
-
// this avoids (expensive) use of Color module at runtime
|
|
48
40
|
export const strokeColor = {
|
|
49
41
|
color_fwd_strand_not_proper: alpha('#CA6767', 0.8),
|
|
50
42
|
color_rev_strand_not_proper: alpha('#7272AA', 0.8),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Feature } from '@jbrowse/core/util';
|
|
1
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
2
2
|
export declare function getBadlyPairedAlignments(features: Map<string, Feature>): Feature[][];
|
|
3
3
|
export declare function getMatchedAlignmentFeatures(features: Map<string, Feature>): Feature[][];
|
|
4
4
|
export declare function hasPairedReads(features: Map<string, Feature>): boolean;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import { notEmpty } from '@jbrowse/core/util';
|
|
2
1
|
import { parseBreakend } from '@gmod/vcf';
|
|
3
|
-
|
|
4
|
-
// BAM/CRAM files
|
|
2
|
+
import { assembleLocStringFast, notEmpty } from '@jbrowse/core/util';
|
|
5
3
|
export function getBadlyPairedAlignments(features) {
|
|
6
4
|
const candidates = new Map();
|
|
7
5
|
const alreadySeen = new Set();
|
|
8
|
-
|
|
6
|
+
const alreadyPairedWithSamePosition = new Set();
|
|
9
7
|
for (const feature of features.values()) {
|
|
10
8
|
const flags = feature.get('flags');
|
|
11
9
|
const id = feature.id();
|
|
10
|
+
const supp = assembleLocStringFast({
|
|
11
|
+
refName: feature.get('refName'),
|
|
12
|
+
start: feature.get('start'),
|
|
13
|
+
end: feature.get('end'),
|
|
14
|
+
});
|
|
12
15
|
const unmapped = flags & 4;
|
|
13
16
|
const correctlyPaired = flags & 2;
|
|
14
|
-
if (!alreadySeen.has(id) &&
|
|
17
|
+
if (!alreadySeen.has(id) &&
|
|
18
|
+
!alreadyPairedWithSamePosition.has(supp) &&
|
|
19
|
+
!correctlyPaired &&
|
|
20
|
+
!unmapped) {
|
|
15
21
|
const n = feature.get('name');
|
|
16
22
|
let val = candidates.get(n);
|
|
17
23
|
if (!val) {
|
|
@@ -21,16 +27,14 @@ export function getBadlyPairedAlignments(features) {
|
|
|
21
27
|
val.push(feature);
|
|
22
28
|
}
|
|
23
29
|
alreadySeen.add(feature.id());
|
|
30
|
+
alreadyPairedWithSamePosition.add(supp);
|
|
24
31
|
}
|
|
25
32
|
return [...candidates.values()].filter(v => v.length > 1);
|
|
26
33
|
}
|
|
27
|
-
// this finds candidate alignment features, aimed at plotting split reads from
|
|
28
|
-
// BAM/CRAM files
|
|
29
34
|
export function getMatchedAlignmentFeatures(features) {
|
|
30
35
|
var _a;
|
|
31
36
|
const candidates = new Map();
|
|
32
37
|
const alreadySeen = new Set();
|
|
33
|
-
// this finds candidate features that share the same name
|
|
34
38
|
for (const feature of features.values()) {
|
|
35
39
|
const id = feature.id();
|
|
36
40
|
const unmapped = feature.get('flags') & 4;
|
|
@@ -66,8 +70,6 @@ export function findMatchingAlt(feat1, feat2) {
|
|
|
66
70
|
}
|
|
67
71
|
return undefined;
|
|
68
72
|
}
|
|
69
|
-
// Returns paired BND features across multiple views by inspecting the ALT
|
|
70
|
-
// field to get exact coordinate matches
|
|
71
73
|
export function getMatchedBreakendFeatures(feats) {
|
|
72
74
|
const candidates = new Map();
|
|
73
75
|
const alreadySeen = new Set();
|
|
@@ -92,7 +94,6 @@ export function getMatchedBreakendFeatures(feats) {
|
|
|
92
94
|
}
|
|
93
95
|
return [...candidates.values()].filter(v => v.length > 1);
|
|
94
96
|
}
|
|
95
|
-
// Getting "matched" TRA means just return all TRA
|
|
96
97
|
export function getMatchedTranslocationFeatures(feats) {
|
|
97
98
|
const ret = [];
|
|
98
99
|
const alreadySeen = new Set();
|
|
@@ -104,7 +105,6 @@ export function getMatchedTranslocationFeatures(feats) {
|
|
|
104
105
|
}
|
|
105
106
|
return ret;
|
|
106
107
|
}
|
|
107
|
-
// Getting "matched" TRA means just return all TRA
|
|
108
108
|
export function getMatchedPairedFeatures(feats) {
|
|
109
109
|
const candidates = new Map();
|
|
110
110
|
const alreadySeen = new Set();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BreakpointSplitViewF(pluginManager: PluginManager): void;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
|
-
|
|
3
|
-
import BreakpointSplitView from './BreakpointSplitView';
|
|
2
|
+
import { ViewType } from '@jbrowse/core/pluggableElementTypes';
|
|
4
3
|
import stateModelFactory from './model';
|
|
5
4
|
export default function BreakpointSplitViewF(pluginManager) {
|
|
6
5
|
pluginManager.addViewType(() => {
|
|
7
|
-
return new
|
|
6
|
+
return new ViewType({
|
|
8
7
|
name: 'BreakpointSplitView',
|
|
9
8
|
displayName: 'Breakpoint split view',
|
|
10
9
|
stateModel: stateModelFactory(pluginManager),
|