@jbrowse/plugin-linear-genome-view 2.11.1 → 2.11.2

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 (43) hide show
  1. package/dist/BaseLinearDisplay/components/LinearBlocks.js +7 -7
  2. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +17 -1
  3. package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +21 -0
  4. package/dist/BaseLinearDisplay/models/configSchema.d.ts +10 -0
  5. package/dist/BaseLinearDisplay/models/configSchema.js +15 -3
  6. package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -0
  7. package/dist/LinearBareDisplay/configSchema.d.ts +5 -0
  8. package/dist/LinearBareDisplay/model.d.ts +17 -2
  9. package/dist/LinearBasicDisplay/components/AddFiltersDialog.d.ts +10 -0
  10. package/dist/LinearBasicDisplay/components/AddFiltersDialog.js +94 -0
  11. package/dist/LinearBasicDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +7 -7
  12. package/dist/LinearBasicDisplay/configSchema.d.ts +5 -0
  13. package/dist/LinearBasicDisplay/model.d.ts +56 -21
  14. package/dist/LinearBasicDisplay/model.js +36 -5
  15. package/dist/LinearGenomeView/components/Gridlines.js +3 -4
  16. package/dist/LinearGenomeView/components/Highlight.js +20 -21
  17. package/dist/LinearGenomeView/components/OverviewScalebar.js +1 -2
  18. package/dist/LinearGenomeView/components/Scalebar.js +4 -5
  19. package/dist/LinearGenomeView/model.d.ts +1 -0
  20. package/dist/index.d.ts +39 -0
  21. package/esm/BaseLinearDisplay/components/LinearBlocks.js +7 -7
  22. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +17 -1
  23. package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +21 -0
  24. package/esm/BaseLinearDisplay/models/configSchema.d.ts +10 -0
  25. package/esm/BaseLinearDisplay/models/configSchema.js +15 -3
  26. package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +1 -0
  27. package/esm/LinearBareDisplay/configSchema.d.ts +5 -0
  28. package/esm/LinearBareDisplay/model.d.ts +17 -2
  29. package/esm/LinearBasicDisplay/components/AddFiltersDialog.d.ts +10 -0
  30. package/esm/LinearBasicDisplay/components/AddFiltersDialog.js +69 -0
  31. package/esm/LinearBasicDisplay/components/{SetMaxHeight.js → SetMaxHeightDialog.js} +7 -7
  32. package/esm/LinearBasicDisplay/configSchema.d.ts +5 -0
  33. package/esm/LinearBasicDisplay/model.d.ts +56 -21
  34. package/esm/LinearBasicDisplay/model.js +37 -6
  35. package/esm/LinearGenomeView/components/Gridlines.js +3 -4
  36. package/esm/LinearGenomeView/components/Highlight.js +20 -21
  37. package/esm/LinearGenomeView/components/OverviewScalebar.js +1 -2
  38. package/esm/LinearGenomeView/components/Scalebar.js +4 -5
  39. package/esm/LinearGenomeView/model.d.ts +1 -0
  40. package/esm/index.d.ts +39 -0
  41. package/package.json +2 -2
  42. /package/dist/LinearBasicDisplay/components/{SetMaxHeight.d.ts → SetMaxHeightDialog.d.ts} +0 -0
  43. /package/esm/LinearBasicDisplay/components/{SetMaxHeight.d.ts → SetMaxHeightDialog.d.ts} +0 -0
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
- const blockTypes_1 = require("@jbrowse/core/util/blockTypes");
8
7
  const mui_1 = require("tss-react/mui");
9
8
  const mobx_react_1 = require("mobx-react");
10
9
  const Block_1 = require("../../BaseLinearDisplay/components/Block");
