@jbrowse/plugin-breakpoint-split-view 2.17.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +6 -3
  2. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +5 -11
  3. package/dist/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
  4. package/dist/BreakpointAlignmentsFeatureDetail/index.js +18 -8
  5. package/dist/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
  6. package/dist/BreakpointSplitView/BreakpointSplitView.js +41 -90
  7. package/dist/BreakpointSplitView/components/AlignmentConnections.d.ts +3 -4
  8. package/dist/BreakpointSplitView/components/AlignmentConnections.js +93 -124
  9. package/dist/BreakpointSplitView/components/Breakends.d.ts +3 -4
  10. package/dist/BreakpointSplitView/components/Breakends.js +67 -92
  11. package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +2 -3
  12. package/dist/BreakpointSplitView/components/BreakpointSplitView.js +13 -17
  13. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +2 -3
  14. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +10 -39
  15. package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  16. package/dist/BreakpointSplitView/components/ExportSvgDialog.js +35 -76
  17. package/dist/BreakpointSplitView/components/Overlay.d.ts +3 -4
  18. package/dist/BreakpointSplitView/components/Overlay.js +8 -9
  19. package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +3 -4
  20. package/dist/BreakpointSplitView/components/PairedFeatures.js +47 -72
  21. package/dist/BreakpointSplitView/components/Translocations.d.ts +3 -4
  22. package/dist/BreakpointSplitView/components/Translocations.js +57 -86
  23. package/dist/BreakpointSplitView/components/getOrientationColor.js +0 -8
  24. package/dist/BreakpointSplitView/components/util.d.ts +1 -1
  25. package/dist/BreakpointSplitView/components/util.js +12 -12
  26. package/dist/BreakpointSplitView/index.d.ts +1 -1
  27. package/dist/BreakpointSplitView/index.js +19 -10
  28. package/dist/BreakpointSplitView/model.d.ts +23 -108
  29. package/dist/BreakpointSplitView/model.js +50 -153
  30. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  31. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +3 -6
  32. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  33. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +6 -30
  34. package/dist/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
  35. package/dist/BreakpointSplitView/svgcomponents/util.js +0 -1
  36. package/dist/BreakpointSplitView/types.d.ts +22 -0
  37. package/dist/BreakpointSplitView/types.js +2 -0
  38. package/dist/BreakpointSplitView/util.d.ts +12 -2
  39. package/dist/BreakpointSplitView/util.js +34 -8
  40. package/dist/index.d.ts +1 -1
  41. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +6 -3
  42. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +5 -8
  43. package/esm/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
  44. package/esm/BreakpointAlignmentsFeatureDetail/index.js +1 -1
  45. package/esm/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
  46. package/esm/BreakpointSplitView/BreakpointSplitView.js +41 -90
  47. package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +3 -4
  48. package/esm/BreakpointSplitView/components/AlignmentConnections.js +94 -102
  49. package/esm/BreakpointSplitView/components/Breakends.d.ts +3 -4
  50. package/esm/BreakpointSplitView/components/Breakends.js +68 -70
  51. package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +2 -3
  52. package/esm/BreakpointSplitView/components/BreakpointSplitView.js +13 -17
  53. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +2 -3
  54. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +10 -16
  55. package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  56. package/esm/BreakpointSplitView/components/ExportSvgDialog.js +35 -53
  57. package/esm/BreakpointSplitView/components/Overlay.d.ts +3 -4
  58. package/esm/BreakpointSplitView/components/Overlay.js +8 -9
  59. package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +3 -4
  60. package/esm/BreakpointSplitView/components/PairedFeatures.js +48 -50
  61. package/esm/BreakpointSplitView/components/Translocations.d.ts +3 -4
  62. package/esm/BreakpointSplitView/components/Translocations.js +58 -64
  63. package/esm/BreakpointSplitView/components/getOrientationColor.js +0 -8
  64. package/esm/BreakpointSplitView/components/util.d.ts +1 -1
  65. package/esm/BreakpointSplitView/components/util.js +12 -12
  66. package/esm/BreakpointSplitView/index.d.ts +1 -1
  67. package/esm/BreakpointSplitView/index.js +2 -3
  68. package/esm/BreakpointSplitView/model.d.ts +23 -108
  69. package/esm/BreakpointSplitView/model.js +30 -142
  70. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  71. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +3 -3
  72. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  73. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +6 -30
  74. package/esm/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
  75. package/esm/BreakpointSplitView/svgcomponents/util.js +0 -1
  76. package/esm/BreakpointSplitView/types.d.ts +22 -0
  77. package/esm/BreakpointSplitView/types.js +1 -0
  78. package/esm/BreakpointSplitView/util.d.ts +12 -2
  79. package/esm/BreakpointSplitView/util.js +33 -10
  80. package/esm/index.d.ts +1 -1
  81. package/package.json +3 -3
