@jbrowse/plugin-alignments 2.10.1 → 2.10.2

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 (81) hide show
  1. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
  2. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +10 -113
  3. package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +12 -0
  4. package/dist/AlignmentsFeatureDetail/BreakendOptionDialog.js +89 -0
  5. package/dist/AlignmentsFeatureDetail/Formatter.d.ts +4 -0
  6. package/dist/AlignmentsFeatureDetail/Formatter.js +47 -0
  7. package/dist/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.d.ts +9 -0
  8. package/dist/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.js +92 -0
  9. package/dist/AlignmentsFeatureDetail/PairLink.d.ts +6 -0
  10. package/dist/AlignmentsFeatureDetail/PairLink.js +16 -0
  11. package/dist/AlignmentsFeatureDetail/SuppAlignments.d.ts +8 -0
  12. package/dist/AlignmentsFeatureDetail/SuppAlignments.js +26 -0
  13. package/dist/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts +6 -0
  14. package/dist/AlignmentsFeatureDetail/{AlignmentsFeatureSuppAligns.js → SuppAlignmentsLocStrings.js} +8 -7
  15. package/dist/AlignmentsFeatureDetail/configSchema.d.ts +1 -0
  16. package/dist/AlignmentsFeatureDetail/configSchema.js +5 -0
  17. package/dist/AlignmentsFeatureDetail/getSAFeatures.d.ts +23 -0
  18. package/dist/AlignmentsFeatureDetail/getSAFeatures.js +41 -0
  19. package/dist/AlignmentsFeatureDetail/index.d.ts +1 -50
  20. package/dist/AlignmentsFeatureDetail/index.js +6 -17
  21. package/dist/AlignmentsFeatureDetail/launchBreakpointSplitView.d.ts +22 -0
  22. package/dist/AlignmentsFeatureDetail/launchBreakpointSplitView.js +50 -0
  23. package/dist/AlignmentsFeatureDetail/stateModelFactory.d.ts +51 -0
  24. package/dist/AlignmentsFeatureDetail/stateModelFactory.js +12 -0
  25. package/dist/AlignmentsFeatureDetail/tagInfo.d.ts +63 -0
  26. package/dist/AlignmentsFeatureDetail/tagInfo.js +66 -0
  27. package/dist/BamAdapter/BamAdapter.js +3 -1
  28. package/dist/CramAdapter/CramAdapter.js +3 -1
  29. package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +20 -20
  30. package/dist/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +8 -8
  31. package/dist/LinearPileupDisplay/model.d.ts +15 -24
  32. package/dist/LinearPileupDisplay/model.js +4 -4
  33. package/dist/LinearReadArcsDisplay/model.d.ts +8 -8
  34. package/dist/LinearReadArcsDisplay/model.js +2 -2
  35. package/dist/LinearReadCloudDisplay/model.d.ts +13 -7
  36. package/dist/LinearReadCloudDisplay/model.js +2 -2
  37. package/dist/LinearSNPCoverageDisplay/components/Tooltip.js +5 -2
  38. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.d.ts +2 -2
  39. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureDetail.js +12 -92
  40. package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.d.ts +12 -0
  41. package/esm/AlignmentsFeatureDetail/BreakendOptionDialog.js +64 -0
  42. package/esm/AlignmentsFeatureDetail/Formatter.d.ts +4 -0
  43. package/esm/AlignmentsFeatureDetail/Formatter.js +18 -0
  44. package/esm/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.d.ts +9 -0
  45. package/esm/AlignmentsFeatureDetail/LaunchBreakpointSplitViewPanel.js +66 -0
  46. package/esm/AlignmentsFeatureDetail/PairLink.d.ts +6 -0
  47. package/esm/AlignmentsFeatureDetail/PairLink.js +10 -0
  48. package/esm/AlignmentsFeatureDetail/SuppAlignments.d.ts +8 -0
  49. package/esm/AlignmentsFeatureDetail/SuppAlignments.js +20 -0
  50. package/esm/AlignmentsFeatureDetail/SuppAlignmentsLocStrings.d.ts +6 -0
  51. package/esm/AlignmentsFeatureDetail/{AlignmentsFeatureSuppAligns.js → SuppAlignmentsLocStrings.js} +7 -6
  52. package/esm/AlignmentsFeatureDetail/configSchema.d.ts +1 -0
  53. package/esm/AlignmentsFeatureDetail/configSchema.js +2 -0
  54. package/esm/AlignmentsFeatureDetail/getSAFeatures.d.ts +23 -0
  55. package/esm/AlignmentsFeatureDetail/getSAFeatures.js +37 -0
  56. package/esm/AlignmentsFeatureDetail/index.d.ts +1 -50
  57. package/esm/AlignmentsFeatureDetail/index.js +4 -13
  58. package/esm/AlignmentsFeatureDetail/launchBreakpointSplitView.d.ts +22 -0
  59. package/esm/AlignmentsFeatureDetail/launchBreakpointSplitView.js +46 -0
  60. package/esm/AlignmentsFeatureDetail/stateModelFactory.d.ts +51 -0
  61. package/esm/AlignmentsFeatureDetail/stateModelFactory.js +8 -0
  62. package/esm/AlignmentsFeatureDetail/tagInfo.d.ts +63 -0
  63. package/esm/AlignmentsFeatureDetail/tagInfo.js +63 -0
  64. package/esm/BamAdapter/BamAdapter.js +3 -1
  65. package/esm/CramAdapter/CramAdapter.js +3 -1
  66. package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.d.ts +20 -20
  67. package/esm/LinearPileupDisplay/SharedLinearPileupDisplayMixin.js +8 -8
  68. package/esm/LinearPileupDisplay/model.d.ts +15 -24
  69. package/esm/LinearPileupDisplay/model.js +4 -4
  70. package/esm/LinearReadArcsDisplay/model.d.ts +8 -8
  71. package/esm/LinearReadArcsDisplay/model.js +2 -2
  72. package/esm/LinearReadCloudDisplay/model.d.ts +13 -7
  73. package/esm/LinearReadCloudDisplay/model.js +2 -2
  74. package/esm/LinearSNPCoverageDisplay/components/Tooltip.js +5 -2
  75. package/package.json +2 -2
  76. package/dist/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.d.ts +0 -6
  77. package/esm/AlignmentsFeatureDetail/AlignmentsFeatureSuppAligns.d.ts +0 -6
  78. /package/dist/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.d.ts → Flags.d.ts} +0 -0
  79. /package/dist/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.js → Flags.js} +0 -0
  80. /package/esm/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.d.ts → Flags.d.ts} +0 -0
  81. /package/esm/AlignmentsFeatureDetail/{AlignmentsFeatureFlags.js → Flags.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { IAnyStateTreeNode } from 'mobx-state-tree';
2
+ import { AlignmentFeatureWidgetModel } from './stateModelFactory';
3
3
  declare const AlignmentsFeatureDetails: (props: {
4
- model: IAnyStateTreeNode;
4
+ model: AlignmentFeatureWidgetModel;
5
5
  }) => React.JSX.Element;
6
6
  export default AlignmentsFeatureDetails;
@@ -1,125 +1,22 @@
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
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
- const react_1 = __importStar(require("react"));
6
+ const react_1 = __importDefault(require("react"));
30
7
  const material_1 = require("@mui/material");
31
8
  const mobx_react_1 = require("mobx-react");
32
- const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
33
9
  const clone_1 = __importDefault(require("clone"));
34
10
  const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
35
11
  // locals
36
12
  const util_1 = require("./util");
37
- const AlignmentsFeatureSuppAligns_1 = __importDefault(require("./AlignmentsFeatureSuppAligns"));
38
- const AlignmentsFeatureFlags_1 = __importDefault(require("./AlignmentsFeatureFlags"));
13
+ const tagInfo_1 = require("./tagInfo");
14
+ // local components
15
+ const SuppAlignments_1 = __importDefault(require("./SuppAlignments"));
16
+ const Flags_1 = __importDefault(require("./Flags"));
17
+ const PairLink_1 = __importDefault(require("./PairLink"));
18
+ const Formatter_1 = __importDefault(require("./Formatter"));
39
19
  const omit = ['clipPos', 'flags'];
40
- const tags = {
41
- AM: 'The smallest template-independent mapping quality in the template',
42
- AS: 'Alignment score generated by aligner',
43
- BC: 'Barcode sequence identifying the sample',
44
- BQ: 'Offset to base alignment quality (BAQ)',
45
- BZ: 'Phred quality of the unique molecular barcode bases in the {OX} tag',
46
- CB: 'Cell identifier',
47
- CC: 'Reference name of the next hit',
48
- CM: 'Edit distance between the color sequence and the color reference (see also {NM})',
49
- CO: 'Free-text comments',
50
- CP: 'Leftmost coordinate of the next hit',
51
- CQ: 'Color read base qualities',
52
- CR: 'Cellular barcode sequence bases (uncorrected)',
53
- CS: 'Color read sequence',
54
- CT: 'Complete read annotation tag, used for consensus annotation dummy features',
55
- CY: 'Phred quality of the cellular barcode sequence in the {CR} tag',
56
- E2: 'The 2nd most likely base calls',
57
- FI: 'The index of segment in the template',
58
- FS: 'Segment suffix',
59
- FZ: 'Flow signal intensities',
60
- GC: 'Reserved for backwards compatibility reasons',
61
- GQ: 'Reserved for backwards compatibility reasons',
62
- GS: 'Reserved for backwards compatibility reasons',
63
- H0: 'Number of perfect hits',
64
- H1: 'Number of 1-difference hits (see also {NM})',
65
- H2: 'Number of 2-difference hits',
66
- HI: 'Query hit index',
67
- IH: 'Query hit total count',
68
- LB: 'Library',
69
- MC: 'CIGAR string for mate/next segment',
70
- MD: 'String encoding mismatched and deleted reference bases',
71
- MF: 'Reserved for backwards compatibility reasons',
72
- MI: 'Molecular identifier; a string that uniquely identifies the molecule from which the record was derived',
73
- ML: 'Base modification probabilities',
74
- MM: 'Base modifications / methylation ',
75
- MQ: 'Mapping quality of the mate/next segment',
76
- NH: 'Number of reported alignments that contain the query in the current record',
77
- NM: 'Edit distance to the reference',
78
- OA: 'Original alignment',
79
- OC: 'Original CIGAR (deprecated; use {OA} instead)',
80
- OP: 'Original mapping position (deprecated; use {OA} instead)',
81
- OQ: 'Original base quality',
82
- OX: 'Original unique molecular barcode bases',
83
- PG: 'Program',
84
- PQ: 'Phred likelihood of the template',
85
- PT: 'Read annotations for parts of the padded read sequence',
86
- PU: 'Platform unit',
87
- Q2: 'Phred quality of the mate/next segment sequence in the {R2} tag',
88
- QT: 'Phred quality of the sample barcode sequence in the {BC} tag',
89
- QX: 'Quality score of the unique molecular identifier in the {RX} tag',
90
- R2: 'Sequence of the mate/next segment in the template',
91
- RG: 'Read group',
92
- RT: 'Reserved for backwards compatibility reasons',
93
- RX: 'Sequence bases of the (possibly corrected) unique molecular identifier',
94
- S2: 'Reserved for backwards compatibility reasons',
95
- SA: 'Other canonical alignments in a chimeric alignment',
96
- SM: 'Template-independent mapping quality',
97
- SQ: 'Reserved for backwards compatibility reasons',
98
- TC: 'The number of segments in the template',
99
- TS: 'Transcript strand',
100
- U2: 'Phred probability of the 2nd call being wrong conditional on the best being wrong',
101
- UQ: 'Phred likelihood of the segment, conditional on the mapping being correct',
102
- };
103
- function Formatter({ value }) {
104
- const [show, setShow] = (0, react_1.useState)(false);
105
- const [copied, setCopied] = (0, react_1.useState)(false);
106
- const display = String(value);
107
- return display.length > 100 ? (react_1.default.createElement(react_1.default.Fragment, null,
108
- react_1.default.createElement("button", { type: "button", onClick: () => {
109
- (0, copy_to_clipboard_1.default)(display);
110
- setCopied(true);
111
- setTimeout(() => setCopied(false), 700);
112
- } }, copied ? 'Copied to clipboard' : 'Copy'),
113
- react_1.default.createElement("button", { type: "button", onClick: () => setShow(val => !val) }, show ? 'Show less' : 'Show more'),
114
- react_1.default.createElement("div", null, show ? display : `${display.slice(0, 100)}...`))) : (react_1.default.createElement("div", null, display));
115
- }
116
- function PairLink({ locString, model, }) {
117
- return (react_1.default.createElement(material_1.Link, { onClick: event => {
118
- event.preventDefault();
119
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
120
- (0, util_1.navToLoc)(locString, model);
121
- }, href: "#" }, locString));
122
- }
123
20
  const AlignmentsFeatureDetails = (0, mobx_react_1.observer)(function (props) {
124
21
  const { model } = props;
125
22
  const feat = (0, clone_1.default)(model.featureData);
@@ -127,8 +24,8 @@ const AlignmentsFeatureDetails = (0, mobx_react_1.observer)(function (props) {
127
24
  return (react_1.default.createElement(material_1.Paper, { "data-testid": "alignment-side-drawer" },
128
25
  react_1.default.createElement(BaseFeatureDetail_1.FeatureDetails, { ...props, omit: omit,
129
26
  // @ts-expect-error
130
- descriptions: { ...tags, tags }, feature: feat, formatter: (value, key) => key === 'next_segment_position' ? (react_1.default.createElement(PairLink, { model: model, locString: value })) : (react_1.default.createElement(Formatter, { value: value })) }),
131
- SA ? react_1.default.createElement(AlignmentsFeatureSuppAligns_1.default, { model: model, tag: SA }) : null,
132
- feat.flags !== undefined ? (react_1.default.createElement(AlignmentsFeatureFlags_1.default, { feature: feat, ...props })) : null));
27
+ descriptions: { ...tagInfo_1.tags, tags: tagInfo_1.tags }, feature: feat, formatter: (value, key) => key === 'next_segment_position' ? (react_1.default.createElement(PairLink_1.default, { model: model, locString: value })) : (react_1.default.createElement(Formatter_1.default, { value: value })) }),
28
+ SA ? react_1.default.createElement(SuppAlignments_1.default, { model: model, tag: SA, feature: feat }) : null,
29
+ feat.flags !== undefined ? react_1.default.createElement(Flags_1.default, { feature: feat, ...props }) : null));
133
30
  });
