@jbrowse/plugin-variants 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.
Files changed (33) hide show
  1. package/dist/ChordVariantDisplay/models/stateModelFactory.d.ts +5 -5
  2. package/dist/LinearVariantDisplay/model.d.ts +9 -9
  3. package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +1 -1
  4. package/dist/StructuralVariantChordRenderer/ReactComponent.js +7 -4
  5. package/dist/VariantFeatureWidget/BreakendMultiLevelOptionDialog.d.ts +1 -0
  6. package/dist/VariantFeatureWidget/BreakendMultiLevelOptionDialog.js +6 -0
  7. package/dist/VariantFeatureWidget/BreakendSingleLevelOptionDialog.d.ts +1 -0
  8. package/dist/VariantFeatureWidget/BreakendSingleLevelOptionDialog.js +6 -0
  9. package/dist/VariantFeatureWidget/Checkbox2.d.ts +7 -0
  10. package/dist/VariantFeatureWidget/Checkbox2.js +18 -0
  11. package/dist/VariantFeatureWidget/{BreakendPanel.js → LaunchBreakendPanel.js} +36 -7
  12. package/dist/VariantFeatureWidget/VariantFeatureWidget.js +46 -5
  13. package/dist/VcfFeature/util.js +7 -1
  14. package/esm/ChordVariantDisplay/models/stateModelFactory.d.ts +5 -5
  15. package/esm/LinearVariantDisplay/model.d.ts +9 -9
  16. package/esm/StructuralVariantChordRenderer/ReactComponent.d.ts +1 -1
  17. package/esm/StructuralVariantChordRenderer/ReactComponent.js +7 -4
  18. package/esm/VariantFeatureWidget/BreakendMultiLevelOptionDialog.d.ts +1 -0
  19. package/esm/VariantFeatureWidget/BreakendMultiLevelOptionDialog.js +2 -0
  20. package/esm/VariantFeatureWidget/BreakendSingleLevelOptionDialog.d.ts +1 -0
  21. package/esm/VariantFeatureWidget/BreakendSingleLevelOptionDialog.js +2 -0
  22. package/esm/VariantFeatureWidget/Checkbox2.d.ts +7 -0
  23. package/esm/VariantFeatureWidget/Checkbox2.js +12 -0
  24. package/esm/VariantFeatureWidget/{BreakendPanel.js → LaunchBreakendPanel.js} +36 -7
  25. package/esm/VariantFeatureWidget/VariantFeatureWidget.js +23 -5
  26. package/esm/VcfFeature/util.js +7 -1
  27. package/package.json +3 -2
  28. package/dist/VariantFeatureWidget/BreakendOptionDialog.d.ts +0 -11
  29. package/dist/VariantFeatureWidget/BreakendOptionDialog.js +0 -95
  30. package/esm/VariantFeatureWidget/BreakendOptionDialog.d.ts +0 -11
  31. package/esm/VariantFeatureWidget/BreakendOptionDialog.js +0 -70
  32. /package/dist/VariantFeatureWidget/{BreakendPanel.d.ts → LaunchBreakendPanel.d.ts} +0 -0
  33. /package/esm/VariantFeatureWidget/{BreakendPanel.d.ts → LaunchBreakendPanel.d.ts} +0 -0
@@ -34,7 +34,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
34
34
  error: unknown;
35
35
  message: string | undefined;
