@jbrowse/plugin-linear-comparative-view 2.7.1 → 2.8.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 (35) hide show
  1. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +7 -0
  2. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +68 -0
  3. package/dist/LGVSyntenyDisplay/components/util.d.ts +8 -0
  4. package/dist/LGVSyntenyDisplay/components/util.js +111 -0
  5. package/dist/LGVSyntenyDisplay/model.d.ts +15 -14
  6. package/dist/LGVSyntenyDisplay/model.js +35 -104
  7. package/dist/LinearComparativeView/model.d.ts +2 -1
  8. package/dist/LinearSyntenyView/components/{ImportCustomTrack.js → ImportForm/ImportCustomTrack.js} +5 -21
  9. package/dist/LinearSyntenyView/components/{ImportSyntenyTrackSelector.d.ts → ImportForm/ImportSyntenyTrackSelector.d.ts} +1 -1
  10. package/{esm/LinearSyntenyView/components/ImportForm.d.ts → dist/LinearSyntenyView/components/ImportForm/index.d.ts} +1 -1
  11. package/dist/LinearSyntenyView/components/ImportForm/util.d.ts +10 -0
  12. package/dist/LinearSyntenyView/components/ImportForm/util.js +27 -0
  13. package/dist/LinearSyntenyView/model.d.ts +7 -4
  14. package/dist/LinearSyntenyView/model.js +1 -1
  15. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +7 -0
  16. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +42 -0
  17. package/esm/LGVSyntenyDisplay/components/util.d.ts +8 -0
  18. package/esm/LGVSyntenyDisplay/components/util.js +107 -0
  19. package/esm/LGVSyntenyDisplay/model.d.ts +15 -14
  20. package/esm/LGVSyntenyDisplay/model.js +14 -106
  21. package/esm/LinearComparativeView/model.d.ts +2 -1
  22. package/esm/LinearSyntenyView/components/{ImportCustomTrack.js → ImportForm/ImportCustomTrack.js} +4 -17
  23. package/esm/LinearSyntenyView/components/{ImportSyntenyTrackSelector.d.ts → ImportForm/ImportSyntenyTrackSelector.d.ts} +1 -1
  24. package/{dist/LinearSyntenyView/components/ImportForm.d.ts → esm/LinearSyntenyView/components/ImportForm/index.d.ts} +1 -1
  25. package/esm/LinearSyntenyView/components/ImportForm/util.d.ts +10 -0
  26. package/esm/LinearSyntenyView/components/ImportForm/util.js +20 -0
  27. package/esm/LinearSyntenyView/model.d.ts +7 -4
  28. package/esm/LinearSyntenyView/model.js +1 -1
  29. package/package.json +2 -2
  30. /package/dist/LinearSyntenyView/components/{ImportCustomTrack.d.ts → ImportForm/ImportCustomTrack.d.ts} +0 -0
  31. /package/dist/LinearSyntenyView/components/{ImportSyntenyTrackSelector.js → ImportForm/ImportSyntenyTrackSelector.js} +0 -0
  32. /package/dist/LinearSyntenyView/components/{ImportForm.js → ImportForm/index.js} +0 -0
  33. /package/esm/LinearSyntenyView/components/{ImportCustomTrack.d.ts → ImportForm/ImportCustomTrack.d.ts} +0 -0
  34. /package/esm/LinearSyntenyView/components/{ImportSyntenyTrackSelector.js → ImportForm/ImportSyntenyTrackSelector.js} +0 -0
  35. /package/esm/LinearSyntenyView/components/{ImportForm.js → ImportForm/index.js} +0 -0
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { Feature } from '@jbrowse/core/util';
3
+ export default function LaunchSyntenyViewDialog({ model, feature, handleClose, }: {
4
+ model: unknown;
5
+ feature: Feature;
6
+ handleClose: () => void;
7
+ }): React.JSX.Element;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const react_1 = __importStar(require("react"));
27
+ const ui_1 = require("@jbrowse/core/ui");
28
+ const util_1 = require("@jbrowse/core/util");
29
+ const material_1 = require("@mui/material");
30
+ const util_2 = require("./util");
31
+ const mui_1 = require("tss-react/mui");
32
+ const useStyles = (0, mui_1.makeStyles)()({
33
+ padding: {
34
+ margin: 10,
35
+ border: '1px solid #ccc',
36
+ },
37
+ });
38
+ function LaunchSyntenyViewDialog({ model, feature, handleClose, }) {
39
+ const { classes } = useStyles();
40
+ const inverted = feature.get('strand') === -1;
41
+ const [horizontallyFlip, setHorizontallyFlip] = (0, react_1.useState)(inverted);
42
+ const [windowSize, setWindowSize] = (0, react_1.useState)('1000');
43
+ return (react_1.default.createElement(ui_1.Dialog, { open: true, title: "Launch synteny view", onClose: handleClose },
44
+ react_1.default.createElement(material_1.DialogContent, null,
45
+ inverted ? (react_1.default.createElement(material_1.FormControlLabel, { className: classes.padding, control: react_1.default.createElement(material_1.Checkbox, { checked: horizontallyFlip, onChange: event => setHorizontallyFlip(event.target.checked) }), label: "Note: The feature is inverted in orientation on the target\n sequence. This will result in the lower panel having genomic\n coordinates decreasing left to right. Horizontally flip?" })) : null,
46
+ react_1.default.createElement(material_1.TextField, { label: "Add window size in bp", value: windowSize, onChange: event => setWindowSize(event.target.value) })),
47
+ react_1.default.createElement(material_1.DialogActions, null,
48
+ react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => {
49
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
50
+ ;
51
+ (async () => {
52
+ try {
53
+ await (0, util_2.navToSynteny)({
54
+ feature,
55
+ windowSize: +windowSize,
56
+ horizontallyFlip,
57
+ model,
58
+ });
59
+ }
60
+ catch (e) {
61
+ (0, util_1.getSession)(model).notify(`${e}`, 'error');
62
+ }
63
+ })();
64
+ handleClose();
65
+ } }, "Submit"),
66
+ react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"))));
67
+ }
68
+ exports.default = LaunchSyntenyViewDialog;
@@ -0,0 +1,8 @@
1
+ import { Feature } from '@jbrowse/core/util';
2
+ import { IAnyStateTreeNode } from 'mobx-state-tree';
3
+ export declare function navToSynteny({ feature, windowSize: ws, model, horizontallyFlip, }: {
4
+ windowSize: number;
5
+ horizontallyFlip: boolean;
6
+ feature: Feature;
7
+ model: IAnyStateTreeNode;
8
+ }): Promise<void>;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.navToSynteny = void 0;
4
+ const util_1 = require("@jbrowse/core/util");
5
+ const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
6
+ const mobx_1 = require("mobx");
7
+ const { parseCigar } = plugin_alignments_1.MismatchParser;
8
+ function f(n) {
9
+ return Math.floor(n);
10
+ }
11
+ function findPosInCigar(cigar, startX) {
12
+ let featX = 0;
13
+ let mateX = 0;
14
+ for (let i = 0; i < cigar.length; i++) {
15
+ const len = +cigar[i];
16
+ const op = cigar[i + 1];
17
+ const min = Math.min(len, startX - featX);
18
+ if (featX >= startX) {
19
+ break;
20
+ }
21
+ else if (op === 'I') {
22
+ mateX += len;
23
+ }
24
+ else if (op === 'D') {
25
+ featX += min;
26
+ }
27
+ else if (op === 'M') {
28
+ mateX += min;
29
+ featX += min;
30
+ }
31
+ }
32
+ return [featX, mateX];
33
+ }
34
+ async function navToSynteny({ feature, windowSize: ws, model, horizontallyFlip, }) {
35
+ const session = (0, util_1.getSession)(model);
36
+ const track = (0, util_1.getContainingTrack)(model);
37
+ const view = (0, util_1.getContainingView)(model);
38
+ const reg = view.dynamicBlocks.contentBlocks[0];
39
+ const cigar = feature.get('CIGAR');
40
+ const strand = feature.get('strand');
41
+ const regStart = reg.start;
42
+ const regEnd = reg.end;
43
+ const featStart = feature.get('start');
44
+ const featEnd = feature.get('end');
45
+ const mate = feature.get('mate');
46
+ const mateStart = mate.start;
47
+ const mateEnd = mate.end;
48
+ const mateAsm = mate.assemblyName;
49
+ const mateRef = mate.refName;
50
+ const featAsm = reg.assemblyName;
51
+ const featRef = reg.refName;
52
+ let rMateStart;
53
+ let rMateEnd;
54
+ let rFeatStart;
55
+ let rFeatEnd;
56
+ if (cigar) {
57
+ const p = parseCigar(cigar);
58
+ const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
59
+ const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
60
+ // avoid multiply by 0 with strand undefined
61
+ const flipper = strand === -1 ? -1 : 1;
62
+ rFeatStart = featStart + fStartX;
63
+ rFeatEnd = featStart + fEndX;
64
+ rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper;
65
+ rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper;
66
+ }
67
+ else {
68
+ rFeatStart = featStart;
69
+ rFeatEnd = featEnd;
70
+ rMateStart = mateStart;
71
+ rMateEnd = mateEnd;
72
+ }
73
+ const trackId = track.configuration.trackId;
74
+ const view2 = session.addView('LinearSyntenyView', {
75
+ type: 'LinearSyntenyView',
76
+ views: [
77
+ {
78
+ id: `${Math.random()}`,
79
+ type: 'LinearGenomeView',
80
+ hideHeader: true,
81
+ },
82
+ {
83
+ id: `${Math.random()}`,
84
+ type: 'LinearGenomeView',
85
+ hideHeader: true,
86
+ },
87
+ ],
88
+ tracks: [
89
+ {
90
+ configuration: trackId,
91
+ type: 'SyntenyTrack',
92
+ displays: [
93
+ {
94
+ type: 'LinearSyntenyDisplay',
95
+ configuration: `${trackId}-LinearSyntenyDisplay`,
96
+ },
97
+ ],
98
+ },
99
+ ],
100
+ });
101
+ const l1 = `${featRef}:${f(rFeatStart - ws)}-${f(rFeatEnd + ws)}`;
102
+ const m1 = Math.min(rMateStart, rMateEnd);
103
+ const m2 = Math.max(rMateStart, rMateEnd);
104
+ const l2 = `${mateRef}:${f(m1 - ws)}-${f(m2 + ws)}${horizontallyFlip ? '[rev]' : ''}`;
105
+ await (0, mobx_1.when)(() => view2.width !== undefined);
106
+ await Promise.all([
107
+ view2.views[0].navToLocString(l1, featAsm),
108
+ view2.views[1].navToLocString(l2, mateAsm),
109
+ ]);
110
+ }
111
+ exports.navToSynteny = navToSynteny;
@@ -1,6 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
3
- import { Feature } from '@jbrowse/core/util';
4
3
  /**
5
4
  * #stateModel LGVSyntenyDisplay
6
5
  * extends `LinearPileupDisplay`, displays location of "synteny" feature in a
@@ -35,7 +34,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
35
34
  renderInProgress: AbortController | undefined;
36
35
  filled: boolean;
37
36
  reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
38
- features: Map<string, Feature> | undefined;
37
+ features: Map<string, import("@jbrowse/core/util").Feature> | undefined;
39
38
  layout: any;
40
39
  status: string;
41
40
  error: unknown;
@@ -53,7 +52,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
53
52
  setMessage(messageText: string): void;
54
53
  setRendered(props: {
55
54
  reactElement: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
56
- features: Map<string, Feature>;
55
+ features: Map<string, import("@jbrowse/core/util").Feature>;
57
56
  layout: any;
58
57
  maxHeightReached: boolean;
59
58
  renderProps: any;
@@ -70,7 +69,9 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
70
69
  };
71
70
  fetchSizeLimit: {
72
71
  type: string;
73
- defaultValue: number;
72
+ defaultValue: number; /**
73
+ * #property
74
+ */
74
75
  description: string;
75
76
  };