@@ -1,38 +1,15 @@
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
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const react_1 = __importStar(require("react"));
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
27
5
  const util_1 = require("@jbrowse/core/util");
28
6
  const mobx_react_1 = require("mobx-react");
29
7
  const mobx_state_tree_1 = require("mobx-state-tree");
30
- // locals
31
8
  const util_2 = require("./util");
32
9
  const util_3 = require("../util");
33
10
  const [LEFT] = [0, 1, 2, 3];
34
11
  const PairedFeatures = (0, mobx_react_1.observer)(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
35
- const { views } = model;
12
+ const { interactiveOverlay, views } = model;
36
13
  const session = (0, util_1.getSession)(model);
37
14
  const { assemblyManager } = session;
38
15
  const totalFeatures = model.getTrackFeatures(trackId);
@@ -49,52 +26,50 @@ const PairedFeatures = (0, mobx_react_1.observer)(function ({ model, trackId, pa
49
26
  const rect = ref.current.getBoundingClientRect();
50
27
  yoff = rect.top;
51
28
  }
52
- return (react_1.default.createElement("g", { stroke: "green", strokeWidth: 5, fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
53
- const ret = [];
54
- // we follow a path in the list of chunks, not from top to bottom, just
55
- // in series following x1,y1 -> x2,y2
56
- for (let i = 0; i < chunk.length - 1; i += 1) {
57
- const { layout: c1, feature: f1, level: level1 } = chunk[i];
58
- const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
59
- const id = f1.id();
60
- if (!c1 || !c2) {
61
- return null;
62
- }
63
- const f1origref = f1.get('refName');
64
- const f2origref = f2.get('refName');
65
- const f1ref = assembly.getCanonicalRefName(f1origref);
66
- const f2ref = assembly.getCanonicalRefName(f2origref);
67
- if (!f1ref || !f2ref) {
68
- throw new Error(`unable to find ref for ${f1ref || f2ref}`);
29
+ return ((0, jsx_runtime_1.jsx)("g", { stroke: "green", strokeWidth: 5, fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
30
+ const ret = [];
31
+ for (let i = 0; i < chunk.length - 1; i += 1) {
32
+ const { layout: c1, feature: f1, level: level1 } = chunk[i];
33
+ const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
34
+ const id = f1.id();
35
+ if (!c1 || !c2) {
36
+ return null;
37
+ }
38
+ const f1origref = f1.get('refName');
39
+ const f2origref = f2.get('refName');
40
+ const f1ref = assembly.getCanonicalRefName(f1origref);
41
+ const f2ref = assembly.getCanonicalRefName(f2origref);
42
+ if (!f1ref || !f2ref) {
43
+ throw new Error(`unable to find ref for ${f1ref || f2ref}`);
44
+ }
45
+ const x1 = (0, util_3.getPxFromCoordinate)(views[level1], f1ref, c1[LEFT]);
46
+ const x2 = (0, util_3.getPxFromCoordinate)(views[level2], f2ref, c2[LEFT]);
47
+ const tracks = views.map(v => v.getTrack(trackId));
48
+ const y1 = (0, util_3.yPos)(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
49
+ yoff;
50
+ const y2 = (0, util_3.yPos)(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
51
+ yoff;
52
+ const path = [
53
+ 'M',
54
+ x1,
55
+ y1,
56
+ 'L',
57
+ x2,
58
+ y2,
59
+ ].join(' ');
60
+ ret.push((0, jsx_runtime_1.jsx)("path", { d: path, "data-testid": "r2", pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
61
+ var _a, _b, _c;
62
+ const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
63
+ featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
64
+ });
65
+ (_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
66
+ }, onMouseOver: () => {
67
+ setMouseoverElt(id);
68
+ }, onMouseOut: () => {
69
+ setMouseoverElt(undefined);
70
+ } }, JSON.stringify(path)));
69
71
  }
70
- const x1 = (0, util_3.getPxFromCoordinate)(views[level1], f1ref, c1[LEFT]);
71
- const x2 = (0, util_3.getPxFromCoordinate)(views[level2], f2ref, c2[LEFT]);
72
- const tracks = views.map(v => v.getTrack(trackId));
73
- const y1 = (0, util_3.yPos)(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
74
- yoff;
75
- const y2 = (0, util_3.yPos)(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
76
- yoff;
77
- const path = [
78
- 'M', // move to
79
- x1,
80
- y1,
81
- 'L', // line to
82
- x2,
83
- y2,
84
- ].join(' ');
85
- ret.push(react_1.default.createElement("path", { d: path, "data-testid": "r2", key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
86
- var _a, _b, _c;
87
- const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
88
- featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
89
- });
90
- (_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
91
- }, onMouseOver: () => {
92
- setMouseoverElt(id);
93
- }, onMouseOut: () => {
94
- setMouseoverElt(undefined);
95
- } }));
96
- }
97
- return ret;
98
- })));
72
+ return ret;
73
+ }) }));
99
74
  });
