@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,37 +1,7 @@
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';
6
- export declare function getClip(cigar: string, strand: number): number;
7
- export interface ExportSvgOptions {
8
- rasterizeLayers?: boolean;
9
- filename?: string;
10
- Wrapper?: React.FC<{
11
- children: React.ReactNode;
12
- }>;
13
- fontSize?: number;
14
- rulerHeight?: number;
15
- textHeight?: number;
16
- paddingHeight?: number;
17
- headerHeight?: number;
18
- cytobandHeight?: number;
19
- trackLabels?: string;
20
- themeName?: string;
21
- }
22
- type LGV = LinearGenomeViewModel;
23
- export interface Breakend {
24
- MateDirection: string;
25
- Join: string;
26
- Replacement: string;
27
- MatePosition: string;
28
- }
29
- export type LayoutRecord = [number, number, number, number];
30
- /**
31
- * #stateModel BreakpointSplitView
32
- * extends
33
- * - [BaseViewModel](../baseviewmodel)
34
- */
1
+ import type { ExportSvgOptions } from './types';
2
+ import type PluginManager from '@jbrowse/core/PluginManager';
3
+ import type { Feature } from '@jbrowse/core/util';
4
+ import type { Instance } from 'mobx-state-tree';
35
5
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
36
6
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
37
7
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -42,7 +12,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
42
12
  trackSelectorType: import("mobx-state-tree").IType<string | undefined, string, string>;
43
13
  showIntraviewLinks: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
44
14
  linkViews: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
45
- interactToggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
15
+ interactiveOverlay: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
46
16
  views: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