@@ -50,13 +49,13 @@ const RenderedVerticalGuides = (0, mobx_react_1.observer)(({ model }) => {
50
49
  const { staticBlocks, bpPerPx } = model;
51
50
  return (react_1.default.createElement(react_1.default.Fragment, null, staticBlocks.map((block, index) => {
52
51
  const k = `${block.key}-${index}`;
53
- if (block instanceof blockTypes_1.ContentBlock) {
52
+ if (block.type === 'ContentBlock') {
54
53
  return react_1.default.createElement(RenderedBlockLines, { key: k, block: block, bpPerPx: bpPerPx });
55
54
  }
56
- else if (block instanceof blockTypes_1.ElidedBlock) {
55
+ else if (block.type === 'ElidedBlock') {
57
56
  return react_1.default.createElement(Block_1.ElidedBlock, { key: k, width: block.widthPx });
58
57
  }
59
- else if (block instanceof blockTypes_1.InterRegionPaddingBlock) {
58
+ else if (block.type === 'InterRegionPaddingBlock') {
60
59
  return (react_1.default.createElement(Block_1.InterRegionPaddingBlock, { key: k, width: block.widthPx, boundary: block.variant === 'boundary' }));
61
60
  }
62
61
  return null;
@@ -61,26 +61,6 @@ const Highlight = (0, mobx_react_1.observer)(function Highlight({ model, highlig
61
61
  const dismissHighlight = () => {
62
62
  model.removeHighlight(highlight);
63
63
  };
64
- const menuItems = [
65
- {
66
- label: 'Dismiss highlight',
67
- icon: Close_1.default,
68
- onClick: () => dismissHighlight(),
69
- },
70
- {
71
- label: 'Bookmark highlighted region',
72
- icon: Bookmark_1.default,
73
- onClick: () => {
74
- let bookmarkWidget = session.widgets.get('GridBookmark');
75
- if (!bookmarkWidget) {
76
- bookmarkWidget = session.addWidget('GridBookmarkWidget', 'GridBookmark');
77
- }
78
- // @ts-ignore
79
- bookmarkWidget.addBookmark(highlight);
80
- dismissHighlight();
81
- },
82
- },
83
- ];
84
64
  function handleClose() {
85
65
  setOpen(false);
86
66
  }
@@ -118,7 +98,26 @@ const Highlight = (0, mobx_react_1.observer)(function Highlight({ model, highlig
118
98
  react_1.default.createElement(ui_1.Menu, { anchorEl: anchorEl.current, onMenuItemClick: (_event, callback) => {
119
99
  callback(session);
120
100
  handleClose();
121
- }, open: open, onClose: handleClose, menuItems: menuItems }))) : null;
101
+ }, open: open, onClose: handleClose, menuItems: [
102
+ {
103
+ label: 'Dismiss highlight',
104
+ icon: Close_1.default,
105
+ onClick: () => dismissHighlight(),
106
+ },
107
+ {
108
+ label: 'Bookmark highlighted region',
109
+ icon: Bookmark_1.default,
110
+ onClick: () => {
111
+ let bookmarkWidget = session.widgets.get('GridBookmark');
112
+ if (!bookmarkWidget) {
113
+ bookmarkWidget = session.addWidget('GridBookmarkWidget', 'GridBookmark');
114
+ }
115
+ // @ts-ignore
116
+ bookmarkWidget.addBookmark(highlight);
117
+ dismissHighlight();
118
+ },
119
+ },
120
+ ] }))) : null;
122
121
  });
123
122
  const HighlightGroup = (0, mobx_react_1.observer)(function HighlightGroup({ model, }) {
124
123
  return model.highlight.map((highlight, idx) => (react_1.default.createElement(Highlight, { key: JSON.stringify(highlight) + '-' + idx, model: model, highlight: highlight })));
@@ -33,7 +33,6 @@ const mobx_react_1 = require("mobx-react");
33
33
  // core
34
34
  const Base1DViewModel_1 = __importDefault(require("@jbrowse/core/util/Base1DViewModel"));
35
35
  const util_1 = require("@jbrowse/core/util");
36
- const blockTypes_1 = require("@jbrowse/core/util/blockTypes");
37
36
  // locals
38
37
  const __1 = require("..");
39
38
  const util_2 = require("../util");
@@ -176,7 +175,7 @@ const Scalebar = (0, mobx_react_1.observer)(function ({ model, scale, overview,
176
175
  borderColor: color,
177
176
  } }),
178
177
  overviewVisibleRegions.map((block, idx) => {
179
- return !(block instanceof blockTypes_1.ContentBlock) ? (react_1.default.createElement("div", { key: `${JSON.stringify(block)}-${idx}`, className: classes.scalebarContig, style: {
178
+ return !(block.type === 'ContentBlock') ? (react_1.default.createElement("div", { key: `${JSON.stringify(block)}-${idx}`, className: classes.scalebarContig, style: {
180
179
  width: block.widthPx,
181
180
  left: block.offsetPx,
182
181
  backgroundColor: '#999',
@@ -5,7 +5,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const material_1 = require("@mui/material");
7
7
  const mui_1 = require("tss-react/mui");
8
- const blockTypes_1 = require("@jbrowse/core/util/blockTypes");
9
8
  const mobx_react_1 = require("mobx-react");
10
9
  const react_1 = __importDefault(require("react"));
11
10
  const Block_1 = require("../../BaseLinearDisplay/components/Block");
@@ -61,7 +60,7 @@ const RenderedRefNameLabels = (0, mobx_react_1.observer)(({ model }) => {
61
60
  }
62
61
  });
63
62
  return (react_1.default.createElement(react_1.default.Fragment, null, model.staticBlocks.map((block, index) => {
64
- return block instanceof blockTypes_1.ContentBlock &&
63
+ return block.type === 'ContentBlock' &&
65
64
  (block.isLeftEndOfDisplayedRegion || index === lastLeftBlock) ? (react_1.default.createElement(material_1.Typography, { key: `refLabel-${block.key}-${index}`, style: {
66
65
  left: index === lastLeftBlock
67
66
  ? Math.max(0, -model.offsetPx)
@@ -88,13 +87,13 @@ const RenderedScalebarLabels = (0, mobx_react_1.observer)(({ model }) => {
88
87
  return (react_1.default.createElement(react_1.default.Fragment, null, staticBlocks.map((block, idx) => {
89
88
  const { key, widthPx } = block;
90
89
  const k = `${key}-${idx}`;
91
- if (block instanceof blockTypes_1.ContentBlock) {
90
+ if (block.type === 'ContentBlock') {
92
91
  return react_1.default.createElement(RenderedBlockTicks, { key: k, block: block, bpPerPx: bpPerPx });
93
92
  }
94
- else if (block instanceof blockTypes_1.ElidedBlock) {
93
+ else if (block.type === 'ElidedBlock') {
95
94
  return react_1.default.createElement(Block_1.ElidedBlock, { key: k, width: widthPx });
96
95
  }
97
- else if (block instanceof blockTypes_1.InterRegionPaddingBlock) {
96
+ else if (block.type === 'InterRegionPaddingBlock') {
98
97
  return (react_1.default.createElement(Block_1.InterRegionPaddingBlock, { key: k, width: widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }));
99
98
  }
100
99
  return null;
@@ -364,6 +364,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
364
364
  getSelectedRegions(leftOffset?: BpOffset, rightOffset?: BpOffset): {
365
365
  start: number;
366
366
  end: number;
367
+ type: string;
367
368
  regionNumber?: number | undefined;
368
369
  reversed?: boolean | undefined;
369
370
  refName: string;
package/dist/index.d.ts CHANGED
@@ -143,6 +143,11 @@ export default class LinearGenomeViewPlugin extends Plugin {
143
143
  defaultValue: string;
144
144
  contextVariable: string[];
145
145
  };
146
+ jexlFilters: {
147
+ type: string;
148
+ description: string;
149
+ defaultValue: never[];
150
+ };
146
151
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>>;
147
152
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
148
153
  rendererTypeName: string;
@@ -258,6 +263,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
258
263
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
259
264
  deleteBlock(key: string): void;
260
265
  selectFeature(feature: import("@jbrowse/core/util").Feature): void;
266
+ navToFeature(feature: import("@jbrowse/core/util").Feature): void;
261
267
  clearFeatureSelection(): void;
262
268
  setFeatureIdUnderMouse(feature?: string | undefined): void;
263
269
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
@@ -355,6 +361,11 @@ export default class LinearGenomeViewPlugin extends Plugin {
355
361
  defaultValue: string;
356
362
  contextVariable: string[];
357
363
  };
364
+ jexlFilters: {
365
+ type: string;
366
+ description: string;
367
+ defaultValue: never[];
368
+ };
358
369
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
359
370
  }, {
360
371
  rendererTypeName: string;
@@ -470,6 +481,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
470
481
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
471
482
  deleteBlock(key: string): void;
472
483
  selectFeature(feature: import("@jbrowse/core/util").Feature): void;
484
+ navToFeature(feature: import("@jbrowse/core/util").Feature): void;
473
485
  clearFeatureSelection(): void;
474
486
  setFeatureIdUnderMouse(feature?: string | undefined): void;
475
487
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
@@ -567,6 +579,11 @@ export default class LinearGenomeViewPlugin extends Plugin {
567
579
  defaultValue: string;
568
580
  contextVariable: string[];
569
581
  };
582
+ jexlFilters: {
583
+ type: string;
584
+ description: string;
585
+ defaultValue: never[];
586
+ };
570
587
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
571
588
  }>>, {
572
589
  type: string;
@@ -664,6 +681,11 @@ export default class LinearGenomeViewPlugin extends Plugin {
664
681
  defaultValue: string;
665
682
  contextVariable: string[];
666
683
  };
684
+ jexlFilters: {
685
+ type: string;
686
+ description: string;
687
+ defaultValue: never[];
688
+ };
667
689
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
668
690
  }, {
669
691
  rendererTypeName: string;
@@ -779,6 +801,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
779
801
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
780
802
  deleteBlock(key: string): void;
781
803
  selectFeature(feature: import("@jbrowse/core/util").Feature): void;
804
+ navToFeature(feature: import("@jbrowse/core/util").Feature): void;
782
805
  clearFeatureSelection(): void;
783
806
  setFeatureIdUnderMouse(feature?: string | undefined): void;
784
807
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
@@ -876,6 +899,11 @@ export default class LinearGenomeViewPlugin extends Plugin {
876
899
  defaultValue: string;
877
900
  contextVariable: string[];
878
901
  };
902
+ jexlFilters: {
903
+ type: string;
904
+ description: string;
905
+ defaultValue: never[];
906
+ };
879
907
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
880
908
  }>>, {
881
909
  type: string;
@@ -908,6 +936,11 @@ export default class LinearGenomeViewPlugin extends Plugin {
908
936
  defaultValue: string;
909
937
  contextVariable: string[];
910
938
  };
939
+ jexlFilters: {
940
+ type: string;
941
+ description: string;
942
+ defaultValue: never[];
943
+ };
911
944
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
912
945
  SearchBox: ({ model, showHelp, }: {
913
946
  showHelp?: boolean | undefined;
@@ -1039,6 +1072,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
1039
1072
  getSelectedRegions(leftOffset?: import("./LinearGenomeView").BpOffset | undefined, rightOffset?: import("./LinearGenomeView").BpOffset | undefined): {
1040
1073
  start: number;
1041
1074
  end: number;
1075
+ type: string;
1042
1076
  regionNumber?: number | undefined;
1043
1077
  reversed?: boolean | undefined;
1044
1078
  refName: string;
@@ -1368,6 +1402,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
1368
1402
  getSelectedRegions(leftOffset?: import("./LinearGenomeView").BpOffset | undefined, rightOffset?: import("./LinearGenomeView").BpOffset | undefined): {
1369
1403
  start: number;
1370
1404
  end: number;
1405
+ type: string;
1371
1406
  regionNumber?: number | undefined;
1372
1407
  reversed?: boolean | undefined;
1373
1408
  refName: string;
@@ -1737,6 +1772,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
1737
1772
  getSelectedRegions(leftOffset?: import("./LinearGenomeView").BpOffset | undefined, rightOffset?: import("./LinearGenomeView").BpOffset | undefined): {
1738
1773
  start: number;
1739
1774
  end: number;
1775
+ type: string;
1740
1776
  regionNumber?: number | undefined;
1741
1777
  reversed?: boolean | undefined;
1742
1778
  refName: string;
@@ -2066,6 +2102,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
2066
2102
  getSelectedRegions(leftOffset?: import("./LinearGenomeView").BpOffset | undefined, rightOffset?: import("./LinearGenomeView").BpOffset | undefined): {
2067
2103
  start: number;
2068
2104
  end: number;
2105
+ type: string;
2069
2106
  regionNumber?: number | undefined;
2070
2107
  reversed?: boolean | undefined;
2071
2108
  refName: string;
@@ -2435,6 +2472,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
2435
2472
  getSelectedRegions(leftOffset?: import("./LinearGenomeView").BpOffset | undefined, rightOffset?: import("./LinearGenomeView").BpOffset | undefined): {
2436
2473
  start: number;
2437
2474
  end: number;
2475
+ type: string;
2438
2476
  regionNumber?: number | undefined;
2439
2477
  reversed?: boolean | undefined;
2440
2478
  refName: string;
@@ -2764,6 +2802,7 @@ export default class LinearGenomeViewPlugin extends Plugin {
2764
2802
  getSelectedRegions(leftOffset?: import("./LinearGenomeView").BpOffset | undefined, rightOffset?: import("./LinearGenomeView").BpOffset | undefined): {
2765
2803
  start: number;
2766
2804
  end: number;
2805
+ type: string;
2767
2806
  regionNumber?: number | undefined;
2768
2807
  reversed?: boolean | undefined;
2769
2808
  refName: string;
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  import { makeStyles } from 'tss-react/mui';
3
3
  import { getContainingView } from '@jbrowse/core/util';
4
4
  import { observer } from 'mobx-react';
5
- import { ContentBlock, ElidedBlock, InterRegionPaddingBlock, } from '@jbrowse/core/util/blockTypes';
6
5
  import { ContentBlock as ContentBlockComponent, ElidedBlock as ElidedBlockComponent, InterRegionPaddingBlock as InterRegionPaddingBlockComponent, } from './Block';
7
6
  const useStyles = makeStyles()({
8
7
  linearBlocks: {
@@ -29,9 +28,10 @@ const RenderedBlocks = observer(function ({ model, }) {
29
28
  const { classes } = useStyles();
30
29
  const { blockDefinitions, blockState } = model;
31
30
  return (React.createElement(React.Fragment, null, blockDefinitions.map(block => {
32
- if (block instanceof ContentBlock) {
31
+ const key = `${model.id}-${block.key}`;
32
+ if (block.type === 'ContentBlock') {
33
33
  const state = blockState.get(block.key);
34
- return (React.createElement(ContentBlockComponent, { block: block, key: `${model.id}-${block.key}` },
34
+ return (React.createElement(ContentBlockComponent, { block: block, key: key },
35
35
  (state === null || state === void 0 ? void 0 : state.ReactComponent) ? (React.createElement(state.ReactComponent, { model: state })) : null,
36
36
  (state === null || state === void 0 ? void 0 : state.maxHeightReached) ? (React.createElement("div", { className: classes.heightOverflowed, style: {
37
37
  top: state.layout.getTotalHeight() - 16,
@@ -39,11 +39,11 @@ const RenderedBlocks = observer(function ({ model, }) {
39
39
  height: 16,
40
40
  } }, "Max height reached")) : null));
41
41
  }
42
- if (block instanceof ElidedBlock) {
43
- return (React.createElement(ElidedBlockComponent, { key: `${model.id}-${block.key}`, width: block.widthPx }));
42
+ else if (block.type === 'ElidedBlock') {
43
+ return React.createElement(ElidedBlockComponent, { key: key, width: block.widthPx });
44
44
  }
45
- if (block instanceof InterRegionPaddingBlock) {
46
- return (React.createElement(InterRegionPaddingBlockComponent, { key: block.key, width: block.widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }));
45
+ else if (block.type === 'InterRegionPaddingBlock') {
46
+ return (React.createElement(InterRegionPaddingBlockComponent, { key: key, width: block.widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }));
47
47
  }
48
48
  throw new Error(`invalid block type ${JSON.stringify(block)}`);
49
49
  })));
@@ -110,6 +110,11 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
110
110
  defaultValue: string;
111
111
  contextVariable: string[];
112
112
  };
113
+ jexlFilters: {
114
+ type: string;
115
+ description: string;
116
+ defaultValue: never[];
117
+ };
113
118
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
114
119
  }, {
115
120
  rendererTypeName: string;
@@ -200,7 +205,9 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
200
205
  readonly regionTooLarge: boolean;
201
206
  readonly regionTooLargeReason: string;
202
207
  } & {
203
- regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
208
+ regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features"; /**
209
+ * #action
210
+ */
204
211
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): React.JSX.Element | null;
205
212
  } & {
206
213
  featureIdUnderMouse: string | undefined;
@@ -273,6 +280,10 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
273
280
  * #action
274
281
  */
275
282
  selectFeature(feature: Feature): void;
283
+ /**
284
+ * #action
285
+ */
286
+ navToFeature(feature: Feature): void;
276
287
  /**
277
288
  * #action
278
289
  */
@@ -401,6 +412,11 @@ export declare const BaseLinearDisplay: import("mobx-state-tree").IModelType<{
401
412
  defaultValue: string;
402
413
  contextVariable: string[];
403
414
  };
415
+ jexlFilters: {
416
+ type: string;
417
+ description: string;
418
+ defaultValue: never[];
419
+ };
404
420
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
405
421
  }>>, {
406
422
  type: string;
@@ -7,6 +7,7 @@ import { autorun } from 'mobx';
7
7
  import { addDisposer, isAlive, types } from 'mobx-state-tree';
8
8
  // icons
9
9
  import MenuOpenIcon from '@mui/icons-material/MenuOpen';
10
+ import CenterFocusStrongIcon from '@mui/icons-material/CenterFocusStrong';
10
11
  import { Tooltip } from '../components/BaseLinearDisplay';
11
12
  import BlockState from './serverSideRenderedBlock';
12
13
  import configSchema from './configSchema';
@@ -182,6 +183,17 @@ function stateModelFactory() {
182
183
  session.setSelection(feature);
183
184
  }
184
185
  },
186
+ /**
187
+ * #action
188
+ */
189
+ navToFeature(feature) {
190
+ const view = getContainingView(self);
191
+ view.navTo({
192
+ refName: feature.get('refName'),
193
+ start: feature.get('start'),
194
+ end: feature.get('end'),
195
+ });
196
+ },
185
197
  /**
186
198
  * #action
187
199
  */
@@ -239,6 +251,15 @@ function stateModelFactory() {
239
251
  }
240
252
  },
241
253
  },
254
+ {
255
+ label: 'Zoom to feature',
256
+ icon: CenterFocusStrongIcon,
257
+ onClick: () => {
258
+ if (self.contextMenuFeature) {
259
+ self.navToFeature(self.contextMenuFeature);
260
+ }
261
+ },
262
+ },
242
263
  ]
243
264
  : []),
244
265
  ];
@@ -32,5 +32,15 @@ declare const baseLinearDisplayConfigSchema: import("@jbrowse/core/configuration
32
32
  defaultValue: string;
33
33
  contextVariable: string[];
34
34
  };
35
+ /**
36
+ * #slot
37
+ * config jexlFilters are deferred evaluated so they are prepended with
38
+ * jexl at runtime rather than being stored with jexl in the config
39
+ */
40
+ jexlFilters: {
41
+ type: string;
42
+ description: string;
43
+ defaultValue: never[];
44
+ };
35
45
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
36
46
  export default baseLinearDisplayConfigSchema;
@@ -2,9 +2,11 @@ import { ConfigurationSchema } from '@jbrowse/core/configuration';
2
2
  /**
3
3
  * #config BaseLinearDisplay
4
4
  * #category display
5
- * `BaseLinearDisplay` is a "base" config that is extended by classes like
6
- * `LinearBasicDisplay` (used for feature tracks, etc) and `LinearBareDisplay`
7
- * (more stripped down than even the basic display, not commonly used)
5
+ *
6
+ * `BaseLinearDisplay` is a "base" config that is extended by other configs including
7
+ * - `LinearBasicDisplay` (used for feature tracks, etc)
8
+ * - `LinearBareDisplay` (more stripped down than even the basic display, not
9
+ * commonly used)
8
10
  */
9
11
  function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
10
12
  const baseLinearDisplayConfigSchema = ConfigurationSchema('BaseLinearDisplay', {
@@ -41,6 +43,16 @@ const baseLinearDisplayConfigSchema = ConfigurationSchema('BaseLinearDisplay', {
41
43
  defaultValue: `jexl:get(feature,'name')`,
42
44
  contextVariable: ['feature'],
43
45
  },
46
+ /**
47
+ * #slot
48
+ * config jexlFilters are deferred evaluated so they are prepended with
49
+ * jexl at runtime rather than being stored with jexl in the config
50
+ */
51
+ jexlFilters: {
52
+ type: 'stringArray',
53
+ description: 'default set of jexl filters to apply to a track. note: these do not use the jexl prefix because they have a deferred evaluation system',
54
+ defaultValue: [],
55
+ },
44
56
  }, {
45
57
  /**
46
58
  * #identifier
@@ -96,6 +96,7 @@ const blockState = types
96
96
  renderInProgress = undefined;
97
97
  },
98
98
  setError(error) {
99
+ console.error(error);
99
100
  if (renderInProgress && !renderInProgress.signal.aborted) {
100
101
  renderInProgress.abort();
101
102
  }
@@ -30,5 +30,10 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("@jbr
30
30
  defaultValue: string;
31
31
  contextVariable: string[];
32
32
  };
33
+ jexlFilters: {
34
+ type: string;
35
+ description: string;
36
+ defaultValue: never[];
37
+ };
33
38
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>, undefined>>;
34
39
  export { configSchemaFactory };
@@ -77,7 +77,9 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
77
77
  };
78
78
  fetchSizeLimit: {
79
79
  type: string;
80
- defaultValue: number;
80
+ defaultValue: number; /**
81
+ * #method
82
+ */
81
83
  description: string;
82
84
  };
83
85
  height: {
@@ -91,6 +93,11 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
91
93
  defaultValue: string;
92
94
  contextVariable: string[];
93
95
  };
96
+ jexlFilters: {
97
+ type: string;
98
+ description: string;
99
+ defaultValue: never[];
100
+ };
94
101
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
95
102
  } & {
96
103
  /**
@@ -215,6 +222,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
215
222
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
216
223
  deleteBlock(key: string): void;
217
224
  selectFeature(feature: import("@jbrowse/core/util").Feature): void;
225
+ navToFeature(feature: import("@jbrowse/core/util").Feature): void;
218
226
  clearFeatureSelection(): void;
219
227
  setFeatureIdUnderMouse(feature?: string | undefined): void;
220
228
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature | undefined): void;
@@ -309,7 +317,9 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
309
317
  };
310
318
  fetchSizeLimit: {
311
319
  type: string;
312
- defaultValue: number;
320
+ defaultValue: number; /**
321
+ * #method
322
+ */
313
323
  description: string;
314
324
  };
315
325
  height: {
@@ -323,6 +333,11 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
323
333
  defaultValue: string;
324
334
  contextVariable: string[];
325
335
  };
336
+ jexlFilters: {
337
+ type: string;
338
+ description: string;
339
+ defaultValue: never[];
340
+ };
326
341
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>;
327
342
  }>> & import("mobx-state-tree/dist/internal").NonEmptyObject & import("mobx-state-tree")._NotCustomized, {
328
343
  type: string;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ declare const AddFiltersDialog: ({ model, handleClose, }: {
3
+ model: {
4
+ jexlFilters?: string[];
5
+ activeFilters: string[];
6
+ setJexlFilters: (arg?: string[]) => void;
7
+ };
8
+ handleClose: () => void;
9
+ }) => React.JSX.Element;
10
+ export default AddFiltersDialog;
@@ -0,0 +1,69 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import { Dialog } from '@jbrowse/core/ui';
4
+ import { Button, DialogActions, DialogContent, TextField } from '@mui/material';
5
+ import { makeStyles } from 'tss-react/mui';
6
+ import { stringToJexlExpression } from '@jbrowse/core/util/jexlStrings';
7
+ const useStyles = makeStyles()({
8
+ dialogContent: {
9
+ width: '80em',
10
+ },
11
+ textAreaFont: {
12
+ fontFamily: 'Courier New',
13
+ },
14
+ error: {
15
+ color: 'red',
16
+ fontSize: '0.8em',
17
+ },
18
+ });
19
+ function checkJexl(code) {
20
+ stringToJexlExpression(code);
21
+ }
22
+ const AddFiltersDialog = observer(function ({ model, handleClose, }) {
23
+ const { classes } = useStyles();
24
+ const { activeFilters } = model;
25
+ const [data, setData] = useState(activeFilters.join('\n'));
26
+ const [error, setError] = useState();
27
+ useEffect(() => {
28
+ try {
29
+ data
30
+ .split('\n')
31
+ .map(line => line.trim())
32
+ .filter(line => !!line)
33
+ .map(line => checkJexl(line.trim()));
34
+ setError(undefined);
35
+ }
36
+ catch (e) {
37
+ console.error(e);
38
+ setError(e);
39
+ }
40
+ }, [data]);
41
+ return (React.createElement(Dialog, { maxWidth: "xl", open: true, onClose: handleClose, title: "Add track filters" },
42
+ React.createElement(DialogContent, null,
43
+ React.createElement("div", null,
44
+ "Add filters, in jexl format, one per line, starting with the string jexl:. Examples:",
45
+ ' ',
46
+ React.createElement("ul", null,
47
+ React.createElement("li", null,
48
+ React.createElement("code", null, "jexl:get(feature,'name')=='BRCA1'"),
49
+ " - show only feature where the name attribute is BRCA1"),
50
+ React.createElement("li", null,
51
+ React.createElement("code", null, "jexl:get(feature,'type')=='gene'"),
52
+ " - show only gene type features in a GFF that has many other feature types"),
53
+ React.createElement("li", null,
54
+ React.createElement("code", null, "jexl:get(feature,'score') > 400"),
55
+ " - show only features that have a score greater than 400"))),
56
+ error ? React.createElement("p", { className: classes.error }, `${error}`) : null,
57
+ React.createElement(TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, className: classes.dialogContent, fullWidth: true, value: data, onChange: event => setData(event.target.value), InputProps: {
58
+ classes: {
59
+ input: classes.textAreaFont,
60
+ },
61
+ } })),
62
+ React.createElement(DialogActions, null,
63
+ React.createElement(Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, disabled: !!error, onClick: () => {
64
+ model.setJexlFilters(data.split('\n'));
65
+ handleClose();
66
+ } }, "Submit"),
67
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"))));
68
+ });
69
+ export default AddFiltersDialog;
@@ -15,12 +15,12 @@ const SetMaxHeightDialog = observer(function ({ model, handleClose, }) {
15
15
  return (React.createElement(Dialog, { open: true, onClose: handleClose, title: "Set max height" },
16
16
  React.createElement(DialogContent, { className: classes.root },
17
17
  React.createElement(Typography, null, "Set max height for the track. For example, you can increase this if the layout says \"Max height reached\""),
18
- React.createElement(TextField, { value: max, onChange: event => setMax(event.target.value), placeholder: "Enter max score" }),
19
- React.createElement(DialogActions, null,
20
- React.createElement(Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, onClick: () => {
21
- model.setMaxHeight(max !== '' && !Number.isNaN(+max) ? +max : undefined);
22
- handleClose();
23
- } }, "Submit"),
24
- React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel")))));
18
+ React.createElement(TextField, { value: max, onChange: event => setMax(event.target.value), placeholder: "Enter max score" })),
19
+ React.createElement(DialogActions, null,
20
+ React.createElement(Button, { variant: "contained", color: "primary", type: "submit", autoFocus: true, onClick: () => {
21
+ model.setMaxHeight(max !== '' && !Number.isNaN(+max) ? +max : undefined);
22
+ handleClose();
23
+ } }, "Submit"),
24
+ React.createElement(Button, { variant: "contained", color: "secondary", onClick: () => handleClose() }, "Cancel"))));
25
25
  });
26
26
  export default SetMaxHeightDialog;
@@ -30,5 +30,10 @@ declare function configSchemaFactory(pluginManager: PluginManager): import("@jbr
30
30
  defaultValue: string;
31
31
  contextVariable: string[];
32
32
  };
33
+ jexlFilters: {
34
+ type: string;
35
+ description: string;
36
+ defaultValue: never[];
37
+ };
33
38
  }, import("@jbrowse/core/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>, undefined>>;
34
39
  export default configSchemaFactory;