100
75
  exports.default = PairedFeatures;
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
- import { BreakpointViewModel } from '../model';
1
+ import type { BreakpointViewModel } from '../model';
3
2
  declare const Translocations: ({ model, trackId, parentRef: ref, getTrackYPosOverride, }: {
4
3
  model: BreakpointViewModel;
5
4
  trackId: string;
6
- parentRef: React.RefObject<SVGSVGElement>;
5
+ parentRef: React.RefObject<SVGSVGElement | null>;
7
6
  getTrackYPosOverride?: (trackId: string, level: number) => number;
8
- }) => React.JSX.Element | null;
7
+ }) => import("react/jsx-runtime").JSX.Element | null;
9
8
  export default Translocations;
@@ -1,33 +1,10 @@
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
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const react_1 = __importStar(require("react"));
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const react_1 = require("react");
27
5
  const util_1 = require("@jbrowse/core/util");
28
6
  const mobx_react_1 = require("mobx-react");
29
7
  const mobx_state_tree_1 = require("mobx-state-tree");
30
- // locals
31
8
  const util_2 = require("./util");
32
9
  const util_3 = require("../util");
33
10
  const [LEFT] = [0, 1, 2, 3];
@@ -43,7 +20,7 @@ function str(s) {
43
20
  }
44
21
  }
45
22
  const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
46
- const { views } = model;
23
+ const { interactiveOverlay, views } = model;
47
24
  const session = (0, util_1.getSession)(model);
48
25
  const { assemblyManager } = session;
49
26
  const totalFeatures = model.getTrackFeatures(trackId);
@@ -60,69 +37,63 @@ const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, pa
60
37
  const rect = ref.current.getBoundingClientRect();
61
38
  yOffset = rect.top;
62
39
  }
63
- // we hardcode the TRA to go to the "other view" and if there is none, we
64
- // just return null here note: would need to do processing of the INFO
65
- // CHR2/END and see which view could contain those coordinates to really do
66
- // it properly
67
40
  if (views.length < 2) {
68
41
  return null;
69
42
  }