76
77
  height: {
@@ -208,7 +209,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
208
209
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
209
210
  } & {
210
211
  featureIdUnderMouse: string | undefined;
211
- contextMenuFeature: Feature | undefined;
212
+ contextMenuFeature: import("@jbrowse/core/util").Feature | undefined;
212
213
  } & {
213
214
  readonly blockType: "dynamicBlocks" | "staticBlocks";
214
215
  readonly blockDefinitions: import("@jbrowse/core/util/blockTypes").BlockSet;
@@ -218,18 +219,18 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
218
219
  readonly selectedFeatureId: string | undefined;
219
220
  readonly DisplayMessageComponent: import("react").FC<any> | undefined;
220
221
  } & {
221
- readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
222
- readonly featureUnderMouse: Feature | undefined;
222
+ readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
223
+ readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
223
224
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
224
225
  getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
225
226
  searchFeatureByID(id: string): [number, number, number, number] | undefined;
226
227
  } & {
227
228
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
228
229
  deleteBlock(key: string): void;
229
- selectFeature(feature: Feature): void;
230
+ selectFeature(feature: import("@jbrowse/core/util").Feature): void;
230
231
  clearFeatureSelection(): void;
231
232
  setFeatureIdUnderMouse(feature?: string | undefined): void;
232
- setContextMenuFeature(feature?: Feature | undefined): void;
233
+ setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
233
234
  } & {
234
235
  reload(): Promise<void>;
235
236
  } & {
@@ -241,7 +242,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
241
242
  afterAttach(): void;
242
243
  } & {
243
244
  colorTagMap: import("mobx").ObservableMap<string, string>;
244
- featureUnderMouseVolatile: Feature | undefined;
245
+ featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
245
246
  tagsReady: boolean;
246
247
  } & {
247
248
  readonly autorunReady: boolean;
@@ -256,9 +257,9 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
256
257
  extra?: import("@jbrowse/plugin-alignments/src/shared/color").ExtraColorBy | undefined;
257
258
  }): void;
