@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
|
@@ -4,22 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.renderToSvg = renderToSvg;
|
|
7
|
-
const
|
|
8
|
-
const mobx_1 = require("mobx");
|
|
9
|
-
const util_1 = require("@jbrowse/core/util");
|
|
10
|
-
const material_1 = require("@mui/material");
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
8
|
const ui_1 = require("@jbrowse/core/ui");
|
|
12
|
-
const
|
|
9
|
+
const util_1 = require("@jbrowse/core/util");
|
|
13
10
|
const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
|
|
14
|
-
|
|
11
|
+
const material_1 = require("@mui/material");
|
|
12
|
+
const mobx_1 = require("mobx");
|
|
15
13
|
const SVGBackground_1 = __importDefault(require("./SVGBackground"));
|
|
16
|
-
const Overlay_1 = __importDefault(require("../components/Overlay"));
|
|
17
14
|
const util_2 = require("./util");
|
|
18
|
-
|
|
15
|
+
const Overlay_1 = __importDefault(require("../components/Overlay"));
|
|
19
16
|
async function renderToSvg(model, opts) {
|
|
20
17
|
var _a;
|
|
21
18
|
const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => children, themeName = 'default', } = opts;
|
|
22
|
-
const { createRootFn } = (0, mobx_state_tree_1.getRoot)(model);
|
|
23
19
|
const session = (0, util_1.getSession)(model);
|
|
24
20
|
const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
|
|
25
21
|
const { width, views } = model;
|
|
@@ -41,25 +37,5 @@ async function renderToSvg(model, opts) {
|
|
|
41
37
|
const trackOffsets = views.map((view, idx) => (0, util_2.getTrackOffsets)(view, textOffset, fontSize + (idx > 0 ? heights[idx - 1] : 0) + offset));
|
|
42
38
|
const w = width + trackLabelOffset;
|
|
43
39
|
const t = (0, ui_1.createJBrowseTheme)(theme);
|
|
44
|
-
|
|
45
|
-
return (0, util_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: t },
|
|
46
|
-
react_1.default.createElement(Wrapper, null,
|
|
47
|
-
react_1.default.createElement("svg", { width: width, height: totalHeightSvg, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w + shift * 2, totalHeightSvg].toString() },
|
|
48
|
-
react_1.default.createElement(SVGBackground_1.default, { width: w, height: totalHeightSvg, shift: shift }),
|
|
49
|
-
views[0] ? (react_1.default.createElement("g", { transform: `translate(${shift} ${fontSize})` },
|
|
50
|
-
react_1.default.createElement("g", { transform: `translate(${trackLabelOffset})` },
|
|
51
|
-
react_1.default.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[0].assemblyNames.join(', ')),
|
|
52
|
-
react_1.default.createElement(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[0].view, fontSize: fontSize })),
|
|
53
|
-
react_1.default.createElement("g", { transform: `translate(0 ${offset})` },
|
|
54
|
-
react_1.default.createElement(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset })))) : null,
|
|
55
|
-
views[1] ? (react_1.default.createElement("g", { transform: `translate(${shift} ${fontSize + heights[0]})` },
|
|
56
|
-
react_1.default.createElement("g", { transform: `translate(${trackLabelOffset})` },
|
|
57
|
-
react_1.default.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[1].assemblyNames.join(', ')),
|
|
58
|
-
react_1.default.createElement(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[1].view, fontSize: fontSize })),
|
|
59
|
-
react_1.default.createElement("g", { transform: `translate(0 ${offset})` },
|
|
60
|
-
react_1.default.createElement(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset })))) : null,
|
|
61
|
-
react_1.default.createElement("defs", null,
|
|
62
|
-
react_1.default.createElement("clipPath", { id: "clip-bsv" },
|
|
63
|
-
react_1.default.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
|
|
64
|
-
react_1.default.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (react_1.default.createElement(Overlay_1.default, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))), createRootFn);
|
|
40
|
+
return (0, util_1.renderToStaticMarkup)((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: t, children: (0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.jsxs)("svg", { width: width, height: totalHeightSvg, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w + shift * 2, totalHeightSvg].toString(), children: [(0, jsx_runtime_1.jsx)(SVGBackground_1.default, { width: w, height: totalHeightSvg, shift: shift }), views[0] ? ((0, jsx_runtime_1.jsxs)("g", { transform: `translate(${shift} ${fontSize})`, children: [(0, jsx_runtime_1.jsxs)("g", { transform: `translate(${trackLabelOffset})`, children: [(0, jsx_runtime_1.jsx)("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[0].assemblyNames.join(', ') }), (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[0].view, fontSize: fontSize })] }), (0, jsx_runtime_1.jsx)("g", { transform: `translate(0 ${offset})`, children: (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset }) })] })) : null, views[1] ? ((0, jsx_runtime_1.jsxs)("g", { transform: `translate(${shift} ${fontSize + heights[0]})`, children: [(0, jsx_runtime_1.jsxs)("g", { transform: `translate(${trackLabelOffset})`, children: [(0, jsx_runtime_1.jsx)("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[1].assemblyNames.join(', ') }), (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[1].view, fontSize: fontSize })] }), (0, jsx_runtime_1.jsx)("g", { transform: `translate(0 ${offset})`, children: (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset }) })] })) : null, (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: "clip-bsv", children: (0, jsx_runtime_1.jsx)("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }) }) }), (0, jsx_runtime_1.jsx)("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)", children: model.matchedTracks.map(track => ((0, jsx_runtime_1.jsx)(Overlay_1.default, { parentRef: { current: null }, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }, track.configuration.trackId))) })] }) }) }));
|
|
65
41
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
-
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
1
|
+
import type { AbstractSessionModel } from '@jbrowse/core/util';
|
|
2
|
+
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
3
|
export declare function getTrackNameMaxLen(views: LinearGenomeViewModel[], fontSize: number, session: AbstractSessionModel): number;
|
|
4
4
|
export declare function getTrackOffsets(view: LinearGenomeViewModel, textOffset: number, extra?: number): Record<string, number>;
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getTrackNameMaxLen = getTrackNameMaxLen;
|
|
4
4
|
exports.getTrackOffsets = getTrackOffsets;
|
|
5
5
|
const util_1 = require("@jbrowse/core/util");
|
|
6
|
-
// locals
|
|
7
6
|
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
8
7
|
function getTrackNameMaxLen(views, fontSize, session) {
|
|
9
8
|
return (0, util_1.max)(views.flatMap(view => view.tracks.map(t => (0, util_1.measureText)((0, tracks_1.getTrackName)(t.configuration, session), fontSize))), 0);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ExportSvgOptions {
|
|
2
|
+
rasterizeLayers?: boolean;
|
|
3
|
+
filename?: string;
|
|
4
|
+
Wrapper?: React.FC<{
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
fontSize?: number;
|
|
8
|
+
rulerHeight?: number;
|
|
9
|
+
textHeight?: number;
|
|
10
|
+
paddingHeight?: number;
|
|
11
|
+
headerHeight?: number;
|
|
12
|
+
cytobandHeight?: number;
|
|
13
|
+
trackLabels?: string;
|
|
14
|
+
themeName?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Breakend {
|
|
17
|
+
MateDirection: string;
|
|
18
|
+
Join: string;
|
|
19
|
+
Replacement: string;
|
|
20
|
+
MatePosition: string;
|
|
21
|
+
}
|
|
22
|
+
export type LayoutRecord = [number, number, number, number];
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { LayoutRecord } from './types';
|
|
2
|
+
import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
|
|
3
|
+
import type { Feature } from '@jbrowse/core/util';
|
|
4
|
+
import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
|
|
3
5
|
type LGV = LinearGenomeViewModel;
|
|
4
6
|
interface Display {
|
|
5
7
|
height: number;
|
|
@@ -7,6 +9,7 @@ interface Display {
|
|
|
7
9
|
SNPCoverageDisplay?: {
|
|
8
10
|
height: number;
|
|
9
11
|
};
|
|
12
|
+
searchFeatureByID?: (str: string) => LayoutRecord;
|
|
10
13
|
}
|
|
11
14
|
interface Track {
|
|
12
15
|
displays: Display[];
|
|
@@ -16,4 +19,11 @@ export declare function getPxFromCoordinate(view: LGV, refName: string, coord: n
|
|
|
16
19
|
export declare function yPos(trackId: string, level: number, views: LGV[], tracks: Track[], c: LayoutRecord, getYPosOverride?: (trackId: string, level: number) => number): number;
|
|
17
20
|
export declare const useNextFrame: (variable: unknown) => void;
|
|
18
21
|
export declare function intersect<T>(cb: (l: T) => string, a1?: T[], a2?: T[], ...rest: T[][]): T[];
|
|
22
|
+
export declare function getClip(cigar: string, strand: number): number;
|
|
23
|
+
export declare function calc(track: Track, f: Feature): LayoutRecord | undefined;
|
|
24
|
+
export declare function getBlockFeatures(model: {
|
|
25
|
+
views: LinearGenomeViewModel[];
|
|
26
|
+
}, track: {
|
|
27
|
+
configuration: AnyConfigurationModel;
|
|
28
|
+
}): Promise<Feature[][] | undefined>;
|
|
19
29
|
export {};
|
|
@@ -5,7 +5,11 @@ exports.heightFromSpecificLevel = heightFromSpecificLevel;
|
|
|
5
5
|
exports.getPxFromCoordinate = getPxFromCoordinate;
|
|
6
6
|
exports.yPos = yPos;
|
|
7
7
|
exports.intersect = intersect;
|
|
8
|
+
exports.getClip = getClip;
|
|
9
|
+
exports.calc = calc;
|
|
10
|
+
exports.getBlockFeatures = getBlockFeatures;
|
|
8
11
|
const react_1 = require("react");
|
|
12
|
+
const configuration_1 = require("@jbrowse/core/configuration");
|
|
9
13
|
const util_1 = require("@jbrowse/core/util");
|
|
10
14
|
const [, TOP, , BOTTOM] = [0, 1, 2, 3];
|
|
11
15
|
function cheight(chunk) {
|
|
@@ -21,7 +25,6 @@ function getPxFromCoordinate(view, refName, coord) {
|
|
|
21
25
|
var _a;
|
|
22
26
|
return (((_a = view.bpToPx({ refName, coord })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - view.offsetPx;
|
|
23
27
|
}
|
|
24
|
-
// get's the yposition of a layout record in a track
|
|
25
28
|
function yPos(trackId, level, views, tracks, c, getYPosOverride) {
|
|
26
29
|
const display = tracks[level].displays[0];
|
|
27
30
|
const min = 0;
|
|
@@ -36,10 +39,6 @@ function yPos(trackId, level, views, tracks, c, getYPosOverride) {
|
|
|
36
39
|
heightFromSpecificLevel(views, trackId, level, getYPosOverride) +
|
|
37
40
|
display.scrollTop);
|
|
38
41
|
}
|
|
39
|
-
// we combo a useEffect and useState combo to force rerender on snap changing.
|
|
40
|
-
// the setup of this being a useEffect+useState makes it re-render once the
|
|
41
|
-
// useEffect is called, which is generally the "next frame". If we removed the
|
|
42
|
-
// below use
|
|
43
42
|
const useNextFrame = (variable) => {
|
|
44
43
|
const [, setNextFrameState] = (0, react_1.useState)();
|
|
45
44
|
(0, react_1.useEffect)(() => {
|
|
@@ -47,11 +46,38 @@ const useNextFrame = (variable) => {
|
|
|
47
46
|
}, [variable]);
|
|
48
47
|
};
|
|
49
48
|
exports.useNextFrame = useNextFrame;
|
|
50
|
-
// https://stackoverflow.com/a/49186706/2129219 the array-intersection package
|
|
51
|
-
// on npm has a large kb size, and we are just intersecting open track ids so
|
|
52
|
-
// simple is better
|
|
53
49
|
function intersect(cb, a1 = [], a2 = [], ...rest) {
|
|
54
50
|
const ids = new Set(a2.map(elt => cb(elt)));
|
|
55
51
|
const a12 = a1.filter(value => ids.has(cb(value)));
|
|
56
52
|
return rest.length === 0 ? a12 : intersect(cb, a12, ...rest);
|
|
57
53
|
}
|
|
54
|
+
const startClip = new RegExp(/(\d+)[SH]$/);
|
|
55
|
+
const endClip = new RegExp(/^(\d+)([SH])/);
|
|
56
|
+
function getClip(cigar, strand) {
|
|
57
|
+
return strand === -1
|
|
58
|
+
? +(startClip.exec(cigar) || [])[1] || 0
|
|
59
|
+
: +(endClip.exec(cigar) || [])[1] || 0;
|
|
60
|
+
}
|
|
61
|
+
function calc(track, f) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
|
|
64
|
+
}
|
|
65
|
+
async function getBlockFeatures(model, track) {
|
|
66
|
+
var _a;
|
|
67
|
+
const { views } = model;
|
|
68
|
+
const { rpcManager, assemblyManager } = (0, util_1.getSession)(model);
|
|
69
|
+
const assemblyName = (_a = model.views[0]) === null || _a === void 0 ? void 0 : _a.assemblyNames[0];
|
|
70
|
+
if (!assemblyName) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const assembly = await assemblyManager.waitForAssembly(assemblyName);
|
|
74
|
+
if (!assembly) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const sessionId = track.configuration.trackId;
|
|
78
|
+
return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
|
|
79
|
+
adapterConfig: (0, configuration_1.getConf)(track, ['adapter']),
|
|
80
|
+
sessionId,
|
|
81
|
+
regions: view.staticBlocks.contentBlocks,
|
|
82
|
+
})).flat()));
|
|
83
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
2
1
|
import Plugin from '@jbrowse/core/Plugin';
|
|
2
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
3
3
|
export default class BreakpointSplitViewPlugin extends Plugin {
|
|
4
4
|
name: string;
|
|
5
5
|
install(pluginManager: PluginManager): void;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { SimpleFeatureSerialized } from '@jbrowse/core/util';
|
|
2
2
|
declare const BreakpointAlignmentsFeatureDetail: ({ model, }: {
|
|
3
3
|
model: {
|
|
4
|
-
featureData:
|
|
4
|
+
featureData: {
|
|
5
|
+
feature1: SimpleFeatureSerialized;
|
|
6
|
+
feature2: SimpleFeatureSerialized;
|
|
7
|
+
};
|
|
5
8
|
};
|
|
6
|
-
}) =>
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
export default BreakpointAlignmentsFeatureDetail;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseAttributes, BaseCoreDetails, } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
|
|
2
3
|
import { Paper } from '@mui/material';
|
|
3
4
|
import { observer } from 'mobx-react';
|
|
4
|
-
import { BaseCoreDetails, BaseAttributes, } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
|
|
5
5
|
const BreakpointAlignmentsFeatureDetail = observer(function ({ model, }) {
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
React.createElement(BaseCoreDetails, { title: "Feature 2", feature: feature2 }),
|
|
10
|
-
React.createElement(BaseAttributes, { title: "Feature 1 attributes", feature: feature1 }),
|
|
11
|
-
React.createElement(BaseAttributes, { title: "Feature 2 attributes", feature: feature2 })));
|
|
6
|
+
const { featureData } = model;
|
|
7
|
+
const { feature1, feature2 } = structuredClone(featureData);
|
|
8
|
+
return (_jsxs(Paper, { children: [_jsx(BaseCoreDetails, { title: "Feature 1", feature: feature1 }), _jsx(BaseCoreDetails, { title: "Feature 2", feature: feature2 }), _jsx(BaseAttributes, { title: "Feature 1 attributes", feature: feature1 }), _jsx(BaseAttributes, { title: "Feature 2 attributes", feature: feature2 })] }));
|
|
12
9
|
});
|
|
13
10
|
export default BreakpointAlignmentsFeatureDetail;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import PluginManager from '@jbrowse/core/PluginManager';
|
|
1
|
+
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
2
|
export default function BreakpointAlignmentsFeatureDetailF(pluginManager: PluginManager): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { lazy } from 'react';
|
|
2
2
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
3
|
+
import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
|
|
3
4
|
import { ElementId } from '@jbrowse/core/util/types/mst';
|
|
4
5
|
import { types } from 'mobx-state-tree';
|
|
5
|
-
import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
|
|
6
6
|
const configSchema = ConfigurationSchema('BreakpointAlignmentsWidget', {});
|
|
7
7
|
const stateModel = types
|
|
8
8
|
.model('BreakpointAlignmentsWidget', {
|
|
@@ -1,52 +1,34 @@
|
|
|
1
|
-
import { Feature, Region } from '@jbrowse/core/util';
|
|
2
1
|
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
|
|
3
|
-
import {
|
|
4
|
-
import { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
2
|
+
import { type AbstractSessionModel, type Feature } from '@jbrowse/core/util';
|
|
3
|
+
import type { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
5
4
|
export default class BreakpointSplitViewType extends ViewType {
|
|
6
5
|
getBreakendCoveringRegions({ feature, assembly, }: {
|
|
7
6
|
feature: Feature;
|
|
8
7
|
assembly: Assembly;
|
|
9
8
|
}): {
|
|
10
9
|
pos: number;
|
|
11
|
-
refName: string
|
|
12
|
-
mateRefName: string
|
|
13
|
-
matePos:
|
|
10
|
+
refName: string;
|
|
11
|
+
mateRefName: string;
|
|
12
|
+
matePos: any;
|
|
14
13
|
};
|
|
15
|
-
singleLevelSnapshotFromBreakendFeature(feature
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
hideHeader: boolean;
|
|
28
|
-
bpPerPx: number;
|
|
29
|
-
offsetPx: number;
|
|
30
|
-
}[];
|
|
31
|
-
displayName: string;
|
|
32
|
-
featureData: unknown;
|
|
33
|
-
};
|
|
34
|
-
snapshotFromBreakendFeature(feature: Feature, view: {
|
|
35
|
-
displayedRegions: Region[];
|
|
36
|
-
} & IStateTreeNode): {
|
|
37
|
-
type: string;
|
|
38
|
-
views: {
|
|
14
|
+
singleLevelSnapshotFromBreakendFeature({ feature, session, assemblyName, }: {
|
|
15
|
+
feature: Feature;
|
|
16
|
+
session: AbstractSessionModel;
|
|
17
|
+
assemblyName: string;
|
|
18
|
+
}): {
|
|
19
|
+
coverage: {
|
|
20
|
+
pos: number;
|
|
21
|
+
refName: string;
|
|
22
|
+
mateRefName: string;
|
|
23
|
+
matePos: any;
|
|
24
|
+
};
|
|
25
|
+
snap: {
|
|
39
26
|
type: string;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
refName: string;
|
|
44
|
-
assemblyName: string;
|
|
27
|
+
views: {
|
|
28
|
+
type: string;
|
|
29
|
+
displayedRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[];
|
|
45
30
|
}[];
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
offsetPx: number;
|
|
49
|
-
}[];
|
|
50
|
-
displayName: string;
|
|
31
|
+
displayName: string;
|
|
32
|
+
};
|
|
51
33
|
};
|
|
52
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getSession } from '@jbrowse/core/util';
|
|
2
|
-
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
|
|
3
1
|
import { parseBreakend } from '@gmod/vcf';
|
|
2
|
+
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
|
|
3
|
+
import { gatherOverlaps, } from '@jbrowse/core/util';
|
|
4
4
|
export default class BreakpointSplitViewType extends ViewType {
|
|
5
5
|
getBreakendCoveringRegions({ feature, assembly, }) {
|
|
6
6
|
var _a;
|
|
@@ -8,81 +8,44 @@ export default class BreakpointSplitViewType extends ViewType {
|
|
|
8
8
|
const bnd = alt ? parseBreakend(alt) : undefined;
|
|
9
9
|
const startPos = feature.get('start');
|
|
10
10
|
const refName = feature.get('refName');
|
|
11
|
-
|
|
12
|
-
let mateRefName;
|
|
13
|
-
// a VCF breakend feature
|
|
11
|
+
const f = (ref) => assembly.getCanonicalRefName(ref) || ref;
|
|
14
12
|
if (alt === '<TRA>') {
|
|
15
13
|
const INFO = feature.get('INFO');
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
return {
|
|
15
|
+
pos: startPos,
|
|
16
|
+
refName: f(refName),
|
|
17
|
+
mateRefName: f(INFO.CHR2[0]),
|
|
18
|
+
matePos: INFO.END[0] - 1,
|
|
19
|
+
};
|
|
18
20
|
}
|
|
19
21
|
else if (bnd === null || bnd === void 0 ? void 0 : bnd.MatePosition) {
|
|
20
22
|
const matePosition = bnd.MatePosition.split(':');
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
return {
|
|
24
|
+
pos: startPos,
|
|
25
|
+
refName: f(refName),
|
|
26
|
+
mateRefName: f(matePosition[0]),
|
|
27
|
+
matePos: +matePosition[1] - 1,
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
30
|
else if (feature.get('mate')) {
|
|
25
|
-
// a generic 'mate' feature
|
|
26
31
|
const mate = feature.get('mate');
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
return {
|
|
33
|
+
pos: startPos,
|
|
34
|
+
refName: f(refName),
|
|
35
|
+
mateRefName: f(mate.refName),
|
|
36
|
+
matePos: mate.start,
|
|
37
|
+
};
|
|
29
38
|
}
|
|
30
39
|
else {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
pos: startPos,
|
|
38
|
-
refName: assembly.getCanonicalRefName(refName),
|
|
39
|
-
mateRefName: assembly.getCanonicalRefName(mateRefName),
|
|
40
|
-
matePos: endPos,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
singleLevelSnapshotFromBreakendFeature(feature, view) {
|
|
44
|
-
const session = getSession(view);
|
|
45
|
-
const bpPerPx = 10;
|
|
46
|
-
const { assemblyName } = view.displayedRegions[0];
|
|
47
|
-
const { assemblyManager } = session;
|
|
48
|
-
const assembly = assemblyManager.get(assemblyName);
|
|
49
|
-
if (!assembly) {
|
|
50
|
-
throw new Error(`assembly ${assemblyName} not found`);
|
|
40
|
+
return {
|
|
41
|
+
pos: startPos,
|
|
42
|
+
refName: f(refName),
|
|
43
|
+
mateRefName: f(refName),
|
|
44
|
+
matePos: feature.get('end'),
|
|
45
|
+
};
|
|
51
46
|
}
|
|
52
|
-
if (!assembly.regions) {
|
|
53
|
-
throw new Error(`assembly ${assemblyName} regions not loaded`);
|
|
54
|
-
}
|
|
55
|
-
const { refName, pos: startPos, mateRefName, matePos: endPos, } = this.getBreakendCoveringRegions({
|
|
56
|
-
feature,
|
|
57
|
-
assembly,
|
|
58
|
-
});
|
|
59
|
-
const topRegion = assembly.regions.find(f => f.refName === refName);
|
|
60
|
-
const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
|
|
61
|
-
const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
|
|
62
|
-
const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
|
|
63
|
-
topMarkedRegion[0].end = startPos;
|
|
64
|
-
topMarkedRegion[1].start = startPos;
|
|
65
|
-
bottomMarkedRegion[0].end = endPos;
|
|
66
|
-
bottomMarkedRegion[1].start = endPos;
|
|
67
|
-
return {
|
|
68
|
-
type: 'BreakpointSplitView',
|
|
69
|
-
views: [
|
|
70
|
-
{
|
|
71
|
-
type: 'LinearGenomeView',
|
|
72
|
-
displayedRegions: topMarkedRegion,
|
|
73
|
-
hideHeader: true,
|
|
74
|
-
bpPerPx,
|
|
75
|
-
offsetPx: (topRegion.start + feature.get('start')) / bpPerPx,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
|
|
79
|
-
featureData: undefined,
|
|
80
|
-
};
|
|
81
47
|
}
|
|
82
|
-
|
|
83
|
-
const session = getSession(view);
|
|
84
|
-
const bpPerPx = 10;
|
|
85
|
-
const { assemblyName } = view.displayedRegions[0];
|
|
48
|
+
singleLevelSnapshotFromBreakendFeature({ feature, session, assemblyName, }) {
|
|
86
49
|
const { assemblyManager } = session;
|
|
87
50
|
const assembly = assemblyManager.get(assemblyName);
|
|
88
51
|
if (!assembly) {
|
|
@@ -91,37 +54,25 @@ export default class BreakpointSplitViewType extends ViewType {
|
|
|
91
54
|
if (!assembly.regions) {
|
|
92
55
|
throw new Error(`assembly ${assemblyName} regions not loaded`);
|
|
93
56
|
}
|
|
94
|
-
const
|
|
57
|
+
const coverage = this.getBreakendCoveringRegions({
|
|
95
58
|
feature,
|
|
96
59
|
assembly,
|
|
97
60
|
});
|
|
61
|
+
const { refName, mateRefName } = coverage;
|
|
98
62
|
const topRegion = assembly.regions.find(f => f.refName === refName);
|
|
99
63
|
const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
|
|
100
|
-
const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
|
|
101
|
-
const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
|
|
102
|
-
topMarkedRegion[0].end = startPos;
|
|
103
|
-
topMarkedRegion[1].start = startPos;
|
|
104
|
-
bottomMarkedRegion[0].end = endPos;
|
|
105
|
-
bottomMarkedRegion[1].start = endPos;
|
|
106
64
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
|
|
118
|
-
displayedRegions: bottomMarkedRegion,
|
|
119
|
-
hideHeader: true,
|
|
120
|
-
bpPerPx,
|
|
121
|
-
offsetPx: (bottomRegion.start + endPos) / bpPerPx,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
|
|
65
|
+
coverage,
|
|
66
|
+
snap: {
|
|
67
|
+
type: 'BreakpointSplitView',
|
|
68
|
+
views: [
|
|
69
|
+
{
|
|
70
|
+
type: 'LinearGenomeView',
|
|
71
|
+
displayedRegions: gatherOverlaps([topRegion, bottomRegion]),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
|
|
75
|
+
},
|
|
125
76
|
};
|
|
126
77
|
}
|
|
127
78
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { BreakpointViewModel } from '../model';
|
|
1
|
+
import type { BreakpointViewModel } from '../model';
|
|
3
2
|
declare const AlignmentConnections: ({ model, trackId, parentRef, 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 AlignmentConnections;
|