70
- return (react_1.default.createElement("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
71
- var _a, _b;
72
- // we follow a path in the list of chunks, not from top to bottom,
73
- // just in series following x1,y1 -> x2,y2
74
- const ret = [];
75
- for (const { layout: c1, feature: f1, level: level1 } of chunk) {
76
- const level2 = level1 === 0 ? 1 : 0;
77
- const id = f1.id();
78
- if (!c1) {
79
- return null;
80
- }
81
- const info = f1.get('INFO');
82
- const chr2 = info.CHR2[0];
83
- const end2 = info.END[0];
84
- const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split(''); // not all files have STRANDS
85
- const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
86
- const r = (0, util_3.getPxFromCoordinate)(views[level2], chr2, end2);
87
- if (r) {
88
- const c2 = [r, 0, r + 1, 0];
89
- const x1 = (0, util_3.getPxFromCoordinate)(views[level1], f1.get('refName'), c1[LEFT]);
90
- const x2 = r;
91
- const reversed1 = views[level1].pxToBp(x1).reversed;
92
- const reversed2 = views[level2].pxToBp(x2).reversed;
93
- const tracks = views.map(v => v.getTrack(trackId));
94
- const y1 = (0, util_3.yPos)(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
95
- yOffset;
96
- const y2 = (0, util_3.yPos)(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
97
- yOffset;
98
- const path = [
99
- 'M', // move to
100
- x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
101
- y1,
102
- 'L', // line to
103
- x1,
104
- y1,
105
- 'L', // line to as const
106
- x2,
107
- y2,
108
- 'L', // line to
109
- x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
110
- y2,
111
- ].join(' ');
112
- ret.push(react_1.default.createElement("path", { d: path, key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
113
- var _a, _b;
114
- const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
115
- featureData: (totalFeatures.get(id) || { toJSON: () => { } }).toJSON(),
116
- });
117
- (_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
118
- }, onMouseOver: () => {
119
- setMouseoverElt(id);
120
- }, onMouseOut: () => {
121
- setMouseoverElt(undefined);
122
- } }));
43
+ return ((0, jsx_runtime_1.jsx)("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
44
+ var _a, _b;
45
+ const ret = [];
46
+ for (const { layout: c1, feature: f1, level: level1 } of chunk) {
47
+ const level2 = level1 === 0 ? 1 : 0;
48
+ const id = f1.id();
49
+ if (!c1) {
50
+ return null;
51
+ }
52
+ const info = f1.get('INFO');
53
+ const chr2 = info.CHR2[0];
54
+ const end2 = info.END[0];
55
+ const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split('');
56
+ const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
57
+ const r = (0, util_3.getPxFromCoordinate)(views[level2], chr2, end2);
58
+ if (r) {
59
+ const c2 = [r, 0, r + 1, 0];
60
+ const x1 = (0, util_3.getPxFromCoordinate)(views[level1], f1.get('refName'), c1[LEFT]);
61
+ const x2 = r;
62
+ const reversed1 = views[level1].pxToBp(x1).reversed;
63
+ const reversed2 = views[level2].pxToBp(x2).reversed;
64
+ const tracks = views.map(v => v.getTrack(trackId));
65
+ const y1 = (0, util_3.yPos)(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
66
+ yOffset;
67
+ const y2 = (0, util_3.yPos)(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
68
+ yOffset;
69
+ const path = [
70
+ 'M',
71
+ x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
72
+ y1,
73
+ 'L',
74
+ x1,
75
+ y1,
76
+ 'L',
77
+ x2,
78
+ y2,
79
+ 'L',
80
+ x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
81
+ y2,
82
+ ].join(' ');
83
+ ret.push((0, jsx_runtime_1.jsx)("path", { d: path, pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
84
+ var _a, _b;
85
+ const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
86
+ featureData: (totalFeatures.get(id) || { toJSON: () => { } }).toJSON(),
87
+ });
88
+ (_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
89
+ }, onMouseOver: () => {
90
+ setMouseoverElt(id);
91
+ }, onMouseOut: () => {
92
+ setMouseoverElt(undefined);
93
+ } }, JSON.stringify(path)));
94
+ }
123
95
  }
124
- }
125
- return ret;
126
- })));
96
+ return ret;
97
+ }) }));
127
98
  });
128
99
  exports.default = Translocations;
@@ -7,8 +7,6 @@ exports.getLongReadOrientationAbnormal = getLongReadOrientationAbnormal;
7
7
  exports.isAbnormalOrientation = isAbnormalOrientation;
8
8
  exports.getPairedOrientationColor = getPairedOrientationColor;
9
9
  const material_1 = require("@mui/material");
