@jbrowse/plugin-alignments 2.15.0 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +29 -3
- package/dist/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.d.ts +1 -0
- package/dist/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.js +6 -0
- package/dist/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.d.ts +1 -0
- package/dist/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.js +6 -0
- package/dist/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.d.ts +9 -0
- package/dist/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.js +92 -0
- package/dist/AlignmentsFeatureDetail/{LaunchBreakpointSplitViewPanel.js → LaunchSupplementaryAlignmentBreakpointSplitViewPanel.js} +43 -18
- package/dist/AlignmentsFeatureDetail/{SuppAlignments.d.ts → LinkedPairedAlignments.d.ts} +0 -1
- package/dist/AlignmentsFeatureDetail/{SuppAlignments.js → LinkedPairedAlignments.js} +3 -6
- package/dist/AlignmentsFeatureDetail/SupplementaryAlignments.d.ts +8 -0
- package/dist/AlignmentsFeatureDetail/SupplementaryAlignments.js +26 -0
- package/{esm/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts → dist/AlignmentsFeatureDetail/SupplementaryAlignmentsLocStrings.d.ts} +1 -1
- package/dist/AlignmentsFeatureDetail/{SuppAlignmentsLocStrings.js → SupplementaryAlignmentsLocStrings.js} +2 -2
- package/dist/LinearAlignmentsDisplay/models/alignmentsModel.js +1 -2
- package/dist/LinearAlignmentsDisplay/models/util.js +2 -4
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +14 -15
- package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +30 -18
- package/dist/LinearPileupDisplay/model.d.ts +29 -26
- package/dist/LinearPileupDisplay/model.js +33 -28
- package/dist/LinearReadArcsDisplay/index.js +25 -2
- package/dist/LinearReadCloudDisplay/index.js +25 -2
- package/dist/LinearSNPCoverageDisplay/models/model.d.ts +4 -4
- package/dist/LinearSNPCoverageDisplay/models/model.js +27 -2
- package/dist/PileupRenderer/PileupRenderer.d.ts +1 -1
- package/dist/shared/color.d.ts +3 -0
- package/dist/shared/color.js +21 -10
- package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +6 -3
- package/esm/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.d.ts +1 -0
- package/esm/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.js +2 -0
- package/esm/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.d.ts +1 -0
- package/esm/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.js +2 -0
- package/esm/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.d.ts +9 -0
- package/esm/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.js +66 -0
- package/esm/AlignmentsFeatureDetail/LaunchSupplementaryAlignmentBreakpointSplitViewPanel.js +84 -0
- package/esm/AlignmentsFeatureDetail/{SuppAlignments.d.ts → LinkedPairedAlignments.d.ts} +0 -1
- package/esm/AlignmentsFeatureDetail/LinkedPairedAlignments.js +17 -0
- package/esm/AlignmentsFeatureDetail/SupplementaryAlignments.d.ts +8 -0
- package/esm/AlignmentsFeatureDetail/{SuppAlignments.js → SupplementaryAlignments.js} +4 -4
- package/{dist/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts → esm/AlignmentsFeatureDetail/SupplementaryAlignmentsLocStrings.d.ts} +1 -1
- package/esm/AlignmentsFeatureDetail/{SuppAlignmentsLocStrings.js → SupplementaryAlignmentsLocStrings.js} +1 -1
- package/esm/LinearAlignmentsDisplay/models/alignmentsModel.js +1 -2
- package/esm/LinearAlignmentsDisplay/models/util.js +2 -4
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +14 -15
- package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +30 -18
- package/esm/LinearPileupDisplay/model.d.ts +29 -26
- package/esm/LinearPileupDisplay/model.js +33 -28
- package/esm/LinearReadArcsDisplay/index.js +2 -2
- package/esm/LinearReadCloudDisplay/index.js +2 -2
- package/esm/LinearSNPCoverageDisplay/models/model.d.ts +4 -4
- package/esm/LinearSNPCoverageDisplay/models/model.js +3 -1
- package/esm/PileupRenderer/PileupRenderer.d.ts +1 -1
- package/esm/shared/color.d.ts +3 -0
- package/esm/shared/color.js +20 -10
- package/package.json +3 -2
- package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +0 -12
- package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.js +0 -97
- package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +0 -12
- package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.js +0 -72
- package/esm/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.js +0 -59
- /package/dist/AlignmentsFeatureDetail/{LaunchBreakpointSplitViewPanel.d.ts → LaunchSupplementaryAlignmentBreakpointSplitViewPanel.d.ts} +0 -0
- /package/esm/AlignmentsFeatureDetail/{LaunchBreakpointSplitViewPanel.d.ts → LaunchSupplementaryAlignmentBreakpointSplitViewPanel.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
|
|
2
2
|
// locals
|
|
3
|
-
import ReactComponent from './components/ReactComponent';
|
|
4
3
|
import configSchemaF from './configSchema';
|
|
5
4
|
import stateModelF from './model';
|
|
5
|
+
import { lazy } from 'react';
|
|
6
6
|
export default function register(pluginManager) {
|
|
7
7
|
pluginManager.addDisplayType(() => {
|
|
8
8
|
const configSchema = configSchemaF(pluginManager);
|
|
@@ -14,7 +14,7 @@ export default function register(pluginManager) {
|
|
|
14
14
|
trackType: 'AlignmentsTrack',
|
|
15
15
|
viewType: 'LinearGenomeView',
|
|
16
16
|
subDisplay: { type: 'LinearAlignmentsDisplay', lowerPanel: true },
|
|
17
|
-
ReactComponent,
|
|
17
|
+
ReactComponent: lazy(() => import('./components/ReactComponent')),
|
|
18
18
|
});
|
|
19
19
|
});
|
|
20
20
|
}
|
|
@@ -33,7 +33,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
33
33
|
}, {
|
|
34
34
|
renderInProgress: AbortController | undefined;
|
|
35
35
|
filled: boolean;
|
|
36
|
-
reactElement:
|
|
36
|
+
reactElement: React.ReactElement | undefined;
|
|
37
37
|
features: Map<string, import("@jbrowse/core/util").Feature> | undefined;
|
|
38
38
|
layout: any;
|
|
39
39
|
status: string;
|
|
@@ -44,10 +44,10 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
44
44
|
model: {
|
|
45
45
|
error?: unknown;
|
|
46
46
|
reload: () => void;
|
|
47
|
-
message:
|
|
47
|
+
message: React.ReactNode;
|
|
48
48
|
filled?: boolean;
|
|
49
49
|
status?: string;
|
|
50
|
-
reactElement?:
|
|
50
|
+
reactElement?: React.ReactElement;
|
|
51
51
|
};
|
|
52
52
|
}) => import("react").JSX.Element | undefined;
|
|
53
53
|
renderProps: any;
|
|
@@ -58,7 +58,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
|
|
|
58
58
|
setLoading(abortController: AbortController): void;
|
|
59
59
|
setMessage(messageText: string): void;
|
|
60
60
|
setRendered(props: {
|
|
61
|
-
reactElement:
|
|
61
|
+
reactElement: React.ReactElement;
|
|
62
62
|
features: Map<string, import("@jbrowse/core/util").Feature>;
|
|
63
63
|
layout: any;
|
|
64
64
|
maxHeightReached: boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
1
2
|
import { types, cast, getEnv, getSnapshot, isAlive } from 'mobx-state-tree';
|
|
2
3
|
import { observable } from 'mobx';
|
|
3
4
|
import { getConf, readConfObject, } from '@jbrowse/core/configuration';
|
|
@@ -5,10 +6,11 @@ import { linearWiggleDisplayModelFactory } from '@jbrowse/plugin-wiggle';
|
|
|
5
6
|
import { getContainingView } from '@jbrowse/core/util';
|
|
6
7
|
import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
|
|
7
8
|
// locals
|
|
8
|
-
import Tooltip from '../components/Tooltip';
|
|
9
9
|
import { FilterModel, getUniqueModificationValues } from '../../shared';
|
|
10
10
|
import { createAutorun, modificationColors } from '../../util';
|
|
11
11
|
import { randomColor } from '../../util';
|
|
12
|
+
// lazies
|
|
13
|
+
const Tooltip = lazy(() => import('../components/Tooltip'));
|
|
12
14
|
// using a map because it preserves order
|
|
13
15
|
const rendererTypes = new Map([['snpcoverage', 'SNPCoverageRenderer']]);
|
|
14
16
|
/**
|
|
@@ -49,7 +49,7 @@ export default class PileupRenderer extends BoxRendererType {
|
|
|
49
49
|
height: number;
|
|
50
50
|
width: number;
|
|
51
51
|
maxHeightReached: boolean;
|
|
52
|
-
reactElement:
|
|
52
|
+
reactElement: React.JSX.Element;
|
|
53
53
|
html?: string;
|
|
54
54
|
} | {
|
|
55
55
|
features: Map<any, any>;
|
package/esm/shared/color.d.ts
CHANGED
|
@@ -51,6 +51,9 @@ export declare function getPairedInsertSizeAndOrientationColor(f1: {
|
|
|
51
51
|
}, f2: {
|
|
52
52
|
refName: string;
|
|
53
53
|
}, stats?: ChainStats): readonly [string, string];
|
|
54
|
+
export declare function getPairedOrientationColorOrDefault(f: {
|
|
55
|
+
pair_orientation?: string;
|
|
56
|
+
}): readonly [string, string] | undefined;
|
|
54
57
|
export declare function getPairedOrientationColor(f: {
|
|
55
58
|
pair_orientation?: string;
|
|
56
59
|
}): readonly [string, string];
|
package/esm/shared/color.js
CHANGED
|
@@ -50,24 +50,34 @@ export function getPairedInsertSizeColor(f1, f2, stats) {
|
|
|
50
50
|
if (sameRef && tlen > ((stats === null || stats === void 0 ? void 0 : stats.upper) || 0)) {
|
|
51
51
|
return [fillColor.color_longinsert, strokeColor.color_longinsert];
|
|
52
52
|
}
|
|
53
|
-
if (sameRef && tlen < ((stats === null || stats === void 0 ? void 0 : stats.lower) || 0)) {
|
|
53
|
+
else if (sameRef && tlen < ((stats === null || stats === void 0 ? void 0 : stats.lower) || 0)) {
|
|
54
54
|
return [fillColor.color_shortinsert, strokeColor.color_shortinsert];
|
|
55
55
|
}
|
|
56
|
-
if (!sameRef) {
|
|
56
|
+
else if (!sameRef) {
|
|
57
57
|
return [fillColor.color_interchrom, strokeColor.color_interchrom];
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
else {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
60
62
|
}
|
|
63
|
+
const defaultColor = [fillColor.color_unknown, fillColor.color_unknown];
|
|
64
|
+
// return color scheme with both insert size and orientation coloring,
|
|
65
|
+
// prioritzing orientation coloring
|
|
61
66
|
export function getPairedInsertSizeAndOrientationColor(f1, f2, stats) {
|
|
62
|
-
return (
|
|
67
|
+
return (getPairedOrientationColorOrDefault(f1) ||
|
|
68
|
+
getPairedInsertSizeColor(f1, f2, stats) ||
|
|
69
|
+
defaultColor);
|
|
63
70
|
}
|
|
64
|
-
export function
|
|
71
|
+
export function getPairedOrientationColorOrDefault(f) {
|
|
65
72
|
const type = orientationTypes.fr;
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
const r = type[f.pair_orientation || ''];
|
|
74
|
+
const type2 = pairMap[r];
|
|
75
|
+
return r === 'LR'
|
|
76
|
+
? undefined
|
|
77
|
+
: [fillColor[type2], strokeColor[type2]];
|
|
78
|
+
}
|
|
79
|
+
export function getPairedOrientationColor(f) {
|
|
80
|
+
return getPairedOrientationColorOrDefault(f) || defaultColor;
|
|
71
81
|
}
|
|
72
82
|
export const ColorByModel = types.maybe(types.model({
|
|
73
83
|
type: types.string,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-alignments",
|
|
3
|
-
"version": "2.15.
|
|
3
|
+
"version": "2.15.1",
|
|
4
4
|
"description": "JBrowse 2 alignments adapters, tracks, etc.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@gmod/bam": "^2.0.0",
|
|
40
40
|
"@gmod/cram": "^3.0.3",
|
|
41
|
+
"@jbrowse/sv-core": "^2.15.1",
|
|
41
42
|
"@mui/icons-material": "^6.0.0",
|
|
42
43
|
"canvas2svg": "^1.0.16",
|
|
43
44
|
"clone": "^2.1.2",
|
|
@@ -63,5 +64,5 @@
|
|
|
63
64
|
"distModule": "esm/index.js",
|
|
64
65
|
"srcModule": "src/index.ts",
|
|
65
66
|
"module": "esm/index.js",
|
|
66
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "86ed70124fc5a0b1161266659d1ca9f8796bf3fe"
|
|
67
68
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ViewType } from '@jbrowse/core/pluggableElementTypes';
|
|
3
|
-
import { AlignmentFeatureWidgetModel } from './stateModelFactory';
|
|
4
|
-
import { ReducedFeature } from './getSAFeatures';
|
|
5
|
-
declare const BreakendOptionDialog: ({ model, handleClose, f1, f2, }: {
|
|
6
|
-
model: AlignmentFeatureWidgetModel;
|
|
7
|
-
handleClose: () => void;
|
|
8
|
-
f1: ReducedFeature;
|
|
9
|
-
f2: ReducedFeature;
|
|
10
|
-
viewType: ViewType;
|
|
11
|
-
}) => React.JSX.Element;
|
|
12
|
-
export default BreakendOptionDialog;
|
|
@@ -1,97 +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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const react_1 = __importStar(require("react"));
|
|
27
|
-
const mobx_react_1 = require("mobx-react");
|
|
28
|
-
const material_1 = require("@mui/material");
|
|
29
|
-
const mui_1 = require("tss-react/mui");
|
|
30
|
-
const util_1 = require("@jbrowse/core/util");
|
|
31
|
-
const ui_1 = require("@jbrowse/core/ui");
|
|
32
|
-
const launchBreakpointSplitView_1 = require("./launchBreakpointSplitView");
|
|
33
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
34
|
-
const useStyles = (0, mui_1.makeStyles)()({
|
|
35
|
-
block: {
|
|
36
|
-
display: 'block',
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
function stripIds(arr) {
|
|
40
|
-
return arr.map(({ id, displays, ...rest }) => ({
|
|
41
|
-
...rest,
|
|
42
|
-
displays: displays.map(({ id, ...rest }) => rest),
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
function Checkbox2({ checked, label, onChange, }) {
|
|
46
|
-
const { classes } = useStyles();
|
|
47
|
-
return (react_1.default.createElement(material_1.FormControlLabel, { className: classes.block, control: react_1.default.createElement(material_1.Checkbox, { checked: checked, onChange: onChange }), label: label }));
|
|
48
|
-
}
|
|
49
|
-
const BreakendOptionDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, f1, f2, }) {
|
|
50
|
-
const [copyTracks, setCopyTracks] = (0, react_1.useState)(true);
|
|
51
|
-
const [mirror, setMirror] = (0, react_1.useState)(true);
|
|
52
|
-
return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: handleClose, title: "Breakpoint split view options" },
|
|
53
|
-
react_1.default.createElement(material_1.DialogContent, null,
|
|
54
|
-
react_1.default.createElement(Checkbox2, { checked: copyTracks, onChange: event => {
|
|
55
|
-
setCopyTracks(event.target.checked);
|
|
56
|
-
}, label: "Copy tracks into the new view" }),
|
|
57
|
-
react_1.default.createElement(Checkbox2, { checked: mirror, onChange: event => {
|
|
58
|
-
setMirror(event.target.checked);
|
|
59
|
-
}, label: "Mirror tracks vertically in vertically stacked view" })),
|
|
60
|
-
react_1.default.createElement(material_1.DialogActions, null,
|
|
61
|
-
react_1.default.createElement(material_1.Button, { onClick: () => {
|
|
62
|
-
const { view } = model;
|
|
63
|
-
const session = (0, util_1.getSession)(model);
|
|
64
|
-
try {
|
|
65
|
-
const viewSnapshot = (0, launchBreakpointSplitView_1.getBreakpointSplitView)({ view, f1, f2 });
|
|
66
|
-
const views = viewSnapshot.views;
|
|
67
|
-
const view1 = views[0];
|
|
68
|
-
const view2 = views[1];
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
70
|
-
const viewTracks = (0, mobx_state_tree_1.getSnapshot)(view.tracks);
|
|
71
|
-
session.addView('BreakpointSplitView', {
|
|
72
|
-
...viewSnapshot,
|
|
73
|
-
views: [
|
|
74
|
-
{
|
|
75
|
-
...view1,
|
|
76
|
-
tracks: stripIds(viewTracks),
|
|
77
|
-
offsetPx: view1.offsetPx - view.width / 2 + 100,
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
...view2,
|
|
81
|
-
tracks: stripIds(mirror ? [...viewTracks].reverse() : viewTracks),
|
|
82
|
-
offsetPx: view2.offsetPx - view.width / 2 + 100,
|
|
83
|
-
},
|
|
84
|
-
],
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
catch (e) {
|
|
88
|
-
console.error(e);
|
|
89
|
-
session.notify(`${e}`);
|
|
90
|
-
}
|
|
91
|
-
handleClose();
|
|
92
|
-
}, variant: "contained", color: "primary", autoFocus: true }, "OK"),
|
|
93
|
-
react_1.default.createElement(material_1.Button, { onClick: () => {
|
|
94
|
-
handleClose();
|
|
95
|
-
}, color: "secondary", variant: "contained" }, "Cancel"))));
|
|
96
|
-
});
|
|
97
|
-
exports.default = BreakendOptionDialog;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ViewType } from '@jbrowse/core/pluggableElementTypes';
|
|
3
|
-
import { AlignmentFeatureWidgetModel } from './stateModelFactory';
|
|
4
|
-
import { ReducedFeature } from './getSAFeatures';
|
|
5
|
-
declare const BreakendOptionDialog: ({ model, handleClose, f1, f2, }: {
|
|
6
|
-
model: AlignmentFeatureWidgetModel;
|
|
7
|
-
handleClose: () => void;
|
|
8
|
-
f1: ReducedFeature;
|
|
9
|
-
f2: ReducedFeature;
|
|
10
|
-
viewType: ViewType;
|
|
11
|
-
}) => React.JSX.Element;
|
|
12
|
-
export default BreakendOptionDialog;
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { observer } from 'mobx-react';
|
|
3
|
-
import { Button, Checkbox, DialogActions, DialogContent, FormControlLabel, } from '@mui/material';
|
|
4
|
-
import { makeStyles } from 'tss-react/mui';
|
|
5
|
-
import { getSession } from '@jbrowse/core/util';
|
|
6
|
-
import { Dialog } from '@jbrowse/core/ui';
|
|
7
|
-
import { getBreakpointSplitView } from './launchBreakpointSplitView';
|
|
8
|
-
import { getSnapshot } from 'mobx-state-tree';
|
|
9
|
-
const useStyles = makeStyles()({
|
|
10
|
-
block: {
|
|
11
|
-
display: 'block',
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
function stripIds(arr) {
|
|
15
|
-
return arr.map(({ id, displays, ...rest }) => ({
|
|
16
|
-
...rest,
|
|
17
|
-
displays: displays.map(({ id, ...rest }) => rest),
|
|
18
|
-
}));
|
|
19
|
-
}
|
|
20
|
-
function Checkbox2({ checked, label, onChange, }) {
|
|
21
|
-
const { classes } = useStyles();
|
|
22
|
-
return (React.createElement(FormControlLabel, { className: classes.block, control: React.createElement(Checkbox, { checked: checked, onChange: onChange }), label: label }));
|
|
23
|
-
}
|
|
24
|
-
const BreakendOptionDialog = observer(function ({ model, handleClose, f1, f2, }) {
|
|
25
|
-
const [copyTracks, setCopyTracks] = useState(true);
|
|
26
|
-
const [mirror, setMirror] = useState(true);
|
|
27
|
-
return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Breakpoint split view options" },
|
|
28
|
-
React.createElement(DialogContent, null,
|
|
29
|
-
React.createElement(Checkbox2, { checked: copyTracks, onChange: event => {
|
|
30
|
-
setCopyTracks(event.target.checked);
|
|
31
|
-
}, label: "Copy tracks into the new view" }),
|
|
32
|
-
React.createElement(Checkbox2, { checked: mirror, onChange: event => {
|
|
33
|
-
setMirror(event.target.checked);
|
|
34
|
-
}, label: "Mirror tracks vertically in vertically stacked view" })),
|
|
35
|
-
React.createElement(DialogActions, null,
|
|
36
|
-
React.createElement(Button, { onClick: () => {
|
|
37
|
-
const { view } = model;
|
|
38
|
-
const session = getSession(model);
|
|
39
|
-
try {
|
|
40
|
-
const viewSnapshot = getBreakpointSplitView({ view, f1, f2 });
|
|
41
|
-
const views = viewSnapshot.views;
|
|
42
|
-
const view1 = views[0];
|
|
43
|
-
const view2 = views[1];
|
|
44
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
45
|
-
const viewTracks = getSnapshot(view.tracks);
|
|
46
|
-
session.addView('BreakpointSplitView', {
|
|
47
|
-
...viewSnapshot,
|
|
48
|
-
views: [
|
|
49
|
-
{
|
|
50
|
-
...view1,
|
|
51
|
-
tracks: stripIds(viewTracks),
|
|
52
|
-
offsetPx: view1.offsetPx - view.width / 2 + 100,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
...view2,
|
|
56
|
-
tracks: stripIds(mirror ? [...viewTracks].reverse() : viewTracks),
|
|
57
|
-
offsetPx: view2.offsetPx - view.width / 2 + 100,
|
|
58
|
-
},
|
|
59
|
-
],
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
catch (e) {
|
|
63
|
-
console.error(e);
|
|
64
|
-
session.notify(`${e}`);
|
|
65
|
-
}
|
|
66
|
-
handleClose();
|
|
67
|
-
}, variant: "contained", color: "primary", autoFocus: true }, "OK"),
|
|
68
|
-
React.createElement(Button, { onClick: () => {
|
|
69
|
-
handleClose();
|
|
70
|
-
}, color: "secondary", variant: "contained" }, "Cancel"))));
|
|
71
|
-
});
|
|
72
|
-
export default BreakendOptionDialog;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React, { lazy, useEffect, useState } from 'react';
|
|
2
|
-
import { Typography, Link, Tooltip } from '@mui/material';
|
|
3
|
-
import { SimpleFeature, getSession, toLocale, } from '@jbrowse/core/util';
|
|
4
|
-
import { ErrorMessage } from '@jbrowse/core/ui';
|
|
5
|
-
import { getSAFeatures } from './getSAFeatures';
|
|
6
|
-
// lazies
|
|
7
|
-
const BreakendOptionDialog = lazy(() => import('./BreakendOptionDialog'));
|
|
8
|
-
export default function LaunchBreakpointSplitViewPanel({ model, feature, viewType, }) {
|
|
9
|
-
const session = getSession(model);
|
|
10
|
-
const { view } = model;
|
|
11
|
-
const [res, setRes] = useState();
|
|
12
|
-
const [error, setError] = useState();
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15
|
-
;
|
|
16
|
-
(async () => {
|
|
17
|
-
try {
|
|
18
|
-
const feats = await getSAFeatures({
|
|
19
|
-
view,
|
|
20
|
-
feature: new SimpleFeature(feature),
|
|
21
|
-
});
|
|
22
|
-
setRes(feats);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
setError(e);
|
|
26
|
-
console.error(e);
|
|
27
|
-
}
|
|
28
|
-
})();
|
|
29
|
-
}, [feature, view]);
|
|
30
|
-
const ret = [];
|
|
31
|
-
if (res) {
|
|
32
|
-
for (let i = 0; i < res.length - 1; i++) {
|
|
33
|
-
ret.push([res[i], res[i + 1]]);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return ret.length ? (React.createElement("div", null,
|
|
37
|
-
React.createElement(Typography, null, "Launch split views with breakend source and target"),
|
|
38
|
-
error ? React.createElement(ErrorMessage, { error: error }) : null,
|
|
39
|
-
React.createElement("ul", null, ret.map((arg, index) => {
|
|
40
|
-
const [f1, f2] = arg;
|
|
41
|
-
return (React.createElement("li", { key: `${JSON.stringify(arg)}-${index}` },
|
|
42
|
-
React.createElement(Tooltip, { title: "Top panel->Bottom panel" },
|
|
43
|
-
React.createElement(Link, { href: "#", onClick: event => {
|
|
44
|
-
event.preventDefault();
|
|
45
|
-
session.queueDialog(handleClose => [
|
|
46
|
-
BreakendOptionDialog,
|
|
47
|
-
{ handleClose, f1, f2, model, viewType },
|
|
48
|
-
]);
|
|
49
|
-
} },
|
|
50
|
-
f1.refName,
|
|
51
|
-
":",
|
|
52
|
-
toLocale(f1.strand === 1 ? f1.end : f1.start),
|
|
53
|
-
' ',
|
|
54
|
-
"-> ",
|
|
55
|
-
f2.refName,
|
|
56
|
-
":",
|
|
57
|
-
toLocale(f2.strand === 1 ? f2.start : f2.end)))));
|
|
58
|
-
})))) : null;
|
|
59
|
-
}
|
|
File without changes
|