36
36
  } & {
37
- readonly RenderingComponent: import("react").FC<{
37
+ readonly RenderingComponent: React.FC<{
38
38
  model: {
39
39
  id: string;
40
40
  type: string;
@@ -55,7 +55,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
55
55
  onHorizontalScroll?: () => void;
56
56
  blockState?: Record<string, any>;
57
57
  }>;
58
- readonly DisplayBlurb: import("react").FC<{
58
+ readonly DisplayBlurb: React.FC<{
59
59
  model: {
60
60
  id: string;
61
61
  type: string;
@@ -78,7 +78,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
78
78
  readonly parentTrack: any;
79
79
  renderProps(): any;
80
80
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
81
- readonly DisplayMessageComponent: undefined | import("react").FC<any>;
81
+ readonly DisplayMessageComponent: undefined | React.FC<any>;
82
82
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
83
83
  readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
84
84
  regionCannotBeRendered(): null;
@@ -89,7 +89,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
89
89
  reload(): void;
90
90
  } & {
91
91
  filled: boolean;
92
- reactElement: import("react").ReactElement | undefined;
92
+ reactElement: React.ReactElement | undefined;
93
93
  data: undefined;
94
94
  html: string | undefined;
95
95
  message: string;
@@ -109,7 +109,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
109
109
  message: string;
110
110
  data: any;
111
111
  html: string;
112
- reactElement: import("react").ReactElement;
112
+ reactElement: React.ReactElement;
113
113
  renderingComponent: import("@jbrowse/core/util").AnyReactComponentType;
114
114
  }): void;
115
115
  renderError(error: unknown): void;
@@ -36,7 +36,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
36
36
  }, {
37
37
  renderInProgress: AbortController | undefined;
38
38
  filled: boolean;
39
- reactElement: import("react").ReactElement | undefined;
39
+ reactElement: React.ReactElement | undefined;
40
40
  features: Map<string, Feature> | undefined;
41
41
  layout: any;
42
42
  status: string;
@@ -47,10 +47,10 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
47
47
  model: {
48
48
  error?: unknown;
49
49
  reload: () => void;
50
- message: import("react").ReactNode;
50
+ message: React.ReactNode;
51
51
  filled?: boolean;
52
52
  status?: string;
53
- reactElement?: import("react").ReactElement;
53
+ reactElement?: React.ReactElement;
54
54
  };
55
55
  }) => import("react").JSX.Element | undefined;
56
56
  renderProps: any;
@@ -61,7 +61,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
61
61
  setLoading(abortController: AbortController): void;
62
62
  setMessage(messageText: string): void;
63
63
  setRendered(props: {
64
- reactElement: import("react").ReactElement;
64
+ reactElement: React.ReactElement;
65
65
  features: Map<string, Feature>;
66
66
  layout: any;
67
67
  maxHeightReached: boolean;
@@ -121,7 +121,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
121
121
  error: unknown;
122
122
  message: string | undefined;
123
123
  } & {
124
- readonly RenderingComponent: import("react").FC<{
124
+ readonly RenderingComponent: React.FC<{
125
125
  model: {
126
126
  id: string;
127
127
  type: string;
@@ -142,7 +142,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
142
142
  onHorizontalScroll?: () => void;
143
143
  blockState?: Record<string, any>;
144
144
  }>;
145
- readonly DisplayBlurb: import("react").FC<{
145
+ readonly DisplayBlurb: React.FC<{
146
146
  model: {
147
147
  id: string;
148
148
  type: string;
@@ -165,7 +165,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
165
165
  readonly parentTrack: any;
166
166
  renderProps(): any;
167
167
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
168
- readonly DisplayMessageComponent: undefined | import("react").FC<any>;
168
+ readonly DisplayMessageComponent: undefined | React.FC<any>;
169
169
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
170
170
  readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
171
171
  regionCannotBeRendered(): null;
@@ -211,13 +211,13 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
211
211
  featureIdUnderMouse: undefined | string;
212
212
  contextMenuFeature: undefined | Feature;
213
213
  } & {
214
+ readonly DisplayMessageComponent: import("react").FC<any> | undefined;
214
215
  readonly blockType: "dynamicBlocks" | "staticBlocks";
215
216
  readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
216
217
  } & {
217
218
  readonly renderDelay: number;
218
- readonly TooltipComponent: import("react").FC<any>;
219
+ readonly TooltipComponent: import("@jbrowse/core/util").AnyReactComponentType;
219
220
  readonly selectedFeatureId: string | undefined;
220
- readonly DisplayMessageComponent: undefined | import("react").FC<any>;
221
221
  } & {
222
222
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
223
223
  readonly featureUnderMouse: Feature | undefined;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Feature } from '@jbrowse/core/util';
3
3
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  import { Block, AnyRegion } from './Chord';
5
- declare const StructuralVariantChordsReactComponent: ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, onChordClick, }: {
5
+ declare const StructuralVariantChordsReactComponent: ({ features, config, blockDefinitions, radius, bezierRadius, displayModel, onChordClick, }: {
6
6
  features: Map<string, Feature>;
7
7
  radius: number;
8
8
  config: AnyConfigurationModel;
@@ -30,9 +30,8 @@ const react_1 = __importStar(require("react"));
30
30
  const mobx_react_1 = require("mobx-react");
31
31
  // locals
32
32
  const Chord_1 = __importDefault(require("./Chord"));
33
- const StructuralVariantChordsReactComponent = (0, mobx_react_1.observer)(function ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, onChordClick, }) {
34
- const { id, selectedFeatureId } = displayModel || {};
35
- // make a map of refName -> blockDefinition
33
+ const StructuralVariantChordsReactComponent = (0, mobx_react_1.observer)(function ({ features, config, blockDefinitions, radius, bezierRadius, displayModel, onChordClick, }) {
34
+ const { selectedFeatureId } = displayModel || {};
36
35
  const blocksForRefsMemo = (0, react_1.useMemo)(() => {
37
36
  const blocksForRefs = {};
38
37
  for (const block of blockDefinitions) {
@@ -45,6 +44,10 @@ const StructuralVariantChordsReactComponent = (0, mobx_react_1.observer)(functio
45
44
  }
46
45
  return blocksForRefs;
47
46
  }, [blockDefinitions]);
48
- return (react_1.default.createElement("g", { "data-testid": "structuralVariantChordRenderer" }, [...features.values()].map(feature => (react_1.default.createElement(Chord_1.default, { key: feature.id(), feature: feature, config: config, radius: radius, bezierRadius: bezierRadius, blocksForRefs: blocksForRefsMemo, selected: String(selectedFeatureId) === String(id), onClick: onChordClick })))));
47
+ return (react_1.default.createElement("g", { "data-testid": "structuralVariantChordRenderer" }, [...features.values()].map(feature => {
48
+ const id = feature.id();
49
+ const selected = String(selectedFeatureId) === String(id);
50
+ return (react_1.default.createElement(Chord_1.default, { key: id, feature: feature, config: config, radius: radius, bezierRadius: bezierRadius, blocksForRefs: blocksForRefsMemo, selected: selected, onClick: onChordClick }));
51
+ })));
49
52
  });
50
53
  exports.default = StructuralVariantChordsReactComponent;
@@ -0,0 +1 @@
1
+ export { BreakendMultiLevelOptionDialog as default } from '@jbrowse/sv-core';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = void 0;
4
+ // re-exported for react lazy
5
+ var sv_core_1 = require("@jbrowse/sv-core");
6
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return sv_core_1.BreakendMultiLevelOptionDialog; } });
@@ -0,0 +1 @@
1
+ export { BreakendSingleLevelOptionDialog as default } from '@jbrowse/sv-core';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = void 0;
4
+ // re-exported for react lazy
5
+ var sv_core_1 = require("@jbrowse/sv-core");
6
+ Object.defineProperty(exports, "default", { enumerable: true, get: function () { return sv_core_1.BreakendSingleLevelOptionDialog; } });
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export default function Checkbox2({ checked, disabled, label, onChange, }: {
3
+ checked: boolean;
4
+ disabled?: boolean;
5
+ label: string;
6
+ onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
7
+ }): React.JSX.Element;
@@ -0,0 +1,18 @@
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
+ exports.default = Checkbox2;
7
+ const react_1 = __importDefault(require("react"));
8
+ const material_1 = require("@mui/material");
9
+ const mui_1 = require("tss-react/mui");
10
+ const useStyles = (0, mui_1.makeStyles)()({
11
+ block: {
12
+ display: 'block',
13
+ },
14
+ });
15
+ function Checkbox2({ checked, disabled, label, onChange, }) {
16
+ const { classes } = useStyles();
17
+ return (react_1.default.createElement(material_1.FormControlLabel, { disabled: disabled, className: classes.block, control: react_1.default.createElement(material_1.Checkbox, { checked: checked, onChange: onChange }), label: label }));
18
+ }
@@ -29,14 +29,17 @@ const material_1 = require("@mui/material");
29
29
  const util_1 = require("@jbrowse/core/util");
30
30
  const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
31
31
  // lazies
32
- const BreakendOptionDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./BreakendOptionDialog'))));
32
+ const BreakendMultiLevelOptionDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./BreakendMultiLevelOptionDialog'))));
33
+ const BreakendSingleLevelOptionDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./BreakendSingleLevelOptionDialog'))));
33
34
  function LocStringList({ locStrings, model, }) {
34
35
  const session = (0, util_1.getSession)(model);
35
36
  return (react_1.default.createElement("div", null,
36
- react_1.default.createElement(material_1.Typography, null, "Link to linear view of breakend endpoints"),
37
+ react_1.default.createElement(material_1.Typography, null, "Navigate to breakend endpoint in linear view:"),
37
38
  react_1.default.createElement("ul", null, locStrings.map((locString, index) => (
38
39
  /* biome-ignore lint/suspicious/noArrayIndexKey: */
39
40
  react_1.default.createElement("li", { key: `${locString}-${index}` },
41
+ locString,
42
+ ' ',
40
43
  react_1.default.createElement(material_1.Link, { href: "#", onClick: event => {
41
44
  var _a;
42
45
  event.preventDefault();
@@ -53,21 +56,47 @@ function LocStringList({ locStrings, model, }) {
53
56
  console.error(e);
54
57
  session.notify(`${e}`);
55
58
  }
56
- } }, `LGV - ${locString}`)))))));
59
+ } }, "(LGV)")))))));
57
60
  }