10
- // orientation definitions from igv.js, see also
11
- // https://software.broadinstitute.org/software/igv/interpreting_pair_orientations
12
10
  exports.orientationTypes = {
13
11
  fr: {
14
12
  F1R2: 'LR',
@@ -47,12 +45,6 @@ exports.pairMap = {
47
45
  RR: 'color_pair_rr',
48
46
  RL: 'color_pair_rl',
49
47
  };
50
- // manually calculated by running
51
- // const color = require('color')
52
- // Object.fromEntries(Object.entries(fillColor).map(([key,val])=>{
53
- // return [key, color(val).darken('0.3').hex()]
54
- // }))
55
- // this avoids (expensive) use of Color module at runtime
56
48
  exports.strokeColor = {
57
49
  color_fwd_strand_not_proper: (0, material_1.alpha)('#CA6767', 0.8),
58
50
  color_rev_strand_not_proper: (0, material_1.alpha)('#7272AA', 0.8),
@@ -1,4 +1,4 @@
1
- import { Feature } from '@jbrowse/core/util';
1
+ import type { Feature } from '@jbrowse/core/util';
2
2
  export declare function getBadlyPairedAlignments(features: Map<string, Feature>): Feature[][];
3
3
  export declare function getMatchedAlignmentFeatures(features: Map<string, Feature>): Feature[][];
4
4
  export declare function hasPairedReads(features: Map<string, Feature>): boolean;
@@ -7,20 +7,26 @@ exports.findMatchingAlt = findMatchingAlt;
7
7
  exports.getMatchedBreakendFeatures = getMatchedBreakendFeatures;
8
8
  exports.getMatchedTranslocationFeatures = getMatchedTranslocationFeatures;
9
9
  exports.getMatchedPairedFeatures = getMatchedPairedFeatures;
10
- const util_1 = require("@jbrowse/core/util");
11
10
  const vcf_1 = require("@gmod/vcf");
12
- // this finds candidate alignment features, aimed at plotting split reads from
13
- // BAM/CRAM files
11
+ const util_1 = require("@jbrowse/core/util");
14
12
  function getBadlyPairedAlignments(features) {
15
13
  const candidates = new Map();
16
14
  const alreadySeen = new Set();
17
- // this finds candidate features that share the same name
15
+ const alreadyPairedWithSamePosition = new Set();
18
16
  for (const feature of features.values()) {
19
17
  const flags = feature.get('flags');
20
18
  const id = feature.id();
19
+ const supp = (0, util_1.assembleLocStringFast)({
20
+ refName: feature.get('refName'),
21
+ start: feature.get('start'),
22
+ end: feature.get('end'),
23
+ });
21
24
  const unmapped = flags & 4;
22
25
  const correctlyPaired = flags & 2;
23
- if (!alreadySeen.has(id) && !correctlyPaired && !unmapped) {
26
+ if (!alreadySeen.has(id) &&
27
+ !alreadyPairedWithSamePosition.has(supp) &&
28
+ !correctlyPaired &&
29
+ !unmapped) {
24
30
  const n = feature.get('name');
25
31
  let val = candidates.get(n);
26
32
  if (!val) {
@@ -30,16 +36,14 @@ function getBadlyPairedAlignments(features) {
30
36
  val.push(feature);
31
37
  }
32
38
  alreadySeen.add(feature.id());
39
+ alreadyPairedWithSamePosition.add(supp);
33
40
  }
34
41
  return [...candidates.values()].filter(v => v.length > 1);
35
42
  }
36
- // this finds candidate alignment features, aimed at plotting split reads from
37
- // BAM/CRAM files
38
43
  function getMatchedAlignmentFeatures(features) {
39
44
  var _a;
40
45
  const candidates = new Map();
41
46
  const alreadySeen = new Set();
42
- // this finds candidate features that share the same name
43
47
  for (const feature of features.values()) {
44
48
  const id = feature.id();
45
49
  const unmapped = feature.get('flags') & 4;
@@ -75,8 +79,6 @@ function findMatchingAlt(feat1, feat2) {
75
79
  }
76
80
  return undefined;
77
81
  }
78
- // Returns paired BND features across multiple views by inspecting the ALT
79
- // field to get exact coordinate matches
80
82
  function getMatchedBreakendFeatures(feats) {
81
83
  const candidates = new Map();
82
84
  const alreadySeen = new Set();
@@ -101,7 +103,6 @@ function getMatchedBreakendFeatures(feats) {
101
103
  }
102
104
  return [...candidates.values()].filter(v => v.length > 1);
103
105
  }
104
- // Getting "matched" TRA means just return all TRA
105
106
  function getMatchedTranslocationFeatures(feats) {
106
107
  const ret = [];
107
108
  const alreadySeen = new Set();
@@ -113,7 +114,6 @@ function getMatchedTranslocationFeatures(feats) {
113
114
  }
114
115
  return ret;
115
116
  }
116
- // Getting "matched" TRA means just return all TRA
117
117
  function getMatchedPairedFeatures(feats) {
118
118
  const candidates = new Map();
119
119
  const alreadySeen = new Set();
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function BreakpointSplitViewF(pluginManager: PluginManager): void;
@@ -15,25 +15,34 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
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
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
39
  exports.default = BreakpointSplitViewF;
30
40
  const react_1 = require("react");
31
- // locals
32
- const BreakpointSplitView_1 = __importDefault(require("./BreakpointSplitView"));
41
+ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
33
42
  const model_1 = __importDefault(require("./model"));
34
43
  function BreakpointSplitViewF(pluginManager) {
35
44
  pluginManager.addViewType(() => {
36
- return new BreakpointSplitView_1.default({
45
+ return new pluggableElementTypes_1.ViewType({
37
46
  name: 'BreakpointSplitView',
38
47
  displayName: 'Breakpoint split view',
39
48
  stateModel: (0, model_1.default)(pluginManager),