@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
@@ -1,17 +1,23 @@
1
- import { notEmpty } from '@jbrowse/core/util';
2
1
  import { parseBreakend } from '@gmod/vcf';
3
- // this finds candidate alignment features, aimed at plotting split reads from
4
- // BAM/CRAM files
2
+ import { assembleLocStringFast, notEmpty } from '@jbrowse/core/util';
5
3
  export function getBadlyPairedAlignments(features) {
6
4
  const candidates = new Map();
7
5
  const alreadySeen = new Set();
8
- // this finds candidate features that share the same name
6
+ const alreadyPairedWithSamePosition = new Set();
9
7
  for (const feature of features.values()) {
10
8
  const flags = feature.get('flags');
11
9
  const id = feature.id();
10
+ const supp = assembleLocStringFast({
11
+ refName: feature.get('refName'),
12
+ start: feature.get('start'),
13
+ end: feature.get('end'),
14
+ });
12
15
  const unmapped = flags & 4;
13
16
  const correctlyPaired = flags & 2;
14
- if (!alreadySeen.has(id) && !correctlyPaired && !unmapped) {
17
+ if (!alreadySeen.has(id) &&
18
+ !alreadyPairedWithSamePosition.has(supp) &&
19
+ !correctlyPaired &&
20
+ !unmapped) {
15
21
  const n = feature.get('name');
16
22
  let val = candidates.get(n);
17
23
  if (!val) {
@@ -21,16 +27,14 @@ export function getBadlyPairedAlignments(features) {
21
27
  val.push(feature);
22
28
  }
23
29
  alreadySeen.add(feature.id());
30
+ alreadyPairedWithSamePosition.add(supp);
24
31
  }
25
32
  return [...candidates.values()].filter(v => v.length > 1);
26
33
  }
27
- // this finds candidate alignment features, aimed at plotting split reads from
28
- // BAM/CRAM files
29
34
  export function getMatchedAlignmentFeatures(features) {
30
35
  var _a;
31
36
  const candidates = new Map();
32
37
  const alreadySeen = new Set();
33
- // this finds candidate features that share the same name
34
38
  for (const feature of features.values()) {
35
39
  const id = feature.id();
36
40
  const unmapped = feature.get('flags') & 4;
@@ -66,8 +70,6 @@ export function findMatchingAlt(feat1, feat2) {
66
70
  }
67
71
  return undefined;
68
72
  }
69
- // Returns paired BND features across multiple views by inspecting the ALT
70
- // field to get exact coordinate matches
71
73
  export function getMatchedBreakendFeatures(feats) {
72
74
  const candidates = new Map();
73
75
  const alreadySeen = new Set();
@@ -92,7 +94,6 @@ export function getMatchedBreakendFeatures(feats) {
92
94
  }
93
95
  return [...candidates.values()].filter(v => v.length > 1);
94
96
  }
95
- // Getting "matched" TRA means just return all TRA
96
97
  export function getMatchedTranslocationFeatures(feats) {
97
98
  const ret = [];
98
99
  const alreadySeen = new Set();
@@ -104,7 +105,6 @@ export function getMatchedTranslocationFeatures(feats) {
104
105
  }
105
106
  return ret;
106
107
  }
107
- // Getting "matched" TRA means just return all TRA
108
108
  export function getMatchedPairedFeatures(feats) {
109
109
  const candidates = new Map();
110
110
  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;
@@ -1,10 +1,9 @@
1
1
  import { lazy } from 'react';
2
- // locals
3
- import BreakpointSplitView from './BreakpointSplitView';
2
+ import { ViewType } from '@jbrowse/core/pluggableElementTypes';
4
3
  import stateModelFactory from './model';
5
4
  export default function BreakpointSplitViewF(pluginManager) {
6
5
  pluginManager.addViewType(() => {
7
- return new BreakpointSplitView({
6
+ return new ViewType({
8
7
  name: 'BreakpointSplitView',
9
8
  displayName: 'Breakpoint split view',
10
9
  stateModel: stateModelFactory(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[];
@@ -1,16 +1,13 @@
1
1
  import { lazy } from 'react';
2
- import { types, onAction, addDisposer, getPath, } from 'mobx-state-tree';
3
- import { autorun } from 'mobx';
4
- import { saveAs } from 'file-saver';
2
+ import { getConf } from '@jbrowse/core/configuration';
5
3
  import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
6
4
  import { getSession, notEmpty } from '@jbrowse/core/util';
7
- import { getConf } from '@jbrowse/core/configuration';
8
- // icons
9
- import PhotoCamera from '@mui/icons-material/PhotoCamera';
10
5
  import LinkIcon from '@mui/icons-material/Link';
11
- // locals
6
+ import PhotoCamera from '@mui/icons-material/PhotoCamera';
7
+ import { saveAs } from 'file-saver';
8
+ import { autorun } from 'mobx';
9
+ import { addDisposer, getPath, onAction, types } from 'mobx-state-tree';
12
10
  import { intersect } from './util';
13
- // lazies
14
11
  const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
15
12
  const startClip = new RegExp(/(\d+)[SH]$/);
16
13
  const endClip = new RegExp(/^(\d+)([SH])/);
@@ -33,7 +30,7 @@ async function getBlockFeatures(model, track) {
33
30
  }
34
31
  const assembly = await assemblyManager.waitForAssembly(assemblyName);
35
32
  if (!assembly) {
36
- return undefined; // throw new Error(`assembly not found: "${assemblyName}"`)
33
+ return undefined;
37
34
  }
38
35
  const sessionId = track.configuration.trackId;
39
36
  return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
@@ -42,43 +39,17 @@ async function getBlockFeatures(model, track) {
42
39
  regions: view.staticBlocks.contentBlocks,
43
40
  })).flat()));
44
41
  }
45
- /**
46
- * #stateModel BreakpointSplitView
47
- * extends
48
- * - [BaseViewModel](../baseviewmodel)
49
- */
50
42
  export default function stateModelFactory(pluginManager) {
51
43
  const minHeight = 40;
52
44
  const defaultHeight = 400;
53
45
  return types
54
46
  .compose('BreakpointSplitView', BaseViewModel, types.model({
55
- /**
56
- * #property
57
- */
58
47
  type: types.literal('BreakpointSplitView'),
59
- /**
60
- * #property
61
- */
62
48
  height: types.optional(types.refinement('viewHeight', types.number, (n) => n >= minHeight), defaultHeight),
63
- /**
64
- * #property
65
- */
66
49
  trackSelectorType: 'hierarchical',
67
- /**
68
- * #property
69
- */
70
50
  showIntraviewLinks: true,
71
- /**
72
- * #property
73
- */
74
51
  linkViews: false,
75
- /**
76
- * #property
77
- */
78
52
  interactToggled: false,
79
- /**
80
- * #property
81
- */
82
53
  views: types.array(pluginManager.getViewType('LinearGenomeView')
83
54
  .stateModel),
84
55
  }))
@@ -87,10 +58,6 @@ export default function stateModelFactory(pluginManager) {
87
58
  matchedTrackFeatures: {},
88
59
  }))
89
60
  .views(self => ({
90
- /**
91
- * #method
92
- * creates an svg export and save using FileSaver
93
- */
94
61
  async exportSvg(opts = {}) {
95
62
  const { renderToSvg } = await import('./svgcomponents/SVGBreakpointSplitView');
96
63
  const html = await renderToSvg(self, opts);
@@ -99,54 +66,27 @@ export default function stateModelFactory(pluginManager) {
99
66
  },
100
67
  }))
101
68
  .views(self => ({
102
- /**
103
- * #getter
104
- * Find all track ids that match across multiple views, or return just
105
- * the single view's track if only a single row is used
106
- */
107
69
  get matchedTracks() {
108
70
  return self.views.length === 1
109
71
  ? self.views[0].tracks
110
72
  : intersect(elt => elt.configuration.trackId, ...self.views.map(view => view.tracks));
111
73
  },
112
- /**
113
- * #method
114
- * Get tracks with a given trackId across multiple views
115
- */
116
74
  getMatchedTracks(trackConfigId) {
117
75
  return self.views
118
76
  .map(view => view.getTrack(trackConfigId))
119
77
  .filter(f => !!f);
120
78
  },
121
- /**
122
- * #method
123
- * Translocation features are handled differently since they do not have
124
- * a mate e.g. they are one sided
125
- */
126
79
  hasTranslocations(trackConfigId) {
127
80
  return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'translocation');
128
81
  },
129
- /**
130
- * #method
131
- * Paired features similar to breakends, but simpler, like BEDPE
132
- */
133
82
  hasPairedFeatures(trackConfigId) {
134
83
  return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'paired_feature');
135
84
  },
136
- /**
137
- * #method
138
- * Get a composite map of featureId-\>feature map for a track across
139
- * multiple views
140
- */
141
85
  getTrackFeatures(trackConfigId) {
142
86
  var _a;
143
87
  return new Map((_a = self.matchedTrackFeatures[trackConfigId]) === null || _a === void 0 ? void 0 : _a.flat().map(f => [f.id(), f]));
144
88
  },
145
- /**
146
- * #method
147
- */
148
89
  getMatchedFeaturesInLayout(trackConfigId, features) {
149
- // use reverse to search the second track first
150
90
  const tracks = this.getMatchedTracks(trackConfigId);
151
91
  return features.map(c => c
152
92
  .map(feature => {
@@ -187,53 +127,31 @@ export default function stateModelFactory(pluginManager) {
187
127
  self.views.forEach(view => {
188
128
  const ret = getPath(view);
189
129
  if (!ret.endsWith(path)) {
190
- // @ts-ignore
191
130
  view[actionName](args === null || args === void 0 ? void 0 : args[0]);
192
131
  }
193
132
  });
194
133
  },
195
- /**
196
- * #action
197
- */
198
134
  setWidth(newWidth) {
199
135
  self.width = newWidth;
200
136
  self.views.forEach(v => {
201
137
  v.setWidth(newWidth);
202
138
  });
203
139
  },
204
- /**
205
- * #action
206
- */
207
140
  removeView(view) {
208
141
  self.views.remove(view);
209
142
  },
210
- /**
211
- * #action
212
- */
213
143
  toggleInteract() {
214
144
  self.interactToggled = !self.interactToggled;
215
145
  },
216
- /**
217
- * #action
218
- */
219
146
  toggleIntraviewLinks() {
220
147
  self.showIntraviewLinks = !self.showIntraviewLinks;
221
148
  },
222
- /**
223
- * #action
224
- */
225
149
  toggleLinkViews() {
226
150
  self.linkViews = !self.linkViews;
227
151
  },
228
- /**
229
- * #action
230
- */
231
152
  setMatchedTrackFeatures(obj) {
232
153
  self.matchedTrackFeatures = obj;
233
154
  },
234
- /**
235
- * #action
236
- */
237
155
  reverseViewOrder() {
238
156
  self.views.reverse();
239
157
  },
@@ -256,9 +174,6 @@ export default function stateModelFactory(pluginManager) {
256
174
  }
257
175
  }));
258
176
  },
259
- /**
260
- * #method
261
- */
262
177
  menuItems() {
263
178
  return [
264
179
  ...self.views
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { useTheme } from '@mui/material';
3
2
  import { stripAlpha } from '@jbrowse/core/util';
3
+ import { useTheme } from '@mui/material';
4
4
  export default function SVGBackground({ width, height, shift, }) {
5
5
  const theme = useTheme();
6
6
  return (React.createElement("rect", { width: width + shift * 2, height: height, fill: 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 {};
@@ -1,15 +1,13 @@
1
1
  import React from 'react';
2
- import { when } from 'mobx';
2
+ import { createJBrowseTheme } from '@jbrowse/core/ui';
3
3
  import { getSession, renderToStaticMarkup, sum } from '@jbrowse/core/util';
4
+ import { SVGRuler, SVGTracks, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
4
5
  import { ThemeProvider } from '@mui/material';
5
- import { createJBrowseTheme } from '@jbrowse/core/ui';
6
+ import { when } from 'mobx';
6
7
  import { getRoot } from 'mobx-state-tree';
7
- import { SVGTracks, SVGRuler, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
8
- // locals
9
8
  import SVGBackground from './SVGBackground';
10
- import Overlay from '../components/Overlay';
11
9
  import { getTrackNameMaxLen, getTrackOffsets } from './util';
12
- // render LGV to SVG
10
+ import Overlay from '../components/Overlay';
13
11
  export async function renderToSvg(model, opts) {
14
12
  var _a;
15
13
  const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => children, themeName = 'default', } = opts;
@@ -35,7 +33,6 @@ export async function renderToSvg(model, opts) {
35
33
  const trackOffsets = views.map((view, idx) => getTrackOffsets(view, textOffset, fontSize + (idx > 0 ? heights[idx - 1] : 0) + offset));
36
34
  const w = width + trackLabelOffset;
37
35
  const t = createJBrowseTheme(theme);
38
- // the xlink namespace is used for rendering <image> tag
39
36
  return renderToStaticMarkup(React.createElement(ThemeProvider, { theme: t },
40
37
  React.createElement(Wrapper, null,
41
38
  React.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>;
@@ -1,5 +1,4 @@
1
1
  import { max, measureText } from '@jbrowse/core/util';
2
- // locals
3
2
  import { getTrackName } from '@jbrowse/core/util/tracks';
4
3
  export function getTrackNameMaxLen(views, fontSize, session) {
5
4
  return max(views.flatMap(view => view.tracks.map(t => measureText(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;
@@ -1,4 +1,4 @@
1
- import { useState, useEffect } from 'react';
1
+ import { useEffect, useState } from 'react';
2
2
  import { clamp } from '@jbrowse/core/util';
3
3
  const [, TOP, , BOTTOM] = [0, 1, 2, 3];
4
4
  function cheight(chunk) {
@@ -14,7 +14,6 @@ export function getPxFromCoordinate(view, refName, coord) {
14
14
  var _a;
15
15
  return (((_a = view.bpToPx({ refName, coord })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - view.offsetPx;
16
16
  }
17
- // get's the yposition of a layout record in a track
18
17
  export function yPos(trackId, level, views, tracks, c, getYPosOverride) {
19
18
  const display = tracks[level].displays[0];
20
19
  const min = 0;
@@ -29,19 +28,12 @@ export function yPos(trackId, level, views, tracks, c, getYPosOverride) {
29
28
  heightFromSpecificLevel(views, trackId, level, getYPosOverride) +
30
29
  display.scrollTop);
31
30
  }
32
- // we combo a useEffect and useState combo to force rerender on snap changing.
33
- // the setup of this being a useEffect+useState makes it re-render once the
34
- // useEffect is called, which is generally the "next frame". If we removed the
35
- // below use
36
31
  export const useNextFrame = (variable) => {
37
32
  const [, setNextFrameState] = useState();
38
33
  useEffect(() => {
39
34
  setNextFrameState(variable);
40
35
  }, [variable]);
41
36
  };
42
- // https://stackoverflow.com/a/49186706/2129219 the array-intersection package
43
- // on npm has a large kb size, and we are just intersecting open track ids so
44
- // simple is better
45
37
  export function intersect(cb, a1 = [], a2 = [], ...rest) {
46
38
  const ids = new Set(a2.map(elt => cb(elt)));
47
39
  const a12 = a1.filter(value => ids.has(cb(value)));
package/esm/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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-breakpoint-split-view",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "description": "JBrowse 2 breakpoint detail split view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -36,7 +36,7 @@
36
36
  "clean": "rimraf dist esm *.tsbuildinfo"
37
37
  },
38
38
  "dependencies": {
39
- "@gmod/vcf": "^5.0.9",
39
+ "@gmod/vcf": "^6.0.0",
40
40
  "@mui/icons-material": "^6.0.0",
41
41
  "@types/file-saver": "^2.0.1",
42
42
  "file-saver": "^2.0.0"
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "eed30b5e671f8f7823652d7cecc51aa89226de46"
61
+ "gitHead": "c344ea60099cb7e460b77f15808946b24a7eee74"
62
62
  }