58
61
  function LaunchBreakpointSplitViewPanel({ locStrings, model, feature, viewType, }) {
59
62
  const session = (0, util_1.getSession)(model);
60
63
  const simpleFeature = new util_1.SimpleFeature(feature);
61
64
  return (react_1.default.createElement("div", null,
62
- react_1.default.createElement(material_1.Typography, null, "Launch split views with breakend source and target"),
65
+ react_1.default.createElement(material_1.Typography, null, "Launch split view"),
63
66
  react_1.default.createElement("ul", null, locStrings.map(locString => (react_1.default.createElement("li", { key: JSON.stringify(locString) },
67
+ `${feature.refName}:${feature.start} // ${locString}`,
68
+ ' ',
64
69
  react_1.default.createElement(material_1.Link, { href: "#", onClick: event => {
65
70
  event.preventDefault();
66
71
  session.queueDialog(handleClose => [
67
- BreakendOptionDialog,
68
- { handleClose, model, feature: simpleFeature, viewType },
72
+ BreakendMultiLevelOptionDialog,
73
+ {
74
+ handleClose,
75
+ model,
76
+ feature: simpleFeature,
77
+ // @ts-expect-error
78
+ viewType,
79
+ view: model.view,
80
+ assemblyName: model.view.displayedRegions[0].assemblyName,
81
+ },
69
82
  ]);
70
- } }, `${feature.refName}:${feature.start} // ${locString} (split view)`)))))));
83
+ } }, "(top/bottom)"),
84
+ ' ',
85
+ react_1.default.createElement(material_1.Link, { href: "#", onClick: event => {
86
+ event.preventDefault();
87
+ session.queueDialog(handleClose => [
88
+ BreakendSingleLevelOptionDialog,
89
+ {
90
+ handleClose,
91
+ model,
92
+ feature: simpleFeature,
93
+ // @ts-expect-error
94
+ viewType,
95
+ view: model.view,
96
+ assemblyName: model.view.displayedRegions[0].assemblyName,
97
+ },
98
+ ]);
99
+ } }, "(single row)")))))));
71
100
  }
