@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,7 +1,10 @@
1
- import React from 'react';
1
+ import type { SimpleFeatureSerialized } from '@jbrowse/core/util';
2
2
  declare const BreakpointAlignmentsFeatureDetail: ({ model, }: {
3
3
  model: {
4
- featureData: Record<string, unknown>;
4
+ featureData: {
5
+ feature1: SimpleFeatureSerialized;
6
+ feature2: SimpleFeatureSerialized;
7
+ };
5
8
  };
6
- }) => React.JSX.Element;
9
+ }) => import("react/jsx-runtime").JSX.Element;
7
10
  export default BreakpointAlignmentsFeatureDetail;
@@ -1,18 +1,12 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
3
+ const jsx_runtime_1 = require("react/jsx-runtime");
4
+ const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
7
5
  const material_1 = require("@mui/material");
8
6
  const mobx_react_1 = require("mobx-react");
9
- const BaseFeatureDetail_1 = require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail");
10
7
  const BreakpointAlignmentsFeatureDetail = (0, mobx_react_1.observer)(function ({ model, }) {
11
- const { feature1, feature2 } = JSON.parse(JSON.stringify(model.featureData));
12
- return (react_1.default.createElement(material_1.Paper, { "data-testid": "alignment-side-drawer" },
13
- react_1.default.createElement(BaseFeatureDetail_1.BaseCoreDetails, { title: "Feature 1", feature: feature1 }),
14
- react_1.default.createElement(BaseFeatureDetail_1.BaseCoreDetails, { title: "Feature 2", feature: feature2 }),
15
- react_1.default.createElement(BaseFeatureDetail_1.BaseAttributes, { title: "Feature 1 attributes", feature: feature1 }),
16
- react_1.default.createElement(BaseFeatureDetail_1.BaseAttributes, { title: "Feature 2 attributes", feature: feature2 })));
8
+ const { featureData } = model;
9
+ const { feature1, feature2 } = structuredClone(featureData);
10
+ return ((0, jsx_runtime_1.jsxs)(material_1.Paper, { children: [(0, jsx_runtime_1.jsx)(BaseFeatureDetail_1.BaseCoreDetails, { title: "Feature 1", feature: feature1 }), (0, jsx_runtime_1.jsx)(BaseFeatureDetail_1.BaseCoreDetails, { title: "Feature 2", feature: feature2 }), (0, jsx_runtime_1.jsx)(BaseFeatureDetail_1.BaseAttributes, { title: "Feature 1 attributes", feature: feature1 }), (0, jsx_runtime_1.jsx)(BaseFeatureDetail_1.BaseAttributes, { title: "Feature 2 attributes", feature: feature2 })] }));
17
11
  });
18
12
  exports.default = BreakpointAlignmentsFeatureDetail;
@@ -1,2 +1,2 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
1
+ import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function BreakpointAlignmentsFeatureDetailF(pluginManager: PluginManager): void;
@@ -15,20 +15,30 @@ 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
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.default = BreakpointAlignmentsFeatureDetailF;
27
37
  const react_1 = require("react");
28
38
  const configuration_1 = require("@jbrowse/core/configuration");
39
+ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
29
40
  const mst_1 = require("@jbrowse/core/util/types/mst");
30
41
  const mobx_state_tree_1 = require("mobx-state-tree");
31
- const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
32
42
  const configSchema = (0, configuration_1.ConfigurationSchema)('BreakpointAlignmentsWidget', {});
33
43
  const stateModel = mobx_state_tree_1.types