134
31
  exports.default = AlignmentsFeatureDetails;
@@ -0,0 +1,12 @@
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;
@@ -0,0 +1,89 @@
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 => setCopyTracks(event.target.checked), label: "Copy tracks into the new view" }),
55
+ react_1.default.createElement(Checkbox2, { checked: mirror, onChange: event => setMirror(event.target.checked), label: "Mirror tracks vertically in vertically stacked view" })),
56
+ react_1.default.createElement(material_1.DialogActions, null,
57
+ react_1.default.createElement(material_1.Button, { onClick: () => {
58
+ const { view } = model;
59
+ const session = (0, util_1.getSession)(model);
60
+ try {
61
+ const viewSnapshot = (0, launchBreakpointSplitView_1.getBreakpointSplitView)({ view, f1, f2 });
62
+ const [view1, view2] = viewSnapshot.views;
63
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
64
+ const viewTracks = (0, mobx_state_tree_1.getSnapshot)(view.tracks);
65
+ session.addView('BreakpointSplitView', {
66
+ ...viewSnapshot,
67
+ views: [
68
+ {
69
+ ...view1,
70
+ tracks: stripIds(viewTracks),
71
+ offsetPx: view1.offsetPx - view.width / 2 + 100,
72
+ },
73
+ {
74
+ ...view2,
75
+ tracks: stripIds(mirror ? [...viewTracks].reverse() : viewTracks),
76
+ offsetPx: view2.offsetPx - view.width / 2 + 100,
77
+ },
78
+ ],
79
+ });
80
+ }
81
+ catch (e) {
82
+ console.error(e);
83
+ session.notify(`${e}`);
84
+ }
85
+ handleClose();
86
+ }, variant: "contained", color: "primary", autoFocus: true }, "OK"),
87
+ react_1.default.createElement(material_1.Button, { onClick: () => handleClose(), color: "secondary", variant: "contained" }, "Cancel"))));
88
+ });
89
+ exports.default = BreakendOptionDialog;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export default function Formatter({ value }: {
3
+ value: unknown;
4
+ }): React.JSX.Element;
@@ -0,0 +1,47 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const react_1 = __importStar(require("react"));
30
+ const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
31
+ // this 'show more...' used specifically as a formatter on alignments feature
32
+ // details because long SEQ or CRAM files, even a single div full of a ton of
33
+ // data from a long read, can slow down the rest of the app
34
+ function Formatter({ value }) {
35
+ const [show, setShow] = (0, react_1.useState)(false);
36
+ const [copied, setCopied] = (0, react_1.useState)(false);
37
+ const display = String(value);
38
+ return display.length > 100 ? (react_1.default.createElement(react_1.default.Fragment, null,
39
+ react_1.default.createElement("button", { type: "button", onClick: () => {
40
+ (0, copy_to_clipboard_1.default)(display);
41
+ setCopied(true);
42
+ setTimeout(() => setCopied(false), 700);
43
+ } }, copied ? 'Copied to clipboard' : 'Copy'),
44
+ react_1.default.createElement("button", { type: "button", onClick: () => setShow(val => !val) }, show ? 'Show less' : 'Show more'),
45
+ react_1.default.createElement("div", null, show ? display : `${display.slice(0, 100)}...`))) : (react_1.default.createElement("div", null, display));
46
+ }
47
+ exports.default = Formatter;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
+ import { ViewType } from '@jbrowse/core/pluggableElementTypes';
4
+ import { AlignmentFeatureWidgetModel } from './stateModelFactory';
5
+ export default function LaunchBreakpointSplitViewPanel({ model, feature, viewType, }: {
6
+ model: AlignmentFeatureWidgetModel;
7
+ feature: SimpleFeatureSerialized;
8
+ viewType: ViewType;
9
+ }): React.JSX.Element;
@@ -0,0 +1,92 @@
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 material_1 = require("@mui/material");
28
+ const util_1 = require("@jbrowse/core/util");
29
+ const mui_1 = require("tss-react/mui");
30
+ const ui_1 = require("@jbrowse/core/ui");
31
+ const getSAFeatures_1 = require("./getSAFeatures");
32
+ // lazies
33
+ const BreakendOptionDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./BreakendOptionDialog'))));
34
+ const useStyles = (0, mui_1.makeStyles)()({
35
+ cursor: {
36
+ cursor: 'pointer',
37
+ },
38
+ });
39
+ function LaunchBreakpointSplitViewPanel({ model, feature, viewType, }) {
40
+ const { classes } = useStyles();
41
+ const session = (0, util_1.getSession)(model);
42
+ const { view } = model;
43
+ const [res, setRes] = (0, react_1.useState)();
44
+ const [error, setError] = (0, react_1.useState)();
45
+ (0, react_1.useEffect)(() => {
46
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
47
+ ;
48
+ (async () => {
49
+ try {
50
+ const feats = await (0, getSAFeatures_1.getSAFeatures)({
51
+ view,
52
+ feature: new util_1.SimpleFeature(feature),
53
+ });
54
+ setRes(feats);
55
+ }
56
+ catch (e) {
57
+ setError(e);
58
+ console.error(e);
59
+ }
60
+ })();
61
+ }, [feature, view]);
62
+ const ret = [];
63
+ if (res) {
64
+ for (let i = 0; i < res.length - 1; i++) {
65
+ ret.push([res[i], res[i + 1]]);
66
+ }
67
+ }
68
+ return (react_1.default.createElement(react_1.default.Fragment, null, ret.length ? (react_1.default.createElement("div", null,
69
+ react_1.default.createElement(material_1.Typography, null, "Launch split views with breakend source and target"),
70
+ error ? react_1.default.createElement(ui_1.ErrorMessage, { error: error }) : null,
71
+ react_1.default.createElement("ul", null, ret.map((arg, index) => {
72
+ const [f1, f2] = arg;
73
+ return (react_1.default.createElement("li", { key: `${JSON.stringify(arg)}-${index}` },
74
+ react_1.default.createElement(material_1.Tooltip, { title: "Top panel->Bottom panel" },
75
+ react_1.default.createElement(material_1.Link, { href: "#", className: classes.cursor, onClick: event => {
76
+ event.preventDefault();
77
+ session.queueDialog(handleClose => [
78
+ BreakendOptionDialog,
79
+ { handleClose, f1, f2, model, viewType },
80
+ ]);
81
+ } },
82
+ f1.refName,
83
+ ":",
84
+ (0, util_1.toLocale)(f1.strand === 1 ? f1.end : f1.start),
85
+ " ->",
86
+ ' ',
87
+ f2.refName,
88
+ ":",
89
+ (0, util_1.toLocale)(f2.strand === 1 ? f2.start : f2.end)))));
90
+ })))) : null));
91
+ }
92
+ exports.default = LaunchBreakpointSplitViewPanel;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { AlignmentFeatureWidgetModel } from './stateModelFactory';
3
+ export default function PairLink({ locString, model, }: {
4
+ locString: string;
5
+ model: AlignmentFeatureWidgetModel;
6
+ }): React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const material_1 = require("@mui/material");
8
+ const util_1 = require("./util");
9
+ function PairLink({ locString, model, }) {
10
+ return (react_1.default.createElement(material_1.Link, { onClick: event => {
11
+ event.preventDefault();
12
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
13
+ (0, util_1.navToLoc)(locString, model);
14
+ }, href: "#" }, locString));
15
+ }
16
+ exports.default = PairLink;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ import { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
+ import { AlignmentFeatureWidgetModel } from './stateModelFactory';
4
+ export default function SuppAlignments(props: {
5
+ tag: string;
6
+ model: AlignmentFeatureWidgetModel;
7
+ feature: SimpleFeatureSerialized;
8
+ }): React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
8
+ const util_1 = require("@jbrowse/core/util");
9
+ const SuppAlignmentsLocStrings_1 = __importDefault(require("./SuppAlignmentsLocStrings"));
10
+ const LaunchBreakpointSplitViewPanel_1 = __importDefault(require("./LaunchBreakpointSplitViewPanel"));
11
+ function SuppAlignments(props) {
12
+ const { model, tag, feature } = props;
13
+ const session = (0, util_1.getSession)(model);
14
+ const { pluginManager } = (0, util_1.getEnv)(session);
15
+ let viewType;
16
+ try {
17
+ viewType = pluginManager.getViewType('BreakpointSplitView');
18
+ }
19
+ catch (e) {
20
+ // ignore
21
+ }
22
+ return (react_1.default.createElement(BaseFeatureDetail_1.BaseCard, { ...props, title: "Supplementary alignments" },
23
+ react_1.default.createElement(SuppAlignmentsLocStrings_1.default, { model: model, tag: tag }),
24
+ viewType ? (react_1.default.createElement(LaunchBreakpointSplitViewPanel_1.default, { viewType: viewType, model: model, feature: feature })) : null));
25
+ }
26
+ exports.default = SuppAlignments;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { AlignmentFeatureWidgetModel } from './stateModelFactory';
3
+ export default function SuppAlignmentsLocStrings({ tag, model, }: {
4
+ tag: string;
5
+ model: AlignmentFeatureWidgetModel;
6
+ }): React.JSX.Element;
@@ -5,12 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const material_1 = require("@mui/material");
8
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
8
+ // locals
9
9
  const MismatchParser_1 = require("../MismatchParser");
10
10
  const util_1 = require("./util");
11
- function SupplementaryAlignments(props) {
12
- const { tag, model } = props;
13
- return (react_1.default.createElement(BaseFeatureDetail_1.BaseCard, { ...props, title: "Supplementary alignments" },
11
+ function SuppAlignmentsLocStrings({ tag, model, }) {
12
+ return (react_1.default.createElement("div", null,
14
13
  react_1.default.createElement(material_1.Typography, null, "List of supplementary alignment locations"),
15
14
  react_1.default.createElement("ul", null, tag
16
15
  .split(';')
@@ -21,7 +20,9 @@ function SupplementaryAlignments(props) {
21
20
  const extra = Math.floor(saLength / 5);
22
21
  const start = +saStart;
23
22
  const end = +saStart + saLength;
24
- const locString = `${saRef}:${Math.max(1, start - extra)}-${end + extra}`;
23
+ const sp = start - extra;
24
+ const ep = end + extra;
25
+ const locString = `${saRef}:${Math.max(1, sp)}-${ep}`;
25
26
  const displayStart = start.toLocaleString('en-US');
26
27
  const displayEnd = end.toLocaleString('en-US');
27
28
  const displayString = `${saRef}:${displayStart}-${displayEnd} (${saStrand}) [${saLength}bp]`;
@@ -30,7 +31,7 @@ function SupplementaryAlignments(props) {
30
31
  event.preventDefault();
31
32
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
32
33
  (0, util_1.navToLoc)(locString, model);
33
- }, href: "#" }, displayString)));
34
+ } }, displayString)));
34
35
  }))));