72
101
  function BreakendPanel(props) {
73
102
  const { model, locStrings, feature } = props;
@@ -1,18 +1,42 @@
1
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
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
29
+ const react_1 = __importStar(require("react"));
7
30
  const mobx_react_1 = require("mobx-react");
8
31
  const material_1 = require("@mui/material");
9
32
  const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
10
33
  const vcf_1 = require("@gmod/vcf");
11
34
  // locals
12
35
  const VariantSampleGrid_1 = __importDefault(require("./VariantSampleGrid"));
13
- const BreakendPanel_1 = __importDefault(require("./BreakendPanel"));
14
36
  const VariantAnnotationTable_1 = __importDefault(require("./VariantAnnotationTable"));
15
37
  const variantFieldDescriptions_1 = require("./variantFieldDescriptions");
38
+ // lazies
39
+ const LaunchBreakendPanel = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./LaunchBreakendPanel'))));
16
40
  function AnnPanel({ descriptions, feature, }) {
17
41
  var _a, _b, _c, _d, _e;
18
42
  const annDesc = (_b = (_a = descriptions === null || descriptions === void 0 ? void 0 : descriptions.INFO) === null || _a === void 0 ? void 0 : _a.ANN) === null || _b === void 0 ? void 0 : _b.Description;
@@ -31,13 +55,30 @@ const VariantFeatureWidget = (0, mobx_react_1.observer)(function (props) {
31
55
  const { model } = props;
32
56
  const { featureData, descriptions } = model;
33
57
  const feat = JSON.parse(JSON.stringify(featureData));
34
- const { samples, ...rest } = feat;
58
+ const { samples, ALT, type = '', ...rest } = feat;
35
59
  return (react_1.default.createElement(material_1.Paper, { "data-testid": "variant-side-drawer" },
36
60
  react_1.default.createElement(BaseFeatureDetail_1.FeatureDetails, { feature: rest, descriptions: { ...variantFieldDescriptions_1.variantFieldDescriptions, ...descriptions }, ...props }),
37
61
  react_1.default.createElement(CsqPanel, { feature: rest, descriptions: descriptions }),
38
62
  react_1.default.createElement(AnnPanel, { feature: rest, descriptions: descriptions }),
39
- feat.type === 'breakend' ? (react_1.default.createElement(BreakendPanel_1.default, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = (0, vcf_1.parseBreakend)(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
40
- feat.type === 'translocation' ? (react_1.default.createElement(BreakendPanel_1.default, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
63
+ react_1.default.createElement(react_1.Suspense, { fallback: null },
64
+ type === 'breakend' ? (react_1.default.createElement(LaunchBreakendPanel, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = (0, vcf_1.parseBreakend)(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
65
+ type === 'translocation' ? (react_1.default.createElement(LaunchBreakendPanel, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
66
+ type === 'paired_feature' ? (react_1.default.createElement(LaunchBreakendPanel, { feature: feat, model: model, locStrings: [`${feat.mate.refName}:${feat.mate.start}`] })) : null,
67
+ type.includes('inversion') ||
68
+ type.includes('deletion') ||
69
+ type.includes('duplication') ||
70
+ type.includes('cnv') ||
71
+ type.includes('sv') ? (react_1.default.createElement(LaunchBreakendPanel, { feature: {
72
+ uniqueId: 'random',
73
+ refName: feat.refName,
74
+ start: feat.start,
75
+ end: feat.start + 1,
76
+ mate: {
77
+ refName: feat.refName,
78
+ start: feat.end,
79
+ end: feat.end + 1,
80
+ },
81
+ }, model: model, locStrings: [`${feat.refName}:${feat.end}`] })) : null),
41
82
  react_1.default.createElement(VariantSampleGrid_1.default, { feature: feat, ...props, descriptions: descriptions })));
42
83
  });
43
84
  exports.default = VariantFeatureWidget;
@@ -9,7 +9,7 @@ const altTypeToSO = {
9
9
  INS: 'insertion',
10
10
  DUP: 'duplication',
11
11
  INV: 'inversion',
12
- INVDUP: 'inverted duplication',
12
+ INVDUP: 'inverted_duplication',
13
13
  CNV: 'copy_number_variation',
14
14
  TRA: 'translocation',
15
15
  'DUP:TANDEM': 'tandem_duplication',
@@ -99,6 +99,12 @@ function getSOAndDescByExamination(ref, alt) {
99
99
  if (alt === '<DEL>') {
100
100
  return ['deletion', alt];
101
101
  }
102
+ if (alt === '<DUP>') {
103
+ return ['duplication', alt];
104
+ }
105
+ if (alt === '<CNV>') {
106
+ return ['cnv', alt];
107
+ }
102
108
  if (alt === '<INV>') {
103
109
  return ['inversion', alt];
104
110
  }
@@ -34,7 +34,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
34
34
  error: unknown;
35
35
  message: string | undefined;
36
36
  } & {
37
- readonly RenderingComponent: import("react").FC<{
37
+ readonly RenderingComponent: React.FC<{
38
38
  model: {
39
39
  id: string;
40
40
  type: string;
@@ -55,7 +55,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
55
55
  onHorizontalScroll?: () => void;
56
56
  blockState?: Record<string, any>;
57
57
  }>;
58
- readonly DisplayBlurb: import("react").FC<{
58
+ readonly DisplayBlurb: React.FC<{
59
59
  model: {
60
60
  id: string;
61
61
  type: string;
@@ -78,7 +78,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
78
78
  readonly parentTrack: any;
79
79
  renderProps(): any;
80
80
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
81
- readonly DisplayMessageComponent: undefined | import("react").FC<any>;
81
+ readonly DisplayMessageComponent: undefined | React.FC<any>;
82
82
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
83
83
  readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
84
84
  regionCannotBeRendered(): null;
@@ -89,7 +89,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
89
89
  reload(): void;
90
90
  } & {
91
91
  filled: boolean;
92
- reactElement: import("react").ReactElement | undefined;
92
+ reactElement: React.ReactElement | undefined;
93
93
  data: undefined;
94
94
  html: string | undefined;
95
95
  message: string;
@@ -109,7 +109,7 @@ declare const stateModelFactory: (configSchema: AnyConfigurationSchemaType) => i
109
109
  message: string;
110
110
  data: any;
111
111
  html: string;
112
- reactElement: import("react").ReactElement;
112
+ reactElement: React.ReactElement;
113
113
  renderingComponent: import("@jbrowse/core/util").AnyReactComponentType;
114
114
  }): void;
115
115
  renderError(error: unknown): void;
@@ -36,7 +36,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
36
36
  }, {
37
37
  renderInProgress: AbortController | undefined;
38
38
  filled: boolean;
39
- reactElement: import("react").ReactElement | undefined;
39
+ reactElement: React.ReactElement | undefined;
40
40
  features: Map<string, Feature> | undefined;
41
41
  layout: any;
42
42
  status: string;
@@ -47,10 +47,10 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
47
47
  model: {
48
48
  error?: unknown;
49
49
  reload: () => void;
50
- message: import("react").ReactNode;
50
+ message: React.ReactNode;
51
51
  filled?: boolean;
52
52
  status?: string;
53
- reactElement?: import("react").ReactElement;
53
+ reactElement?: React.ReactElement;
54
54
  };
55
55
  }) => import("react").JSX.Element | undefined;
56
56
  renderProps: any;
@@ -61,7 +61,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
61
61
  setLoading(abortController: AbortController): void;
62
62
  setMessage(messageText: string): void;
63
63
  setRendered(props: {
64
- reactElement: import("react").ReactElement;
64
+ reactElement: React.ReactElement;
65
65
  features: Map<string, Feature>;
66
66
  layout: any;
67
67
  maxHeightReached: boolean;
@@ -121,7 +121,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
121
121
  error: unknown;
122
122
  message: string | undefined;
123
123
  } & {
124
- readonly RenderingComponent: import("react").FC<{
124
+ readonly RenderingComponent: React.FC<{
125
125
  model: {
126
126
  id: string;
127
127
  type: string;
@@ -142,7 +142,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
142
142
  onHorizontalScroll?: () => void;
143
143
  blockState?: Record<string, any>;
144
144
  }>;
145
- readonly DisplayBlurb: import("react").FC<{
145
+ readonly DisplayBlurb: React.FC<{
146
146
  model: {
147
147
  id: string;
148
148
  type: string;
@@ -165,7 +165,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
165
165
  readonly parentTrack: any;
166
166
  renderProps(): any;
167
167
  readonly rendererType: import("@jbrowse/core/pluggableElementTypes").RendererType;
168
- readonly DisplayMessageComponent: undefined | import("react").FC<any>;
168
+ readonly DisplayMessageComponent: undefined | React.FC<any>;
169
169
  trackMenuItems(): import("@jbrowse/core/ui").MenuItem[];
170
170
  readonly viewMenuActions: import("@jbrowse/core/ui").MenuItem[];
171
171
  regionCannotBeRendered(): null;
@@ -211,13 +211,13 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
211
211
  featureIdUnderMouse: undefined | string;
212
212
  contextMenuFeature: undefined | Feature;
213
213
  } & {
214
+ readonly DisplayMessageComponent: import("react").FC<any> | undefined;
214
215
  readonly blockType: "dynamicBlocks" | "staticBlocks";
215
216
  readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
216
217
  } & {
217
218
  readonly renderDelay: number;
218
- readonly TooltipComponent: import("react").FC<any>;
219
+ readonly TooltipComponent: import("@jbrowse/core/util").AnyReactComponentType;
219
220
  readonly selectedFeatureId: string | undefined;
220
- readonly DisplayMessageComponent: undefined | import("react").FC<any>;
221
221
  } & {
222
222
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
223
223
  readonly featureUnderMouse: Feature | undefined;
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { Feature } from '@jbrowse/core/util';
3
3
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  import { Block, AnyRegion } from './Chord';
5
- declare const StructuralVariantChordsReactComponent: ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, onChordClick, }: {
5
+ declare const StructuralVariantChordsReactComponent: ({ features, config, blockDefinitions, radius, bezierRadius, displayModel, onChordClick, }: {
6
6
  features: Map<string, Feature>;
7
7
  radius: number;
8
8
  config: AnyConfigurationModel;
@@ -2,9 +2,8 @@ import React, { useMemo } from 'react';
2
2
  import { observer } from 'mobx-react';
3
3
  // locals
4
4
  import Chord from './Chord';
5
- const StructuralVariantChordsReactComponent = observer(function ({ features, config, displayModel, blockDefinitions, radius, bezierRadius, onChordClick, }) {
6
- const { id, selectedFeatureId } = displayModel || {};
7
- // make a map of refName -> blockDefinition
5
+ const StructuralVariantChordsReactComponent = observer(function ({ features, config, blockDefinitions, radius, bezierRadius, displayModel, onChordClick, }) {
6
+ const { selectedFeatureId } = displayModel || {};
8
7
  const blocksForRefsMemo = useMemo(() => {
9
8
  const blocksForRefs = {};
10
9
  for (const block of blockDefinitions) {
@@ -17,6 +16,10 @@ const StructuralVariantChordsReactComponent = observer(function ({ features, con
17
16
  }
18
17
  return blocksForRefs;
19
18
  }, [blockDefinitions]);
20
- return (React.createElement("g", { "data-testid": "structuralVariantChordRenderer" }, [...features.values()].map(feature => (React.createElement(Chord, { key: feature.id(), feature: feature, config: config, radius: radius, bezierRadius: bezierRadius, blocksForRefs: blocksForRefsMemo, selected: String(selectedFeatureId) === String(id), onClick: onChordClick })))));
19
+ return (React.createElement("g", { "data-testid": "structuralVariantChordRenderer" }, [...features.values()].map(feature => {
20
+ const id = feature.id();
21
+ const selected = String(selectedFeatureId) === String(id);
22
+ return (React.createElement(Chord, { key: id, feature: feature, config: config, radius: radius, bezierRadius: bezierRadius, blocksForRefs: blocksForRefsMemo, selected: selected, onClick: onChordClick }));
23
+ })));
21
24
  });
22
25
  export default StructuralVariantChordsReactComponent;
@@ -0,0 +1 @@
1
+ export { BreakendMultiLevelOptionDialog as default } from '@jbrowse/sv-core';
@@ -0,0 +1,2 @@
1
+ // re-exported for react lazy
2
+ export { BreakendMultiLevelOptionDialog as default } from '@jbrowse/sv-core';
@@ -0,0 +1 @@
1
+ export { BreakendSingleLevelOptionDialog as default } from '@jbrowse/sv-core';
@@ -0,0 +1,2 @@
1
+ // re-exported for react lazy
2
+ export { BreakendSingleLevelOptionDialog as default } from '@jbrowse/sv-core';
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export default function Checkbox2({ checked, disabled, label, onChange, }: {
3
+ checked: boolean;
4
+ disabled?: boolean;
5
+ label: string;
6
+ onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
7
+ }): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
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
+ export default function Checkbox2({ checked, disabled, label, onChange, }) {
10
+ const { classes } = useStyles();
11
+ return (React.createElement(FormControlLabel, { disabled: disabled, className: classes.block, control: React.createElement(Checkbox, { checked: checked, onChange: onChange }), label: label }));
12
+ }
@@ -3,14 +3,17 @@ import { Link, Typography } from '@mui/material';
3
3
  import { getEnv, getSession, SimpleFeature, } from '@jbrowse/core/util';
4
4
  import { BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
5
5
  // lazies
6
- const BreakendOptionDialog = lazy(() => import('./BreakendOptionDialog'));
6
+ const BreakendMultiLevelOptionDialog = lazy(() => import('./BreakendMultiLevelOptionDialog'));
7
+ const BreakendSingleLevelOptionDialog = lazy(() => import('./BreakendSingleLevelOptionDialog'));
7
8
  function LocStringList({ locStrings, model, }) {
8
9
  const session = getSession(model);
9
10
  return (React.createElement("div", null,
10
- React.createElement(Typography, null, "Link to linear view of breakend endpoints"),
11
+ React.createElement(Typography, null, "Navigate to breakend endpoint in linear view:"),
11
12
  React.createElement("ul", null, locStrings.map((locString, index) => (
12
13
  /* biome-ignore lint/suspicious/noArrayIndexKey: */
13
14
  React.createElement("li", { key: `${locString}-${index}` },
15
+ locString,
16
+ ' ',
14
17
  React.createElement(Link, { href: "#", onClick: event => {
15
18
  var _a;
16
19
  event.preventDefault();
@@ -27,21 +30,47 @@ function LocStringList({ locStrings, model, }) {
27
30
  console.error(e);
28
31
  session.notify(`${e}`);
29
32
  }
30
- } }, `LGV - ${locString}`)))))));
33
+ } }, "(LGV)")))))));
31
34
  }
32
35
  function LaunchBreakpointSplitViewPanel({ locStrings, model, feature, viewType, }) {
33
36
  const session = getSession(model);
34
37
  const simpleFeature = new SimpleFeature(feature);
35
38
  return (React.createElement("div", null,
36
- React.createElement(Typography, null, "Launch split views with breakend source and target"),
39
+ React.createElement(Typography, null, "Launch split view"),
37
40
  React.createElement("ul", null, locStrings.map(locString => (React.createElement("li", { key: JSON.stringify(locString) },
41
+ `${feature.refName}:${feature.start} // ${locString}`,
42
+ ' ',
38
43
  React.createElement(Link, { href: "#", onClick: event => {
39
44
  event.preventDefault();
40
45
  session.queueDialog(handleClose => [
41
- BreakendOptionDialog,
42
- { handleClose, model, feature: simpleFeature, viewType },
46
+ BreakendMultiLevelOptionDialog,
47
+ {
48
+ handleClose,
49
+ model,
50
+ feature: simpleFeature,
51
+ // @ts-expect-error
52
+ viewType,
53
+ view: model.view,
54
+ assemblyName: model.view.displayedRegions[0].assemblyName,
55
+ },
43
56
  ]);
44
- } }, `${feature.refName}:${feature.start} // ${locString} (split view)`)))))));
57
+ } }, "(top/bottom)"),
58
+ ' ',
59
+ React.createElement(Link, { href: "#", onClick: event => {
60
+ event.preventDefault();
61
+ session.queueDialog(handleClose => [
62
+ BreakendSingleLevelOptionDialog,
63
+ {
64
+ handleClose,
65
+ model,
66
+ feature: simpleFeature,
67
+ // @ts-expect-error
68
+ viewType,
69
+ view: model.view,
70
+ assemblyName: model.view.displayedRegions[0].assemblyName,
71
+ },
72
+ ]);
73
+ } }, "(single row)")))))));
45
74
  }
46
75
  export default function BreakendPanel(props) {
47
76
  const { model, locStrings, feature } = props;
@@ -1,13 +1,14 @@
1
- import React from 'react';
1
+ import React, { lazy, Suspense } from 'react';
2
2
  import { observer } from 'mobx-react';
3
3
  import { Paper } from '@mui/material';
4
4
  import { FeatureDetails } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
5
5
  import { parseBreakend } from '@gmod/vcf';
6
6
  // locals
7
7
  import VariantSampleGrid from './VariantSampleGrid';
8
- import BreakendPanel from './BreakendPanel';
9
8
  import VariantAnnotationTable from './VariantAnnotationTable';
10
9
  import { variantFieldDescriptions } from './variantFieldDescriptions';
10
+ // lazies
11
+ const LaunchBreakendPanel = lazy(() => import('./LaunchBreakendPanel'));
11
12
  function AnnPanel({ descriptions, feature, }) {
12
13
  var _a, _b, _c, _d, _e;
13
14
  const annDesc = (_b = (_a = descriptions === null || descriptions === void 0 ? void 0 : descriptions.INFO) === null || _a === void 0 ? void 0 : _a.ANN) === null || _b === void 0 ? void 0 : _b.Description;
@@ -26,13 +27,30 @@ const VariantFeatureWidget = observer(function (props) {
26
27
  const { model } = props;
27
28
  const { featureData, descriptions } = model;
28
29
  const feat = JSON.parse(JSON.stringify(featureData));
29
- const { samples, ...rest } = feat;
30
+ const { samples, ALT, type = '', ...rest } = feat;
30
31
  return (React.createElement(Paper, { "data-testid": "variant-side-drawer" },
31
32
  React.createElement(FeatureDetails, { feature: rest, descriptions: { ...variantFieldDescriptions, ...descriptions }, ...props }),
32
33
  React.createElement(CsqPanel, { feature: rest, descriptions: descriptions }),
33
34
  React.createElement(AnnPanel, { feature: rest, descriptions: descriptions }),
34
- feat.type === 'breakend' ? (React.createElement(BreakendPanel, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = parseBreakend(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
35
- feat.type === 'translocation' ? (React.createElement(BreakendPanel, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
35
+ React.createElement(Suspense, { fallback: null },
36
+ type === 'breakend' ? (React.createElement(LaunchBreakendPanel, { feature: feat, locStrings: feat.ALT.map((alt) => { var _a; return ((_a = parseBreakend(alt)) === null || _a === void 0 ? void 0 : _a.MatePosition) || ''; }), model: model })) : null,
37
+ type === 'translocation' ? (React.createElement(LaunchBreakendPanel, { feature: feat, model: model, locStrings: [`${feat.INFO.CHR2[0]}:${feat.INFO.END}`] })) : null,
38
+ type === 'paired_feature' ? (React.createElement(LaunchBreakendPanel, { feature: feat, model: model, locStrings: [`${feat.mate.refName}:${feat.mate.start}`] })) : null,
39
+ type.includes('inversion') ||
40
+ type.includes('deletion') ||
41
+ type.includes('duplication') ||
42
+ type.includes('cnv') ||
43
+ type.includes('sv') ? (React.createElement(LaunchBreakendPanel, { feature: {
44
+ uniqueId: 'random',
45
+ refName: feat.refName,
46
+ start: feat.start,
47
+ end: feat.start + 1,
48
+ mate: {
49
+ refName: feat.refName,
50
+ start: feat.end,
51
+ end: feat.end + 1,
52
+ },
53
+ }, model: model, locStrings: [`${feat.refName}:${feat.end}`] })) : null),
36
54
  React.createElement(VariantSampleGrid, { feature: feat, ...props, descriptions: descriptions })));
37
55
  });
38
56
  export default VariantFeatureWidget;
@@ -4,7 +4,7 @@ const altTypeToSO = {
4
4
  INS: 'insertion',
5
5
  DUP: 'duplication',
6
6
  INV: 'inversion',
7
- INVDUP: 'inverted duplication',
7
+ INVDUP: 'inverted_duplication',
8
8
  CNV: 'copy_number_variation',
9
9
  TRA: 'translocation',
10
10
  'DUP:TANDEM': 'tandem_duplication',
@@ -94,6 +94,12 @@ export function getSOAndDescByExamination(ref, alt) {
94
94
  if (alt === '<DEL>') {
95
95
  return ['deletion', alt];
96
96
  }
97
+ if (alt === '<DUP>') {
98
+ return ['duplication', alt];
99
+ }
100
+ if (alt === '<CNV>') {
101
+ return ['cnv', alt];
102
+ }
97
103
  if (alt === '<INV>') {
98
104
  return ['inversion', alt];
99
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-variants",
3
- "version": "2.15.0",
3
+ "version": "2.15.1",
4
4
  "description": "JBrowse 2 variant adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -40,6 +40,7 @@
40
40
  "@gmod/bgzf-filehandle": "^1.4.3",
41
41
  "@gmod/tabix": "^1.5.6",
42
42
  "@gmod/vcf": "^5.0.9",
43
+ "@jbrowse/sv-core": "^2.15.1",
43
44
  "@mui/icons-material": "^6.0.0",
44
45
  "@mui/x-data-grid": "^7.0.0",
45
46
  "generic-filehandle": "^3.0.0"
@@ -62,5 +63,5 @@
62
63
  "distModule": "esm/index.js",
63
64
  "srcModule": "src/index.ts",
64
65
  "module": "esm/index.js",
65
- "gitHead": "87eeb1fbf8311dbf88d5e75b5a265f03beffdda8"
66
+ "gitHead": "86ed70124fc5a0b1161266659d1ca9f8796bf3fe"
66
67
  }
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { Feature } from '@jbrowse/core/util';
3
- import { ViewType } from '@jbrowse/core/pluggableElementTypes';
4
- import { VariantFeatureWidgetModel } from './stateModelFactory';
5
- declare const BreakendOptionDialog: ({ model, handleClose, feature, viewType, }: {
6
- model: VariantFeatureWidgetModel;
7
- handleClose: () => void;
8
- feature: Feature;
9
- viewType: ViewType;
10
- }) => React.JSX.Element;
11
- export default BreakendOptionDialog;
@@ -1,95 +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 mobx_state_tree_1 = require("mobx-state-tree");
31
- const ui_1 = require("@jbrowse/core/ui");
32
- const util_1 = require("@jbrowse/core/util");
33
- const useStyles = (0, mui_1.makeStyles)()({
34
- block: {
35
- display: 'block',
36
- },
37
- });
38
- function stripIds(arr) {
39
- return arr.map(({ id, displays, ...rest }) => ({
40
- ...rest,
41
- displays: displays.map(({ id, ...rest }) => rest),
42
- }));
43
- }
44
- function Checkbox2({ checked, label, onChange, }) {
45
- const { classes } = useStyles();
46
- 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 }));
47
- }
48
- const BreakendOptionDialog = (0, mobx_react_1.observer)(function ({ model, handleClose, feature, viewType, }) {
49
- const [copyTracks, setCopyTracks] = (0, react_1.useState)(true);
50
- const [mirror, setMirror] = (0, react_1.useState)(true);
51
- return (react_1.default.createElement(ui_1.Dialog, { open: true, onClose: handleClose, title: "Breakpoint split view options" },
52
- react_1.default.createElement(material_1.DialogContent, null,
53
- react_1.default.createElement(Checkbox2, { checked: copyTracks, onChange: event => {
54
- setCopyTracks(event.target.checked);
55
- }, label: "Copy tracks into the new view" }),
56
- react_1.default.createElement(Checkbox2, { checked: mirror, onChange: event => {
57
- setMirror(event.target.checked);
58
- }, label: "Mirror tracks vertically in vertically stacked view" })),
59
- react_1.default.createElement(material_1.DialogActions, null,
60
- react_1.default.createElement(material_1.Button, { onClick: () => {
61
- const { view } = model;
62
- const session = (0, util_1.getSession)(model);
63
- try {
64
- // @ts-expect-error
65
- const viewSnapshot = viewType.snapshotFromBreakendFeature(feature, view);
66
- const [view1, view2] = viewSnapshot.views;
67
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
68
- const viewTracks = (0, mobx_state_tree_1.getSnapshot)(view.tracks);
69
- session.addView('BreakpointSplitView', {
70
- ...viewSnapshot,
71
- views: [
72
- {
73
- ...view1,
74
- tracks: stripIds(viewTracks),
75
- offsetPx: view1.offsetPx - view.width / 2 + 100,
76
- },
77
- {
78
- ...view2,
79
- tracks: stripIds(mirror ? [...viewTracks].reverse() : viewTracks),
80
- offsetPx: view2.offsetPx - view.width / 2 + 100,
81
- },
82
- ],
83
- });
84
- }
85
- catch (e) {
86
- console.error(e);
87
- session.notify(`${e}`);
88
- }
89
- handleClose();
90
- }, variant: "contained", color: "primary", autoFocus: true }, "OK"),
91
- react_1.default.createElement(material_1.Button, { onClick: () => {
92
- handleClose();
93
- }, color: "secondary", variant: "contained" }, "Cancel"))));
94
- });
95
- exports.default = BreakendOptionDialog;
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- import { Feature } from '@jbrowse/core/util';
3
- import { ViewType } from '@jbrowse/core/pluggableElementTypes';
4
- import { VariantFeatureWidgetModel } from './stateModelFactory';
5
- declare const BreakendOptionDialog: ({ model, handleClose, feature, viewType, }: {
6
- model: VariantFeatureWidgetModel;
7
- handleClose: () => void;
8
- feature: Feature;
9
- viewType: ViewType;
10
- }) => React.JSX.Element;
11
- export default BreakendOptionDialog;
@@ -1,70 +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 { getSnapshot } from 'mobx-state-tree';
6
- import { Dialog } from '@jbrowse/core/ui';
7
- import { getSession } from '@jbrowse/core/util';
8
- const useStyles = makeStyles()({
9
- block: {
10
- display: 'block',
11
- },
12
- });
13
- function stripIds(arr) {
14
- return arr.map(({ id, displays, ...rest }) => ({
15
- ...rest,
16
- displays: displays.map(({ id, ...rest }) => rest),
17
- }));
18
- }
19
- function Checkbox2({ checked, label, onChange, }) {
20
- const { classes } = useStyles();
21
- return (React.createElement(FormControlLabel, { className: classes.block, control: React.createElement(Checkbox, { checked: checked, onChange: onChange }), label: label }));
22
- }
23
- const BreakendOptionDialog = observer(function ({ model, handleClose, feature, viewType, }) {
24
- const [copyTracks, setCopyTracks] = useState(true);
25
- const [mirror, setMirror] = useState(true);
26
- return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Breakpoint split view options" },
27
- React.createElement(DialogContent, null,
28
- React.createElement(Checkbox2, { checked: copyTracks, onChange: event => {
29
- setCopyTracks(event.target.checked);
30
- }, label: "Copy tracks into the new view" }),
31
- React.createElement(Checkbox2, { checked: mirror, onChange: event => {
32
- setMirror(event.target.checked);
33
- }, label: "Mirror tracks vertically in vertically stacked view" })),
34
- React.createElement(DialogActions, null,
35
- React.createElement(Button, { onClick: () => {
36
- const { view } = model;
37
- const session = getSession(model);
38
- try {
39
- // @ts-expect-error
40
- const viewSnapshot = viewType.snapshotFromBreakendFeature(feature, view);
41
- const [view1, view2] = viewSnapshot.views;
42
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
43
- const viewTracks = getSnapshot(view.tracks);
44
- session.addView('BreakpointSplitView', {
45
- ...viewSnapshot,
46
- views: [
47
- {
48
- ...view1,
49
- tracks: stripIds(viewTracks),
50
- offsetPx: view1.offsetPx - view.width / 2 + 100,
51
- },
52
- {
53
- ...view2,
54
- tracks: stripIds(mirror ? [...viewTracks].reverse() : viewTracks),
55
- offsetPx: view2.offsetPx - view.width / 2 + 100,
56
- },
57
- ],
58
- });
59
- }
60
- catch (e) {
61
- console.error(e);
62
- session.notify(`${e}`);
63
- }
64
- handleClose();
65
- }, variant: "contained", color: "primary", autoFocus: true }, "OK"),
66
- React.createElement(Button, { onClick: () => {
67
- handleClose();
68
- }, color: "secondary", variant: "contained" }, "Cancel"))));
69
- });
70
- export default BreakendOptionDialog;