@jbrowse/plugin-breakpoint-split-view 2.18.0 → 3.0.1

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 (59) hide show
  1. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +1 -2
  2. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +2 -9
  3. package/dist/BreakpointAlignmentsFeatureDetail/index.js +17 -7
  4. package/dist/BreakpointSplitView/components/AlignmentConnections.d.ts +2 -3
  5. package/dist/BreakpointSplitView/components/AlignmentConnections.js +91 -113
  6. package/dist/BreakpointSplitView/components/Breakends.d.ts +2 -3
  7. package/dist/BreakpointSplitView/components/Breakends.js +67 -89
  8. package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -2
  9. package/dist/BreakpointSplitView/components/BreakpointSplitView.js +12 -16
  10. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -2
  11. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +9 -31
  12. package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  13. package/dist/BreakpointSplitView/components/ExportSvgDialog.js +34 -73
  14. package/dist/BreakpointSplitView/components/Overlay.d.ts +2 -3
  15. package/dist/BreakpointSplitView/components/Overlay.js +7 -6
  16. package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +2 -3
  17. package/dist/BreakpointSplitView/components/PairedFeatures.js +47 -69
  18. package/dist/BreakpointSplitView/components/Translocations.d.ts +2 -3
  19. package/dist/BreakpointSplitView/components/Translocations.js +57 -79
  20. package/dist/BreakpointSplitView/index.js +17 -7
  21. package/dist/BreakpointSplitView/model.d.ts +19 -46
  22. package/dist/BreakpointSplitView/model.js +46 -64
  23. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  24. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +2 -5
  25. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  26. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +2 -23
  27. package/dist/BreakpointSplitView/types.d.ts +22 -0
  28. package/dist/BreakpointSplitView/types.js +2 -0
  29. package/dist/BreakpointSplitView/util.d.ts +11 -1
  30. package/dist/BreakpointSplitView/util.js +34 -0
  31. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +1 -2
  32. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +2 -6
  33. package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +2 -3
  34. package/esm/BreakpointSplitView/components/AlignmentConnections.js +91 -90
  35. package/esm/BreakpointSplitView/components/Breakends.d.ts +2 -3
  36. package/esm/BreakpointSplitView/components/Breakends.js +67 -66
  37. package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -2
  38. package/esm/BreakpointSplitView/components/BreakpointSplitView.js +12 -16
  39. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -2
  40. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +9 -8
  41. package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  42. package/esm/BreakpointSplitView/components/ExportSvgDialog.js +34 -50
  43. package/esm/BreakpointSplitView/components/Overlay.d.ts +2 -3
  44. package/esm/BreakpointSplitView/components/Overlay.js +7 -6
  45. package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +2 -3
  46. package/esm/BreakpointSplitView/components/PairedFeatures.js +47 -46
  47. package/esm/BreakpointSplitView/components/Translocations.d.ts +2 -3
  48. package/esm/BreakpointSplitView/components/Translocations.js +57 -56
  49. package/esm/BreakpointSplitView/model.d.ts +19 -46
  50. package/esm/BreakpointSplitView/model.js +26 -53
  51. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  52. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +2 -2
  53. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  54. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +2 -23
  55. package/esm/BreakpointSplitView/types.d.ts +22 -0
  56. package/esm/BreakpointSplitView/types.js +1 -0
  57. package/esm/BreakpointSplitView/util.d.ts +11 -1
  58. package/esm/BreakpointSplitView/util.js +32 -1
  59. package/package.json +10 -10
@@ -1,32 +1,7 @@
1
- import type React from 'react';
1
+ import type { ExportSvgOptions } from './types';
2
2
  import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  import type { Feature } from '@jbrowse/core/util';
4
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
5
4
  import type { Instance } from 'mobx-state-tree';
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
5
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
31
6
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
32
7
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -37,7 +12,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
37
12
  trackSelectorType: import("mobx-state-tree").IType<string | undefined, string, string>;