47
17
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
48
18
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -62,7 +32,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
62
32
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
63
33
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
64
34
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
65
- highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType>>, [undefined]>;
35
+ highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
66
36
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
67
37
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
68
38
  }, {
@@ -83,8 +53,8 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
83
53
  trackRefs: Record<string, HTMLDivElement>;
84
54
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
85
55
  coarseTotalBp: number;
86
- leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset;
87
- rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset;
56
+ leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
57
+ rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
88
58
  } & {
89
59
  readonly trackLabelsSetting: any;
90
60
  readonly width: number;
@@ -94,6 +64,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
94
64
  scaleBarDisplayPrefix(): string | undefined;
95
65
  MiniControlsComponent(): React.FC<any>;
96
66
  HeaderComponent(): React.FC<any>;
67
+ readonly assembliesNotFound: string | undefined;
97
68
  readonly assemblyErrors: string;
98
69
  readonly assembliesInitialized: boolean;
99
70
  readonly initialized: boolean;
@@ -130,12 +101,12 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
130
101
  setHideHeaderOverview(b: boolean): void;
131
102
  setHideNoTracksActive(b: boolean): void;
132
103
  setShowGridlines(b: boolean): void;
133
- addToHighlights(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType): void;
134
- setHighlight(highlight?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType[]): void;
135
- removeHighlight(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType): void;
104
+ addToHighlights(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType): void;
105
+ setHighlight(highlight?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType[]): void;
106
+ removeHighlight(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType): void;
136
107
  scrollTo(offsetPx: number): number;
137
108
  zoomTo(bpPerPx: number, offset?: number, centerAtOffset?: boolean): number;
138
- setOffsets(left?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset, right?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset): void;
109
+ setOffsets(left?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, right?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): void;
139
110
  setSearchResults(searchResults: import("@jbrowse/core/TextSearch/BaseResults").default[], searchQuery: string, assemblyName?: string): void;
140
111
  setNewView(bpPerPx: number, offsetPx: number): void;
141
112
  horizontallyFlip(): void;
@@ -152,7 +123,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
152
123
  setShowCenterLine(b: boolean): void;
153
124
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
154
125
  activateTrackSelector(): import("@jbrowse/core/util").Widget;
155
- getSelectedRegions(leftOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset, rightOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset): {
126
+ getSelectedRegions(leftOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, rightOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): {
156
127
  start: number;
157
128
  end: number;
158
129
  type: string;
@@ -174,7 +145,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
174
145
  setDraggingTrackId(idx?: string): void;
175
146
  setScaleFactor(factor: number): void;
176
147
  clearView(): void;
177
- exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").ExportSvgOptions): Promise<void>;
148
+ exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").ExportSvgOptions): Promise<void>;
178
149
  } & {
179
150
  slide: (viewWidths: number) => void;
180
151
  } & {
@@ -196,15 +167,15 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
196
167
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
197
168
  afterAttach(): void;
198
169
  } & {
199
- moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset): void;
170
+ moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): void;
200
171
  navToLocString(input: string, optAssemblyName?: string): Promise<void>;
201
172
  navToSearchString({ input, assembly, }: {
202
173
  input: string;
203
174
  assembly: import("@jbrowse/core/assemblyManager/assembly").Assembly;
204
175
  }): Promise<void>;
205
176
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string): Promise<void>;
206
- navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation): void;
207
- navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation[]): void;
177
+ navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation): void;
178
+ navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[]): void;
208
179
  } & {
209
180
  rubberBandMenuItems(): import("@jbrowse/core/ui").MenuItem[];
210
181
  bpToPx({ refName, coord, regionNumber, }: {
@@ -259,7 +230,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
259
230
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
260
231
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
261
232
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
262
- highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType>>, [undefined]>;
233
+ highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
263
234
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
264
235
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
265
236
  }>>, import("mobx-state-tree")._NotCustomized>>;
@@ -275,89 +246,34 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
275
246
  width: number;
276
247
  matchedTrackFeatures: Record<string, Feature[][]>;
277
248
  } & {
278
- /**
279
- * #method
280
- * creates an svg export and save using FileSaver
281
- */
282
249
  exportSvg(opts?: ExportSvgOptions): Promise<void>;
283
250
  } & {
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
251
  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
252
  configuration: {
291
253
  trackId: string;
292
254
  };
293
255
  }[];
294
- /**
295
- * #method
296
- * Get tracks with a given trackId across multiple views
297
- */
298
256
  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
257
  hasTranslocations(trackConfigId: string): Feature | undefined;
305
- /**
306
- * #method
307
- * Paired features similar to breakends, but simpler, like BEDPE
308
- */
309
258
  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
259
  getTrackFeatures(trackConfigId: string): Map<string, Feature>;
316
- /**
317
- * #method
318
- */
319
260
  getMatchedFeaturesInLayout(trackConfigId: string, features: Feature[][]): {
320
261
  feature: Feature;
321
- layout: LayoutRecord | undefined;
262
+ layout: import("./types").LayoutRecord | undefined;
322
263
  level: number;
323
264
  clipPos: number;
324
265
  }[][];
325
266
  } & {
326
267
  afterAttach(): void;
327
268
  onSubviewAction(actionName: string, path: string, args?: unknown[]): void;
328
- /**
329
- * #action
330
- */
331
269
  setWidth(newWidth: number): void;
332
- /**
333
- * #action
334
- */
335
- removeView(view: LGV): void;
336
- /**
337
- * #action
338
- */
339
- toggleInteract(): void;
340
- /**
341
- * #action
342
- */
343
- toggleIntraviewLinks(): void;
344
- /**
345
- * #action
346
- */
347
- toggleLinkViews(): void;
348
- /**
349
- * #action
350
- */
270
+ setInteractiveOverlay(arg: boolean): void;
271
+ setShowIntraviewLinks(arg: boolean): void;
272
+ setLinkViews(arg: boolean): void;
351
273
  setMatchedTrackFeatures(obj: Record<string, Feature[][]>): void;
352
- /**
353
- * #action
354
- */
355
274
  reverseViewOrder(): void;
356
275
  } & {
357
276
  afterAttach(): void;
358
- /**
359
- * #method
360
- */
361
277
  menuItems(): ({
362
278
  label: string;
363
279
  subMenu: import("@jbrowse/core/ui").MenuItem[];
@@ -393,4 +309,3 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
393
309
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
394
310
  export type BreakpointViewStateModel = ReturnType<typeof stateModelFactory>;
395
311
  export type BreakpointViewModel = Instance<BreakpointViewStateModel>;
396
- export {};
@@ -1,84 +1,24 @@
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';
5
2
  import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
6
3
  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
4
  import LinkIcon from '@mui/icons-material/Link';
11
- // locals
12
- import { intersect } from './util';
13
- // lazies
5
+ import PhotoCamera from '@mui/icons-material/PhotoCamera';
6
+ import { saveAs } from 'file-saver';
7
+ import { autorun } from 'mobx';
8
+ import { addDisposer, getPath, onAction, types } from 'mobx-state-tree';
9
+ import { calc, getBlockFeatures, getClip, intersect } from './util';
14
10
  const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
15
- const startClip = new RegExp(/(\d+)[SH]$/);
16
- const endClip = new RegExp(/^(\d+)([SH])/);
17
- export function getClip(cigar, strand) {
18
- return strand === -1
19
- ? +(startClip.exec(cigar) || [])[1] || 0
20
- : +(endClip.exec(cigar) || [])[1] || 0;
21
- }
22
- function calc(track, f) {
23
- var _a, _b;
24
- return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
25
- }
26
- async function getBlockFeatures(model, track) {
27
- var _a;
28
- const { views } = model;
29
- const { rpcManager, assemblyManager } = getSession(model);
30
- const assemblyName = (_a = model.views[0]) === null || _a === void 0 ? void 0 : _a.assemblyNames[0];
31
- if (!assemblyName) {
32
- return undefined;
33
- }
34
- const assembly = await assemblyManager.waitForAssembly(assemblyName);
35
- if (!assembly) {
36
- return undefined; // throw new Error(`assembly not found: "${assemblyName}"`)
37
- }
38
- const sessionId = track.configuration.trackId;
39
- return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
40
- adapterConfig: getConf(track, ['adapter']),
41
- sessionId,
42
- regions: view.staticBlocks.contentBlocks,
43
- })).flat()));
44
- }
45
- /**
46
- * #stateModel BreakpointSplitView
47
- * extends
48
- * - [BaseViewModel](../baseviewmodel)
49
- */
50
11
  export default function stateModelFactory(pluginManager) {
51
12
  const minHeight = 40;
52
13
  const defaultHeight = 400;
53
14
  return types
54
15
  .compose('BreakpointSplitView', BaseViewModel, types.model({
55
- /**
56
- * #property
57
- */
58
16
  type: types.literal('BreakpointSplitView'),
59
- /**
60
- * #property
61
- */
62
17
  height: types.optional(types.refinement('viewHeight', types.number, (n) => n >= minHeight), defaultHeight),
63
- /**
64
- * #property
65
- */
66
18
  trackSelectorType: 'hierarchical',
67
- /**
68
- * #property
69
- */
70
19
  showIntraviewLinks: true,
71
- /**
72
- * #property
73
- */
74
20
  linkViews: false,
75
- /**
76
- * #property
77
- */
78
- interactToggled: false,
79
- /**
80
- * #property
81
- */
21
+ interactiveOverlay: true,
82
22
  views: types.array(pluginManager.getViewType('LinearGenomeView')
83
23
  .stateModel),
84
24
  }))
@@ -87,10 +27,6 @@ export default function stateModelFactory(pluginManager) {
87
27
  matchedTrackFeatures: {},
88
28
  }))
