@jbrowse/plugin-breakpoint-split-view 2.17.0 → 2.18.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 (75) hide show
  1. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +5 -1
  2. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +4 -3
  3. package/dist/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
  4. package/dist/BreakpointAlignmentsFeatureDetail/index.js +1 -1
  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 +1 -1
  8. package/dist/BreakpointSplitView/components/AlignmentConnections.js +2 -11
  9. package/dist/BreakpointSplitView/components/Breakends.d.ts +1 -1
  10. package/dist/BreakpointSplitView/components/Breakends.js +4 -7
  11. package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -1
  12. package/dist/BreakpointSplitView/components/BreakpointSplitView.js +1 -1
  13. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -1
  14. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +2 -9
  15. package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +1 -1
  16. package/dist/BreakpointSplitView/components/ExportSvgDialog.js +2 -4
  17. package/dist/BreakpointSplitView/components/Overlay.d.ts +1 -1
  18. package/dist/BreakpointSplitView/components/Overlay.js +1 -3
  19. package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +1 -1
  20. package/dist/BreakpointSplitView/components/PairedFeatures.js +2 -5
  21. package/dist/BreakpointSplitView/components/Translocations.d.ts +1 -1
  22. package/dist/BreakpointSplitView/components/Translocations.js +5 -12
  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 +2 -3
  28. package/dist/BreakpointSplitView/model.d.ts +6 -64
  29. package/dist/BreakpointSplitView/model.js +6 -91
  30. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +1 -1
  31. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +1 -1
  32. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +4 -7
  33. package/dist/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
  34. package/dist/BreakpointSplitView/svgcomponents/util.js +0 -1
  35. package/dist/BreakpointSplitView/util.d.ts +2 -2
  36. package/dist/BreakpointSplitView/util.js +0 -8
  37. package/dist/index.d.ts +1 -1
  38. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +5 -1
  39. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +4 -3
  40. package/esm/BreakpointAlignmentsFeatureDetail/index.d.ts +1 -1
  41. package/esm/BreakpointAlignmentsFeatureDetail/index.js +1 -1
  42. package/esm/BreakpointSplitView/BreakpointSplitView.d.ts +22 -40
  43. package/esm/BreakpointSplitView/BreakpointSplitView.js +41 -90
  44. package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +1 -1
  45. package/esm/BreakpointSplitView/components/AlignmentConnections.js +3 -12
  46. package/esm/BreakpointSplitView/components/Breakends.d.ts +1 -1
  47. package/esm/BreakpointSplitView/components/Breakends.js +6 -9
  48. package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -1
  49. package/esm/BreakpointSplitView/components/BreakpointSplitView.js +1 -1
  50. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -1
  51. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +2 -9
  52. package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +1 -1
  53. package/esm/BreakpointSplitView/components/ExportSvgDialog.js +2 -4
  54. package/esm/BreakpointSplitView/components/Overlay.d.ts +1 -1
  55. package/esm/BreakpointSplitView/components/Overlay.js +1 -3
  56. package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +1 -1
  57. package/esm/BreakpointSplitView/components/PairedFeatures.js +4 -7
  58. package/esm/BreakpointSplitView/components/Translocations.d.ts +1 -1
  59. package/esm/BreakpointSplitView/components/Translocations.js +7 -14
  60. package/esm/BreakpointSplitView/components/getOrientationColor.js +0 -8
  61. package/esm/BreakpointSplitView/components/util.d.ts +1 -1
  62. package/esm/BreakpointSplitView/components/util.js +12 -12
  63. package/esm/BreakpointSplitView/index.d.ts +1 -1
  64. package/esm/BreakpointSplitView/index.js +2 -3
  65. package/esm/BreakpointSplitView/model.d.ts +6 -64
  66. package/esm/BreakpointSplitView/model.js +6 -91
  67. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +1 -1
  68. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +1 -1
  69. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +4 -7
  70. package/esm/BreakpointSplitView/svgcomponents/util.d.ts +2 -2
  71. package/esm/BreakpointSplitView/svgcomponents/util.js +0 -1
  72. package/esm/BreakpointSplitView/util.d.ts +2 -2
  73. package/esm/BreakpointSplitView/util.js +1 -9
  74. package/esm/index.d.ts +1 -1
  75. package/package.json +3 -3