38
13
  showIntraviewLinks: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
39
14
  linkViews: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
40
- interactToggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
15
+ interactiveOverlay: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
41
16
  views: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
42
17
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
43
18
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -57,7 +32,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
57
32
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
58
33
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
59
34
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
60
- 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]>;
61
36
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
62
37
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
63
38
  }, {
@@ -78,8 +53,8 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
78
53
  trackRefs: Record<string, HTMLDivElement>;
79
54
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
80
55
  coarseTotalBp: number;
81
- leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset;
82
- 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;
83
58
  } & {
84
59
  readonly trackLabelsSetting: any;
85
60
  readonly width: number;
@@ -126,12 +101,12 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
126
101
  setHideHeaderOverview(b: boolean): void;
127
102
  setHideNoTracksActive(b: boolean): void;
128
103
  setShowGridlines(b: boolean): void;
129
- addToHighlights(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType): void;
130
- setHighlight(highlight?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType[]): void;
131
- 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;
132
107
  scrollTo(offsetPx: number): number;
133
108
  zoomTo(bpPerPx: number, offset?: number, centerAtOffset?: boolean): number;
134
- 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;
135
110
  setSearchResults(searchResults: import("@jbrowse/core/TextSearch/BaseResults").default[], searchQuery: string, assemblyName?: string): void;
136
111
  setNewView(bpPerPx: number, offsetPx: number): void;
137
112
  horizontallyFlip(): void;
@@ -148,7 +123,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
148
123
  setShowCenterLine(b: boolean): void;
149
124
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
150
125
  activateTrackSelector(): import("@jbrowse/core/util").Widget;
151
- 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): {
152
127
  start: number;
153
128
  end: number;
154
129
  type: string;
@@ -170,7 +145,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
170
145
  setDraggingTrackId(idx?: string): void;
171
146
  setScaleFactor(factor: number): void;
172
147
  clearView(): void;
173
- 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>;
174
149
  } & {
175
150
  slide: (viewWidths: number) => void;
176
151
  } & {
@@ -192,15 +167,15 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
192
167
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
193
168
  afterAttach(): void;
194
169
  } & {
195
- 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;
196
171
  navToLocString(input: string, optAssemblyName?: string): Promise<void>;
197
172
  navToSearchString({ input, assembly, }: {
198
173
  input: string;
199
174
  assembly: import("@jbrowse/core/assemblyManager/assembly").Assembly;
200
175
  }): Promise<void>;
201
176
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string): Promise<void>;
202
- navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation): void;
203
- 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;
204
179
  } & {
205
180
  rubberBandMenuItems(): import("@jbrowse/core/ui").MenuItem[];
206
181
  bpToPx({ refName, coord, regionNumber, }: {
@@ -255,7 +230,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
255
230
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
256
231
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
257
232
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
258
- 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]>;
259
234
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
260
235
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
261
236
  }>>, import("mobx-state-tree")._NotCustomized>>;
@@ -284,7 +259,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
284
259
  getTrackFeatures(trackConfigId: string): Map<string, Feature>;
285
260
  getMatchedFeaturesInLayout(trackConfigId: string, features: Feature[][]): {
286
261
  feature: Feature;
287
- layout: LayoutRecord | undefined;
262
+ layout: import("./types").LayoutRecord | undefined;
288
263
  level: number;
289
264
  clipPos: number;
290
265
  }[][];
@@ -292,10 +267,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
292
267
  afterAttach(): void;
293
268
  onSubviewAction(actionName: string, path: string, args?: unknown[]): void;
294
269
  setWidth(newWidth: number): void;
295
- removeView(view: LGV): void;
296
- toggleInteract(): void;
297
- toggleIntraviewLinks(): void;
298
- toggleLinkViews(): void;
270
+ setInteractiveOverlay(arg: boolean): void;
271
+ setShowIntraviewLinks(arg: boolean): void;
272
+ setLinkViews(arg: boolean): void;
299
273
  setMatchedTrackFeatures(obj: Record<string, Feature[][]>): void;
300
274
  reverseViewOrder(): void;
301
275
  } & {
@@ -335,4 +309,3 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
335
309
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
336
310
  export type BreakpointViewStateModel = ReturnType<typeof stateModelFactory>;
337
311
  export type BreakpointViewModel = Instance<BreakpointViewStateModel>;
338
- export {};
@@ -15,21 +15,29 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
37
  };