89
29
  .views(self => ({
90
- /**
91
- * #method
92
- * creates an svg export and save using FileSaver
93
- */
94
30
  async exportSvg(opts = {}) {
95
31
  const { renderToSvg } = await import('./svgcomponents/SVGBreakpointSplitView');
96
32
  const html = await renderToSvg(self, opts);
@@ -99,54 +35,27 @@ export default function stateModelFactory(pluginManager) {
99
35
  },
100
36
  }))
101
37
  .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
38
  get matchedTracks() {
108
39
  return self.views.length === 1
109
40
  ? self.views[0].tracks
110
41
  : intersect(elt => elt.configuration.trackId, ...self.views.map(view => view.tracks));
111
42
  },
112
- /**
113
- * #method
114
- * Get tracks with a given trackId across multiple views
115
- */
116
43
  getMatchedTracks(trackConfigId) {
117
44
  return self.views
118
45
  .map(view => view.getTrack(trackConfigId))
119
46
  .filter(f => !!f);
120
47
  },
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
48
  hasTranslocations(trackConfigId) {
127
49
  return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'translocation');
128
50
  },
129
- /**
130
- * #method
131
- * Paired features similar to breakends, but simpler, like BEDPE
132
- */
133
51
  hasPairedFeatures(trackConfigId) {
134
52
  return [...this.getTrackFeatures(trackConfigId).values()].find(f => f.get('type') === 'paired_feature');
135
53
  },