@@ -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;
@@ -28,12 +28,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.default = BreakpointSplitViewF;
30
30
  const react_1 = require("react");
31
- // locals
32
- const BreakpointSplitView_1 = __importDefault(require("./BreakpointSplitView"));
31
+ const pluggableElementTypes_1 = require("@jbrowse/core/pluggableElementTypes");
33
32
  const model_1 = __importDefault(require("./model"));
34
33
  function BreakpointSplitViewF(pluginManager) {
35
34
  pluginManager.addViewType(() => {
36
- return new BreakpointSplitView_1.default({
35
+ return new pluggableElementTypes_1.ViewType({
37
36
  name: 'BreakpointSplitView',
38
37
  displayName: 'Breakpoint split view',
39
38
  stateModel: (0, model_1.default)(pluginManager),
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- import { Instance } from 'mobx-state-tree';
3
- import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
4
- import PluginManager from '@jbrowse/core/PluginManager';
5
- import { Feature } from '@jbrowse/core/util';
1
+ import type React from 'react';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
+ import type { Feature } from '@jbrowse/core/util';
4
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
5
+ import type { Instance } from 'mobx-state-tree';
6
6
  export declare function getClip(cigar: string, strand: number): number;
7
7
  export interface ExportSvgOptions {
8
8
  rasterizeLayers?: boolean;
@@ -27,11 +27,6 @@ export interface Breakend {
27
27
  MatePosition: string;
28
28
  }
29
29
  export type LayoutRecord = [number, number, number, number];
30
- /**
31
- * #stateModel BreakpointSplitView
32
- * extends
33
- * - [BaseViewModel](../baseviewmodel)
34
- */
35
30
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
36
31
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
37
32
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -94,6 +89,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
94
89
  scaleBarDisplayPrefix(): string | undefined;
95
90
  MiniControlsComponent(): React.FC<any>;
96
91
  HeaderComponent(): React.FC<any>;
92
+ readonly assembliesNotFound: string | undefined;
97
93
  readonly assemblyErrors: string;
98
94
  readonly assembliesInitialized: boolean;
99
95
  readonly initialized: boolean;
@@ -275,47 +271,17 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
275
271
  width: number;
276
272
  matchedTrackFeatures: Record<string, Feature[][]>;
277
273
  } & {
278
- /**
279
- * #method
280
- * creates an svg export and save using FileSaver
281
- */
282
274
  exportSvg(opts?: ExportSvgOptions): Promise<void>;
283
275
  } & {
284
- /**
285
- * #getter
286
- * Find all track ids that match across multiple views, or return just
287
- * the single view's track if only a single row is used
288
- */
289
276
  readonly matchedTracks: (import("mobx-state-tree").IMSTArray<import("mobx-state-tree").IAnyType> & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyType>>) | {
290
277
  configuration: {
291
278
  trackId: string;
292
279
  };
293
280
  }[];
294
- /**
295
- * #method
296
- * Get tracks with a given trackId across multiple views
297
- */
298
281
  getMatchedTracks(trackConfigId: string): any[];
299
- /**
300
- * #method
301
- * Translocation features are handled differently since they do not have
302
- * a mate e.g. they are one sided
303
- */
304
282
  hasTranslocations(trackConfigId: string): Feature | undefined;
305
- /**
306
- * #method
307
- * Paired features similar to breakends, but simpler, like BEDPE
308
- */
309
283
  hasPairedFeatures(trackConfigId: string): Feature | undefined;
310
- /**
311
- * #method
312
- * Get a composite map of featureId-\>feature map for a track across
313
- * multiple views
314
- */
315
284
  getTrackFeatures(trackConfigId: string): Map<string, Feature>;
316
- /**
317
- * #method
318
- */
319
285
  getMatchedFeaturesInLayout(trackConfigId: string, features: Feature[][]): {
320
286
  feature: Feature;
321
287
  layout: LayoutRecord | undefined;
@@ -325,39 +291,15 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
325
291
  } & {
326
292
  afterAttach(): void;
327
293
  onSubviewAction(actionName: string, path: string, args?: unknown[]): void;
328
- /**
329
- * #action
330
- */
331
294
  setWidth(newWidth: number): void;
332
- /**
333
- * #action
334
- */
335
295
  removeView(view: LGV): void;
336
- /**
337
- * #action
338
- */
339
296
  toggleInteract(): void;
340
- /**
341
- * #action
342
- */
343
297
  toggleIntraviewLinks(): void;
344
- /**
345
- * #action
346
- */
347
298
  toggleLinkViews(): void;
348
- /**
349
- * #action
350
- */
351
299
  setMatchedTrackFeatures(obj: Record<string, Feature[][]>): void;
352
- /**
353
- * #action
354
- */
355
300
  reverseViewOrder(): void;
356
301
  } & {
357
302
  afterAttach(): void;
358
- /**
359
- * #method
360
- */
361
303
  menuItems(): ({
362
304
  label: string;
363
305
  subMenu: import("@jbrowse/core/ui").MenuItem[];
@@ -29,18 +29,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.getClip = getClip;
30
30
  exports.default = stateModelFactory;
31
31
  const react_1 = require("react");
32
- const mobx_state_tree_1 = require("mobx-state-tree");
33
- const mobx_1 = require("mobx");
34
- const file_saver_1 = require("file-saver");
32
+ const configuration_1 = require("@jbrowse/core/configuration");
35
33
  const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
36
34
  const util_1 = require("@jbrowse/core/util");
37
- const configuration_1 = require("@jbrowse/core/configuration");
38
- // icons
39
- const PhotoCamera_1 = __importDefault(require("@mui/icons-material/PhotoCamera"));
40
35
  const Link_1 = __importDefault(require("@mui/icons-material/Link"));
41
- // locals
36
+ const PhotoCamera_1 = __importDefault(require("@mui/icons-material/PhotoCamera"));
37
+ const file_saver_1 = require("file-saver");
38
+ const mobx_1 = require("mobx");
39
+ const mobx_state_tree_1 = require("mobx-state-tree");
42
40
  const util_2 = require("./util");
43
- // lazies
44
41
  const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ExportSvgDialog'))));
45
42
  const startClip = new RegExp(/(\d+)[SH]$/);
46
43
  const endClip = new RegExp(/^(\d+)([SH])/);
@@ -63,7 +60,7 @@ async function getBlockFeatures(model, track) {
63
60
  }
64
61
  const assembly = await assemblyManager.waitForAssembly(assemblyName);
65
62
  if (!assembly) {
66
- return undefined; // throw new Error(`assembly not found: "${assemblyName}"`)
63
+ return undefined;
67
64
  }
68
65
  const sessionId = track.configuration.trackId;
69
66
  return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
@@ -72,43 +69,17 @@ async function getBlockFeatures(model, track) {
72
69
  regions: view.staticBlocks.contentBlocks,
73
70
  })).flat()));
74
71
  }
75
- /**
76
- * #stateModel BreakpointSplitView
77
- * extends
78
- * - [BaseViewModel](../baseviewmodel)
79
- */
80
72
  function stateModelFactory(pluginManager) {
81
73
  const minHeight = 40;
82
74
  const defaultHeight = 400;
83
75
  return mobx_state_tree_1.types
84
76
  .compose('BreakpointSplitView', models_1.BaseViewModel, mobx_state_tree_1.types.model({
85
- /**
86
- * #property
87
- */
88
77
  type: mobx_state_tree_1.types.literal('BreakpointSplitView'),
89
- /**
90
- * #property
91
- */
92
78
  height: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.refinement('viewHeight', mobx_state_tree_1.types.number, (n) => n >= minHeight), defaultHeight),
93
- /**
94
- * #property
95
- */
96
79
  trackSelectorType: 'hierarchical',
97
- /**
98
- * #property
99
- */
100
80
  showIntraviewLinks: true,
101
- /**
102
- * #property
103
- */
104
81
  linkViews: false,
105
- /**
106
- * #property
107
- */
108
82
  interactToggled: false,
109
- /**
110
- * #property
111
- */
112
83
  views: mobx_state_tree_1.types.array(pluginManager.getViewType('LinearGenomeView')
113
84
  .stateModel),
114
85
  }))
@@ -117,10 +88,6 @@ function stateModelFactory(pluginManager) {
117
88
  matchedTrackFeatures: {},
118
89
  }))
119
90
  .views(self => ({
120
- /**
121
- * #method
122
- * creates an svg export and save using FileSaver
123
- */
124
91
  async exportSvg(opts = {}) {
125
92
  const { renderToSvg } = await Promise.resolve().then(() => __importStar(require('./svgcomponents/SVGBreakpointSplitView')));
126
93
  const html = await renderToSvg(self, opts);
@@ -129,54 +96,27 @@ function stateModelFactory(pluginManager) {
129
96
  },
130
97
  }))
131
98
  .views(self => ({
132
- /**
133
- * #getter
134
- * Find all track ids that match across multiple views, or return just
135
- * the single view's track if only a single row is used
136
- */
137
99
  get matchedTracks() {
138
100
  return self.views.length === 1
139
101
  ? self.views[0].tracks
140
102
  : (0, util_2.intersect)(elt => elt.configuration.trackId, ...self.views.map(view => view.tracks));
141
103
  },
142
- /**
143
- * #method
144
- * Get tracks with a given trackId across multiple views
145
- */
146
104
  getMatchedTracks(trackConfigId) {
147
105
  return self.views
148
106
  .map(view => view.getTrack(trackConfigId))
149
107
  .filter(f => !!f);
150
108
  },
151
- /**
152
- * #method
153
- * Translocation features are handled differently since they do not have
154
- * a mate e.g. they are one sided
155
- */
156
109
  hasTranslocations(trackConfigId) {
157
110
  return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'translocation');
158
111
  },
159
- /**
160
- * #method
161
- * Paired features similar to breakends, but simpler, like BEDPE
162
- */
163
112
  hasPairedFeatures(trackConfigId) {
164
113
  return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'paired_feature');
165
114
  },
166
- /**
167
- * #method
168
- * Get a composite map of featureId-\>feature map for a track across
169
- * multiple views
170
- */
171
115
  getTrackFeatures(trackConfigId) {
172
116
  var _a;
173
117
  return new Map((_a = self.matchedTrackFeatures[trackConfigId]) === null || _a === void 0 ? void 0 : _a.flat().map(f => [f.id(), f]));
174
118
  },
175
- /**
176
- * #method
177
- */
178
119
  getMatchedFeaturesInLayout(trackConfigId, features) {
179
- // use reverse to search the second track first
180
120
  const tracks = this.getMatchedTracks(trackConfigId);
181
121
  return features.map(c => c
182
122
  .map(feature => {
@@ -217,53 +157,31 @@ function stateModelFactory(pluginManager) {
217
157
  self.views.forEach(view => {
218
158
  const ret = (0, mobx_state_tree_1.getPath)(view);
219
159
  if (!ret.endsWith(path)) {
220
- // @ts-ignore
221
160
  view[actionName](args === null || args === void 0 ? void 0 : args[0]);
222
161
  }
223
162
  });
224
163
  },
225
- /**
226
- * #action
227
- */
228
164
  setWidth(newWidth) {
229
165
  self.width = newWidth;
230
166
  self.views.forEach(v => {
231
167
  v.setWidth(newWidth);
232
168
  });
233
169
  },
234
- /**
235
- * #action
236
- */
237
170
  removeView(view) {
238
171
  self.views.remove(view);
239
172
  },
240
- /**
241
- * #action
242
- */
243
173
  toggleInteract() {
244
174
  self.interactToggled = !self.interactToggled;
245
175
  },
246
- /**
247
- * #action
248
- */
249
176
  toggleIntraviewLinks() {
250
177
  self.showIntraviewLinks = !self.showIntraviewLinks;
251
178
  },
252
- /**
253
- * #action
254
- */
255
179
  toggleLinkViews() {
256
180
  self.linkViews = !self.linkViews;
257
181
  },
258
- /**
259
- * #action
260
- */
261
182
  setMatchedTrackFeatures(obj) {
262
183
  self.matchedTrackFeatures = obj;
263
184
  },
264
- /**
265
- * #action
266
- */
267
185
  reverseViewOrder() {
268
186
  self.views.reverse();
269
187
  },
@@ -286,9 +204,6 @@ function stateModelFactory(pluginManager) {
286
204
  }
287
205
  }));
288
206
  },
289
- /**
290
- * #method
291
- */
292
207
  menuItems() {
293
208
  return [
294
209
  ...self.views
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = SVGBackground;
7
7
  const react_1 = __importDefault(require("react"));
8
- const material_1 = require("@mui/material");
9
8
  const util_1 = require("@jbrowse/core/util");
9
+ const material_1 = require("@mui/material");
10
10
  function SVGBackground({ width, height, shift, }) {
11
11
  const theme = (0, material_1.useTheme)();
12
12
  return (react_1.default.createElement("rect", { width: width + shift * 2, height: height, fill: (0, util_1.stripAlpha)(theme.palette.background.default) }));
@@ -1,4 +1,4 @@
1
- import { ExportSvgOptions, BreakpointViewModel } from '../model';
1
+ import type { BreakpointViewModel, ExportSvgOptions } from '../model';
2
2
  type BSV = BreakpointViewModel;
3
3
  export declare function renderToSvg(model: BSV, opts: ExportSvgOptions): Promise<string>;
4
4
  export {};
@@ -5,17 +5,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.renderToSvg = renderToSvg;
7
7
  const react_1 = __importDefault(require("react"));
8
- const mobx_1 = require("mobx");
8
+ const ui_1 = require("@jbrowse/core/ui");
9
9
  const util_1 = require("@jbrowse/core/util");
10
+ const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
10
11
  const material_1 = require("@mui/material");
11
- const ui_1 = require("@jbrowse/core/ui");
12
+ const mobx_1 = require("mobx");
12
13
  const mobx_state_tree_1 = require("mobx-state-tree");
13
- const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
14
- // locals
15
14
  const SVGBackground_1 = __importDefault(require("./SVGBackground"));
16
- const Overlay_1 = __importDefault(require("../components/Overlay"));
17
15
  const util_2 = require("./util");
18
- // render LGV to SVG
16
+ const Overlay_1 = __importDefault(require("../components/Overlay"));
19
17
  async function renderToSvg(model, opts) {
20
18
  var _a;
21
19
  const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => children, themeName = 'default', } = opts;
@@ -41,7 +39,6 @@ async function renderToSvg(model, opts) {
41
39
  const trackOffsets = views.map((view, idx) => (0, util_2.getTrackOffsets)(view, textOffset, fontSize + (idx > 0 ? heights[idx - 1] : 0) + offset));
42
40
  const w = width + trackLabelOffset;
43
41
  const t = (0, ui_1.createJBrowseTheme)(theme);
44
- // the xlink namespace is used for rendering <image> tag
45
42
  return (0, util_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: t },
46
43
  react_1.default.createElement(Wrapper, null,
47
44
  react_1.default.createElement("svg", { width: width, height: totalHeightSvg, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w + shift * 2, totalHeightSvg].toString() },
@@ -1,4 +1,4 @@
1
- import { AbstractSessionModel } from '@jbrowse/core/util';
2
- import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
1
+ import type { AbstractSessionModel } from '@jbrowse/core/util';
2
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
3
  export declare function getTrackNameMaxLen(views: LinearGenomeViewModel[], fontSize: number, session: AbstractSessionModel): number;
4
4
  export declare function getTrackOffsets(view: LinearGenomeViewModel, textOffset: number, extra?: number): Record<string, number>;
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTrackNameMaxLen = getTrackNameMaxLen;
4
4
  exports.getTrackOffsets = getTrackOffsets;
5
5
  const util_1 = require("@jbrowse/core/util");
6
- // locals
7
6
  const tracks_1 = require("@jbrowse/core/util/tracks");
8
7
  function getTrackNameMaxLen(views, fontSize, session) {
9
8
  return (0, util_1.max)(views.flatMap(view => view.tracks.map(t => (0, util_1.measureText)((0, tracks_1.getTrackName)(t.configuration, session), fontSize))), 0);
@@ -1,5 +1,5 @@
1
- import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
2
- import { LayoutRecord } from './model';
1
+ import type { LayoutRecord } from './model';
2
+ import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  interface Display {
5
5
  height: number;
@@ -21,7 +21,6 @@ function getPxFromCoordinate(view, refName, coord) {
21
21
  var _a;
22
22
  return (((_a = view.bpToPx({ refName, coord })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - view.offsetPx;
23
23
  }
24
- // get's the yposition of a layout record in a track
25
24
  function yPos(trackId, level, views, tracks, c, getYPosOverride) {
26
25
  const display = tracks[level].displays[0];
27
26
  const min = 0;
@@ -36,10 +35,6 @@ function yPos(trackId, level, views, tracks, c, getYPosOverride) {
36
35
  heightFromSpecificLevel(views, trackId, level, getYPosOverride) +
37
36
  display.scrollTop);
38
37
  }
39
- // we combo a useEffect and useState combo to force rerender on snap changing.
40
- // the setup of this being a useEffect+useState makes it re-render once the
41
- // useEffect is called, which is generally the "next frame". If we removed the
42
- // below use
43
38
  const useNextFrame = (variable) => {
44
39
  const [, setNextFrameState] = (0, react_1.useState)();
45
40
  (0, react_1.useEffect)(() => {
@@ -47,9 +42,6 @@ const useNextFrame = (variable) => {
47
42
  }, [variable]);
48
43
  };
49
44
  exports.useNextFrame = useNextFrame;
50
- // https://stackoverflow.com/a/49186706/2129219 the array-intersection package
51
- // on npm has a large kb size, and we are just intersecting open track ids so
52
- // simple is better
53
45
  function intersect(cb, a1 = [], a2 = [], ...rest) {
54
46
  const ids = new Set(a2.map(elt => cb(elt)));
55
47
  const a12 = a1.filter(value => ids.has(cb(value)));
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import PluginManager from '@jbrowse/core/PluginManager';
2
1
  import Plugin from '@jbrowse/core/Plugin';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  export default class BreakpointSplitViewPlugin extends Plugin {
4
4
  name: string;
5
5
  install(pluginManager: PluginManager): void;
@@ -1,7 +1,11 @@
1
1
  import React from 'react';
2
+ import type { SimpleFeatureSerialized } from '@jbrowse/core/util';
2
3
  declare const BreakpointAlignmentsFeatureDetail: ({ model, }: {
3
4
  model: {
4
- featureData: Record<string, unknown>;
5
+ featureData: {
6
+ feature1: SimpleFeatureSerialized;
7
+ feature2: SimpleFeatureSerialized;
8
+ };
5
9
  };
6
10
  }) => React.JSX.Element;
7
11
  export default BreakpointAlignmentsFeatureDetail;
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
+ import { BaseAttributes, BaseCoreDetails, } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
2
3
  import { Paper } from '@mui/material';
3
4
  import { observer } from 'mobx-react';
4
- import { BaseCoreDetails, BaseAttributes, } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
5
5
  const BreakpointAlignmentsFeatureDetail = observer(function ({ model, }) {
6
- const { feature1, feature2 } = JSON.parse(JSON.stringify(model.featureData));
7
- return (React.createElement(Paper, { "data-testid": "alignment-side-drawer" },
6
+ const { featureData } = model;
7
+ const { feature1, feature2 } = structuredClone(featureData);
8
+ return (React.createElement(Paper, null,
8
9
  React.createElement(BaseCoreDetails, { title: "Feature 1", feature: feature1 }),
9
10
  React.createElement(BaseCoreDetails, { title: "Feature 2", feature: feature2 }),
10
11
  React.createElement(BaseAttributes, { title: "Feature 1 attributes", feature: feature1 }),
@@ -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;
@@ -1,8 +1,8 @@
1
1
  import { lazy } from 'react';
2
2
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
+ import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
3
4
  import { ElementId } from '@jbrowse/core/util/types/mst';
4
5
  import { types } from 'mobx-state-tree';
5
- import { WidgetType } from '@jbrowse/core/pluggableElementTypes';
6
6
  const configSchema = ConfigurationSchema('BreakpointAlignmentsWidget', {});
7
7
  const stateModel = types
8
8
  .model('BreakpointAlignmentsWidget', {