@jbrowse/plugin-alignments 2.14.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 (66) hide show
  1. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +29 -3
  2. package/dist/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.d.ts +1 -0
  3. package/dist/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.js +6 -0
  4. package/dist/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.d.ts +1 -0
  5. package/dist/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.js +6 -0
  6. package/dist/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.d.ts +9 -0
  7. package/dist/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.js +92 -0
  8. package/dist/AlignmentsFeatureDetail/{LaunchBreakpointSplitViewPanel.js → LaunchSupplementaryAlignmentBreakpointSplitViewPanel.js} +43 -18
  9. package/dist/AlignmentsFeatureDetail/{SuppAlignments.d.ts → LinkedPairedAlignments.d.ts} +0 -1
  10. package/dist/AlignmentsFeatureDetail/{SuppAlignments.js → LinkedPairedAlignments.js} +3 -6
  11. package/dist/AlignmentsFeatureDetail/SupplementaryAlignments.d.ts +8 -0
  12. package/dist/AlignmentsFeatureDetail/SupplementaryAlignments.js +26 -0
  13. package/{esm/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts → dist/AlignmentsFeatureDetail/SupplementaryAlignmentsLocStrings.d.ts} +1 -1
  14. package/dist/AlignmentsFeatureDetail/{SuppAlignmentsLocStrings.js → SupplementaryAlignmentsLocStrings.js} +2 -2
  15. package/dist/LinearAlignmentsDisplay/models/alignmentsModel.js +1 -2
  16. package/dist/LinearAlignmentsDisplay/models/util.js +2 -4
  17. package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +20 -19
  18. package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +35 -19
  19. package/dist/LinearPileupDisplay/components/SetMaxHeightDialog.js +2 -2
  20. package/dist/LinearPileupDisplay/model.d.ts +29 -26
  21. package/dist/LinearPileupDisplay/model.js +33 -28
  22. package/dist/LinearReadArcsDisplay/index.js +25 -2
  23. package/dist/LinearReadCloudDisplay/index.js +25 -2
  24. package/dist/LinearSNPCoverageDisplay/models/model.d.ts +4 -4
  25. package/dist/LinearSNPCoverageDisplay/models/model.js +27 -2
  26. package/dist/MismatchParser/index.js +1 -1
  27. package/dist/PileupRenderer/PileupRenderer.d.ts +1 -1
  28. package/dist/shared/color.d.ts +3 -0
  29. package/dist/shared/color.js +21 -10
  30. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +6 -3
  31. package/esm/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.d.ts +1 -0
  32. package/esm/AlignmentsFeatureDetail/BreakendMultiLevelOptionDialog.js +2 -0
  33. package/esm/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.d.ts +1 -0
  34. package/esm/AlignmentsFeatureDetail/BreakendSingleLevelOptionDialog.js +2 -0
  35. package/esm/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.d.ts +9 -0
  36. package/esm/AlignmentsFeatureDetail/LaunchPairedEndBreakpointSplitViewPanel.js +66 -0
  37. package/esm/AlignmentsFeatureDetail/LaunchSupplementaryAlignmentBreakpointSplitViewPanel.js +84 -0
  38. package/esm/AlignmentsFeatureDetail/{SuppAlignments.d.ts → LinkedPairedAlignments.d.ts} +0 -1
  39. package/esm/AlignmentsFeatureDetail/LinkedPairedAlignments.js +17 -0
  40. package/esm/AlignmentsFeatureDetail/SupplementaryAlignments.d.ts +8 -0
  41. package/esm/AlignmentsFeatureDetail/{SuppAlignments.js → SupplementaryAlignments.js} +4 -4
  42. package/{dist/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts → esm/AlignmentsFeatureDetail/SupplementaryAlignmentsLocStrings.d.ts} +1 -1
  43. package/esm/AlignmentsFeatureDetail/{SuppAlignmentsLocStrings.js → SupplementaryAlignmentsLocStrings.js} +1 -1
  44. package/esm/LinearAlignmentsDisplay/models/alignmentsModel.js +1 -2
  45. package/esm/LinearAlignmentsDisplay/models/util.js +2 -4
  46. package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +20 -19
  47. package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +36 -20
  48. package/esm/LinearPileupDisplay/components/SetMaxHeightDialog.js +2 -2
  49. package/esm/LinearPileupDisplay/model.d.ts +29 -26
  50. package/esm/LinearPileupDisplay/model.js +33 -28
  51. package/esm/LinearReadArcsDisplay/index.js +2 -2
  52. package/esm/LinearReadCloudDisplay/index.js +2 -2
  53. package/esm/LinearSNPCoverageDisplay/models/model.d.ts +4 -4
  54. package/esm/LinearSNPCoverageDisplay/models/model.js +3 -1
  55. package/esm/MismatchParser/index.js +1 -1
  56. package/esm/PileupRenderer/PileupRenderer.d.ts +1 -1
  57. package/esm/shared/color.d.ts +3 -0
  58. package/esm/shared/color.js +20 -10
  59. package/package.json +5 -4
  60. package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +0 -12
  61. package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.js +0 -97
  62. package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +0 -12
  63. package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.js +0 -72
  64. package/esm/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.js +0 -59
  65. /package/dist/AlignmentsFeatureDetail/{LaunchBreakpointSplitViewPanel.d.ts → LaunchSupplementaryAlignmentBreakpointSplitViewPanel.d.ts} +0 -0
  66. /package/esm/AlignmentsFeatureDetail/{LaunchBreakpointSplitViewPanel.d.ts → LaunchSupplementaryAlignmentBreakpointSplitViewPanel.d.ts} +0 -0