34
44
  .model('BreakpointAlignmentsWidget', {
@@ -1,52 +1,34 @@
1
- import { Feature, Region } from '@jbrowse/core/util';
2
1
  import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
3
- import { IStateTreeNode } from 'mobx-state-tree';
4
- import { Assembly } from '@jbrowse/core/assemblyManager/assembly';
2
+ import { type AbstractSessionModel, type Feature } from '@jbrowse/core/util';
3
+ import type { Assembly } from '@jbrowse/core/assemblyManager/assembly';
5
4
  export default class BreakpointSplitViewType extends ViewType {
6
5
  getBreakendCoveringRegions({ feature, assembly, }: {
7
6
  feature: Feature;
8
7
  assembly: Assembly;
9
8
  }): {
10
9
  pos: number;
11
- refName: string | undefined;
12
- mateRefName: string | undefined;
13
- matePos: number;
10
+ refName: string;
11
+ mateRefName: string;
12
+ matePos: any;
14
13
  };
15
- singleLevelSnapshotFromBreakendFeature(feature: Feature, view: {
16
- displayedRegions: Region[];
17
- } & IStateTreeNode): {
18
- type: string;
19
- views: {
20
- type: string;
21
- displayedRegions: {
22
- start: number;
23
- end: number;
24
- refName: string;
25
- assemblyName: string;
26
- }[];
27
- hideHeader: boolean;
28
- bpPerPx: number;
29
- offsetPx: number;
30
- }[];
31
- displayName: string;
32
- featureData: unknown;
33
- };
34
- snapshotFromBreakendFeature(feature: Feature, view: {
35
- displayedRegions: Region[];
36
- } & IStateTreeNode): {
37
- type: string;
38
- views: {
14
+ singleLevelSnapshotFromBreakendFeature({ feature, session, assemblyName, }: {
15
+ feature: Feature;
16
+ session: AbstractSessionModel;
17
+ assemblyName: string;
18
+ }): {
19
+ coverage: {
20
+ pos: number;
21
+ refName: string;
22
+ mateRefName: string;
23
+ matePos: any;
24
+ };
25
+ snap: {
39
26
  type: string;
40
- displayedRegions: {
41
- start: number;
42
- end: number;
43
- refName: string;
44
- assemblyName: string;
27
+ views: {
28
+ type: string;
29
+ displayedRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[];
45
30
  }[];
46
- hideHeader: boolean;
47
- bpPerPx: number;
48
- offsetPx: number;
49
- }[];
50
- displayName: string;
31
+ displayName: string;
32
+ };
51
33
  };
52
34
  }
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const util_1 = require("@jbrowse/core/util");
7
- const ViewType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/ViewType"));
8
6
  const vcf_1 = require("@gmod/vcf");
7
+ const ViewType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/ViewType"));
8
+ const util_1 = require("@jbrowse/core/util");
9
9
  class BreakpointSplitViewType extends ViewType_1.default {
10
10
  getBreakendCoveringRegions({ feature, assembly, }) {
11
11
  var _a;
@@ -13,81 +13,44 @@ class BreakpointSplitViewType extends ViewType_1.default {
13
13
  const bnd = alt ? (0, vcf_1.parseBreakend)(alt) : undefined;
14
14
  const startPos = feature.get('start');
15
15
  const refName = feature.get('refName');
16
- let endPos;
17
- let mateRefName;
18
- // a VCF breakend feature
16
+ const f = (ref) => assembly.getCanonicalRefName(ref) || ref;
19
17
  if (alt === '<TRA>') {
20
18
  const INFO = feature.get('INFO');
21
- endPos = INFO.END[0] - 1;
22
- mateRefName = INFO.CHR2[0];
19
+ return {
20
+ pos: startPos,
21
+ refName: f(refName),
22
+ mateRefName: f(INFO.CHR2[0]),
23
+ matePos: INFO.END[0] - 1,
24
+ };
23
25
  }
24
26
  else if (bnd === null || bnd === void 0 ? void 0 : bnd.MatePosition) {
25
27
  const matePosition = bnd.MatePosition.split(':');
26
- endPos = +matePosition[1] - 1;
27
- mateRefName = matePosition[0];
28
+ return {
29
+ pos: startPos,
30
+ refName: f(refName),
31
+ mateRefName: f(matePosition[0]),
32
+ matePos: +matePosition[1] - 1,
33
+ };
28
34
  }
29
35
  else if (feature.get('mate')) {
30
- // a generic 'mate' feature
31
36
  const mate = feature.get('mate');
32
- mateRefName = mate.refName;
33
- endPos = mate.start;
37
+ return {
38
+ pos: startPos,
39
+ refName: f(refName),
40
+ mateRefName: f(mate.refName),
41
+ matePos: mate.start,
42
+ };
34
43
  }
35
44
  else {
36
- endPos = startPos + 1;
37
- }
38
- if (!mateRefName) {
39
- throw new Error(`unable to resolve mate refName ${mateRefName} in reference genome`);
45
+ return {
46
+ pos: startPos,
47
+ refName: f(refName),
48
+ mateRefName: f(refName),
49
+ matePos: feature.get('end'),
50
+ };
40
51
  }
41
- return {
42
- pos: startPos,
43
- refName: assembly.getCanonicalRefName(refName),
44
- mateRefName: assembly.getCanonicalRefName(mateRefName),
45
- matePos: endPos,
46
- };
47
- }
48
- singleLevelSnapshotFromBreakendFeature(feature, view) {
49
- const session = (0, util_1.getSession)(view);
50
- const bpPerPx = 10;
51
- const { assemblyName } = view.displayedRegions[0];
52
- const { assemblyManager } = session;
53
- const assembly = assemblyManager.get(assemblyName);
54
- if (!assembly) {
55
- throw new Error(`assembly ${assemblyName} not found`);
56
- }
57
- if (!assembly.regions) {
58
- throw new Error(`assembly ${assemblyName} regions not loaded`);
59
- }
60
- const { refName, pos: startPos, mateRefName, matePos: endPos, } = this.getBreakendCoveringRegions({
61
- feature,
62
- assembly,
63
- });
64
- const topRegion = assembly.regions.find(f => f.refName === refName);
65
- const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
66
- const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
67
- const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
68
- topMarkedRegion[0].end = startPos;
69
- topMarkedRegion[1].start = startPos;
70
- bottomMarkedRegion[0].end = endPos;
71
- bottomMarkedRegion[1].start = endPos;
72
- return {
73
- type: 'BreakpointSplitView',
74
- views: [
75
- {
76
- type: 'LinearGenomeView',
77
- displayedRegions: topMarkedRegion,
78
- hideHeader: true,
79
- bpPerPx,
80
- offsetPx: (topRegion.start + feature.get('start')) / bpPerPx,
81
- },
82
- ],
83
- displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
84
- featureData: undefined,
85
- };
86
52
  }
87
- snapshotFromBreakendFeature(feature, view) {
88
- const session = (0, util_1.getSession)(view);
89
- const bpPerPx = 10;
90
- const { assemblyName } = view.displayedRegions[0];
53
+ singleLevelSnapshotFromBreakendFeature({ feature, session, assemblyName, }) {
91
54
  const { assemblyManager } = session;
92
55
  const assembly = assemblyManager.get(assemblyName);
93
56
  if (!assembly) {
@@ -96,37 +59,25 @@ class BreakpointSplitViewType extends ViewType_1.default {
96
59
  if (!assembly.regions) {
97
60
  throw new Error(`assembly ${assemblyName} regions not loaded`);
98
61
  }
99
- const { refName, pos: startPos, mateRefName, matePos: endPos, } = this.getBreakendCoveringRegions({
62
+ const coverage = this.getBreakendCoveringRegions({
100
63
  feature,
101
64
  assembly,
102
65
  });
66
+ const { refName, mateRefName } = coverage;
103
67
  const topRegion = assembly.regions.find(f => f.refName === refName);
104
68
  const bottomRegion = assembly.regions.find(f => f.refName === mateRefName);
105
- const topMarkedRegion = [{ ...topRegion }, { ...topRegion }];
106
- const bottomMarkedRegion = [{ ...bottomRegion }, { ...bottomRegion }];
107
- topMarkedRegion[0].end = startPos;
108
- topMarkedRegion[1].start = startPos;
109
- bottomMarkedRegion[0].end = endPos;
110
- bottomMarkedRegion[1].start = endPos;
111
69
  return {
112
- type: 'BreakpointSplitView',
113
- views: [
114
- {
115
- type: 'LinearGenomeView',
116
- displayedRegions: topMarkedRegion,
117
- hideHeader: true,
118
- bpPerPx,
119
- offsetPx: (topRegion.start + feature.get('start')) / bpPerPx,
120
- },
121
- {
122
- type: 'LinearGenomeView',
123
- displayedRegions: bottomMarkedRegion,
124
- hideHeader: true,
125
- bpPerPx,
126
- offsetPx: (bottomRegion.start + endPos) / bpPerPx,
127
- },
128
- ],
129
- displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
70
+ coverage,
71
+ snap: {
72
+ type: 'BreakpointSplitView',
73
+ views: [
74
+ {
75
+ type: 'LinearGenomeView',
76
+ displayedRegions: (0, util_1.gatherOverlaps)([topRegion, bottomRegion]),
77
+ },
78
+ ],
79
+ displayName: `${feature.get('name') || feature.get('id') || 'breakend'} split detail`,
80
+ },
130
81
  };
131
82
  }
132
83
  }
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
- import { BreakpointViewModel } from '../model';
1
+ import type { BreakpointViewModel } from '../model';
3
2
  declare const AlignmentConnections: ({ model, trackId, parentRef, 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 AlignmentConnections;
@@ -1,40 +1,17 @@
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");
5
+ const util_1 = require("@jbrowse/core/util");
6
+ const material_1 = require("@mui/material");
27
7
  const mobx_react_1 = require("mobx-react");
28
8
  const mobx_state_tree_1 = require("mobx-state-tree");
29
- const material_1 = require("@mui/material");
30
- const util_1 = require("@jbrowse/core/util");
31
- // locals
32
9
  const util_2 = require("./util");
33
10
  const util_3 = require("../util");
34
11
  const getOrientationColor_1 = require("./getOrientationColor");
35
12
  const [LEFT, , RIGHT] = [0, 1, 2, 3];
36
13
  const AlignmentConnections = (0, mobx_react_1.observer)(function ({ model, trackId, parentRef, getTrackYPosOverride, }) {
37
- const { views, showIntraviewLinks } = model;
14
+ const { interactiveOverlay, views, showIntraviewLinks } = model;
38
15
  const theme = (0, material_1.useTheme)();
39
16
  const session = (0, util_1.getSession)(model);
40
17
  const snap = (0, mobx_state_tree_1.getSnapshot)(model);
@@ -61,104 +38,96 @@ const AlignmentConnections = (0, mobx_react_1.observer)(function ({ model, track
61
38
  const rect = parentRef.current.getBoundingClientRect();
62
39
  yOffset = rect.top;
63
40
  }
64
- return assembly ? (react_1.default.createElement("g", { fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
65
- const ret = [];
66
- // we follow a path in the list of chunks, not from top to bottom, just in series
67
- // following x1,y1 -> x2,y2
68
- for (let i = 0; i < chunk.length - 1; i++) {
69
- const { layout: c1, feature: f1, level: level1 } = chunk[i];
70
- const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
71
- if (!c1 || !c2) {
72
- console.warn('received null layout for a overlay feature');
73
- return null;
74
- }
75
- // disable rendering connections in a single row
76
- if (!showIntraviewLinks && level1 === level2) {
77
- return null;
78
- }
79
- const f1ref = assembly.getCanonicalRefName(f1.get('refName'));
80
- const f2ref = assembly.getCanonicalRefName(f2.get('refName'));
81
- if (!f1ref || !f2ref) {
82
- throw new Error(`unable to find ref for ${f1ref || f2ref}`);
83
- }
84
- const r = {
85
- pair_orientation: f1.get('pair_orientation'),
86
- };
87
- const s1 = f1.get('strand');
88
- const s2 = f2.get('strand');
89
- const sameRef = f1ref === f2ref;
90
- const checkOrientation = sameRef;
91
- let orientationColor = '';
92
- let isAbnormal = false;
93
- if (checkOrientation) {
94
- if (hasPaired) {
95
- orientationColor = (0, getOrientationColor_1.getPairedOrientationColor)(r);
96
- isAbnormal = (0, getOrientationColor_1.isAbnormalOrientation)(r);
41
+ return assembly ? ((0, jsx_runtime_1.jsx)("g", { fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
42
+ const ret = [];
43
+ for (let i = 0; i < chunk.length - 1; i++) {
44
+ const { layout: c1, feature: f1, level: level1 } = chunk[i];
45
+ const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
46
+ if (!c1 || !c2) {
47
+ console.warn('received null layout for a overlay feature');
48
+ return null;
97
49
  }
98
- else {
99
- orientationColor = (0, getOrientationColor_1.getLongReadOrientationColorOrDefault)(s1, s2);
100
- isAbnormal = (0, getOrientationColor_1.getLongReadOrientationAbnormal)(s1, s2);
50
+ if (!showIntraviewLinks && level1 === level2) {
51
+ return null;
101
52
  }
53
+ const f1ref = assembly.getCanonicalRefName(f1.get('refName'));
54
+ const f2ref = assembly.getCanonicalRefName(f2.get('refName'));
55
+ if (!f1ref || !f2ref) {
56
+ throw new Error(`unable to find ref for ${f1ref || f2ref}`);
57
+ }
58
+ const r = {
59
+ pair_orientation: f1.get('pair_orientation'),
60
+ };
61
+ const s1 = f1.get('strand');
62
+ const s2 = f2.get('strand');
63
+ const sameRef = f1ref === f2ref;
64
+ const checkOrientation = sameRef;
65
+ let orientationColor = '';
66
+ let isAbnormal = false;
67
+ if (checkOrientation) {
68
+ if (hasPaired) {
69
+ orientationColor = (0, getOrientationColor_1.getPairedOrientationColor)(r);
70
+ isAbnormal = (0, getOrientationColor_1.isAbnormalOrientation)(r);
71
+ }
72
+ else {
73
+ orientationColor = (0, getOrientationColor_1.getLongReadOrientationColorOrDefault)(s1, s2);
74
+ isAbnormal = (0, getOrientationColor_1.getLongReadOrientationAbnormal)(s1, s2);
75
+ }
76
+ }
77
+ const p1 = c1[s1 === -1 ? LEFT : RIGHT];
78
+ const sn1 = s2 === -1;
79
+ const p2 = hasPaired ? c2[sn1 ? LEFT : RIGHT] : c2[sn1 ? RIGHT : LEFT];
80
+ const x1 = (0, util_3.getPxFromCoordinate)(views[level1], f1ref, p1);
81
+ const x2 = (0, util_3.getPxFromCoordinate)(views[level2], f2ref, p2);
82
+ const reversed1 = views[level1].pxToBp(x1).reversed;
83
+ const reversed2 = views[level2].pxToBp(x2).reversed;
84
+ const rf1 = reversed1 ? -1 : 1;
85
+ const rf2 = reversed2 ? -1 : 1;
86
+ const tracks = views.map(v => v.getTrack(trackId));
87
+ const y1 = (0, util_3.yPos)(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
88
+ yOffset;
89
+ const y2 = (0, util_3.yPos)(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
90
+ yOffset;
91
+ const sameLevel = level1 === level2;
92
+ const abnormalSpecialRenderFlag = sameLevel && isAbnormal;
93
+ const trackHeight = abnormalSpecialRenderFlag
94
+ ? tracks[level1].displays[0].height
95
+ : 0;
96
+ const pf1 = hasPaired ? -1 : 1;
97
+ const y0 = (0, util_3.heightFromSpecificLevel)(views, trackId, level1, getTrackYPosOverride);
98
+ const path = [
99
+ 'M',
100
+ x1,
101
+ y1,
102
+ 'C',
103
+ x1 + 200 * f1.get('strand') * rf1,
104
+ abnormalSpecialRenderFlag
105
+ ? Math.min(y0 - yOffset + trackHeight, y1 + trackHeight)
106
+ : y1,
107
+ x2 - 200 * f2.get('strand') * rf2 * pf1,
108
+ abnormalSpecialRenderFlag
109
+ ? Math.min(y0 - yOffset + trackHeight, y2 + trackHeight)
110
+ : y2,
111
+ x2,
112
+ y2,
113
+ ].join(' ');
114
+ const id = `${f1.id()}-${f2.id()}`;
115
+ ret.push((0, jsx_runtime_1.jsx)("path", { d: path, "data-testid": "r1", pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: mouseoverElt === id ? 5 : 1, ...(0, util_1.getStrokeProps)(orientationColor || theme.palette.text.disabled), onClick: () => {
116
+ var _a, _b;
117
+ const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'BreakpointAlignmentsWidget', 'breakpointAlignments', {
118
+ featureData: {
119
+ feature1: (allFeatures.get(f1.id()) || { toJSON: () => { } }).toJSON(),
120
+ feature2: (allFeatures.get(f2.id()) || { toJSON: () => { } }).toJSON(),
121
+ },
122
+ });
123
+ (_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
124
+ }, onMouseOver: () => {
125
+ setMouseoverElt(id);
126
+ }, onMouseOut: () => {
127
+ setMouseoverElt(undefined);
128
+ } }, id));
102
129
  }
103
- const p1 = c1[s1 === -1 ? LEFT : RIGHT];
104
- const sn1 = s2 === -1;
105
- const p2 = hasPaired ? c2[sn1 ? LEFT : RIGHT] : c2[sn1 ? RIGHT : LEFT];
106
- const x1 = (0, util_3.getPxFromCoordinate)(views[level1], f1ref, p1);
107
- const x2 = (0, util_3.getPxFromCoordinate)(views[level2], f2ref, p2);
108
- const reversed1 = views[level1].pxToBp(x1).reversed;
109
- const reversed2 = views[level2].pxToBp(x2).reversed;
110
- const rf1 = reversed1 ? -1 : 1;
111
- const rf2 = reversed2 ? -1 : 1;
112
- const tracks = views.map(v => v.getTrack(trackId));
113
- const y1 = (0, util_3.yPos)(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
114
- yOffset;
115
- const y2 = (0, util_3.yPos)(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
116
- yOffset;
117
- const sameLevel = level1 === level2;
118
- const abnormalSpecialRenderFlag = sameLevel && isAbnormal;
119
- const trackHeight = abnormalSpecialRenderFlag
120
- ? tracks[level1].displays[0].height
121
- : 0;
122
- const pf1 = hasPaired ? -1 : 1;
123
- const y0 = (0, util_3.heightFromSpecificLevel)(views, trackId, level1, getTrackYPosOverride);
124
- // possible todo: use totalCurveHeight to possibly make alternative
125
- // squiggle if the S is too small
126
- const path = [
127
- 'M',
128
- x1,
129
- y1,
130
- 'C',
131
- // first bezier x,y
132
- x1 + 200 * f1.get('strand') * rf1,
133
- abnormalSpecialRenderFlag
134
- ? Math.min(y0 - yOffset + trackHeight, y1 + trackHeight)
135
- : y1,
136
- // second bezier x,y
137
- x2 - 200 * f2.get('strand') * rf2 * pf1,
138
- abnormalSpecialRenderFlag
139
- ? Math.min(y0 - yOffset + trackHeight, y2 + trackHeight)
140
- : y2,
141
- // third bezier x,y
142
- x2,
143
- y2,
144
- ].join(' ');
145
- const id = `${f1.id()}-${f2.id()}`;
146
- ret.push(react_1.default.createElement("path", { d: path, key: id, "data-testid": "r1", strokeWidth: mouseoverElt === id ? 5 : 1, ...(0, util_1.getStrokeProps)(orientationColor || theme.palette.text.disabled), onClick: () => {
147
- var _a, _b;
148
- const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'BreakpointAlignmentsWidget', 'breakpointAlignments', {
149
- featureData: {
150
- feature1: (allFeatures.get(f1.id()) || { toJSON: () => { } }).toJSON(),
151
- feature2: (allFeatures.get(f2.id()) || { toJSON: () => { } }).toJSON(),
152
- },
153
- });
154
- (_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
155
- }, onMouseOver: () => {
156
- setMouseoverElt(id);
157
- }, onMouseOut: () => {
158
- setMouseoverElt(undefined);
159
- } }));
160
- }
161
- return ret;
162
- }))) : null;
130
+ return ret;
131
+ }) })) : null;
163
132
  });
164
133
  exports.default = AlignmentConnections;
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
- import { BreakpointViewModel } from '../model';
1
+ import type { BreakpointViewModel } from '../model';
3
2
  declare const Breakends: ({ 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 Breakends;