@jbrowse/sv-core 3.7.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{dist/BreakendMultiLevelOptionDialog.d.ts → esm/BreakpointSplitViewChoiceDialog.d.ts} +2 -2
- package/esm/BreakpointSplitViewChoiceDialog.js +83 -0
- package/esm/Checkbox2.js +1 -8
- package/esm/index.d.ts +4 -5
- package/esm/index.js +4 -5
- package/esm/navToMultiLevelBreak.d.ts +2 -2
- package/esm/navToMultiLevelBreak.js +11 -34
- package/esm/navToSingleLevelBreak.js +29 -22
- package/esm/util.d.ts +20 -1
- package/esm/util.js +25 -5
- package/package.json +25 -32
- package/dist/BreakendMultiLevelOptionDialog.js +0 -46
- package/dist/BreakendSingleLevelOptionDialog.d.ts +0 -11
- package/dist/BreakendSingleLevelOptionDialog.js +0 -53
- package/dist/Checkbox2.d.ts +0 -6
- package/dist/Checkbox2.js +0 -15
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -27
- package/dist/navToMultiLevelBreak.d.ts +0 -11
- package/dist/navToMultiLevelBreak.js +0 -77
- package/dist/navToSingleLevelBreak.d.ts +0 -61
- package/dist/navToSingleLevelBreak.js +0 -136
- package/dist/types.d.ts +0 -13
- package/dist/types.js +0 -2
- package/dist/util.d.ts +0 -18
- package/dist/util.js +0 -58
- package/esm/BreakendMultiLevelOptionDialog.d.ts +0 -11
- package/esm/BreakendMultiLevelOptionDialog.js +0 -41
- package/esm/BreakendSingleLevelOptionDialog.d.ts +0 -11
- package/esm/BreakendSingleLevelOptionDialog.js +0 -48
package/{dist/BreakendMultiLevelOptionDialog.d.ts → esm/BreakpointSplitViewChoiceDialog.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
|
|
2
2
|
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
declare const
|
|
3
|
+
declare const BreakpointSplitViewChoiceDialog: ({ session, handleClose, feature, assemblyName, stableViewId, view, }: {
|
|
4
4
|
session: AbstractSessionModel;
|
|
5
5
|
handleClose: () => void;
|
|
6
6
|
feature: Feature;
|
|
@@ -8,4 +8,4 @@ declare const BreakendMultiLevelOptionDialog: ({ session, handleClose, feature,
|
|
|
8
8
|
assemblyName: string;
|
|
9
9
|
stableViewId?: string;
|
|
10
10
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default
|
|
11
|
+
export default BreakpointSplitViewChoiceDialog;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
+
import { useLocalStorage } from '@jbrowse/core/util';
|
|
5
|
+
import { getSnapshot } from '@jbrowse/mobx-state-tree';
|
|
6
|
+
import { Button, DialogActions, DialogContent, List, ListItemButton, ListItemIcon, ListItemText, TextField, } from '@mui/material';
|
|
7
|
+
import { observer } from 'mobx-react';
|
|
8
|
+
import Checkbox2 from "./Checkbox2.js";
|
|
9
|
+
import { navToMultiLevelBreak } from "./navToMultiLevelBreak.js";
|
|
10
|
+
import { navToSingleLevelBreak } from "./navToSingleLevelBreak.js";
|
|
11
|
+
function SplitLevelIcon() {
|
|
12
|
+
return (_jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", children: [_jsx("rect", { x: "2", y: "3", width: "20", height: "8", rx: "1", fill: "currentColor" }), _jsx("rect", { x: "2", y: "13", width: "20", height: "8", rx: "1", fill: "currentColor" })] }));
|
|
13
|
+
}
|
|
14
|
+
function SingleLevelIcon() {
|
|
15
|
+
return (_jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", children: _jsx("rect", { x: "2", y: "8", width: "20", height: "8", rx: "1", fill: "currentColor" }) }));
|
|
16
|
+
}
|
|
17
|
+
const BreakpointSplitViewChoiceDialog = observer(function BreakpointSplitViewChoiceDialog({ session, handleClose, feature, assemblyName, stableViewId, view, }) {
|
|
18
|
+
const [step, setStep] = useState('choose');
|
|
19
|
+
const [viewType, setViewType] = useState('split');
|
|
20
|
+
const [copyTracks, setCopyTracks] = useState(true);
|
|
21
|
+
const [mirror, setMirror] = useState(true);
|
|
22
|
+
const [focusOnBreakends, setFocusOnBreakends] = useState(true);
|
|
23
|
+
const [windowSize, setWindowSize] = useLocalStorage('breakpointWindowSize', '5000');
|
|
24
|
+
const isSplitLevel = viewType === 'split';
|
|
25
|
+
const handleLaunch = () => {
|
|
26
|
+
;
|
|
27
|
+
(async () => {
|
|
28
|
+
try {
|
|
29
|
+
await (isSplitLevel
|
|
30
|
+
? navToMultiLevelBreak({
|
|
31
|
+
stableViewId: stableViewId
|
|
32
|
+
? `${stableViewId}_multilevel`
|
|
33
|
+
: undefined,
|
|
34
|
+
session,
|
|
35
|
+
tracks: copyTracks && view
|
|
36
|
+
? getSnapshot(view.tracks)
|
|
37
|
+
: [],
|
|
38
|
+
mirror,
|
|
39
|
+
feature,
|
|
40
|
+
assemblyName,
|
|
41
|
+
windowSize: +windowSize || 0,
|
|
42
|
+
})
|
|
43
|
+
: navToSingleLevelBreak({
|
|
44
|
+
feature,
|
|
45
|
+
assemblyName,
|
|
46
|
+
focusOnBreakends,
|
|
47
|
+
session,
|
|
48
|
+
stableViewId: stableViewId
|
|
49
|
+
? `${stableViewId}_singlelevel`
|
|
50
|
+
: undefined,
|
|
51
|
+
tracks: copyTracks ? view?.tracks : undefined,
|
|
52
|
+
windowSize: +windowSize || 0,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
catch (e) {
|
|
56
|
+
console.error(e);
|
|
57
|
+
session.notifyError(`${e}`, e);
|
|
58
|
+
}
|
|
59
|
+
})();
|
|
60
|
+
handleClose();
|
|
61
|
+
};
|
|
62
|
+
if (step === 'choose') {
|
|
63
|
+
return (_jsx(Dialog, { open: true, onClose: handleClose, title: "Open breakpoint split view", children: _jsx(DialogContent, { children: _jsxs(List, { children: [_jsxs(ListItemButton, { onClick: () => {
|
|
64
|
+
setViewType('split');
|
|
65
|
+
setStep('options');
|
|
66
|
+
}, children: [_jsx(ListItemIcon, { children: _jsx(SplitLevelIcon, {}) }), _jsx(ListItemText, { primary: "Split level (top/bottom)", secondary: "Opens two stacked linear genome views, one for each breakend" })] }), _jsxs(ListItemButton, { onClick: () => {
|
|
67
|
+
setViewType('single');
|
|
68
|
+
setStep('options');
|
|
69
|
+
}, children: [_jsx(ListItemIcon, { children: _jsx(SingleLevelIcon, {}) }), _jsx(ListItemText, { primary: "Single level (single row)", secondary: "Opens one linear genome view spanning both breakends" })] })] }) }) }));
|
|
70
|
+
}
|
|
71
|
+
return (_jsxs(Dialog, { open: true, onClose: handleClose, title: isSplitLevel ? 'Split level options' : 'Single level options', children: [_jsxs(DialogContent, { children: [view ? (_jsx(Checkbox2, { checked: copyTracks, label: "Copy tracks into the new view", onChange: event => {
|
|
72
|
+
setCopyTracks(event.target.checked);
|
|
73
|
+
} })) : null, isSplitLevel ? (view && copyTracks ? (_jsx(Checkbox2, { checked: mirror, label: "Mirror the copied tracks", onChange: event => {
|
|
74
|
+
setMirror(event.target.checked);
|
|
75
|
+
} })) : null) : (_jsx(Checkbox2, { checked: focusOnBreakends, label: "Focus on breakends", onChange: event => {
|
|
76
|
+
setFocusOnBreakends(event.target.checked);
|
|
77
|
+
} })), _jsx(TextField, { label: "Window size (bp)", value: windowSize, onChange: event => {
|
|
78
|
+
setWindowSize(event.target.value);
|
|
79
|
+
}, size: "small", style: { marginTop: 8, display: 'block' } })] }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: () => {
|
|
80
|
+
setStep('choose');
|
|
81
|
+
}, children: "Back" }), _jsx(Button, { variant: "contained", color: "primary", onClick: handleLaunch, children: "Open" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: handleClose, children: "Cancel" })] })] }));
|
|
82
|
+
});
|
|
83
|
+
export default BreakpointSplitViewChoiceDialog;
|
package/esm/Checkbox2.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Checkbox, FormControlLabel } from '@mui/material';
|
|
3
|
-
import { makeStyles } from 'tss-react/mui';
|
|
4
|
-
const useStyles = makeStyles()({
|
|
5
|
-
block: {
|
|
6
|
-
display: 'block',
|
|
7
|
-
},
|
|
8
|
-
});
|
|
9
3
|
export default function Checkbox2({ checked, disabled, label, onChange, }) {
|
|
10
|
-
|
|
11
|
-
return (_jsx(FormControlLabel, { disabled: disabled, className: classes.block, control: _jsx(Checkbox, { checked: checked, onChange: onChange }), label: label }));
|
|
4
|
+
return (_jsx(FormControlLabel, { disabled: disabled, style: { display: 'block' }, control: _jsx(Checkbox, { checked: checked, onChange: onChange }), label: label }));
|
|
12
5
|
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './navToMultiLevelBreak';
|
|
1
|
+
export { default as BreakpointSplitViewChoiceDialog } from './BreakpointSplitViewChoiceDialog.tsx';
|
|
2
|
+
export * from './util.ts';
|
|
3
|
+
export * from './navToSingleLevelBreak.ts';
|
|
4
|
+
export * from './navToMultiLevelBreak.ts';
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from './navToMultiLevelBreak';
|
|
1
|
+
export { default as BreakpointSplitViewChoiceDialog } from "./BreakpointSplitViewChoiceDialog.js";
|
|
2
|
+
export * from "./util.js";
|
|
3
|
+
export * from "./navToSingleLevelBreak.js";
|
|
4
|
+
export * from "./navToMultiLevelBreak.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Track } from './types';
|
|
1
|
+
import type { Track } from './types.ts';
|
|
2
2
|
import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
|
|
3
|
-
export declare function navToMultiLevelBreak({ stableViewId, feature, assemblyName, session, mirror, tracks: viewTracks, }: {
|
|
3
|
+
export declare function navToMultiLevelBreak({ stableViewId, feature, assemblyName, session, mirror, tracks: viewTracks, windowSize, }: {
|
|
4
4
|
stableViewId?: string;
|
|
5
5
|
feature: Feature;
|
|
6
6
|
assemblyName: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { when } from '@jbrowse/core/util';
|
|
2
|
-
import { getBreakendCoveringRegions, makeTitle, stripIds } from
|
|
3
|
-
export async function navToMultiLevelBreak({ stableViewId, feature, assemblyName, session, mirror, tracks: viewTracks = [], }) {
|
|
2
|
+
import { getBreakendCoveringRegions, makeTitle, splitRegionAtPosition, stripIds, } from "./util.js";
|
|
3
|
+
export async function navToMultiLevelBreak({ stableViewId, feature, assemblyName, session, mirror, tracks: viewTracks = [], windowSize = 0, }) {
|
|
4
4
|
const { assemblyManager } = session;
|
|
5
5
|
const assembly = await assemblyManager.waitForAssembly(assemblyName);
|
|
6
6
|
if (!assembly) {
|
|
@@ -37,38 +37,15 @@ export async function navToMultiLevelBreak({ stableViewId, feature, assemblyName
|
|
|
37
37
|
throw new Error("can't find regions");
|
|
38
38
|
}
|
|
39
39
|
await Promise.all([
|
|
40
|
-
view.views[0].navToLocations(
|
|
41
|
-
|
|
42
|
-
refName,
|
|
43
|
-
start: r1.start,
|
|
44
|
-
end: pos,
|
|
45
|
-
assemblyName,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
refName,
|
|
49
|
-
start: pos + 1,
|
|
50
|
-
end: r1.end,
|
|
51
|
-
assemblyName,
|
|
52
|
-
},
|
|
53
|
-
]),
|
|
54
|
-
view.views[1].navToLocations([
|
|
55
|
-
{
|
|
56
|
-
refName: mateRefName,
|
|
57
|
-
start: r2.start,
|
|
58
|
-
end: matePos,
|
|
59
|
-
assemblyName,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
refName: mateRefName,
|
|
63
|
-
start: matePos + 1,
|
|
64
|
-
end: r2.end,
|
|
65
|
-
assemblyName,
|
|
66
|
-
},
|
|
67
|
-
]),
|
|
40
|
+
view.views[0].navToLocations(splitRegionAtPosition(r1, pos, assemblyName)),
|
|
41
|
+
view.views[1].navToLocations(splitRegionAtPosition(r2, matePos, assemblyName)),
|
|
68
42
|
]);
|
|
69
43
|
await when(() => view.views[1].initialized && view.views[0].initialized);
|
|
70
|
-
view.views[
|
|
71
|
-
view.views[
|
|
72
|
-
|
|
73
|
-
|
|
44
|
+
const lgv0 = view.views[0];
|
|
45
|
+
const lgv1 = view.views[1];
|
|
46
|
+
const bpPerPx = windowSize > 0 ? (windowSize * 2) / lgv0.width : 10;
|
|
47
|
+
lgv0.zoomTo(bpPerPx);
|
|
48
|
+
lgv1.zoomTo(bpPerPx);
|
|
49
|
+
lgv0.centerAt(pos, refName);
|
|
50
|
+
lgv1.centerAt(matePos, mateRefName);
|
|
74
51
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { gatherOverlaps, getSession, when } from '@jbrowse/core/util';
|
|
2
|
-
import { getSnapshot } from 'mobx-state-tree';
|
|
3
|
-
import { getBreakendCoveringRegions, makeTitle, stripIds } from
|
|
2
|
+
import { getSnapshot } from '@jbrowse/mobx-state-tree';
|
|
3
|
+
import { getBreakendCoveringRegions, makeTitle, stripIds } from "./util.js";
|
|
4
4
|
export function singleLevelFocusedSnapshotFromBreakendFeature({ feature, session, assemblyName, windowSize = 0, }) {
|
|
5
5
|
const { assemblyManager } = session;
|
|
6
6
|
const assembly = assemblyManager.get(assemblyName);
|
|
@@ -27,7 +27,7 @@ export function singleLevelFocusedSnapshotFromBreakendFeature({ feature, session
|
|
|
27
27
|
displayedRegions: gatherOverlaps([
|
|
28
28
|
{
|
|
29
29
|
...topRegion,
|
|
30
|
-
end: coverage.pos + windowSize,
|
|
30
|
+
end: coverage.pos + 1 + windowSize,
|
|
31
31
|
assemblyName,
|
|
32
32
|
},
|
|
33
33
|
{
|
|
@@ -76,7 +76,6 @@ export function singleLevelEncompassingSnapshotFromBreakendFeature({ feature, se
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
export async function navToSingleLevelBreak({ stableViewId, feature, assemblyName, session, tracks, windowSize = 0, focusOnBreakends, }) {
|
|
79
|
-
var _a;
|
|
80
79
|
const { snap, coverage } = focusOnBreakends
|
|
81
80
|
? singleLevelFocusedSnapshotFromBreakendFeature({
|
|
82
81
|
feature,
|
|
@@ -103,29 +102,37 @@ export async function navToSingleLevelBreak({ stableViewId, feature, assemblyNam
|
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
104
|
else {
|
|
106
|
-
|
|
105
|
+
view.views[0]?.setDisplayedRegions(snap.views[0].displayedRegions);
|
|
107
106
|
view.setDisplayName(snap.displayName);
|
|
108
107
|
}
|
|
109
108
|
const lgv = view.views[0];
|
|
110
109
|
await when(() => lgv.initialized);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
refName
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
offset: l0.offsetPx,
|
|
123
|
-
}, {
|
|
124
|
-
...r0,
|
|
125
|
-
offset: r0.offsetPx,
|
|
126
|
-
});
|
|
110
|
+
if (focusOnBreakends) {
|
|
111
|
+
lgv.zoomTo(10);
|
|
112
|
+
const l0 = lgv.bpToPx({ coord: startPos, refName });
|
|
113
|
+
const r0 = lgv.bpToPx({ coord: endPos, refName: mateRefName });
|
|
114
|
+
if (l0 && r0) {
|
|
115
|
+
const midPx = (l0.offsetPx + r0.offsetPx) / 2;
|
|
116
|
+
lgv.scrollTo(Math.round(midPx - lgv.width / 2));
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
getSession(lgv).notify('Unable to navigate to breakpoint');
|
|
120
|
+
}
|
|
127
121
|
}
|
|
128
122
|
else {
|
|
129
|
-
|
|
123
|
+
const l0 = lgv.bpToPx({
|
|
124
|
+
coord: Math.max(0, startPos - windowSize),
|
|
125
|
+
refName,
|
|
126
|
+
});
|
|
127
|
+
const r0 = lgv.bpToPx({
|
|
128
|
+
coord: endPos + windowSize,
|
|
129
|
+
refName: mateRefName,
|
|
130
|
+
});
|
|
131
|
+
if (l0 && r0) {
|
|
132
|
+
lgv.moveTo({ ...l0, offset: l0.offsetPx }, { ...r0, offset: r0.offsetPx });
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
getSession(lgv).notify('Unable to navigate to breakpoint');
|
|
136
|
+
}
|
|
130
137
|
}
|
|
131
138
|
}
|
package/esm/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Track } from './types';
|
|
1
|
+
import type { Track } from './types.ts';
|
|
2
2
|
import type { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
3
3
|
import type { Feature } from '@jbrowse/core/util';
|
|
4
4
|
export declare function getBreakendCoveringRegions({ feature, assembly, }: {
|
|
@@ -16,3 +16,22 @@ export declare function stripIds(arr: Track[]): {
|
|
|
16
16
|
}[];
|
|
17
17
|
}[];
|
|
18
18
|
export declare function makeTitle(f: Feature): string;
|
|
19
|
+
export interface Region {
|
|
20
|
+
refName: string;
|
|
21
|
+
start: number;
|
|
22
|
+
end: number;
|
|
23
|
+
assemblyName?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ViewWithAssemblyNames {
|
|
26
|
+
assemblyNames: string[];
|
|
27
|
+
}
|
|
28
|
+
export declare function getAssemblyName(view?: ViewWithAssemblyNames): string | undefined;
|
|
29
|
+
export declare function splitRegionAtPosition<T extends {
|
|
30
|
+
refName: string;
|
|
31
|
+
start: number;
|
|
32
|
+
end: number;
|
|
33
|
+
}>(region: T, pos: number, assemblyName?: string): [T & {
|
|
34
|
+
assemblyName?: string;
|
|
35
|
+
}, T & {
|
|
36
|
+
assemblyName?: string;
|
|
37
|
+
}];
|
package/esm/util.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { parseBreakend } from '@gmod/vcf';
|
|
2
2
|
export function getBreakendCoveringRegions({ feature, assembly, }) {
|
|
3
|
-
|
|
4
|
-
const alt = (_a = feature.get('ALT')) === null || _a === void 0 ? void 0 : _a[0];
|
|
3
|
+
const alt = feature.get('ALT')?.[0];
|
|
5
4
|
const bnd = alt ? parseBreakend(alt) : undefined;
|
|
6
5
|
const startPos = feature.get('start');
|
|
7
6
|
const refName = feature.get('refName');
|
|
@@ -15,7 +14,7 @@ export function getBreakendCoveringRegions({ feature, assembly, }) {
|
|
|
15
14
|
matePos: INFO.END[0] - 1,
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
else if (bnd
|
|
17
|
+
else if (bnd?.MatePosition) {
|
|
19
18
|
const matePosition = bnd.MatePosition.split(':');
|
|
20
19
|
return {
|
|
21
20
|
pos: startPos,
|
|
@@ -26,11 +25,15 @@ export function getBreakendCoveringRegions({ feature, assembly, }) {
|
|
|
26
25
|
}
|
|
27
26
|
else if (feature.get('mate')) {
|
|
28
27
|
const mate = feature.get('mate');
|
|
28
|
+
const strand = feature.get('strand');
|
|
29
|
+
const mateStrand = mate.strand;
|
|
30
|
+
const pos = strand === 1 ? feature.get('end') : startPos;
|
|
31
|
+
const matePos = mateStrand === 1 ? mate.start : (mate.end ?? mate.start);
|
|
29
32
|
return {
|
|
30
|
-
pos
|
|
33
|
+
pos,
|
|
31
34
|
refName: f(refName),
|
|
32
35
|
mateRefName: f(mate.refName),
|
|
33
|
-
matePos
|
|
36
|
+
matePos,
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
else {
|
|
@@ -51,3 +54,20 @@ export function stripIds(arr) {
|
|
|
51
54
|
export function makeTitle(f) {
|
|
52
55
|
return `${f.get('name') || f.get('id') || 'breakend'} split detail`;
|
|
53
56
|
}
|
|
57
|
+
export function getAssemblyName(view) {
|
|
58
|
+
return view?.assemblyNames[0];
|
|
59
|
+
}
|
|
60
|
+
export function splitRegionAtPosition(region, pos, assemblyName) {
|
|
61
|
+
return [
|
|
62
|
+
{
|
|
63
|
+
...region,
|
|
64
|
+
end: pos + 1,
|
|
65
|
+
...(assemblyName !== undefined && { assemblyName }),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
...region,
|
|
69
|
+
start: pos,
|
|
70
|
+
...(assemblyName !== undefined && { assemblyName }),
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/sv-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "JBrowse 2 code shared between sv type code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -18,39 +18,18 @@
|
|
|
18
18
|
"directory": "packages/sv-core"
|
|
19
19
|
},
|
|
20
20
|
"author": "JBrowse Team",
|
|
21
|
-
"
|
|
22
|
-
"distModule": "esm/index.js",
|
|
23
|
-
"srcMain": "src/index.ts",
|
|
24
|
-
"srcModule": "src/index.ts",
|
|
25
|
-
"main": "dist/index.js",
|
|
26
|
-
"module": "esm/index.js",
|
|
21
|
+
"main": "esm/index.js",
|
|
27
22
|
"files": [
|
|
28
|
-
"dist",
|
|
29
23
|
"esm"
|
|
30
24
|
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"build:esm": "tsc --build tsconfig.build.esm.json",
|
|
33
|
-
"build:commonjs": "tsc --build tsconfig.build.commonjs.json",
|
|
34
|
-
"build": "npm run build:esm && npm run build:commonjs",
|
|
35
|
-
"test": "cd ../..; jest --passWithNoTests packages/sv-core",
|
|
36
|
-
"clean": "rimraf dist esm *.tsbuildinfo",
|
|
37
|
-
"prebuild": "yarn clean",
|
|
38
|
-
"prepack": "yarn build && yarn useDist",
|
|
39
|
-
"postpack": "yarn useSrc",
|
|
40
|
-
"useDist": "node ../../scripts/useDist.js",
|
|
41
|
-
"useSrc": "node ../../scripts/useSrc.js"
|
|
42
|
-
},
|
|
43
25
|
"dependencies": {
|
|
44
|
-
"@gmod/vcf": "^6.0
|
|
45
|
-
"@jbrowse/
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"mobx-state-tree": "^5.0.0",
|
|
52
|
-
"rxjs": "^7.0.0",
|
|
53
|
-
"tss-react": "^4.0.0"
|
|
26
|
+
"@gmod/vcf": "^6.1.0",
|
|
27
|
+
"@jbrowse/mobx-state-tree": "^5.5.0",
|
|
28
|
+
"@mui/material": "^7.3.6",
|
|
29
|
+
"mobx": "^6.15.0",
|
|
30
|
+
"mobx-react": "^9.2.1",
|
|
31
|
+
"@jbrowse/core": "^4.0.0",
|
|
32
|
+
"@jbrowse/plugin-linear-genome-view": "^4.0.0"
|
|
54
33
|
},
|
|
55
34
|
"peerDependencies": {
|
|
56
35
|
"react": ">=18.0.0",
|
|
@@ -59,5 +38,19 @@
|
|
|
59
38
|
"publishConfig": {
|
|
60
39
|
"access": "public"
|
|
61
40
|
},
|
|
62
|
-
"
|
|
63
|
-
|
|
41
|
+
"sideEffects": false,
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build:esm": "tsc -p tsconfig.build.esm.json",
|
|
44
|
+
"build": "pnpm build:esm",
|
|
45
|
+
"test": "cd ../..; jest --passWithNoTests packages/sv-core",
|
|
46
|
+
"clean": "rimraf esm *.tsbuildinfo",
|
|
47
|
+
"prebuild": "pnpm clean"
|
|
48
|
+
},
|
|
49
|
+
"types": "esm/index.d.ts",
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"types": "./esm/index.d.ts",
|
|
53
|
+
"import": "./esm/index.js"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -1,46 +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
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
9
|
-
const material_1 = require("@mui/material");
|
|
10
|
-
const mobx_react_1 = require("mobx-react");
|
|
11
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
12
|
-
const Checkbox2_1 = __importDefault(require("./Checkbox2"));
|
|
13
|
-
const navToMultiLevelBreak_1 = require("./navToMultiLevelBreak");
|
|
14
|
-
const BreakendMultiLevelOptionDialog = (0, mobx_react_1.observer)(function ({ session, handleClose, feature, assemblyName, stableViewId, view, }) {
|
|
15
|
-
const [copyTracks, setCopyTracks] = (0, react_1.useState)(true);
|
|
16
|
-
const [mirror, setMirror] = (0, react_1.useState)(true);
|
|
17
|
-
return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { open: true, onClose: handleClose, title: "Multi-level breakpoint split view options", children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [(0, jsx_runtime_1.jsx)("div", { children: "Launch multi-level breakpoint split view" }), view ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Checkbox2_1.default, { checked: copyTracks, label: "Copy tracks into the new view", onChange: event => {
|
|
18
|
-
setCopyTracks(event.target.checked);
|
|
19
|
-
} }), copyTracks ? ((0, jsx_runtime_1.jsx)(Checkbox2_1.default, { checked: mirror, disabled: !copyTracks, label: "Mirror the copied tracks (only available if copying tracks and using two level)", onChange: event => {
|
|
20
|
-
setMirror(event.target.checked);
|
|
21
|
-
} })) : null] })) : null] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => {
|
|
22
|
-
;
|
|
23
|
-
(async () => {
|
|
24
|
-
try {
|
|
25
|
-
await (0, navToMultiLevelBreak_1.navToMultiLevelBreak)({
|
|
26
|
-
stableViewId,
|
|
27
|
-
session,
|
|
28
|
-
tracks: copyTracks && view
|
|
29
|
-
? (0, mobx_state_tree_1.getSnapshot)(view.tracks)
|
|
30
|
-
: [],
|
|
31
|
-
mirror,
|
|
32
|
-
feature,
|
|
33
|
-
assemblyName,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
catch (e) {
|
|
37
|
-
console.error(e);
|
|
38
|
-
session.notifyError(`${e}`, e);
|
|
39
|
-
}
|
|
40
|
-
})();
|
|
41
|
-
handleClose();
|
|
42
|
-
}, variant: "contained", color: "primary", autoFocus: true, children: "OK" }), (0, jsx_runtime_1.jsx)(material_1.Button, { color: "secondary", variant: "contained", onClick: () => {
|
|
43
|
-
handleClose();
|
|
44
|
-
}, children: "Cancel" })] })] }));
|
|
45
|
-
});
|
|
46
|
-
exports.default = BreakendMultiLevelOptionDialog;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
|
|
2
|
-
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
declare const BreakendSingleLevelOptionDialog: ({ session, handleClose, feature, stableViewId, assemblyName, view, }: {
|
|
4
|
-
session: AbstractSessionModel;
|
|
5
|
-
handleClose: () => void;
|
|
6
|
-
stableViewId?: string;
|
|
7
|
-
feature: Feature;
|
|
8
|
-
view?: LinearGenomeViewModel;
|
|
9
|
-
assemblyName: string;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default BreakendSingleLevelOptionDialog;
|
|
@@ -1,53 +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
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
-
const react_1 = require("react");
|
|
8
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
9
|
-
const util_1 = require("@jbrowse/core/util");
|
|
10
|
-
const material_1 = require("@mui/material");
|
|
11
|
-
const mobx_react_1 = require("mobx-react");
|
|
12
|
-
const Checkbox2_1 = __importDefault(require("./Checkbox2"));
|
|
13
|
-
const navToSingleLevelBreak_1 = require("./navToSingleLevelBreak");
|
|
14
|
-
const BreakendSingleLevelOptionDialog = (0, mobx_react_1.observer)(function ({ session, handleClose, feature, stableViewId, assemblyName, view, }) {
|
|
15
|
-
const [copyTracks, setCopyTracks] = (0, react_1.useState)(true);
|
|
16
|
-
const [focusOnBreakends, setFocusOnBreakends] = (0, react_1.useState)(true);
|
|
17
|
-
const [windowSize, setWindowSize] = (0, util_1.useLocalStorage)('breakpointWindowSize', '5000');
|
|
18
|
-
return ((0, jsx_runtime_1.jsxs)(ui_1.Dialog, { open: true, onClose: handleClose, title: "Single-level breakpoint split view options", children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [view ? ((0, jsx_runtime_1.jsx)(Checkbox2_1.default, { checked: copyTracks, label: "Copy tracks into the new view", onChange: event => {
|
|
19
|
-
setCopyTracks(event.target.checked);
|
|
20
|
-
} })) : null, (0, jsx_runtime_1.jsx)(Checkbox2_1.default, { checked: copyTracks, label: "Focus on breakends", onChange: event => {
|
|
21
|
-
setFocusOnBreakends(event.target.checked);
|
|
22
|
-
} }), (0, jsx_runtime_1.jsx)(material_1.TextField, { label: "Window size (bp)", value: windowSize, onChange: event => {
|
|
23
|
-
setWindowSize(event.target.value);
|
|
24
|
-
} })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => {
|
|
25
|
-
;
|
|
26
|
-
(async () => {
|
|
27
|
-
try {
|
|
28
|
-
const { assemblyManager } = session;
|
|
29
|
-
const assembly = await assemblyManager.waitForAssembly(assemblyName);
|
|
30
|
-
if (!assembly) {
|
|
31
|
-
throw new Error(`assembly ${assemblyName} not found`);
|
|
32
|
-
}
|
|
33
|
-
await (0, navToSingleLevelBreak_1.navToSingleLevelBreak)({
|
|
34
|
-
feature,
|
|
35
|
-
assemblyName,
|
|
36
|
-
focusOnBreakends,
|
|
37
|
-
session,
|
|
38
|
-
stableViewId,
|
|
39
|
-
tracks: view === null || view === void 0 ? void 0 : view.tracks,
|
|
40
|
-
windowSize: +windowSize || 0,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
catch (e) {
|
|
44
|
-
console.error(e);
|
|
45
|
-
session.notifyError(`${e}`, e);
|
|
46
|
-
}
|
|
47
|
-
})();
|
|
48
|
-
handleClose();
|
|
49
|
-
}, variant: "contained", color: "primary", autoFocus: true, children: "OK" }), (0, jsx_runtime_1.jsx)(material_1.Button, { color: "secondary", variant: "contained", onClick: () => {
|
|
50
|
-
handleClose();
|
|
51
|
-
}, children: "Cancel" })] })] }));
|
|
52
|
-
});
|
|
53
|
-
exports.default = BreakendSingleLevelOptionDialog;
|
package/dist/Checkbox2.d.ts
DELETED
package/dist/Checkbox2.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = Checkbox2;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const material_1 = require("@mui/material");
|
|
6
|
-
const mui_1 = require("tss-react/mui");
|
|
7
|
-
const useStyles = (0, mui_1.makeStyles)()({
|
|
8
|
-
block: {
|
|
9
|
-
display: 'block',
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
function Checkbox2({ checked, disabled, label, onChange, }) {
|
|
13
|
-
const { classes } = useStyles();
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { disabled: disabled, className: classes.block, control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: checked, onChange: onChange }), label: label }));
|
|
15
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { default as BreakendMultiLevelOptionDialog } from './BreakendMultiLevelOptionDialog';
|
|
2
|
-
export { default as BreakendSingleLevelOptionDialog } from './BreakendSingleLevelOptionDialog';
|
|
3
|
-
export * from './util';
|
|
4
|
-
export * from './navToSingleLevelBreak';
|
|
5
|
-
export * from './navToMultiLevelBreak';
|
package/dist/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.BreakendSingleLevelOptionDialog = exports.BreakendMultiLevelOptionDialog = void 0;
|
|
21
|
-
var BreakendMultiLevelOptionDialog_1 = require("./BreakendMultiLevelOptionDialog");
|
|
22
|
-
Object.defineProperty(exports, "BreakendMultiLevelOptionDialog", { enumerable: true, get: function () { return __importDefault(BreakendMultiLevelOptionDialog_1).default; } });
|
|
23
|
-
var BreakendSingleLevelOptionDialog_1 = require("./BreakendSingleLevelOptionDialog");
|
|
24
|
-
Object.defineProperty(exports, "BreakendSingleLevelOptionDialog", { enumerable: true, get: function () { return __importDefault(BreakendSingleLevelOptionDialog_1).default; } });
|
|
25
|
-
__exportStar(require("./util"), exports);
|
|
26
|
-
__exportStar(require("./navToSingleLevelBreak"), exports);
|
|
27
|
-
__exportStar(require("./navToMultiLevelBreak"), exports);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Track } from './types';
|
|
2
|
-
import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
|
|
3
|
-
export declare function navToMultiLevelBreak({ stableViewId, feature, assemblyName, session, mirror, tracks: viewTracks, }: {
|
|
4
|
-
stableViewId?: string;
|
|
5
|
-
feature: Feature;
|
|
6
|
-
assemblyName: string;
|
|
7
|
-
windowSize?: number;
|
|
8
|
-
session: AbstractSessionModel;
|
|
9
|
-
mirror?: boolean;
|
|
10
|
-
tracks?: Track[];
|
|
11
|
-
}): Promise<void>;
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.navToMultiLevelBreak = navToMultiLevelBreak;
|
|
4
|
-
const util_1 = require("@jbrowse/core/util");
|
|
5
|
-
const util_2 = require("./util");
|
|
6
|
-
async function navToMultiLevelBreak({ stableViewId, feature, assemblyName, session, mirror, tracks: viewTracks = [], }) {
|
|
7
|
-
const { assemblyManager } = session;
|
|
8
|
-
const assembly = await assemblyManager.waitForAssembly(assemblyName);
|
|
9
|
-
if (!assembly) {
|
|
10
|
-
throw new Error(`assembly ${assemblyName} not found`);
|
|
11
|
-
}
|
|
12
|
-
const { refName, pos, mateRefName, matePos } = (0, util_2.getBreakendCoveringRegions)({
|
|
13
|
-
feature,
|
|
14
|
-
assembly: assembly,
|
|
15
|
-
});
|
|
16
|
-
let view = session.views.find(f => f.id === stableViewId);
|
|
17
|
-
if (!view) {
|
|
18
|
-
view = session.addView('BreakpointSplitView', {
|
|
19
|
-
id: stableViewId,
|
|
20
|
-
type: 'BreakpointSplitView',
|
|
21
|
-
displayName: (0, util_2.makeTitle)(feature),
|
|
22
|
-
views: [
|
|
23
|
-
{
|
|
24
|
-
type: 'LinearGenomeView',
|
|
25
|
-
hideHeader: true,
|
|
26
|
-
tracks: (0, util_2.stripIds)(viewTracks),
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
type: 'LinearGenomeView',
|
|
30
|
-
hideHeader: true,
|
|
31
|
-
tracks: (0, util_2.stripIds)(mirror ? [...viewTracks].reverse() : viewTracks),
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
view.setDisplayName((0, util_2.makeTitle)(feature));
|
|
37
|
-
const r1 = assembly.regions.find(r => r.refName === refName);
|
|
38
|
-
const r2 = assembly.regions.find(r => r.refName === mateRefName);
|
|
39
|
-
if (!r1 || !r2) {
|
|
40
|
-
throw new Error("can't find regions");
|
|
41
|
-
}
|
|
42
|
-
await Promise.all([
|
|
43
|
-
view.views[0].navToLocations([
|
|
44
|
-
{
|
|
45
|
-
refName,
|
|
46
|
-
start: r1.start,
|
|
47
|
-
end: pos,
|
|
48
|
-
assemblyName,
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
refName,
|
|
52
|
-
start: pos + 1,
|
|
53
|
-
end: r1.end,
|
|
54
|
-
assemblyName,
|
|
55
|
-
},
|
|
56
|
-
]),
|
|
57
|
-
view.views[1].navToLocations([
|
|
58
|
-
{
|
|
59
|
-
refName: mateRefName,
|
|
60
|
-
start: r2.start,
|
|
61
|
-
end: matePos,
|
|
62
|
-
assemblyName,
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
refName: mateRefName,
|
|
66
|
-
start: matePos + 1,
|
|
67
|
-
end: r2.end,
|
|
68
|
-
assemblyName,
|
|
69
|
-
},
|
|
70
|
-
]),
|
|
71
|
-
]);
|
|
72
|
-
await (0, util_1.when)(() => view.views[1].initialized && view.views[0].initialized);
|
|
73
|
-
view.views[1].zoomTo(10);
|
|
74
|
-
view.views[0].zoomTo(10);
|
|
75
|
-
view.views[1].centerAt(matePos, mateRefName);
|
|
76
|
-
view.views[0].centerAt(pos, refName);
|
|
77
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
|
|
2
|
-
export declare function singleLevelFocusedSnapshotFromBreakendFeature({ feature, session, assemblyName, windowSize, }: {
|
|
3
|
-
feature: Feature;
|
|
4
|
-
session: AbstractSessionModel;
|
|
5
|
-
assemblyName: string;
|
|
6
|
-
windowSize?: number;
|
|
7
|
-
}): {
|
|
8
|
-
coverage: {
|
|
9
|
-
pos: number;
|
|
10
|
-
refName: string;
|
|
11
|
-
mateRefName: string;
|
|
12
|
-
matePos: any;
|
|
13
|
-
};
|
|
14
|
-
snap: {
|
|
15
|
-
type: string;
|
|
16
|
-
views: {
|
|
17
|
-
type: string;
|
|
18
|
-
displayedRegions: {
|
|
19
|
-
end: number;
|
|
20
|
-
assemblyName: string;
|
|
21
|
-
start: number;
|
|
22
|
-
refName: string;
|
|
23
|
-
}[];
|
|
24
|
-
}[];
|
|
25
|
-
displayName: string;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export declare function singleLevelEncompassingSnapshotFromBreakendFeature({ feature, session, assemblyName, }: {
|
|
29
|
-
feature: Feature;
|
|
30
|
-
session: AbstractSessionModel;
|
|
31
|
-
assemblyName: string;
|
|
32
|
-
}): {
|
|
33
|
-
coverage: {
|
|
34
|
-
pos: number;
|
|
35
|
-
refName: string;
|
|
36
|
-
mateRefName: string;
|
|
37
|
-
matePos: any;
|
|
38
|
-
};
|
|
39
|
-
snap: {
|
|
40
|
-
type: string;
|
|
41
|
-
views: {
|
|
42
|
-
type: string;
|
|
43
|
-
displayedRegions: {
|
|
44
|
-
assemblyName: string;
|
|
45
|
-
start: number;
|
|
46
|
-
end: number;
|
|
47
|
-
refName: string;
|
|
48
|
-
}[];
|
|
49
|
-
}[];
|
|
50
|
-
displayName: string;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
export declare function navToSingleLevelBreak({ stableViewId, feature, assemblyName, session, tracks, windowSize, focusOnBreakends, }: {
|
|
54
|
-
stableViewId?: string;
|
|
55
|
-
feature: Feature;
|
|
56
|
-
assemblyName: string;
|
|
57
|
-
windowSize?: number;
|
|
58
|
-
session: AbstractSessionModel;
|
|
59
|
-
tracks?: any;
|
|
60
|
-
focusOnBreakends?: boolean;
|
|
61
|
-
}): Promise<void>;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.singleLevelFocusedSnapshotFromBreakendFeature = singleLevelFocusedSnapshotFromBreakendFeature;
|
|
4
|
-
exports.singleLevelEncompassingSnapshotFromBreakendFeature = singleLevelEncompassingSnapshotFromBreakendFeature;
|
|
5
|
-
exports.navToSingleLevelBreak = navToSingleLevelBreak;
|
|
6
|
-
const util_1 = require("@jbrowse/core/util");
|
|
7
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
8
|
-
const util_2 = require("./util");
|
|
9
|
-
function singleLevelFocusedSnapshotFromBreakendFeature({ feature, session, assemblyName, windowSize = 0, }) {
|
|
10
|
-
const { assemblyManager } = session;
|
|
11
|
-
const assembly = assemblyManager.get(assemblyName);
|
|
12
|
-
if (!assembly) {
|
|
13
|
-
throw new Error(`assembly ${assemblyName} not found`);
|
|
14
|
-
}
|
|
15
|
-
if (!assembly.regions) {
|
|
16
|
-
throw new Error(`assembly ${assemblyName} regions not loaded`);
|
|
17
|
-
}
|
|
18
|
-
const coverage = (0, util_2.getBreakendCoveringRegions)({
|
|
19
|
-
feature,
|
|
20
|
-
assembly,
|
|
21
|
-
});
|
|
22
|
-
const { refName, mateRefName } = coverage;
|
|
23
|
-
const topRegion = assembly.regions.find(f => f.refName === refName);
|
|
24
|
-
const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
|
|
25
|
-
return {
|
|
26
|
-
coverage,
|
|
27
|
-
snap: {
|
|
28
|
-
type: 'BreakpointSplitView',
|
|
29
|
-
views: [
|
|
30
|
-
{
|
|
31
|
-
type: 'LinearGenomeView',
|
|
32
|
-
displayedRegions: (0, util_1.gatherOverlaps)([
|
|
33
|
-
{
|
|
34
|
-
...topRegion,
|
|
35
|
-
end: coverage.pos + windowSize,
|
|
36
|
-
assemblyName,
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
...bottomRegion,
|
|
40
|
-
start: coverage.matePos - windowSize,
|
|
41
|
-
assemblyName,
|
|
42
|
-
},
|
|
43
|
-
]),
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
displayName: (0, util_2.makeTitle)(feature),
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function singleLevelEncompassingSnapshotFromBreakendFeature({ feature, session, assemblyName, }) {
|
|
51
|
-
const { assemblyManager } = session;
|
|
52
|
-
const assembly = assemblyManager.get(assemblyName);
|
|
53
|
-
if (!assembly) {
|
|
54
|
-
throw new Error(`assembly ${assemblyName} not found`);
|
|
55
|
-
}
|
|
56
|
-
if (!assembly.regions) {
|
|
57
|
-
throw new Error(`assembly ${assemblyName} regions not loaded`);
|
|
58
|
-
}
|
|
59
|
-
const coverage = (0, util_2.getBreakendCoveringRegions)({
|
|
60
|
-
feature,
|
|
61
|
-
assembly,
|
|
62
|
-
});
|
|
63
|
-
const { refName, mateRefName } = coverage;
|
|
64
|
-
const topRegion = assembly.regions.find(f => f.refName === refName);
|
|
65
|
-
const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
|
|
66
|
-
return {
|
|
67
|
-
coverage,
|
|
68
|
-
snap: {
|
|
69
|
-
type: 'BreakpointSplitView',
|
|
70
|
-
views: [
|
|
71
|
-
{
|
|
72
|
-
type: 'LinearGenomeView',
|
|
73
|
-
displayedRegions: (0, util_1.gatherOverlaps)([
|
|
74
|
-
{ ...topRegion, assemblyName },
|
|
75
|
-
{ ...bottomRegion, assemblyName },
|
|
76
|
-
]),
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
displayName: (0, util_2.makeTitle)(feature),
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
async function navToSingleLevelBreak({ stableViewId, feature, assemblyName, session, tracks, windowSize = 0, focusOnBreakends, }) {
|
|
84
|
-
var _a;
|
|
85
|
-
const { snap, coverage } = focusOnBreakends
|
|
86
|
-
? singleLevelFocusedSnapshotFromBreakendFeature({
|
|
87
|
-
feature,
|
|
88
|
-
assemblyName,
|
|
89
|
-
session,
|
|
90
|
-
windowSize,
|
|
91
|
-
})
|
|
92
|
-
: singleLevelEncompassingSnapshotFromBreakendFeature({
|
|
93
|
-
feature,
|
|
94
|
-
assemblyName,
|
|
95
|
-
session,
|
|
96
|
-
});
|
|
97
|
-
const { refName, pos: startPos, mateRefName, matePos: endPos } = coverage;
|
|
98
|
-
let view = session.views.find(f => f.id === stableViewId);
|
|
99
|
-
if (!view) {
|
|
100
|
-
view = session.addView('BreakpointSplitView', {
|
|
101
|
-
...snap,
|
|
102
|
-
views: [
|
|
103
|
-
{
|
|
104
|
-
...snap.views[0],
|
|
105
|
-
tracks: tracks ? (0, util_2.stripIds)((0, mobx_state_tree_1.getSnapshot)(tracks)) : [],
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
(_a = view.views[0]) === null || _a === void 0 ? void 0 : _a.setDisplayedRegions(snap.views[0].displayedRegions);
|
|
112
|
-
view.setDisplayName(snap.displayName);
|
|
113
|
-
}
|
|
114
|
-
const lgv = view.views[0];
|
|
115
|
-
await (0, util_1.when)(() => lgv.initialized);
|
|
116
|
-
const l0 = lgv.bpToPx({
|
|
117
|
-
coord: Math.max(0, startPos - windowSize),
|
|
118
|
-
refName,
|
|
119
|
-
});
|
|
120
|
-
const r0 = lgv.bpToPx({
|
|
121
|
-
coord: endPos + windowSize,
|
|
122
|
-
refName: mateRefName,
|
|
123
|
-
});
|
|
124
|
-
if (l0 && r0) {
|
|
125
|
-
lgv.moveTo({
|
|
126
|
-
...l0,
|
|
127
|
-
offset: l0.offsetPx,
|
|
128
|
-
}, {
|
|
129
|
-
...r0,
|
|
130
|
-
offset: r0.offsetPx,
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
(0, util_1.getSession)(lgv).notify('Unable to navigate to breakpoint');
|
|
135
|
-
}
|
|
136
|
-
}
|
package/dist/types.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
2
|
-
export interface Display {
|
|
3
|
-
id: string;
|
|
4
|
-
[key: string]: unknown;
|
|
5
|
-
}
|
|
6
|
-
export interface Track {
|
|
7
|
-
id: string;
|
|
8
|
-
displays: Display[];
|
|
9
|
-
[key: string]: unknown;
|
|
10
|
-
}
|
|
11
|
-
export interface BreakpointSplitView {
|
|
12
|
-
views: LinearGenomeViewModel[];
|
|
13
|
-
}
|
package/dist/types.js
DELETED
package/dist/util.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Track } from './types';
|
|
2
|
-
import type { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
3
|
-
import type { Feature } from '@jbrowse/core/util';
|
|
4
|
-
export declare function getBreakendCoveringRegions({ feature, assembly, }: {
|
|
5
|
-
feature: Feature;
|
|
6
|
-
assembly: Assembly;
|
|
7
|
-
}): {
|
|
8
|
-
pos: number;
|
|
9
|
-
refName: string;
|
|
10
|
-
mateRefName: string;
|
|
11
|
-
matePos: any;
|
|
12
|
-
};
|
|
13
|
-
export declare function stripIds(arr: Track[]): {
|
|
14
|
-
displays: {
|
|
15
|
-
[key: string]: unknown;
|
|
16
|
-
}[];
|
|
17
|
-
}[];
|
|
18
|
-
export declare function makeTitle(f: Feature): string;
|
package/dist/util.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getBreakendCoveringRegions = getBreakendCoveringRegions;
|
|
4
|
-
exports.stripIds = stripIds;
|
|
5
|
-
exports.makeTitle = makeTitle;
|
|
6
|
-
const vcf_1 = require("@gmod/vcf");
|
|
7
|
-
function getBreakendCoveringRegions({ feature, assembly, }) {
|
|
8
|
-
var _a;
|
|
9
|
-
const alt = (_a = feature.get('ALT')) === null || _a === void 0 ? void 0 : _a[0];
|
|
10
|
-
const bnd = alt ? (0, vcf_1.parseBreakend)(alt) : undefined;
|
|
11
|
-
const startPos = feature.get('start');
|
|
12
|
-
const refName = feature.get('refName');
|
|
13
|
-
const f = (ref) => assembly.getCanonicalRefName(ref) || ref;
|
|
14
|
-
if (alt === '<TRA>') {
|
|
15
|
-
const INFO = feature.get('INFO');
|
|
16
|
-
return {
|
|
17
|
-
pos: startPos,
|
|
18
|
-
refName: f(refName),
|
|
19
|
-
mateRefName: f(INFO.CHR2[0]),
|
|
20
|
-
matePos: INFO.END[0] - 1,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
else if (bnd === null || bnd === void 0 ? void 0 : bnd.MatePosition) {
|
|
24
|
-
const matePosition = bnd.MatePosition.split(':');
|
|
25
|
-
return {
|
|
26
|
-
pos: startPos,
|
|
27
|
-
refName: f(refName),
|
|
28
|
-
mateRefName: f(matePosition[0]),
|
|
29
|
-
matePos: +matePosition[1] - 1,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
else if (feature.get('mate')) {
|
|
33
|
-
const mate = feature.get('mate');
|
|
34
|
-
return {
|
|
35
|
-
pos: startPos,
|
|
36
|
-
refName: f(refName),
|
|
37
|
-
mateRefName: f(mate.refName),
|
|
38
|
-
matePos: mate.start,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return {
|
|
43
|
-
pos: startPos,
|
|
44
|
-
refName: f(refName),
|
|
45
|
-
mateRefName: f(refName),
|
|
46
|
-
matePos: feature.get('end'),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function stripIds(arr) {
|
|
51
|
-
return arr.map(({ id, displays, ...rest }) => ({
|
|
52
|
-
...rest,
|
|
53
|
-
displays: displays.map(({ id, ...rest }) => rest),
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
function makeTitle(f) {
|
|
57
|
-
return `${f.get('name') || f.get('id') || 'breakend'} split detail`;
|
|
58
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
|
|
2
|
-
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
declare const BreakendMultiLevelOptionDialog: ({ session, handleClose, feature, assemblyName, stableViewId, view, }: {
|
|
4
|
-
session: AbstractSessionModel;
|
|
5
|
-
handleClose: () => void;
|
|
6
|
-
feature: Feature;
|
|
7
|
-
view?: LinearGenomeViewModel;
|
|
8
|
-
assemblyName: string;
|
|
9
|
-
stableViewId?: string;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default BreakendMultiLevelOptionDialog;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
-
import { Button, DialogActions, DialogContent } from '@mui/material';
|
|
5
|
-
import { observer } from 'mobx-react';
|
|
6
|
-
import { getSnapshot } from 'mobx-state-tree';
|
|
7
|
-
import Checkbox2 from './Checkbox2';
|
|
8
|
-
import { navToMultiLevelBreak } from './navToMultiLevelBreak';
|
|
9
|
-
const BreakendMultiLevelOptionDialog = observer(function ({ session, handleClose, feature, assemblyName, stableViewId, view, }) {
|
|
10
|
-
const [copyTracks, setCopyTracks] = useState(true);
|
|
11
|
-
const [mirror, setMirror] = useState(true);
|
|
12
|
-
return (_jsxs(Dialog, { open: true, onClose: handleClose, title: "Multi-level breakpoint split view options", children: [_jsxs(DialogContent, { children: [_jsx("div", { children: "Launch multi-level breakpoint split view" }), view ? (_jsxs(_Fragment, { children: [_jsx(Checkbox2, { checked: copyTracks, label: "Copy tracks into the new view", onChange: event => {
|
|
13
|
-
setCopyTracks(event.target.checked);
|
|
14
|
-
} }), copyTracks ? (_jsx(Checkbox2, { checked: mirror, disabled: !copyTracks, label: "Mirror the copied tracks (only available if copying tracks and using two level)", onChange: event => {
|
|
15
|
-
setMirror(event.target.checked);
|
|
16
|
-
} })) : null] })) : null] }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: () => {
|
|
17
|
-
;
|
|
18
|
-
(async () => {
|
|
19
|
-
try {
|
|
20
|
-
await navToMultiLevelBreak({
|
|
21
|
-
stableViewId,
|
|
22
|
-
session,
|
|
23
|
-
tracks: copyTracks && view
|
|
24
|
-
? getSnapshot(view.tracks)
|
|
25
|
-
: [],
|
|
26
|
-
mirror,
|
|
27
|
-
feature,
|
|
28
|
-
assemblyName,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
console.error(e);
|
|
33
|
-
session.notifyError(`${e}`, e);
|
|
34
|
-
}
|
|
35
|
-
})();
|
|
36
|
-
handleClose();
|
|
37
|
-
}, variant: "contained", color: "primary", autoFocus: true, children: "OK" }), _jsx(Button, { color: "secondary", variant: "contained", onClick: () => {
|
|
38
|
-
handleClose();
|
|
39
|
-
}, children: "Cancel" })] })] }));
|
|
40
|
-
});
|
|
41
|
-
export default BreakendMultiLevelOptionDialog;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AbstractSessionModel, Feature } from '@jbrowse/core/util';
|
|
2
|
-
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
declare const BreakendSingleLevelOptionDialog: ({ session, handleClose, feature, stableViewId, assemblyName, view, }: {
|
|
4
|
-
session: AbstractSessionModel;
|
|
5
|
-
handleClose: () => void;
|
|
6
|
-
stableViewId?: string;
|
|
7
|
-
feature: Feature;
|
|
8
|
-
view?: LinearGenomeViewModel;
|
|
9
|
-
assemblyName: string;
|
|
10
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export default BreakendSingleLevelOptionDialog;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { Dialog } from '@jbrowse/core/ui';
|
|
4
|
-
import { useLocalStorage } from '@jbrowse/core/util';
|
|
5
|
-
import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
|
|
6
|
-
import { observer } from 'mobx-react';
|
|
7
|
-
import Checkbox2 from './Checkbox2';
|
|
8
|
-
import { navToSingleLevelBreak } from './navToSingleLevelBreak';
|
|
9
|
-
const BreakendSingleLevelOptionDialog = observer(function ({ session, handleClose, feature, stableViewId, assemblyName, view, }) {
|
|
10
|
-
const [copyTracks, setCopyTracks] = useState(true);
|
|
11
|
-
const [focusOnBreakends, setFocusOnBreakends] = useState(true);
|
|
12
|
-
const [windowSize, setWindowSize] = useLocalStorage('breakpointWindowSize', '5000');
|
|
13
|
-
return (_jsxs(Dialog, { open: true, onClose: handleClose, title: "Single-level breakpoint split view options", children: [_jsxs(DialogContent, { children: [view ? (_jsx(Checkbox2, { checked: copyTracks, label: "Copy tracks into the new view", onChange: event => {
|
|
14
|
-
setCopyTracks(event.target.checked);
|
|
15
|
-
} })) : null, _jsx(Checkbox2, { checked: copyTracks, label: "Focus on breakends", onChange: event => {
|
|
16
|
-
setFocusOnBreakends(event.target.checked);
|
|
17
|
-
} }), _jsx(TextField, { label: "Window size (bp)", value: windowSize, onChange: event => {
|
|
18
|
-
setWindowSize(event.target.value);
|
|
19
|
-
} })] }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: () => {
|
|
20
|
-
;
|
|
21
|
-
(async () => {
|
|
22
|
-
try {
|
|
23
|
-
const { assemblyManager } = session;
|
|
24
|
-
const assembly = await assemblyManager.waitForAssembly(assemblyName);
|
|
25
|
-
if (!assembly) {
|
|
26
|
-
throw new Error(`assembly ${assemblyName} not found`);
|
|
27
|
-
}
|
|
28
|
-
await navToSingleLevelBreak({
|
|
29
|
-
feature,
|
|
30
|
-
assemblyName,
|
|
31
|
-
focusOnBreakends,
|
|
32
|
-
session,
|
|
33
|
-
stableViewId,
|
|
34
|
-
tracks: view === null || view === void 0 ? void 0 : view.tracks,
|
|
35
|
-
windowSize: +windowSize || 0,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
console.error(e);
|
|
40
|
-
session.notifyError(`${e}`, e);
|
|
41
|
-
}
|
|
42
|
-
})();
|
|
43
|
-
handleClose();
|
|
44
|
-
}, variant: "contained", color: "primary", autoFocus: true, children: "OK" }), _jsx(Button, { color: "secondary", variant: "contained", onClick: () => {
|
|
45
|
-
handleClose();
|
|
46
|
-
}, children: "Cancel" })] })] }));
|
|
47
|
-
});
|
|
48
|
-
export default BreakendSingleLevelOptionDialog;
|