28
38
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.getClip = getClip;
30
39
  exports.default = stateModelFactory;
31
40
  const react_1 = require("react");
32
- const configuration_1 = require("@jbrowse/core/configuration");
33
41
  const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
34
42
  const util_1 = require("@jbrowse/core/util");
35
43
  const Link_1 = __importDefault(require("@mui/icons-material/Link"));
@@ -39,36 +47,6 @@ const mobx_1 = require("mobx");
39
47
  const mobx_state_tree_1 = require("mobx-state-tree");
40
48
  const util_2 = require("./util");
41
49
  const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/ExportSvgDialog'))));
42
- const startClip = new RegExp(/(\d+)[SH]$/);
43
- const endClip = new RegExp(/^(\d+)([SH])/);
44
- function getClip(cigar, strand) {
45
- return strand === -1
46
- ? +(startClip.exec(cigar) || [])[1] || 0
47
- : +(endClip.exec(cigar) || [])[1] || 0;
48
- }
49
- function calc(track, f) {
50
- var _a, _b;
51
- return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
52
- }
53
- async function getBlockFeatures(model, track) {
54
- var _a;
55
- const { views } = model;
56
- const { rpcManager, assemblyManager } = (0, util_1.getSession)(model);
57
- const assemblyName = (_a = model.views[0]) === null || _a === void 0 ? void 0 : _a.assemblyNames[0];
58
- if (!assemblyName) {
59
- return undefined;
60
- }
61
- const assembly = await assemblyManager.waitForAssembly(assemblyName);
62
- if (!assembly) {
63
- return undefined;
64
- }
65
- const sessionId = track.configuration.trackId;
66
- return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
67
- adapterConfig: (0, configuration_1.getConf)(track, ['adapter']),
68
- sessionId,
69
- regions: view.staticBlocks.contentBlocks,
70
- })).flat()));
71
- }
72
50
  function stateModelFactory(pluginManager) {
73
51
  const minHeight = 40;
74
52
  const defaultHeight = 400;
@@ -79,7 +57,7 @@ function stateModelFactory(pluginManager) {
79
57
  trackSelectorType: 'hierarchical',
80
58
  showIntraviewLinks: true,
81
59
  linkViews: false,
82
- interactToggled: false,
60
+ interactiveOverlay: true,
83
61
  views: mobx_state_tree_1.types.array(pluginManager.getViewType('LinearGenomeView')
84
62
  .stateModel),
85
63
  }))
@@ -120,13 +98,13 @@ function stateModelFactory(pluginManager) {
120
98
  const tracks = this.getMatchedTracks(trackConfigId);
121
99
  return features.map(c => c
122
100
  .map(feature => {
123
- const level = tracks.findIndex(track => calc(track, feature));
101
+ const level = tracks.findIndex(track => (0, util_2.calc)(track, feature));
124
102
  return level !== -1
125
103
  ? {
126
104
  feature,
127
- layout: calc(tracks[level], feature),
105
+ layout: (0, util_2.calc)(tracks[level], feature),
128
106
  level,
129
- clipPos: getClip(feature.get('CIGAR'), feature.get('strand')),
107
+ clipPos: (0, util_2.getClip)(feature.get('CIGAR'), feature.get('strand')),
130
108
  }
131
109
  : undefined;
132
110
  })
@@ -167,17 +145,14 @@ function stateModelFactory(pluginManager) {
167
145
  v.setWidth(newWidth);
168
146
  });
169
147
  },