@@ -223,59 +223,65 @@ function stateModelFactory(configSchema) {
223
223
  return [
224
224
  ...superTrackMenuItems(),
225
225
  {
226
- label: 'Color by...',
227
- icon: ColorLensIcon,
226
+ label: 'Sort by...',
227
+ icon: SortIcon,
228
+ disabled: self.showSoftClipping,
228
229
  subMenu: [
229
- {
230
- label: 'Pair orientation',
230
+ ...['Start location', 'Read strand', 'Base pair'].map(option => ({
231
+ label: option,
231
232
  onClick: () => {
232
- self.setColorScheme({ type: 'pairOrientation' });
233
+ self.setSortedBy(option);
233
234
  },
234
- },
235
+ })),
235
236
  {
236
- label: 'Modifications or methylation',
237
+ label: 'Sort by tag...',
237
238
  onClick: () => {
238
- getSession(self).queueDialog(doneCallback => [
239
- ModificationsDialog,
240
- { model: self, handleClose: doneCallback },
239
+ getSession(self).queueDialog(handleClose => [
240
+ SortByTagDialog,
241
+ {
242
+ model: self,
243
+ handleClose,
244
+ },
241
245
  ]);
242
246
  },
243
247
  },
244
248
  {
245
- label: 'Insert size',
249
+ label: 'Clear sort',
246
250
  onClick: () => {
247
- self.setColorScheme({ type: 'insertSize' });
251
+ self.clearSelected();
248
252
  },
249
253
  },
250
- ...superColorSchemeSubMenuItems(),
251
254
  ],
252
255
  },
253
256
  {
254
- label: 'Sort by...',
255
- icon: SortIcon,
256
- disabled: self.showSoftClipping,
257
+ label: 'Color by...',
258
+ icon: ColorLensIcon,
257
259
  subMenu: [
258
- ...['Start location', 'Read strand', 'Base pair'].map(option => ({
259
- label: option,
260
+ {
261
+ label: 'Pair orientation',
260
262
  onClick: () => {
261
- self.setSortedBy(option);
263
+ self.setColorScheme({ type: 'pairOrientation' });
262
264
  },
263
- })),
265
+ },
264
266
  {
265
- label: 'Sort by tag...',
267
+ label: 'Modifications or methylation',
266
268
  onClick: () => {
267
- getSession(self).queueDialog(handleClose => [
268
- SortByTagDialog,
269
- { model: self, handleClose },
269
+ getSession(self).queueDialog(doneCallback => [
270
+ ModificationsDialog,
271
+ {
272
+ model: self,
273
+ handleClose: doneCallback,
274
+ },
270
275
  ]);
271
276
  },
272
277
  },
273
278
  {
274
- label: 'Clear sort',
279
+ label: 'Insert size',
275
280
  onClick: () => {
276
- self.clearSelected();
281
+ self.setColorScheme({ type: 'insertSize' });
277
282
  },
278
283
  },
284
+ ...superColorSchemeSubMenuItems(),
279
285
  ],
280
286
  },
281
287
  {
@@ -321,8 +327,7 @@ function stateModelFactory(configSchema) {
321
327
  if (!self.autorunReady) {
322
328
  return;
323
329
  }
324
- const { bpPerPx } = view;
325
- self.setCurrSortBpPerPx(bpPerPx);
330
+ self.setCurrSortBpPerPx(view.bpPerPx);
326
331
  }, { delay: 1000 });
327
332
  createAutorun(self, async () => {
328
333
  const { rpcManager } = getSession(self);
@@ -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
  }
@@ -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: import("react").ReactElement | undefined;
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: import("react").ReactNode;
47
+ message: React.ReactNode;
48
48
  filled?: boolean;
49
49
  status?: string;
50
- reactElement?: import("react").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: import("react").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
  /**
@@ -61,7 +61,7 @@ export function cigarToMismatches(ops, seq, ref, qual) {
61
61
  }
62
62
  else if (op === 'X') {
63
63
  const r = (seq === null || seq === void 0 ? void 0 : seq.slice(soffset, soffset + len)) || [];
64
- const q = (qual === null || qual === void 0 ? void 0 : qual.slice(soffset, soffset + len)) || [];
64
+ const q = (qual === null || qual === void 0 ? void 0 : qual.subarray(soffset, soffset + len)) || [];
65
65
  for (let j = 0; j < len; j++) {
66
66
  mismatches.push({
67
67
  start: roffset + j,
@@ -49,7 +49,7 @@ export default class PileupRenderer extends BoxRendererType {
49
49
  height: number;
50
50
  width: number;
51
51
  maxHeightReached: boolean;
52
- reactElement: import("react").JSX.Element;
52
+ reactElement: React.JSX.Element;
53
53
  html?: string;
54
54
  } | {
55
55
  features: Map<any, any>;
@@ -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];
@@ -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
- return undefined;
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 (getPairedInsertSizeColor(f1, f2, stats) || getPairedOrientationColor(f1));
67
+ return (getPairedOrientationColorOrDefault(f1) ||
68
+ getPairedInsertSizeColor(f1, f2, stats) ||
69
+ defaultColor);
63
70
  }
64
- export function getPairedOrientationColor(f) {
71
+ export function getPairedOrientationColorOrDefault(f) {
65
72
  const type = orientationTypes.fr;
66
- const type2 = pairMap[type[f.pair_orientation || '']];
67
- return [
68
- fillColor[type2] || fillColor.color_unknown,
69
- strokeColor[type2] || strokeColor.color_unknown,
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.14.0",
3
+ "version": "2.15.1",
4
4
  "description": "JBrowse 2 alignments adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -38,7 +38,8 @@
38
38
  "dependencies": {
39
39
  "@gmod/bam": "^2.0.0",
40
40
  "@gmod/cram": "^3.0.3",
41
- "@mui/icons-material": "^5.0.1",
41
+ "@jbrowse/sv-core": "^2.15.1",
42
+ "@mui/icons-material": "^6.0.0",
42
43
  "canvas2svg": "^1.0.16",
43
44
  "clone": "^2.1.2",
44
45
  "copy-to-clipboard": "^3.3.1",
@@ -49,7 +50,7 @@
49
50
  "@jbrowse/core": "^2.0.0",
50
51
  "@jbrowse/plugin-linear-genome-view": "^2.0.0",
51
52
  "@jbrowse/plugin-wiggle": "^2.0.0",
52
- "@mui/material": "^5.0.0",
53
+ "@mui/material": "^6.0.0",
53
54
  "mobx": "^6.0.0",
54
55
  "mobx-react": "^9.0.0",
55
56
  "mobx-state-tree": "^5.0.0",
@@ -63,5 +64,5 @@
63
64
  "distModule": "esm/index.js",
64
65
  "srcModule": "src/index.ts",
65
66
  "module": "esm/index.js",
66
- "gitHead": "9fb8231d932db40adf0a283081765431756c66ff"
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
- }