35
36
  }
36
- exports.default = SupplementaryAlignments;
37
+ exports.default = SuppAlignmentsLocStrings;
@@ -0,0 +1 @@
1
+ export declare const configSchema: import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaType<{}, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.configSchema = void 0;
4
+ const configuration_1 = require("@jbrowse/core/configuration");
5
+ exports.configSchema = (0, configuration_1.ConfigurationSchema)('AlignmentsFeatureWidget', {});
@@ -0,0 +1,23 @@
1
+ import { Feature } from '@jbrowse/core/util';
2
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
+ export interface ReducedFeature {
4
+ refName: string;
5
+ start: number;
6
+ clipPos: number;
7
+ end: number;
8
+ strand: number;
9
+ seqLength: number;
10
+ syntenyId?: number;
11
+ uniqueId: string;
12
+ mate: {
13
+ refName: string;
14
+ start: number;
15
+ end: number;
16
+ syntenyId?: number;
17
+ uniqueId?: string;
18
+ };
19
+ }
20
+ export declare function getSAFeatures({ view, feature, }: {
21
+ view: LinearGenomeViewModel;
22
+ feature: Feature;
23
+ }): Promise<ReducedFeature[]>;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSAFeatures = void 0;
4
+ const util_1 = require("@jbrowse/core/util");
5
+ // locals
6
+ const MismatchParser_1 = require("../MismatchParser");
7
+ const util_2 = require("../util");
8
+ async function getSAFeatures({ view, feature, }) {
9
+ const { assemblyManager } = (0, util_1.getSession)(view);
10
+ const cigar = feature.get('CIGAR');
11
+ const origStrand = feature.get('strand');
12
+ const SA = (0, util_2.getTag)(feature, 'SA') || '';
13
+ const readName = feature.get('name');
14
+ const clipPos = (0, MismatchParser_1.getClip)(cigar, 1);
15
+ // get the canonical refname for the read because if the
16
+ // read.get('refName') is chr1 and the actual fasta refName is 1 then no
17
+ // tracks can be opened on the top panel of the linear read vs ref
18
+ const assembly = await assemblyManager.waitForAssembly(view.assemblyNames[0]);
19
+ if (!assembly) {
20
+ throw new Error('assembly not found');
21
+ }
22
+ const suppAlns = (0, MismatchParser_1.featurizeSA)(SA, feature.id(), origStrand, readName, true);
23
+ const feat = feature.toJSON();
24
+ feat.clipPos = clipPos;
25
+ feat.strand = 1;
26
+ feat.mate = {
27
+ refName: readName,
28
+ start: clipPos,
29
+ end: clipPos + (0, MismatchParser_1.getLengthSansClipping)(cigar),
30
+ };
31
+ const features = [feat, ...suppAlns];
32
+ features.forEach((f, idx) => {
33
+ f.refName = (assembly === null || assembly === void 0 ? void 0 : assembly.getCanonicalRefName(f.refName)) || f.refName;
34
+ f.syntenyId = idx;
35
+ f.mate.syntenyId = idx;
36
+ f.mate.uniqueId = `${f.uniqueId}_mate`;
37
+ });
38
+ features.sort((a, b) => a.clipPos - b.clipPos);
39
+ return features;
40
+ }
41
+ exports.getSAFeatures = getSAFeatures;