136
- /**
137
- * #method
138
- * Get a composite map of featureId-\>feature map for a track across
139
- * multiple views
140
- */
141
54
  getTrackFeatures(trackConfigId) {
142
55
  var _a;
143
56
  return new Map((_a = self.matchedTrackFeatures[trackConfigId]) === null || _a === void 0 ? void 0 : _a.flat().map(f => [f.id(), f]));
144
57
  },
145
- /**
146
- * #method
147
- */
148
58
  getMatchedFeaturesInLayout(trackConfigId, features) {
149
- // use reverse to search the second track first
150
59
  const tracks = this.getMatchedTracks(trackConfigId);
151
60
  return features.map(c => c
152
61
  .map(feature => {
@@ -187,53 +96,28 @@ export default function stateModelFactory(pluginManager) {
187
96
  self.views.forEach(view => {
188
97
  const ret = getPath(view);
189
98
  if (!ret.endsWith(path)) {
190
- // @ts-ignore
191
99
  view[actionName](args === null || args === void 0 ? void 0 : args[0]);
192
100
  }
193
101
  });
194
102
  },
195
- /**
196
- * #action
197
- */
198
103
  setWidth(newWidth) {
199
104
  self.width = newWidth;
200
105
  self.views.forEach(v => {
201
106
  v.setWidth(newWidth);
202
107
  });
203
108
  },
204
- /**
205
- * #action
206
- */
207
- removeView(view) {
208
- self.views.remove(view);
109
+ setInteractiveOverlay(arg) {
110
+ self.interactiveOverlay = arg;
209
111
  },
210
- /**
211
- * #action
212
- */
213
- toggleInteract() {
214
- self.interactToggled = !self.interactToggled;
112
+ setShowIntraviewLinks(arg) {
113
+ self.showIntraviewLinks = arg;
215
114
  },
216
- /**
217
- * #action
218
- */
219
- toggleIntraviewLinks() {
220
- self.showIntraviewLinks = !self.showIntraviewLinks;
115
+ setLinkViews(arg) {
116
+ self.linkViews = arg;
221
117
  },
222
- /**
223
- * #action
224
- */
225
- toggleLinkViews() {
226
- self.linkViews = !self.linkViews;
227
- },
228
- /**
229
- * #action
230
- */
231
118
  setMatchedTrackFeatures(obj) {
232
119
  self.matchedTrackFeatures = obj;
233
120
  },
234
- /**
235
- * #action
236
- */
237
121
  reverseViewOrder() {
238
122
  self.views.reverse();
239
123
  },
@@ -256,9 +140,6 @@ export default function stateModelFactory(pluginManager) {
256
140
  }
257
141
  }));
258
142
  },
259
- /**
260
- * #method
261
- */
262
143
  menuItems() {
263
144
  return [
264
145
  ...self.views
@@ -267,26 +148,30 @@ export default function stateModelFactory(pluginManager) {
267
148
  label: `Row ${f[0] + 1} view menu`,
268
149
  subMenu: f[1],
269
150
  })),
270
- {
271
- label: 'Reverse view order',
272
- onClick: () => {
273
- self.reverseViewOrder();
274
- },
275
- },
151
+ ...(self.views.length > 1
152
+ ? [
153
+ {
154
+ label: 'Reverse view order',
155
+ onClick: () => {
156
+ self.reverseViewOrder();
157
+ },
158
+ },
159
+ ]
160
+ : []),
276
161
  {
277
162
  label: 'Show intra-view links',
278
163
  type: 'checkbox',
279
164
  checked: self.showIntraviewLinks,
280
165
  onClick: () => {
281
- self.toggleIntraviewLinks();
166
+ self.setShowIntraviewLinks(!self.showIntraviewLinks);
282
167
  },
283
168
  },
284
169
  {
285
170
  label: 'Allow clicking alignment squiggles?',
286
171
  type: 'checkbox',
287
- checked: self.interactToggled,
172
+ checked: self.interactiveOverlay,
288
173
  onClick: () => {
289
- self.toggleInteract();
174
+ self.setInteractiveOverlay(!self.interactiveOverlay);
290
175
  },
291
176
  },
292
177
  {
@@ -295,7 +180,7 @@ export default function stateModelFactory(pluginManager) {
295
180
  icon: LinkIcon,
296
181
  checked: self.linkViews,
297
182
  onClick: () => {
298
- self.toggleLinkViews();
183
+ self.setLinkViews(!self.linkViews);
299
184
  },
300
185
  },
301
186
  {
@@ -304,7 +189,10 @@ export default function stateModelFactory(pluginManager) {
304
189
  onClick: () => {
305
190
  getSession(self).queueDialog(handleClose => [
306
191
  ExportSvgDialog,
307
- { model: self, handleClose },
192
+ {
193
+ model: self,
194
+ handleClose,
195
+ },
308
196
  ]);
309
197
  },
310
198
  },
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
1
  export default function SVGBackground({ width, height, shift, }: {
3
2
  width: number;
4
3
  height: number;
5
4
  shift: number;
6
- }): React.JSX.Element;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
- import React from 'react';
2
- import { useTheme } from '@mui/material';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
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
- return (React.createElement("rect", { width: width + shift * 2, height: height, fill: stripAlpha(theme.palette.background.default) }));
6
+ return (_jsx("rect", { width: width + shift * 2, height: height, fill: stripAlpha(theme.palette.background.default) }));
7
7
  }
@@ -1,4 +1,5 @@
1
- import { ExportSvgOptions, BreakpointViewModel } from '../model';
1
+ import type { BreakpointViewModel } from '../model';
2
+ import type { ExportSvgOptions } from '../types';
2
3
  type BSV = BreakpointViewModel;
3
4
  export declare function renderToSvg(model: BSV, opts: ExportSvgOptions): Promise<string>;
4
5
  export {};
@@ -1,19 +1,15 @@
1
- import React from 'react';
2
- import { when } from 'mobx';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 { getRoot } from 'mobx-state-tree';
7
- import { SVGTracks, SVGRuler, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
8
- // locals
6
+ import { when } from 'mobx';
9
7
  import SVGBackground from './SVGBackground';
10
- import Overlay from '../components/Overlay';
11
8
  import { getTrackNameMaxLen, getTrackOffsets } from './util';
12
- // render LGV to SVG
9
+ import Overlay from '../components/Overlay';
13
10
  export async function renderToSvg(model, opts) {
14
11
  var _a;
15
12
  const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => children, themeName = 'default', } = opts;
16
- const { createRootFn } = getRoot(model);
17
13
  const session = getSession(model);
18
14
  const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
19
15
  const { width, views } = model;
@@ -35,25 +31,5 @@ export async function renderToSvg(model, opts) {
35
31
  const trackOffsets = views.map((view, idx) => getTrackOffsets(view, textOffset, fontSize + (idx > 0 ? heights[idx - 1] : 0) + offset));
36
32
  const w = width + trackLabelOffset;
37
33
  const t = createJBrowseTheme(theme);
38
- // the xlink namespace is used for rendering <image> tag
39
- return renderToStaticMarkup(React.createElement(ThemeProvider, { theme: t },
40
- React.createElement(Wrapper, null,
41
- 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() },
42
- React.createElement(SVGBackground, { width: w, height: totalHeightSvg, shift: shift }),
43
- views[0] ? (React.createElement("g", { transform: `translate(${shift} ${fontSize})` },
44
- React.createElement("g", { transform: `translate(${trackLabelOffset})` },
45
- React.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[0].assemblyNames.join(', ')),
46
- React.createElement(SVGRuler, { model: displayResults[0].view, fontSize: fontSize })),
47
- React.createElement("g", { transform: `translate(0 ${offset})` },
48
- React.createElement(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset })))) : null,
49
- views[1] ? (React.createElement("g", { transform: `translate(${shift} ${fontSize + heights[0]})` },
50
- React.createElement("g", { transform: `translate(${trackLabelOffset})` },
51
- React.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[1].assemblyNames.join(', ')),
52
- React.createElement(SVGRuler, { model: displayResults[1].view, fontSize: fontSize })),
53
- React.createElement("g", { transform: `translate(0 ${offset})` },
54
- React.createElement(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset })))) : null,
55
- React.createElement("defs", null,
56
- React.createElement("clipPath", { id: "clip-bsv" },
57
- React.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
58
- React.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (React.createElement(Overlay, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))), createRootFn);
34
+ return renderToStaticMarkup(_jsx(ThemeProvider, { theme: t, children: _jsx(Wrapper, { children: _jsxs("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(), children: [_jsx(SVGBackground, { width: w, height: totalHeightSvg, shift: shift }), views[0] ? (_jsxs("g", { transform: `translate(${shift} ${fontSize})`, children: [_jsxs("g", { transform: `translate(${trackLabelOffset})`, children: [_jsx("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[0].assemblyNames.join(', ') }), _jsx(SVGRuler, { model: displayResults[0].view, fontSize: fontSize })] }), _jsx("g", { transform: `translate(0 ${offset})`, children: _jsx(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset }) })] })) : null, views[1] ? (_jsxs("g", { transform: `translate(${shift} ${fontSize + heights[0]})`, children: [_jsxs("g", { transform: `translate(${trackLabelOffset})`, children: [_jsx("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[1].assemblyNames.join(', ') }), _jsx(SVGRuler, { model: displayResults[1].view, fontSize: fontSize })] }), _jsx("g", { transform: `translate(0 ${offset})`, children: _jsx(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset }) })] })) : null, _jsx("defs", { children: _jsx("clipPath", { id: "clip-bsv", children: _jsx("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }) }) }), _jsx("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)", children: model.matchedTracks.map(track => (_jsx(Overlay, { parentRef: { current: null }, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }, track.configuration.trackId))) })] }) }) }));
59
35
  }
@@ -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);
@@ -0,0 +1,22 @@
1
+ export interface ExportSvgOptions {
2
+ rasterizeLayers?: boolean;
3
+ filename?: string;
4
+ Wrapper?: React.FC<{
5
+ children: React.ReactNode;
6
+ }>;
7
+ fontSize?: number;
8
+ rulerHeight?: number;
9
+ textHeight?: number;
10
+ paddingHeight?: number;
11
+ headerHeight?: number;
12
+ cytobandHeight?: number;
13
+ trackLabels?: string;
14
+ themeName?: string;
15
+ }
16
+ export interface Breakend {
17
+ MateDirection: string;
18
+ Join: string;
19
+ Replacement: string;
20
+ MatePosition: string;
21
+ }
22
+ export type LayoutRecord = [number, number, number, number];
@@ -0,0 +1 @@
1
+ export {};