170
- removeView(view) {
171
- self.views.remove(view);
148
+ setInteractiveOverlay(arg) {
149
+ self.interactiveOverlay = arg;
172
150
  },
173
- toggleInteract() {
174
- self.interactToggled = !self.interactToggled;
151
+ setShowIntraviewLinks(arg) {
152
+ self.showIntraviewLinks = arg;
175
153
  },
176
- toggleIntraviewLinks() {
177
- self.showIntraviewLinks = !self.showIntraviewLinks;
178
- },
179
- toggleLinkViews() {
180
- self.linkViews = !self.linkViews;
154
+ setLinkViews(arg) {
155
+ self.linkViews = arg;
181
156
  },
182
157
  setMatchedTrackFeatures(obj) {
183
158
  self.matchedTrackFeatures = obj;
@@ -195,7 +170,7 @@ function stateModelFactory(pluginManager) {
195
170
  }
196
171
  self.setMatchedTrackFeatures(Object.fromEntries(await Promise.all(self.matchedTracks.map(async (track) => [
197
172
  track.configuration.trackId,
198
- await getBlockFeatures(self, track),
173
+ await (0, util_2.getBlockFeatures)(self, track),
199
174
  ]))));
200
175
  }
201
176
  catch (e) {
@@ -212,26 +187,30 @@ function stateModelFactory(pluginManager) {
212
187
  label: `Row ${f[0] + 1} view menu`,
213
188
  subMenu: f[1],
214
189
  })),
215
- {
216
- label: 'Reverse view order',
217
- onClick: () => {
218
- self.reverseViewOrder();
219
- },
220
- },
190
+ ...(self.views.length > 1
191
+ ? [
192
+ {
193
+ label: 'Reverse view order',
194
+ onClick: () => {
195
+ self.reverseViewOrder();
196
+ },
197
+ },
198
+ ]
199
+ : []),
221
200
  {
222
201
  label: 'Show intra-view links',
223
202
  type: 'checkbox',
224
203
  checked: self.showIntraviewLinks,
225
204
  onClick: () => {
226
- self.toggleIntraviewLinks();
205
+ self.setShowIntraviewLinks(!self.showIntraviewLinks);
227
206
  },
228
207
  },
229
208
  {
230
209
  label: 'Allow clicking alignment squiggles?',
231
210
  type: 'checkbox',
232
- checked: self.interactToggled,
211
+ checked: self.interactiveOverlay,
233
212
  onClick: () => {
234
- self.toggleInteract();
213
+ self.setInteractiveOverlay(!self.interactiveOverlay);
235
214
  },
236
215
  },
237
216
  {
@@ -240,7 +219,7 @@ function stateModelFactory(pluginManager) {
240
219
  icon: Link_1.default,
241
220
  checked: self.linkViews,
242
221
  onClick: () => {
243
- self.toggleLinkViews();
222
+ self.setLinkViews(!self.linkViews);
244
223
  },
245
224
  },
246
225
  {
@@ -249,7 +228,10 @@ function stateModelFactory(pluginManager) {
249
228
  onClick: () => {
250
229
  (0, util_1.getSession)(self).queueDialog(handleClose => [
251
230
  ExportSvgDialog,
252
- { model: self, handleClose },
231
+ {
232
+ model: self,
233
+ handleClose,
234
+ },
253
235
  ]);
254
236
  },
255
237
  },
@@ -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,13 +1,10 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.default = SVGBackground;
7
- const react_1 = __importDefault(require("react"));
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
5
  const util_1 = require("@jbrowse/core/util");
9
6
  const material_1 = require("@mui/material");
10
7
  function SVGBackground({ width, height, shift, }) {
11
8
  const theme = (0, material_1.useTheme)();
12
- return (react_1.default.createElement("rect", { width: width + shift * 2, height: height, fill: (0, util_1.stripAlpha)(theme.palette.background.default) }));
9
+ return ((0, jsx_runtime_1.jsx)("rect", { width: width + shift * 2, height: height, fill: (0, util_1.stripAlpha)(theme.palette.background.default) }));
13
10
  }
@@ -1,4 +1,5 @@
1
- import type { BreakpointViewModel, ExportSvgOptions } 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 {};
@@ -4,20 +4,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.renderToSvg = renderToSvg;
7
- const react_1 = __importDefault(require("react"));
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const ui_1 = require("@jbrowse/core/ui");
9
9
  const util_1 = require("@jbrowse/core/util");
10
10
  const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
11
11
  const material_1 = require("@mui/material");
12
12
  const mobx_1 = require("mobx");
13
- const mobx_state_tree_1 = require("mobx-state-tree");
14
13
  const SVGBackground_1 = __importDefault(require("./SVGBackground"));
15
14
  const util_2 = require("./util");
16
15
  const Overlay_1 = __importDefault(require("../components/Overlay"));
17
16
  async function renderToSvg(model, opts) {
18
17
  var _a;
19
18
  const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => children, themeName = 'default', } = opts;
20
- const { createRootFn } = (0, mobx_state_tree_1.getRoot)(model);
21
19
  const session = (0, util_1.getSession)(model);
22
20
  const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
23
21
  const { width, views } = model;
@@ -39,24 +37,5 @@ async function renderToSvg(model, opts) {
39
37
  const trackOffsets = views.map((view, idx) => (0, util_2.getTrackOffsets)(view, textOffset, fontSize + (idx > 0 ? heights[idx - 1] : 0) + offset));
40
38
  const w = width + trackLabelOffset;
41
39
  const t = (0, ui_1.createJBrowseTheme)(theme);
42
- return (0, util_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: t },
43
- react_1.default.createElement(Wrapper, null,
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() },
45
- react_1.default.createElement(SVGBackground_1.default, { width: w, height: totalHeightSvg, shift: shift }),
46
- views[0] ? (react_1.default.createElement("g", { transform: `translate(${shift} ${fontSize})` },
47
- react_1.default.createElement("g", { transform: `translate(${trackLabelOffset})` },
48
- react_1.default.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[0].assemblyNames.join(', ')),
49
- react_1.default.createElement(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[0].view, fontSize: fontSize })),
50
- react_1.default.createElement("g", { transform: `translate(0 ${offset})` },
51
- react_1.default.createElement(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset })))) : null,
52
- views[1] ? (react_1.default.createElement("g", { transform: `translate(${shift} ${fontSize + heights[0]})` },
53
- react_1.default.createElement("g", { transform: `translate(${trackLabelOffset})` },
54
- react_1.default.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[1].assemblyNames.join(', ')),
55
- react_1.default.createElement(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[1].view, fontSize: fontSize })),
56
- react_1.default.createElement("g", { transform: `translate(0 ${offset})` },
57
- react_1.default.createElement(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset })))) : null,
58
- react_1.default.createElement("defs", null,
59
- react_1.default.createElement("clipPath", { id: "clip-bsv" },
60
- react_1.default.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
61
- react_1.default.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (react_1.default.createElement(Overlay_1.default, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))), createRootFn);
40
+ return (0, util_1.renderToStaticMarkup)((0, jsx_runtime_1.jsx)(material_1.ThemeProvider, { theme: t, children: (0, jsx_runtime_1.jsx)(Wrapper, { children: (0, jsx_runtime_1.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: [(0, jsx_runtime_1.jsx)(SVGBackground_1.default, { width: w, height: totalHeightSvg, shift: shift }), views[0] ? ((0, jsx_runtime_1.jsxs)("g", { transform: `translate(${shift} ${fontSize})`, children: [(0, jsx_runtime_1.jsxs)("g", { transform: `translate(${trackLabelOffset})`, children: [(0, jsx_runtime_1.jsx)("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[0].assemblyNames.join(', ') }), (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[0].view, fontSize: fontSize })] }), (0, jsx_runtime_1.jsx)("g", { transform: `translate(0 ${offset})`, children: (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset }) })] })) : null, views[1] ? ((0, jsx_runtime_1.jsxs)("g", { transform: `translate(${shift} ${fontSize + heights[0]})`, children: [(0, jsx_runtime_1.jsxs)("g", { transform: `translate(${trackLabelOffset})`, children: [(0, jsx_runtime_1.jsx)("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[1].assemblyNames.join(', ') }), (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGRuler, { model: displayResults[1].view, fontSize: fontSize })] }), (0, jsx_runtime_1.jsx)("g", { transform: `translate(0 ${offset})`, children: (0, jsx_runtime_1.jsx)(plugin_linear_genome_view_1.SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset }) })] })) : null, (0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsx)("clipPath", { id: "clip-bsv", children: (0, jsx_runtime_1.jsx)("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }) }) }), (0, jsx_runtime_1.jsx)("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)", children: model.matchedTracks.map(track => ((0, jsx_runtime_1.jsx)(Overlay_1.default, { parentRef: { current: null }, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }, track.configuration.trackId))) })] }) }) }));
62
41
  }
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,6 @@
1
- import type { LayoutRecord } from './model';
1
+ import type { LayoutRecord } from './types';
2
+ import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
+ import type { Feature } from '@jbrowse/core/util';
2
4
  import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
5
  type LGV = LinearGenomeViewModel;
4
6
  interface Display {
@@ -7,6 +9,7 @@ interface Display {
7
9
  SNPCoverageDisplay?: {
8
10
  height: number;
9
11
  };
12
+ searchFeatureByID?: (str: string) => LayoutRecord;
10
13
  }
11
14
  interface Track {
12
15
  displays: Display[];
@@ -16,4 +19,11 @@ export declare function getPxFromCoordinate(view: LGV, refName: string, coord: n
16
19
  export declare function yPos(trackId: string, level: number, views: LGV[], tracks: Track[], c: LayoutRecord, getYPosOverride?: (trackId: string, level: number) => number): number;
17
20
  export declare const useNextFrame: (variable: unknown) => void;
18
21
  export declare function intersect<T>(cb: (l: T) => string, a1?: T[], a2?: T[], ...rest: T[][]): T[];
22
+ export declare function getClip(cigar: string, strand: number): number;
23
+ export declare function calc(track: Track, f: Feature): LayoutRecord | undefined;
24
+ export declare function getBlockFeatures(model: {
25
+ views: LinearGenomeViewModel[];
26
+ }, track: {
27
+ configuration: AnyConfigurationModel;
28
+ }): Promise<Feature[][] | undefined>;
19
29
  export {};
@@ -5,7 +5,11 @@ exports.heightFromSpecificLevel = heightFromSpecificLevel;
5
5
  exports.getPxFromCoordinate = getPxFromCoordinate;
6
6
  exports.yPos = yPos;
7
7
  exports.intersect = intersect;
8
+ exports.getClip = getClip;
9
+ exports.calc = calc;
10
+ exports.getBlockFeatures = getBlockFeatures;
8
11
  const react_1 = require("react");
12
+ const configuration_1 = require("@jbrowse/core/configuration");
9
13
  const util_1 = require("@jbrowse/core/util");
10
14
  const [, TOP, , BOTTOM] = [0, 1, 2, 3];
11
15
  function cheight(chunk) {
@@ -47,3 +51,33 @@ function intersect(cb, a1 = [], a2 = [], ...rest) {
47
51
  const a12 = a1.filter(value => ids.has(cb(value)));
48
52
  return rest.length === 0 ? a12 : intersect(cb, a12, ...rest);
49
53
  }
54
+ const startClip = new RegExp(/(\d+)[SH]$/);
55
+ const endClip = new RegExp(/^(\d+)([SH])/);
56
+ function getClip(cigar, strand) {
57
+ return strand === -1
58
+ ? +(startClip.exec(cigar) || [])[1] || 0
59
+ : +(endClip.exec(cigar) || [])[1] || 0;
60
+ }
61
+ function calc(track, f) {
62
+ var _a, _b;
63
+ return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
64
+ }
65
+ async function getBlockFeatures(model, track) {
66
+ var _a;
67
+ const { views } = model;
68
+ const { rpcManager, assemblyManager } = (0, util_1.getSession)(model);
69
+ const assemblyName = (_a = model.views[0]) === null || _a === void 0 ? void 0 : _a.assemblyNames[0];
70
+ if (!assemblyName) {
71
+ return undefined;
72
+ }
73
+ const assembly = await assemblyManager.waitForAssembly(assemblyName);
74
+ if (!assembly) {
75
+ return undefined;
76
+ }
77
+ const sessionId = track.configuration.trackId;
78
+ return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
79
+ adapterConfig: (0, configuration_1.getConf)(track, ['adapter']),
80
+ sessionId,
81
+ regions: view.staticBlocks.contentBlocks,
82
+ })).flat()));
83
+ }
@@ -1,4 +1,3 @@
1
- import React from 'react';
2
1
  import type { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
2
  declare const BreakpointAlignmentsFeatureDetail: ({ model, }: {
4
3
  model: {
@@ -7,5 +6,5 @@ declare const BreakpointAlignmentsFeatureDetail: ({ model, }: {
7
6
  feature2: SimpleFeatureSerialized;
8
7
  };
9
8
  };
10
- }) => React.JSX.Element;
9
+ }) => import("react/jsx-runtime").JSX.Element;
11
10
  export default BreakpointAlignmentsFeatureDetail;
@@ -1,14 +1,10 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { BaseAttributes, BaseCoreDetails, } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
3
3
  import { Paper } from '@mui/material';
4
4
  import { observer } from 'mobx-react';
5
5
  const BreakpointAlignmentsFeatureDetail = observer(function ({ model, }) {
6
6
  const { featureData } = model;
7
7
  const { feature1, feature2 } = structuredClone(featureData);
8
- return (React.createElement(Paper, null,
9
- React.createElement(BaseCoreDetails, { title: "Feature 1", feature: feature1 }),
10
- React.createElement(BaseCoreDetails, { title: "Feature 2", feature: feature2 }),
11
- React.createElement(BaseAttributes, { title: "Feature 1 attributes", feature: feature1 }),
12
- React.createElement(BaseAttributes, { title: "Feature 2 attributes", feature: feature2 })));
8
+ return (_jsxs(Paper, { children: [_jsx(BaseCoreDetails, { title: "Feature 1", feature: feature1 }), _jsx(BaseCoreDetails, { title: "Feature 2", feature: feature2 }), _jsx(BaseAttributes, { title: "Feature 1 attributes", feature: feature1 }), _jsx(BaseAttributes, { title: "Feature 2 attributes", feature: feature2 })] }));
13
9
  });
14
10
  export default BreakpointAlignmentsFeatureDetail;
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
1
  import type { BreakpointViewModel } from '../model';
3
2
  declare const AlignmentConnections: ({ model, trackId, parentRef, getTrackYPosOverride, }: {
4
3
  model: BreakpointViewModel;
5
4
  trackId: string;
6
- parentRef: React.RefObject<SVGSVGElement>;
5
+ parentRef: React.RefObject<SVGSVGElement | null>;
7
6
  getTrackYPosOverride?: (trackId: string, level: number) => number;
8
- }) => React.JSX.Element | null;
7
+ }) => import("react/jsx-runtime").JSX.Element | null;
9
8
  export default AlignmentConnections;