@jbrowse/plugin-linear-comparative-view 2.15.4 → 2.16.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 (121) hide show
  1. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
  2. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
  3. package/dist/LGVSyntenyDisplay/components/util.d.ts +4 -1
  4. package/dist/LGVSyntenyDisplay/components/util.js +7 -15
  5. package/dist/LGVSyntenyDisplay/model.d.ts +26 -14
  6. package/dist/LGVSyntenyDisplay/model.js +23 -1
  7. package/dist/LaunchLinearSyntenyView.js +41 -11
  8. package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +42 -14
  9. package/dist/LinearComparativeDisplay/stateModelFactory.js +20 -10
  10. package/dist/LinearComparativeView/components/Header.d.ts +2 -3
  11. package/dist/LinearComparativeView/components/Header.js +72 -62
  12. package/dist/LinearComparativeView/components/HeaderSearchBoxes.d.ts +6 -0
  13. package/dist/LinearComparativeView/components/HeaderSearchBoxes.js +34 -0
  14. package/dist/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +6 -0
  15. package/dist/LinearComparativeView/components/LinearComparativeRenderArea.js +61 -0
  16. package/dist/LinearComparativeView/components/LinearComparativeView.d.ts +2 -4
  17. package/dist/LinearComparativeView/components/LinearComparativeView.js +3 -67
  18. package/dist/LinearComparativeView/components/Rubberband.js +1 -1
  19. package/dist/LinearComparativeView/index.js +3 -0
  20. package/dist/LinearComparativeView/model.d.ts +265 -12
  21. package/dist/LinearComparativeView/model.js +45 -75
  22. package/dist/LinearSyntenyDisplay/afterAttach.js +5 -4
  23. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +47 -32
  24. package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +10 -6
  25. package/dist/LinearSyntenyDisplay/components/util.d.ts +7 -2
  26. package/dist/LinearSyntenyDisplay/components/util.js +12 -14
  27. package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  28. package/dist/LinearSyntenyDisplay/drawSynteny.js +29 -25
  29. package/dist/LinearSyntenyDisplay/index.js +1 -1
  30. package/dist/LinearSyntenyDisplay/model.d.ts +48 -10
  31. package/dist/LinearSyntenyDisplay/model.js +38 -15
  32. package/dist/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.d.ts → AddCustomTrack.d.ts} +2 -3
  33. package/dist/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.js → AddCustomTrack.js} +3 -3
  34. package/dist/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +195 -0
  35. package/dist/LinearSyntenyView/components/ImportForm/Spacer.d.ts +2 -0
  36. package/dist/LinearSyntenyView/components/ImportForm/Spacer.js +10 -0
  37. package/dist/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +10 -0
  38. package/dist/LinearSyntenyView/components/ImportForm/{ImportSyntenyTrackSelector.js → TrackSelector.js} +15 -20
  39. package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +14 -0
  40. package/dist/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +52 -0
  41. package/dist/LinearSyntenyView/components/LinearSyntenyView.js +3 -3
  42. package/dist/LinearSyntenyView/index.js +1 -1
  43. package/dist/LinearSyntenyView/model.d.ts +267 -9
  44. package/dist/LinearSyntenyView/model.js +2 -2
  45. package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
  46. package/dist/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +19 -0
  47. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -3
  48. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +36 -27
  49. package/dist/LinearSyntenyViewHelper/index.d.ts +2 -0
  50. package/dist/LinearSyntenyViewHelper/index.js +25 -0
  51. package/dist/LinearSyntenyViewHelper/stateModelFactory.d.ts +30 -0
  52. package/dist/LinearSyntenyViewHelper/stateModelFactory.js +105 -0
  53. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
  54. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +100 -0
  55. package/dist/SyntenyFeatureDetail/index.d.ts +2 -0
  56. package/dist/SyntenyFeatureDetail/index.js +56 -0
  57. package/dist/index.js +4 -0
  58. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.d.ts +2 -1
  59. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +4 -2
  60. package/esm/LGVSyntenyDisplay/components/util.d.ts +4 -1
  61. package/esm/LGVSyntenyDisplay/components/util.js +8 -16
  62. package/esm/LGVSyntenyDisplay/model.d.ts +26 -14
  63. package/esm/LGVSyntenyDisplay/model.js +25 -3
  64. package/esm/LaunchLinearSyntenyView.js +41 -11
  65. package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +42 -14
  66. package/esm/LinearComparativeDisplay/stateModelFactory.js +21 -11
  67. package/esm/LinearComparativeView/components/Header.d.ts +2 -3
  68. package/esm/LinearComparativeView/components/Header.js +73 -63
  69. package/esm/LinearComparativeView/components/HeaderSearchBoxes.d.ts +6 -0
  70. package/esm/LinearComparativeView/components/HeaderSearchBoxes.js +29 -0
  71. package/esm/LinearComparativeView/components/LinearComparativeRenderArea.d.ts +6 -0
  72. package/esm/LinearComparativeView/components/LinearComparativeRenderArea.js +56 -0
  73. package/esm/LinearComparativeView/components/LinearComparativeView.d.ts +2 -4
  74. package/esm/LinearComparativeView/components/LinearComparativeView.js +3 -67
  75. package/esm/LinearComparativeView/components/Rubberband.js +1 -1
  76. package/esm/LinearComparativeView/index.js +3 -0
  77. package/esm/LinearComparativeView/model.d.ts +265 -12
  78. package/esm/LinearComparativeView/model.js +47 -77
  79. package/esm/LinearSyntenyDisplay/afterAttach.js +5 -4
  80. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +48 -33
  81. package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +10 -6
  82. package/esm/LinearSyntenyDisplay/components/util.d.ts +7 -2
  83. package/esm/LinearSyntenyDisplay/components/util.js +12 -14
  84. package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  85. package/esm/LinearSyntenyDisplay/drawSynteny.js +29 -25
  86. package/esm/LinearSyntenyDisplay/index.js +1 -1
  87. package/esm/LinearSyntenyDisplay/model.d.ts +48 -10
  88. package/esm/LinearSyntenyDisplay/model.js +38 -15
  89. package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.d.ts → AddCustomTrack.d.ts} +2 -3
  90. package/esm/LinearSyntenyView/components/ImportForm/{ImportCustomTrack.js → AddCustomTrack.js} +3 -3
  91. package/esm/LinearSyntenyView/components/ImportForm/LinearSyntenyImportForm.js +167 -0
  92. package/esm/LinearSyntenyView/components/ImportForm/Spacer.d.ts +2 -0
  93. package/esm/LinearSyntenyView/components/ImportForm/Spacer.js +4 -0
  94. package/esm/LinearSyntenyView/components/ImportForm/TrackSelector.d.ts +10 -0
  95. package/esm/LinearSyntenyView/components/ImportForm/{ImportSyntenyTrackSelector.js → TrackSelector.js} +15 -20
  96. package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.d.ts +14 -0
  97. package/esm/LinearSyntenyView/components/ImportForm/TrackSelectorUtil.js +23 -0
  98. package/esm/LinearSyntenyView/components/LinearSyntenyView.js +3 -3
  99. package/esm/LinearSyntenyView/index.js +1 -1
  100. package/esm/LinearSyntenyView/model.d.ts +267 -9
  101. package/esm/LinearSyntenyView/model.js +2 -2
  102. package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.d.ts +12 -0
  103. package/esm/LinearSyntenyView/svgcomponents/SVGLinearGenomeView.js +13 -0
  104. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.d.ts +1 -3
  105. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +38 -29
  106. package/esm/LinearSyntenyViewHelper/index.d.ts +2 -0
  107. package/esm/LinearSyntenyViewHelper/index.js +19 -0
  108. package/esm/LinearSyntenyViewHelper/stateModelFactory.d.ts +30 -0
  109. package/esm/LinearSyntenyViewHelper/stateModelFactory.js +102 -0
  110. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.d.ts +14 -0
  111. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +72 -0
  112. package/esm/SyntenyFeatureDetail/index.d.ts +2 -0
  113. package/esm/SyntenyFeatureDetail/index.js +27 -0
  114. package/esm/index.js +4 -0
  115. package/package.json +3 -3
  116. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -9
  117. package/dist/LinearSyntenyView/components/ImportForm/index.js +0 -138
  118. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +0 -9
  119. package/esm/LinearSyntenyView/components/ImportForm/index.js +0 -110
  120. /package/dist/LinearSyntenyView/components/ImportForm/{index.d.ts → LinearSyntenyImportForm.d.ts} +0 -0
  121. /package/esm/LinearSyntenyView/components/ImportForm/{index.d.ts → LinearSyntenyImportForm.d.ts} +0 -0
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { SimpleFeatureSerialized } from '@jbrowse/core/util';
3
+ interface SyntenyFeatureDetailModel {
4
+ trackId: string;
5
+ featureData: SimpleFeatureSerialized;
6
+ level?: number;
7
+ view: {
8
+ type: string;
9
+ };
10
+ }
11
+ declare const SyntenyFeatureDetail: ({ model, }: {
12
+ model: SyntenyFeatureDetailModel;
13
+ }) => React.JSX.Element;
14
+ export default SyntenyFeatureDetail;
@@ -0,0 +1,100 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ const react_1 = __importStar(require("react"));
30
+ const material_1 = require("@mui/material");
31
+ const mobx_react_1 = require("mobx-react");
32
+ // locals
33
+ const BaseCard_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail/BaseCard"));
34
+ const BaseFeatureDetail_1 = __importDefault(require("@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail"));
35
+ const util_1 = require("@jbrowse/core/util");
36
+ // lazies
37
+ const LaunchSyntenyViewDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('../LGVSyntenyDisplay/components/LaunchSyntenyViewDialog'))));
38
+ const CustomLinker = (0, mobx_react_1.observer)(function ({ model, }) {
39
+ const { featureData, view, level, trackId } = model;
40
+ return (react_1.default.createElement("ul", null,
41
+ view.type === 'LinearSyntenyView' ? (react_1.default.createElement("li", null,
42
+ react_1.default.createElement(material_1.Link, { href: "#", onClick: event => {
43
+ var _a, _b;
44
+ event.preventDefault();
45
+ const { views } = view;
46
+ if (level !== undefined) {
47
+ // level is "pre-known", and stored in the SyntenyFeatureWidget
48
+ // model state e.g. when clicking on a feature from a
49
+ // LinearSyntenyRendering
50
+ (_a = views[level]) === null || _a === void 0 ? void 0 : _a.navTo(featureData);
51
+ (_b = views[level + 1]) === null || _b === void 0 ? void 0 : _b.navTo(featureData.mate);
52
+ }
53
+ else {
54
+ // best effort to find the right level. this is triggered for
55
+ // example if a user clicks on a feature in a LGVSyntenyDisplay
56
+ // in an existing LinearSyntenyView, there is no real proper
57
+ // level "pre-known" to this situation
58
+ const f1 = featureData;
59
+ const f2 = featureData.mate;
60
+ const r1 = f1.assemblyName;
61
+ const r2 = f2.assemblyName;
62
+ const v1 = views.find(view => view.assemblyNames[0] === r1);
63
+ const v2 = views.find(view => view.assemblyNames[0] === r2);
64
+ if (!v1 || !v2) {
65
+ (0, util_1.getSession)(model).notify([
66
+ v1
67
+ ? `Unable to find ${(0, util_1.assembleLocString)(f1)} in synteny view`
68
+ : '',
69
+ v2
70
+ ? `Unable to find ${(0, util_1.assembleLocString)(f2)} in synteny view`
71
+ : '',
72
+ ].join(' ... '));
73
+ }
74
+ v1 === null || v1 === void 0 ? void 0 : v1.navTo(f1);
75
+ v2 === null || v2 === void 0 ? void 0 : v2.navTo(f2);
76
+ }
77
+ } }, "Center view on this feature"))) : null,
78
+ react_1.default.createElement("li", null,
79
+ react_1.default.createElement(material_1.Link, { href: "#", onClick: event => {
80
+ event.preventDefault();
81
+ const session = (0, util_1.getSession)(model);
82
+ const feature = new util_1.SimpleFeature(featureData);
83
+ session.queueDialog(handleClose => [
84
+ LaunchSyntenyViewDialog,
85
+ {
86
+ model,
87
+ feature,
88
+ trackId,
89
+ handleClose,
90
+ },
91
+ ]);
92
+ } }, "Launch new linear synteny view on this feature"))));
93
+ });
94
+ const SyntenyFeatureDetail = (0, mobx_react_1.observer)(function ({ model, }) {
95
+ return (react_1.default.createElement(material_1.Paper, { "data-testid": "alignment-side-drawer" },
96
+ react_1.default.createElement(BaseFeatureDetail_1.default, { title: "Feature", model: model }),
97
+ react_1.default.createElement(BaseCard_1.default, { title: "Link to view" },
98
+ react_1.default.createElement(CustomLinker, { model: model }))));
99
+ });
100
+ exports.default = SyntenyFeatureDetail;
@@ -0,0 +1,2 @@
1
+ import PluginManager from '@jbrowse/core/PluginManager';
2
+ export default function SyntenyFeatureWidgetF(pluginManager: PluginManager): void;
@@ -0,0 +1,56 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.default = SyntenyFeatureWidgetF;
30
+ const react_1 = require("react");
31
+ const configuration_1 = require("@jbrowse/core/configuration");
32
+ const WidgetType_1 = __importDefault(require("@jbrowse/core/pluggableElementTypes/WidgetType"));
33
+ const mobx_state_tree_1 = require("mobx-state-tree");
34
+ const BaseFeatureWidget_1 = require("@jbrowse/core/BaseFeatureWidget");
35
+ const configSchema = (0, configuration_1.ConfigurationSchema)('SyntenyFeatureWidget', {});
36
+ function stateModelF(pluginManager) {
37
+ return mobx_state_tree_1.types.compose((0, BaseFeatureWidget_1.stateModelFactory)(pluginManager), mobx_state_tree_1.types.model('SyntenyFeatureWidget', {
38
+ /**
39
+ * #property
40
+ */
41
+ type: mobx_state_tree_1.types.literal('SyntenyFeatureWidget'),
42
+ /**
43
+ * #property
44
+ */
45
+ level: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.number),
46
+ }));
47
+ }
48
+ function SyntenyFeatureWidgetF(pluginManager) {
49
+ pluginManager.addWidgetType(() => new WidgetType_1.default({
50
+ name: 'SyntenyFeatureWidget',
51
+ heading: 'Synteny feature details',
52
+ configSchema,
53
+ stateModel: stateModelF(pluginManager),
54
+ ReactComponent: (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./SyntenyFeatureDetail')))),
55
+ }));
56
+ }
package/dist/index.js CHANGED
@@ -11,19 +11,23 @@ const LinearComparativeView_1 = __importDefault(require("./LinearComparativeView
11
11
  const LinearSyntenyDisplay_1 = __importDefault(require("./LinearSyntenyDisplay"));
12
12
  const LGVSyntenyDisplay_1 = __importDefault(require("./LGVSyntenyDisplay"));
13
13
  const LinearSyntenyView_1 = __importDefault(require("./LinearSyntenyView"));
14
+ const LinearSyntenyViewHelper_1 = __importDefault(require("./LinearSyntenyViewHelper"));
14
15
  const LaunchLinearSyntenyView_1 = __importDefault(require("./LaunchLinearSyntenyView"));
15
16
  const SyntenyTrack_1 = __importDefault(require("./SyntenyTrack"));
16
17
  const LinearReadVsRef_1 = __importDefault(require("./LinearReadVsRef"));
18
+ const SyntenyFeatureDetail_1 = __importDefault(require("./SyntenyFeatureDetail"));
17
19
  class LinearComparativeViewPlugin extends Plugin_1.default {
18
20
  constructor() {
19
21
  super(...arguments);
20
22
  this.name = 'LinearComparativeViewPlugin';
21
23
  }
22
24
  install(pluginManager) {
25
+ (0, LinearSyntenyViewHelper_1.default)(pluginManager);
23
26
  (0, LinearComparativeView_1.default)(pluginManager);
24
27
  (0, LinearSyntenyView_1.default)(pluginManager);
25
28
  (0, LinearComparativeDisplay_1.default)(pluginManager);
26
29
  (0, LinearSyntenyDisplay_1.default)(pluginManager);
30
+ (0, SyntenyFeatureDetail_1.default)(pluginManager);
27
31
  (0, LGVSyntenyDisplay_1.default)(pluginManager);
28
32
  (0, LaunchLinearSyntenyView_1.default)(pluginManager);
29
33
  (0, SyntenyTrack_1.default)(pluginManager);
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { Feature } from '@jbrowse/core/util';
3
- export default function LaunchSyntenyViewDialog({ model, feature, handleClose, }: {
3
+ export default function LaunchSyntenyViewDialog({ model, feature, trackId, handleClose, }: {
4
4
  model: unknown;
5
5
  feature: Feature;
6
+ trackId: string;
6
7
  handleClose: () => void;
7
8
  }): React.JSX.Element;
@@ -2,15 +2,16 @@ import React, { useState } from 'react';
2
2
  import { Dialog } from '@jbrowse/core/ui';
3
3
  import { getSession } from '@jbrowse/core/util';
4
4
  import { Button, Checkbox, DialogActions, DialogContent, FormControlLabel, TextField, } from '@mui/material';
5
- import { navToSynteny } from './util';
6
5
  import { makeStyles } from 'tss-react/mui';
6
+ // locals
7
+ import { navToSynteny } from './util';
7
8
  const useStyles = makeStyles()({
8
9
  padding: {
9
10
  margin: 10,
10
11
  border: '1px solid #ccc',
11
12
  },
12
13
  });
13
- export default function LaunchSyntenyViewDialog({ model, feature, handleClose, }) {
14
+ export default function LaunchSyntenyViewDialog({ model, feature, trackId, handleClose, }) {
14
15
  const { classes } = useStyles();
15
16
  const inverted = feature.get('strand') === -1;
16
17
  const [horizontallyFlip, setHorizontallyFlip] = useState(inverted);
@@ -33,6 +34,7 @@ export default function LaunchSyntenyViewDialog({ model, feature, handleClose, }
33
34
  feature,
34
35
  windowSize: +windowSize,
35
36
  horizontallyFlip,
37
+ trackId,
36
38
  model,
37
39
  });
38
40
  }
@@ -1,8 +1,11 @@
1
1
  import { Feature } from '@jbrowse/core/util';
2
2
  import { IAnyStateTreeNode } from 'mobx-state-tree';
3
- export declare function navToSynteny({ feature, windowSize: ws, model, horizontallyFlip, }: {
3
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
4
+ export declare function navToSynteny({ feature, windowSize: ws, model, trackId, view, horizontallyFlip, }: {
4
5
  windowSize: number;
6
+ trackId: string;
5
7
  horizontallyFlip: boolean;
6
8
  feature: Feature;
9
+ view?: LinearGenomeViewModel;
7
10
  model: IAnyStateTreeNode;
8
11
  }): Promise<void>;
@@ -1,4 +1,4 @@
1
- import { getSession, getContainingTrack, getContainingView, } from '@jbrowse/core/util';
1
+ import { getSession } from '@jbrowse/core/util';
2
2
  import { MismatchParser } from '@jbrowse/plugin-alignments';
3
3
  const { parseCigar } = MismatchParser;
4
4
  function f(n) {
@@ -27,18 +27,13 @@ function findPosInCigar(cigar, startX) {
27
27
  }
28
28
  return [featX, mateX];
29
29
  }
30
- export async function navToSynteny({ feature, windowSize: ws, model, horizontallyFlip, }) {
30
+ export async function navToSynteny({ feature, windowSize: ws, model, trackId, view, horizontallyFlip, }) {
31
31
  const session = getSession(model);
32
- const track = getContainingTrack(model);
33
- const view = getContainingView(model);
34
- const reg = view.dynamicBlocks.contentBlocks[0];
35
- if (!reg) {
36
- throw new Error('no visible region');
37
- }
32
+ const reg = view === null || view === void 0 ? void 0 : view.dynamicBlocks.contentBlocks[0];
38
33
  const cigar = feature.get('CIGAR');
39
34
  const strand = feature.get('strand');
40
- const regStart = reg.start;
41
- const regEnd = reg.end;
35
+ const featRef = feature.get('refName');
36
+ const featAsm = feature.get('assemblyName');
42
37
  const featStart = feature.get('start');
43
38
  const featEnd = feature.get('end');
44
39
  const mate = feature.get('mate');
@@ -46,13 +41,13 @@ export async function navToSynteny({ feature, windowSize: ws, model, horizontall
46
41
  const mateEnd = mate.end;
47
42
  const mateAsm = mate.assemblyName;
48
43
  const mateRef = mate.refName;
49
- const featAsm = reg.assemblyName;
50
- const featRef = reg.refName;
51
44
  let rMateStart;
52
45
  let rMateEnd;
53
46
  let rFeatStart;
54
47
  let rFeatEnd;
55
- if (cigar) {
48
+ if (reg && cigar) {
49
+ const regStart = reg.start;
50
+ const regEnd = reg.end;
56
51
  const p = parseCigar(cigar);
57
52
  const [fStartX, mStartX] = findPosInCigar(p, regStart - featStart);
58
53
  const [fEndX, mEndX] = findPosInCigar(p, regEnd - featStart);
@@ -69,17 +64,14 @@ export async function navToSynteny({ feature, windowSize: ws, model, horizontall
69
64
  rMateStart = mateStart;
70
65
  rMateEnd = mateEnd;
71
66
  }
72
- const trackId = track.configuration.trackId;
73
67
  const view2 = session.addView('LinearSyntenyView', {
74
68
  type: 'LinearSyntenyView',
75
69
  views: [
76
70
  {
77
- id: `${Math.random()}`,
78
71
  type: 'LinearGenomeView',
79
72
  hideHeader: true,
80
73
  },
81
74
  {
82
- id: `${Math.random()}`,
83
75
  type: 'LinearGenomeView',
84
76
  hideHeader: true,
85
77
  },
@@ -1,4 +1,5 @@
1
1
  import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
2
+ import { Feature } from '@jbrowse/core/util';
2
3
  /**
3
4
  * #stateModel LGVSyntenyDisplay
4
5
  * displays location of "synteny" feature in a plain LGV, allowing linking out
@@ -10,7 +11,14 @@ import { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
10
11
  declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("mobx-state-tree").IModelType<{
11
12
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
12
13
  type: import("mobx-state-tree").ISimpleType<string>;
13
- rpcDriverName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
14
+ rpcDriverName: import("mobx-state-tree" /**
15
+ * #stateModel LGVSyntenyDisplay
16
+ * displays location of "synteny" feature in a plain LGV, allowing linking out
17
+ * to external synteny views
18
+ *
19
+ * extends
20
+ * - [SharedLinearPileupDisplayMixin](../sharedlinearpileupdisplaymixin)
21
+ */).IMaybe<import("mobx-state-tree").ISimpleType<string>>;
14
22
  } & {
15
23
  heightPreConfig: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<number>>;
16
24
  } & {
@@ -38,7 +46,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
38
46
  renderInProgress: AbortController | undefined;
39
47
  filled: boolean;
40
48
  reactElement: React.ReactElement | undefined;
41
- features: Map<string, import("@jbrowse/core/util").Feature> | undefined;
49
+ features: Map<string, Feature> | undefined;
42
50
  layout: any;
43
51
  status: string;
44
52
  error: unknown;
@@ -63,7 +71,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
63
71
  setMessage(messageText: string): void;
64
72
  setRendered(props: {
65
73
  reactElement: React.ReactElement;
66
- features: Map<string, import("@jbrowse/core/util").Feature>;
74
+ features: Map<string, Feature>;
67
75
  layout: any;
68
76
  maxHeightReached: boolean;
69
77
  renderProps: any;
@@ -223,7 +231,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
223
231
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react").JSX.Element | null;
224
232
  } & {
225
233
  featureIdUnderMouse: undefined | string;
226
- contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
234
+ contextMenuFeature: undefined | Feature;
227
235
  } & {
228
236
  readonly DisplayMessageComponent: import("react").FC<any> | undefined;
229
237
  readonly blockType: "dynamicBlocks" | "staticBlocks";
@@ -233,19 +241,19 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
233
241
  readonly TooltipComponent: import("@jbrowse/core/util").AnyReactComponentType;
234
242
  readonly selectedFeatureId: string | undefined;
235
243
  } & {
236
- readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
237
- readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
244
+ readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
245
+ readonly featureUnderMouse: Feature | undefined;
238
246
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
239
247
  getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
240
248
  searchFeatureByID(id: string): [number, number, number, number] | undefined;
241
249
  } & {
242
250
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
243
251
  deleteBlock(key: string): void;
244
- selectFeature(feature: import("@jbrowse/core/util").Feature): void;
245
- navToFeature(feature: import("@jbrowse/core/util").Feature): void;
252
+ selectFeature(feature: Feature): void;
253
+ navToFeature(feature: Feature): void;
246
254
  clearFeatureSelection(): void;
247
255
  setFeatureIdUnderMouse(feature?: string): void;
248
- setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature): void;
256
+ setContextMenuFeature(feature?: Feature): void;
249
257
  } & {
250
258
  reload(): Promise<void>;
251
259
  } & {
@@ -257,7 +265,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
257
265
  afterAttach(): void;
258
266
  } & {
259
267
  colorTagMap: import("mobx").ObservableMap<string, string>;
260
- featureUnderMouseVolatile: undefined | import("@jbrowse/core/util").Feature;
268
+ featureUnderMouseVolatile: undefined | Feature;
261
269
  tagsReady: boolean;
262
270
  } & {
263
271
  readonly autorunReady: boolean;
@@ -272,9 +280,9 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
272
280
  extra?: import("@jbrowse/plugin-alignments/src/shared/color").ExtraColorBy;
273
281
  }): void;
274
282
  updateColorTagMap(uniqueTag: string[]): void;
275
- setFeatureUnderMouse(feat?: import("@jbrowse/core/util").Feature): void;
276
- selectFeature(feature: import("@jbrowse/core/util").Feature): void;
277
- copyFeatureToClipboard(feature: import("@jbrowse/core/util").Feature): void;
283
+ setFeatureUnderMouse(feat?: Feature): void;
284
+ selectFeature(feature: Feature): void;
285
+ copyFeatureToClipboard(feature: Feature): void;
278
286
  setConfig(conf: import("@jbrowse/core/configuration").AnyConfigurationModel): void;
279
287
  setFilterBy(filter: import("@jbrowse/plugin-alignments/src/shared").IFilter): void;
280
288
  setJexlFilters(filters: string[]): void;
@@ -293,7 +301,7 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
293
301
  } & {
294
302
  readonly maxHeight: any;
295
303
  readonly featureHeightSetting: any;
296
- readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
304
+ readonly featureUnderMouse: Feature | undefined;
297
305
  renderReady(): boolean;
298
306
  readonly filters: import("@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain").default;
299
307
  } & {
@@ -352,6 +360,10 @@ declare function stateModelFactory(schema: AnyConfigurationSchemaType): import("
352
360
  }[];
353
361
  })[];
354
362
  } & {
363
+ /**
364
+ * #action
365
+ */
366
+ selectFeature(feature: Feature): void;
355
367
  afterCreate(): void;
356
368
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
357
369
  export default stateModelFactory;
@@ -1,6 +1,6 @@
1
1
  import { lazy } from 'react';
2
- import { ConfigurationReference, } from '@jbrowse/core/configuration';
3
- import { getSession } from '@jbrowse/core/util';
2
+ import { ConfigurationReference, getConf, } from '@jbrowse/core/configuration';
3
+ import { getContainingTrack, getContainingView, getSession, isSessionModelWithWidgets, } from '@jbrowse/core/util';
4
4
  import { SharedLinearPileupDisplayMixin } from '@jbrowse/plugin-alignments';
5
5
  import { types } from 'mobx-state-tree';
6
6
  const LaunchSyntenyViewDialog = lazy(() => import('./components/LaunchSyntenyViewDialog'));
@@ -37,12 +37,13 @@ function stateModelFactory(schema) {
37
37
  ...(feature
38
38
  ? [
39
39
  {
40
- label: 'Open synteny view for this position',
40
+ label: 'Launch synteny view for this position',
41
41
  onClick: () => {
42
42
  getSession(self).queueDialog(handleClose => [
43
43
  LaunchSyntenyViewDialog,
44
44
  {
45
45
  model: self,
46
+ trackId: getConf(getContainingTrack(self), 'trackId'),
46
47
  handleClose,
47
48
  feature,
48
49
  },
@@ -73,6 +74,27 @@ function stateModelFactory(schema) {
73
74
  };
74
75
  })
75
76
  .actions(self => ({
77
+ /**
78
+ * #action
79
+ */
80
+ selectFeature(feature) {
81
+ const session = getSession(self);
82
+ if (isSessionModelWithWidgets(session)) {
83
+ const r2 = getContainingView(self);
84
+ let r3 = r2;
85
+ try {
86
+ r3 = getContainingView(r3);
87
+ }
88
+ catch (e) { }
89
+ const featureWidget = session.addWidget('SyntenyFeatureWidget', 'syntenyFeature', {
90
+ featureData: feature.toJSON(),
91
+ view: r3,
92
+ track: getContainingTrack(self),
93
+ });
94
+ session.showWidget(featureWidget);
95
+ }
96
+ session.setSelection(feature);
97
+ },
76
98
  afterCreate() {
77
99
  // use color by stand to help indicate inversions better on first load,
78
100
  // otherwise use selected orientation
@@ -1,4 +1,8 @@
1
+ import { notEmpty } from '@jbrowse/core/util';
1
2
  import { when } from 'mobx';
3
+ function makeMultiDimArray(str) {
4
+ return Array.isArray(str[0]) ? str : [str];
5
+ }
2
6
  export default function LaunchLinearSyntenyView(pluginManager) {
3
7
  pluginManager.addToExtensionPoint('LaunchView-LinearSyntenyView',
4
8
  // @ts-expect-error
@@ -21,7 +25,7 @@ export default function LaunchLinearSyntenyView(pluginManager) {
21
25
  };
22
26
  })));
23
27
  await Promise.all(model.views.map(view => when(() => view.initialized)));
24
- const idsNotFound = [];
28
+ let idsNotFound = [];
25
29
  await Promise.all(views.map(async (data, idx) => {
26
30
  const view = model.views[idx];
27
31
  const { assembly, loc, tracks = [] } = data;
@@ -30,14 +34,23 @@ export default function LaunchLinearSyntenyView(pluginManager) {
30
34
  throw new Error(`Assembly ${data.assembly} failed to load`);
31
35
  }
32
36
  await view.navToSearchString({ input: loc, assembly: asm });
33
- tracks.forEach(track => {
34
- tryTrack(view, track, idsNotFound);
35
- });
37
+ idsNotFound = [
38
+ ...idsNotFound,
39
+ ...tracks.map(trackId => tryTrackLGV({
40
+ model: view,
41
+ trackId,
42
+ })),
43
+ ];
36
44
  }));
37
- tracks.forEach(track => {
38
- tryTrack(model, track, idsNotFound);
39
- });
40
- if (idsNotFound.length) {
45
+ idsNotFound = [
46
+ ...idsNotFound,
47
+ ...makeMultiDimArray(tracks).flatMap((trackSet, level) => trackSet.map(trackId => tryTrackSynteny({
48
+ model,
49
+ trackId,
50
+ level,
51
+ }))),
52
+ ];
53
+ if (idsNotFound.filter(notEmpty).length) {
41
54
  throw new Error(`Could not resolve identifiers: ${idsNotFound.join(',')}`);
42
55
  }
43
56
  }
@@ -47,16 +60,33 @@ export default function LaunchLinearSyntenyView(pluginManager) {
47
60
  }
48
61
  });
49
62
  }
50
- function tryTrack(model, trackId, idsNotFound) {
63
+ function tryTrackLGV({ model, trackId, }) {
51
64
  try {
52
65
  model.showTrack(trackId);
53
66
  }
54
67
  catch (e) {
55
- if (/Could not resolve identifier/.exec(`${e}`)) {
56
- idsNotFound.push(trackId);
68
+ if (/Could not resolve identifier/.exec(`${e}`) ||
69
+ /track not found/.exec(`${e}`)) {
70
+ return trackId;
71
+ }
72
+ else {
73
+ throw e;
74
+ }
75
+ }
76
+ return undefined;
77
+ }
78
+ function tryTrackSynteny({ model, trackId, level, }) {
79
+ try {
80
+ model.showTrack(trackId, level);
81
+ }
82
+ catch (e) {
83
+ if (/Could not resolve identifier/.exec(`${e}`) ||
84
+ /track not found/.exec(`${e}`)) {
85
+ return trackId;
57
86
  }
58
87
  else {
59
88
  throw e;
60
89
  }
61
90
  }
91
+ return undefined;
62
92
  }