258
259
  updateColorTagMap(uniqueTag: string[]): void;
259
- setFeatureUnderMouse(feat?: Feature | undefined): void;
260
- selectFeature(feature: Feature): void;
261
- copyFeatureToClipboard(feature: Feature): void;
260
+ setFeatureUnderMouse(feat?: import("@jbrowse/core/util").Feature | undefined): void;
261
+ selectFeature(feature: import("@jbrowse/core/util").Feature): void;
262
+ copyFeatureToClipboard(feature: import("@jbrowse/core/util").Feature): void;
262
263
  setConfig(conf: {
263
264
  [x: string]: any;
264
265
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
@@ -275,7 +276,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
275
276
  } & {
276
277
  readonly maxHeight: any;
277
278
  readonly featureHeightSetting: any;
278
- readonly featureUnderMouse: Feature | undefined;
279
+ readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
279
280
  renderReady(): boolean;
280
281
  readonly filters: import("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain").default;
281
282
  } & {
@@ -1,112 +1,34 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
+ const react_1 = require("react");
3
27
  const configuration_1 = require("@jbrowse/core/configuration");
4
28
  const util_1 = require("@jbrowse/core/util");
5
29
  const plugin_alignments_1 = require("@jbrowse/plugin-alignments");
6
30
  const mobx_state_tree_1 = require("mobx-state-tree");
7
- const mobx_1 = require("mobx");
8
- const { parseCigar } = plugin_alignments_1.MismatchParser;
9
- function findPosInCigar(cigar, startX) {
10
- let featX = 0;
11
- let mateX = 0;
12
- for (let i = 0; i < cigar.length; i++) {
13
- const len = +cigar[i];
14
- const op = cigar[i + 1];
15
- const min = Math.min(len, startX - featX);
16
- if (featX >= startX) {
17
- break;
18
- }
19
- else if (op === 'I') {
20
- mateX += len;
21
- }
22
- else if (op === 'D') {
23
- featX += min;
24
- }
25
- else if (op === 'M') {
26
- mateX += min;
27
- featX += min;
28
- }
29
- }
30
- return [featX, mateX];
31
- }
32
- async function navToSynteny(feature, self) {
33
- const session = (0, util_1.getSession)(self);
34
- const track = (0, util_1.getContainingTrack)(self);
35
- const view = (0, util_1.getContainingView)(self);
36
- const reg = view.dynamicBlocks.contentBlocks[0];
37
- const cigar = feature.get('CIGAR');
38
- const strand = feature.get('strand');
39
- const regStart = reg.start;
40
- const regEnd = reg.end;
41
- const featStart = feature.get('start');
42
- const featEnd = feature.get('end');
43
- const mate = feature.get('mate');
44
- const mateStart = mate.start;
45
- const mateEnd = mate.end;
46
- const mateAsm = mate.assemblyName;
47
- const mateRef = mate.refName;
48
- const featAsm = reg.assemblyName;
49
- const featRef = reg.refName;
50
- let rMateStart;
51
- let rMateEnd;
52
- let rFeatStart;
53
- let rFeatEnd;
54
- if (cigar) {
55
- const p = parseCigar(cigar);
56
- const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
57
- const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
58
- // avoid multiply by 0 with strand undefined
59
- const flipper = strand === -1 ? -1 : 1;
60
- rFeatStart = featStart + fStartX;
61
- rFeatEnd = featStart + fEndX;
62
- rMateStart = (strand === -1 ? mateEnd : mateStart) + mStartX * flipper;
63
- rMateEnd = (strand === -1 ? mateEnd : mateStart) + mEndX * flipper;
64
- }
65
- else {
66
- rFeatStart = featStart;
67
- rFeatEnd = featEnd;
68
- rMateStart = mateStart;
69
- rMateEnd = mateEnd;
70
- }
71
- const trackId = track.configuration.trackId;
72
- const view2 = session.addView('LinearSyntenyView', {
73
- type: 'LinearSyntenyView',
74
- views: [
75
- {
76
- id: `${Math.random()}`,
77
- type: 'LinearGenomeView',
78
- hideHeader: true,
79
- },
80
- {
81
- id: `${Math.random()}`,
82
- type: 'LinearGenomeView',
83
- hideHeader: true,
84
- },
85
- ],
86
- tracks: [
87
- {
88
- configuration: trackId,
89
- type: 'SyntenyTrack',
90
- displays: [
91
- {
92
- type: 'LinearSyntenyDisplay',
93
- configuration: `${trackId}-LinearSyntenyDisplay`,
94
- },
95
- ],
96
- },
97
- ],
98
- });
99
- const f = (n) => Math.floor(n);
100
- const l1 = `${featRef}:${f(rFeatStart)}-${f(rFeatEnd)}`;
101
- const m1 = Math.min(rMateStart, rMateEnd);
102
- const m2 = Math.max(rMateStart, rMateEnd);
103
- const l2 = `${mateRef}:${f(m1)}-${f(m2)}${strand === -1 ? '[rev]' : ''}`;
104
- await (0, mobx_1.when)(() => view2.width !== undefined);
105
- await Promise.all([
106
- view2.views[0].navToLocString(l1, featAsm),
107
- view2.views[1].navToLocString(l2, mateAsm),
108
- ]);
109
- }
31
+ const LaunchSyntenyViewDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/LaunchSyntenyViewDialog'))));
110
32
  /**
111
33
  * #stateModel LGVSyntenyDisplay
112
34
  * extends `LinearPileupDisplay`, displays location of "synteny" feature in a
@@ -135,7 +57,16 @@ function stateModelFactory(schema) {
135
57
  ? [
136
58
  {
137
59
  label: 'Open synteny view for this position',
138
- onClick: () => navToSynteny(feature, self),
60
+ onClick: () => {
61
+ (0, util_1.getSession)(self).queueDialog(handleClose => [
62
+ LaunchSyntenyViewDialog,
63
+ {
64
+ model: self,
65
+ handleClose,
66
+ feature,
67
+ },
68
+ ]);
69
+ },
139
70
  },
140
71
  ]
141
72
  : []),
@@ -46,9 +46,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
46
46
  hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
47
47
  hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
48
48
  trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
49
- trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
50
49
  showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
51
50
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
51
+ trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
52
52
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
53
53
  }, {
54
54
  width: number;
@@ -71,6 +71,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
71
71
  leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
72
72
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
73
73
  } & {
74
+ readonly trackLabelsSetting: any;
74
75
  readonly width: number;
75
76
  readonly interRegionPaddingWidth: number;
76
77
  readonly assemblyNames: string[];
@@ -22,28 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
25
  Object.defineProperty(exports, "__esModule", { value: true });
29
26
  const react_1 = __importStar(require("react"));
30
- const path_1 = __importDefault(require("path"));
31
27
  const material_1 = require("@mui/material");
32
28
  const ui_1 = require("@jbrowse/core/ui");
33
29
  const mobx_react_1 = require("mobx-react");
34
- function getName(sessionTrackData) {
35
- return sessionTrackData
36
- ? // @ts-expect-error
37
- sessionTrackData.uri ||
38
- // @ts-expect-error
39
- sessionTrackData.localPath ||
40
- // @ts-expect-error
41
- sessionTrackData.name
42
- : undefined;
43
- }
44
- function stripGz(fileName) {
45
- return fileName.endsWith('.gz') ? fileName.slice(0, -3) : fileName;
46
- }
30
+ const util_1 = require("./util");
47
31
  function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Location, bed2Location, }) {
48
32
  if (radioOption === '.paf') {
49
33
  return {
@@ -96,7 +80,7 @@ function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Locat
96
80
  };
97
81
  }
98
82
  else {
99
- throw new Error('Unknown type');
83
+ throw new Error(`Unknown to detect type ${radioOption} from filename (select radio button to clarify)`);
100
84
  }
101
85
  }
102
86
  const OpenTrack = (0, mobx_react_1.observer)(({ assembly1, assembly2, setSessionTrackData, }) => {
@@ -105,12 +89,12 @@ const OpenTrack = (0, mobx_react_1.observer)(({ assembly1, assembly2, setSession
105
89
  const [fileLocation, setFileLocation] = (0, react_1.useState)();
106
90
  const [value, setValue] = (0, react_1.useState)('');
107
91
  const [error, setError] = (0, react_1.useState)();
108
- const fileName = getName(fileLocation);
109
- const radioOption = value || (fileName ? path_1.default.extname(stripGz(fileName)) : '');
92
+ const fileName = (0, util_1.getName)(fileLocation);
93
+ const radioOption = value || (fileName ? (0, util_1.extName)((0, util_1.stripGz)(fileName)) : '');
110
94
  (0, react_1.useEffect)(() => {
111
95
  try {
112
96
  if (fileLocation) {
113
- const fn = fileName ? path_1.default.basename(fileName) : 'MyTrack';
97
+ const fn = fileName ? (0, util_1.basename)(fileName) : 'MyTrack';
114
98
  const trackId = `${fn}-${Date.now()}`;
115
99
  setError(undefined);
116
100
  setSessionTrackData({
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinearSyntenyViewModel } from '../model';
2
+ import { LinearSyntenyViewModel } from '../../model';
3
3
  declare const Selector: ({ model, assembly1, assembly2, setShowTrackId, }: {
4
4
  model: LinearSyntenyViewModel;
5
5
  assembly1: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinearSyntenyViewModel } from '../model';
2
+ import { LinearSyntenyViewModel } from '../../model';
3
3
  declare const LinearSyntenyViewImportForm: ({ model, }: {
4
4
  model: LinearSyntenyViewModel;
5
5
  }) => React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ export declare function getName(sessionTrackData?: {
2
+ uri: string;
3
+ } | {
4
+ localPath: string;
5
+ } | {
6
+ name: string;
7
+ }): any;
8
+ export declare function stripGz(fileName: string): string;
9
+ export declare function basename(str: string): string | undefined;
10
+ export declare function extName(str: string): string;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extName = exports.basename = exports.stripGz = exports.getName = void 0;
4
+ function getName(sessionTrackData) {
5
+ return sessionTrackData
6
+ ? // @ts-expect-error
7
+ sessionTrackData.uri ||
8
+ // @ts-expect-error
9
+ sessionTrackData.localPath ||
10
+ // @ts-expect-error
11
+ sessionTrackData.name
12
+ : undefined;
13
+ }
14
+ exports.getName = getName;
15
+ function stripGz(fileName) {
16
+ return fileName.endsWith('.gz') ? fileName.slice(0, -3) : fileName;
17
+ }
18
+ exports.stripGz = stripGz;
19
+ function basename(str) {
20
+ return str.split('#')[0].split('?')[0].split('/').pop();
21
+ }
22
+ exports.basename = basename;
23
+ function extName(str) {
24
+ const r = str.split('.').pop();
25
+ return r ? `.${r}` : '';
26
+ }
27
+ exports.extName = extName;
@@ -57,9 +57,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
57
57
  hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
58
58
  hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
59
59
  trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
60
- trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
61
60
  showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
62
61
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
62
+ trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
63
63
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
64
64
  }, {
65
65
  width: number;
@@ -82,6 +82,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
82
82
  leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
83
83
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
84
84
  } & {
85
+ readonly trackLabelsSetting: any;
85
86
  readonly width: number;
86
87
  readonly interRegionPaddingWidth: number;
87
88
  readonly assemblyNames: string[];
@@ -271,9 +272,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
271
272
  hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
272
273
  hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
273
274
  trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
274
- trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
275
275
  showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
276
276
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
277
+ trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
277
278
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
278
279
  }>>[]): void;
279
280
  removeView(view: {
@@ -307,9 +308,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
307
308
  hideHeaderOverview: boolean;
308
309
  hideNoTracksActive: boolean;
309
310
  trackSelectorType: string;
310
- trackLabels: string;
311
311
  showCenterLine: boolean;
312
312
  showCytobandsSetting: boolean;
313
+ trackLabels: string;
313
314
  showGridlines: boolean;
314
315
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
315
316
  width: number;
@@ -332,6 +333,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
332
333
  leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
333
334
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
334
335
  } & {
336
+ readonly trackLabelsSetting: any;
335
337
  readonly width: number;
336
338
  readonly interRegionPaddingWidth: number;
337
339
  readonly assemblyNames: string[];
@@ -495,9 +497,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
495
497
  hideHeaderOverview: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
496
498
  hideNoTracksActive: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
497
499
  trackSelectorType: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
498
- trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
499
500
  showCenterLine: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
500
501
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
502
+ trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
501
503
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
502
504
  }, {
503
505
  width: number;
@@ -520,6 +522,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
520
522
  leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
521
523
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
522
524
  } & {
525
+ readonly trackLabelsSetting: any;
523
526
  readonly width: number;
524
527
  readonly interRegionPaddingWidth: number;
525
528
  readonly assemblyNames: string[];
@@ -47,7 +47,7 @@ const ExportSvgDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __i
47
47
  */
48
48
  function stateModelFactory(pluginManager) {
49
49
  return mobx_state_tree_1.types
50
- .compose((0, model_1.default)(pluginManager), mobx_state_tree_1.types.model('LinearSyntenyView', {
50
+ .compose('LinearSyntenyView', (0, model_1.default)(pluginManager), mobx_state_tree_1.types.model({
51
51
  /**
52
52
  * #property
53
53
  */