@jbrowse/plugin-variants 3.6.4 → 3.7.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 (83) hide show
  1. package/dist/LinearVariantDisplay/model.d.ts +17 -2
  2. package/dist/MultiLinearVariantDisplay/model.d.ts +17 -2
  3. package/dist/MultiLinearVariantMatrixDisplay/model.d.ts +17 -2
  4. package/dist/MultiLinearVariantMatrixRenderer/makeImageData.js +6 -4
  5. package/dist/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +6 -3
  6. package/dist/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.d.ts +7 -2
  7. package/dist/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.js +14 -17
  8. package/dist/MultiLinearVariantRenderer/makeImageData.d.ts +2 -1
  9. package/dist/MultiLinearVariantRenderer/makeImageData.js +32 -22
  10. package/dist/StructuralVariantChordRenderer/ReactComponent.js +1 -1
  11. package/dist/VariantFeatureWidget/AltFormatter.d.ts +2 -2
  12. package/dist/VariantFeatureWidget/AltFormatter.js +3 -3
  13. package/dist/VariantFeatureWidget/VariantFeatureWidget.js +1 -1
  14. package/dist/VariantFeatureWidget/stateModelFactory.d.ts +4 -4
  15. package/dist/VcfAdapter/VcfAdapter.d.ts +5 -5
  16. package/dist/VcfAdapter/VcfAdapter.js +2 -2
  17. package/dist/VcfFeature/index.d.ts +1 -1
  18. package/dist/VcfFeature/index.js +21 -5
  19. package/dist/shared/MultiVariantBaseModel.d.ts +17 -2
  20. package/dist/shared/SharedVariantMixin.d.ts +17 -2
  21. package/dist/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +3 -3
  22. package/dist/shared/components/SetColorDialog.js +2 -45
  23. package/dist/shared/components/SetColorDialogBulkEditPanel.d.ts +10 -0
  24. package/dist/shared/components/{BulkEditPanel.js → SetColorDialogBulkEditPanel.js} +2 -2
  25. package/dist/shared/components/SetColorDialogHelpfulTips.d.ts +1 -0
  26. package/dist/shared/components/{HelpfulTips.js → SetColorDialogHelpfulTips.js} +2 -2
  27. package/dist/shared/components/SetColorDialogRowPalettizer.d.ts +10 -0
  28. package/dist/shared/components/{RowPalettizer.js → SetColorDialogRowPalettizer.js} +13 -12
  29. package/dist/shared/components/ui/SetColorDialog.d.ts +31 -0
  30. package/dist/shared/components/ui/SetColorDialog.js +51 -0
  31. package/dist/shared/components/ui/SetColorDialogBulkEditPanel.d.ts +10 -0
  32. package/dist/shared/components/ui/SetColorDialogBulkEditPanel.js +84 -0
  33. package/dist/shared/components/ui/SetColorDialogHelpfulTips.d.ts +1 -0
  34. package/dist/shared/components/ui/SetColorDialogHelpfulTips.js +7 -0
  35. package/dist/shared/components/ui/SetColorDialogRowPalettizer.d.ts +10 -0
  36. package/dist/shared/components/ui/SetColorDialogRowPalettizer.js +41 -0
  37. package/dist/shared/util.d.ts +0 -1
  38. package/dist/shared/util.js +0 -8
  39. package/esm/LinearVariantDisplay/model.d.ts +17 -2
  40. package/esm/MultiLinearVariantDisplay/model.d.ts +17 -2
  41. package/esm/MultiLinearVariantMatrixDisplay/model.d.ts +17 -2
  42. package/esm/MultiLinearVariantMatrixRenderer/makeImageData.js +6 -4
  43. package/esm/MultiLinearVariantRenderer/MultiVariantRenderer.d.ts +6 -3
  44. package/esm/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.d.ts +7 -2
  45. package/esm/MultiLinearVariantRenderer/components/MultiLinearVariantRendering.js +14 -17
  46. package/esm/MultiLinearVariantRenderer/makeImageData.d.ts +2 -1
  47. package/esm/MultiLinearVariantRenderer/makeImageData.js +32 -22
  48. package/esm/StructuralVariantChordRenderer/ReactComponent.js +1 -1
  49. package/esm/VariantFeatureWidget/AltFormatter.d.ts +2 -2
  50. package/esm/VariantFeatureWidget/AltFormatter.js +4 -4
  51. package/esm/VariantFeatureWidget/VariantFeatureWidget.js +1 -1
  52. package/esm/VariantFeatureWidget/stateModelFactory.d.ts +4 -4
  53. package/esm/VcfAdapter/VcfAdapter.d.ts +5 -5
  54. package/esm/VcfAdapter/VcfAdapter.js +1 -1
  55. package/esm/VcfFeature/index.d.ts +1 -1
  56. package/esm/VcfFeature/index.js +19 -3
  57. package/esm/shared/MultiVariantBaseModel.d.ts +17 -2
  58. package/esm/shared/SharedVariantMixin.d.ts +17 -2
  59. package/esm/shared/components/MultiVariantClusterDialog/ClusterDialogManual.js +3 -3
  60. package/esm/shared/components/SetColorDialog.js +3 -46
  61. package/esm/shared/components/SetColorDialogBulkEditPanel.d.ts +10 -0
  62. package/esm/shared/components/{BulkEditPanel.js → SetColorDialogBulkEditPanel.js} +1 -1
  63. package/esm/shared/components/SetColorDialogHelpfulTips.d.ts +1 -0
  64. package/esm/shared/components/{HelpfulTips.js → SetColorDialogHelpfulTips.js} +1 -1
  65. package/esm/shared/components/SetColorDialogRowPalettizer.d.ts +10 -0
  66. package/esm/shared/components/{RowPalettizer.js → SetColorDialogRowPalettizer.js} +11 -10
  67. package/esm/shared/components/ui/SetColorDialog.d.ts +31 -0
  68. package/esm/shared/components/ui/SetColorDialog.js +45 -0
  69. package/esm/shared/components/ui/SetColorDialogBulkEditPanel.d.ts +10 -0
  70. package/esm/shared/components/ui/SetColorDialogBulkEditPanel.js +81 -0
  71. package/esm/shared/components/ui/SetColorDialogHelpfulTips.d.ts +1 -0
  72. package/esm/shared/components/ui/SetColorDialogHelpfulTips.js +4 -0
  73. package/esm/shared/components/ui/SetColorDialogRowPalettizer.d.ts +10 -0
  74. package/esm/shared/components/ui/SetColorDialogRowPalettizer.js +38 -0
  75. package/esm/shared/util.d.ts +0 -1
  76. package/esm/shared/util.js +0 -7
  77. package/package.json +7 -7
  78. package/dist/shared/components/BulkEditPanel.d.ts +0 -5
  79. package/dist/shared/components/HelpfulTips.d.ts +0 -1
  80. package/dist/shared/components/RowPalettizer.d.ts +0 -5
  81. package/esm/shared/components/BulkEditPanel.d.ts +0 -5
  82. package/esm/shared/components/HelpfulTips.d.ts +0 -1
  83. package/esm/shared/components/RowPalettizer.d.ts +0 -5
@@ -174,6 +174,7 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
174
174
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
175
175
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
176
176
  } & {
177
+ mouseoverExtraInformation: string | undefined;
177
178
  featureIdUnderMouse: undefined | string;
178
179
  contextMenuFeature: undefined | Feature;
179
180
  } & {
@@ -188,9 +189,22 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
188
189
  } & {
189
190
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
190
191
  readonly featureUnderMouse: Feature | undefined;
192
+ readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
193
+ label?: string;
194
+ description?: string;
195
+ refName: string;
196
+ }]>;
191
197
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
192
- getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
193
- searchFeatureByID(id: string): [number, number, number, number] | undefined;
198
+ getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
199
+ label?: string;
200
+ description?: string;
201
+ refName: string;
202
+ }]) | undefined;
203
+ searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
204
+ label?: string;
205
+ description?: string;
206
+ refName: string;
207
+ }]) | undefined;
194
208
  } & {
195
209
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
196
210
  deleteBlock(key: string): void;
@@ -199,6 +213,7 @@ export default function SharedVariantMixin(configSchema: AnyConfigurationSchemaT
199
213
  clearFeatureSelection(): void;
200
214
  setFeatureIdUnderMouse(feature?: string): void;
201
215
  setContextMenuFeature(feature?: Feature): void;
216
+ setMouseoverExtraInformation(extra?: string): void;
202
217
  } & {
203
218
  reload(): Promise<void>;
204
219
  } & {
@@ -68,7 +68,7 @@ const ClusterDialogManuals = (0, mobx_react_1.observer)(function ({ model, handl
68
68
  })();
69
69
  }, [model]);
70
70
  const results = ret
71
- ? `inputMatrix<-matrix(c(${Object.values(ret)
71
+ ? String.raw `inputMatrix<-matrix(c(${Object.values(ret)
72
72
  .map(val => val.join(','))
73
73
  .join(',\n')}
74
74
  ),nrow=${Object.values(ret).length},byrow=TRUE)
@@ -76,7 +76,7 @@ rownames(inputMatrix)<-c(${Object.keys(ret)
76
76
  .map(key => `'${key}'`)
77
77
  .join(',')})
78
78
  resultClusters<-hclust(dist(inputMatrix), method='${clusterMethod}')
79
- cat(resultClusters$order,sep='\\n')`
79
+ cat(resultClusters$order,sep='\n')`
80
80
  : undefined;
81
81
  const resultsTsv = ret
82
82
  ? Object.entries(ret)
@@ -107,7 +107,7 @@ cat(resultClusters$order,sep='\\n')`
107
107
  complete: 'Complete',
108
108
  }).map(([key, val]) => ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Radio, { checked: clusterMethod === key, onChange: () => {
109
109
  setClusterMethod(key);
110
- } }), label: val }, key))) })] })) : null, results ? ((0, jsx_runtime_1.jsx)("div", {})) : loading ? ((0, jsx_runtime_1.jsx)(ui_1.LoadingEllipses, { variant: "h6", title: "Generating genotype matrix" })) : error ? ((0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error })) : null] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle2", gutterBottom: true, style: { marginTop: '16px' }, children: "Clustering Results:" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true, variant: "outlined", placeholder: "Paste results from Rscript here (sequence of numbers, one per line, specifying the new ordering)", rows: 10, value: paste, onChange: event => {
110
+ } }), label: val }, key))) })] })) : null, results ? ((0, jsx_runtime_1.jsx)("div", {})) : loading ? ((0, jsx_runtime_1.jsx)(ui_1.LoadingEllipses, { variant: "h6", message: "Generating genotype matrix" })) : error ? ((0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error })) : null] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "subtitle2", gutterBottom: true, style: { marginTop: '16px' }, children: "Clustering Results:" }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true, variant: "outlined", placeholder: "Paste results from Rscript here (sequence of numbers, one per line, specifying the new ordering)", rows: 10, value: paste, onChange: event => {
111
111
  setPaste(event.target.value);
112
112
  }, slotProps: {
113
113
  input: {
@@ -5,51 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = SetColorDialog;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const DraggableDialog_1 = __importDefault(require("@jbrowse/core/ui/DraggableDialog"));
10
- const util_1 = require("@jbrowse/core/util");
11
- const material_1 = require("@mui/material");
12
- const mui_1 = require("tss-react/mui");
13
- const BulkEditPanel_1 = __importDefault(require("./BulkEditPanel"));
14
- const HelpfulTips_1 = __importDefault(require("./HelpfulTips"));
15
- const RowPalettizer_1 = __importDefault(require("./RowPalettizer"));
16
8
  const SourcesGrid_1 = __importDefault(require("./SourcesGrid"));
17
- const useStyles = (0, mui_1.makeStyles)()({
18
- content: {
19
- minWidth: 800,
20
- },
21
- fr: {
22
- float: 'right',
23
- display: 'flex',
24
- gap: 8,
25
- },
26
- textAreaFont: {
27
- fontFamily: 'Courier New',
28
- },
29
- });
9
+ const SetColorDialog_1 = __importDefault(require("./ui/SetColorDialog"));
30
10
  function SetColorDialog({ model, handleClose, }) {
31
- const { classes } = useStyles();
32
- const { sources } = model;
33
- const [showBulkEditor, setShowBulkEditor] = (0, react_1.useState)(false);
34
- const [currLayout, setCurrLayout] = (0, react_1.useState)(sources || []);
35
- const [showTips, setShowTips] = (0, util_1.useLocalStorage)('multivariant-showTips', false);
36
- return ((0, jsx_runtime_1.jsx)(DraggableDialog_1.default, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-sample variant display - Color/arrangement editor", children: showBulkEditor ? ((0, jsx_runtime_1.jsx)(BulkEditPanel_1.default, { currLayout: currLayout, onClose: arg => {
37
- if (arg) {
38
- setCurrLayout(arg);
39
- }
40
- setShowBulkEditor(false);
41
- } })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { className: classes.content, children: [(0, jsx_runtime_1.jsxs)("div", { className: classes.fr, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
42
- setShowTips(!showTips);
43
- }, children: showTips ? 'Hide tips' : 'Show tips' }), (0, jsx_runtime_1.jsx)(material_1.Button, { color: "secondary", variant: "contained", onClick: () => {
44
- setShowBulkEditor(!showBulkEditor);
45
- }, children: "Show Bulk row editor" })] }), showTips ? (0, jsx_runtime_1.jsx)(HelpfulTips_1.default, {}) : null, (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(RowPalettizer_1.default, { currLayout: currLayout, setCurrLayout: setCurrLayout }), (0, jsx_runtime_1.jsx)(SourcesGrid_1.default, { rows: currLayout, onChange: setCurrLayout, showTips: showTips })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", type: "submit", color: "inherit", onClick: () => {
46
- model.clearLayout();
47
- setCurrLayout(model.sources || []);
48
- }, children: "Clear custom settings" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
49
- handleClose();
50
- setCurrLayout([...(model.sources || [])]);
51
- }, children: "Cancel" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", type: "submit", onClick: () => {
52
- model.setLayout(currLayout);
53
- handleClose();
54
- }, children: "Submit" })] })] })) }));
11
+ return ((0, jsx_runtime_1.jsx)(SetColorDialog_1.default, { model: model, handleClose: handleClose, title: "Multi-sample variant display - Color/arrangement editor", enableBulkEdit: true, enableRowPalettizer: true, showTipsStorageKey: "multivariant-showTips", SourcesGridComponent: SourcesGrid_1.default }));
55
12
  }
@@ -0,0 +1,10 @@
1
+ export default function SetColorDialogBulkEditPanel({ onClose, currLayout, }: {
2
+ currLayout: {
3
+ name: string;
4
+ [key: string]: unknown;
5
+ }[];
6
+ onClose: (arg?: {
7
+ name: string;
8
+ [key: string]: unknown;
9
+ }[]) => void;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = BulkEditPanel;
3
+ exports.default = SetColorDialogBulkEditPanel;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const ui_1 = require("@jbrowse/core/ui");
@@ -11,7 +11,7 @@ const useStyles = (0, mui_1.makeStyles)()({
11
11
  fontFamily: 'Courier New',
12
12
  },
13
13
  });
14
- function BulkEditPanel({ onClose, currLayout, }) {
14
+ function SetColorDialogBulkEditPanel({ onClose, currLayout, }) {
15
15
  const { classes } = useStyles();
16
16
  const [val, setVal] = (0, react_1.useState)('');
17
17
  const [error, setError] = (0, react_1.useState)();
@@ -0,0 +1 @@
1
+ export default function SetColorDialogHelpfulTips(): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = HelpfulTips;
3
+ exports.default = SetColorDialogHelpfulTips;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- function HelpfulTips() {
5
+ function SetColorDialogHelpfulTips() {
6
6
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Helpful tips", (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "You can select rows in the table with the checkboxes" }), (0, jsx_runtime_1.jsx)("li", { children: "Multi-select is enabled with shift-click and control-click" }), (0, jsx_runtime_1.jsx)("li", { children: "The \"Move selected items up/down\" can re-arrange subtracks" }), (0, jsx_runtime_1.jsx)("li", { children: "Sorting the data grid itself can also re-arrange subtracks" }), (0, jsx_runtime_1.jsx)("li", { children: "Changes are applied when you hit Submit" }), (0, jsx_runtime_1.jsx)("li", { children: "You can click and drag the dialog box to move it on the screen" }), (0, jsx_runtime_1.jsx)("li", { children: "Columns in the table can be hidden using a vertical '...' menu on the right side of each column" })] })] }));
7
7
  }
@@ -0,0 +1,10 @@
1
+ export default function SetColorDialogRowPalettizer({ setCurrLayout, currLayout, }: {
2
+ currLayout: {
3
+ name: string;
4
+ [key: string]: unknown;
5
+ }[];
6
+ setCurrLayout: (arg: {
7
+ name: string;
8
+ [key: string]: unknown;
9
+ }[]) => void;
10
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = RowPalettizer;
3
+ exports.default = SetColorDialogRowPalettizer;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const colors_1 = require("@jbrowse/core/ui/colors");
6
+ const color_1 = require("@jbrowse/core/util/color");
6
7
  const material_1 = require("@mui/material");
7
- const util_1 = require("../util");
8
- function RowPalettizer({ setCurrLayout, currLayout, }) {
9
- var _a;
10
- return ((0, jsx_runtime_1.jsxs)("div", { children: ["Create color palette based on...", Object.keys((_a = currLayout[0]) !== null && _a !== void 0 ? _a : [])
11
- .filter(f => f !== 'name' &&
12
- f !== 'color' &&
13
- f !== 'label' &&
14
- f !== 'id' &&
15
- f !== 'HP')
16
- .map(r => ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "inherit", onClick: () => {
8
+ function SetColorDialogRowPalettizer({ setCurrLayout, currLayout, }) {
9
+ if (!currLayout.length || !currLayout[0]) {
10
+ return null;
11
+ }
12
+ const fields = Object.keys(currLayout[0]).filter(f => f !== 'name' &&
13
+ f !== 'color' &&
14
+ f !== 'label' &&
15
+ f !== 'id' &&
16
+ f !== 'HP');
17
+ return ((0, jsx_runtime_1.jsxs)("div", { children: ["Create color palette based on...", fields.map(r => ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "inherit", onClick: () => {
17
18
  const map = new Map();
18
19
  for (const row of currLayout) {
19
20
  const val = map.get(row[r]);
@@ -26,7 +27,7 @@ function RowPalettizer({ setCurrLayout, currLayout, }) {
26
27
  }
27
28
  const ret = Object.fromEntries([...map.entries()]
28
29
  .sort((a, b) => a[1] - b[1])
29
- .map((r, idx) => [r[0], colors_1.set1[idx] || (0, util_1.randomColor)(r[0])]));
30
+ .map((r, idx) => [r[0], colors_1.set1[idx] || (0, color_1.randomColor)(r[0])]));
30
31
  setCurrLayout(currLayout.map(row => ({
31
32
  ...row,
32
33
  color: ret[row[r]],
@@ -0,0 +1,31 @@
1
+ interface SetColorDialogProps {
2
+ model: {
3
+ sources?: {
4
+ name: string;
5
+ [key: string]: unknown;
6
+ }[];
7
+ setLayout: (s: {
8
+ name: string;
9
+ [key: string]: unknown;
10
+ }[]) => void;
11
+ clearLayout: () => void;
12
+ };
13
+ handleClose: () => void;
14
+ title?: string;
15
+ enableBulkEdit?: boolean;
16
+ enableRowPalettizer?: boolean;
17
+ showTipsStorageKey?: string;
18
+ SourcesGridComponent: React.ComponentType<{
19
+ rows: {
20
+ name: string;
21
+ [key: string]: unknown;
22
+ }[];
23
+ onChange: (rows: {
24
+ name: string;
25
+ [key: string]: unknown;
26
+ }[]) => void;
27
+ showTips: boolean;
28
+ }>;
29
+ }
30
+ export default function SetColorDialog({ model, handleClose, title, enableBulkEdit, enableRowPalettizer, showTipsStorageKey, SourcesGridComponent, }: SetColorDialogProps): import("react/jsx-runtime").JSX.Element;
31
+ export {};
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = SetColorDialog;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const DraggableDialog_1 = __importDefault(require("@jbrowse/core/ui/DraggableDialog"));
10
+ const util_1 = require("@jbrowse/core/util");
11
+ const material_1 = require("@mui/material");
12
+ const mui_1 = require("tss-react/mui");
13
+ const SetColorDialogBulkEditPanel_1 = __importDefault(require("./SetColorDialogBulkEditPanel"));
14
+ const SetColorDialogHelpfulTips_1 = __importDefault(require("./SetColorDialogHelpfulTips"));
15
+ const SetColorDialogRowPalettizer_1 = __importDefault(require("./SetColorDialogRowPalettizer"));
16
+ const useStyles = (0, mui_1.makeStyles)()({
17
+ content: {
18
+ minWidth: 800,
19
+ },
20
+ fr: {
21
+ float: 'right',
22
+ display: 'flex',
23
+ gap: 8,
24
+ },
25
+ });
26
+ function SetColorDialog({ model, handleClose, title = 'Color/arrangement editor', enableBulkEdit = false, enableRowPalettizer = false, showTipsStorageKey = 'setColorDialog-showTips', SourcesGridComponent, }) {
27
+ const { classes } = useStyles();
28
+ const { sources } = model;
29
+ const [showBulkEditor, setShowBulkEditor] = (0, react_1.useState)(false);
30
+ const [currLayout, setCurrLayout] = (0, react_1.useState)(structuredClone(sources || []));
31
+ const [showTips, setShowTips] = (0, util_1.useLocalStorage)(showTipsStorageKey, false);
32
+ return ((0, jsx_runtime_1.jsx)(DraggableDialog_1.default, { open: true, onClose: handleClose, maxWidth: "xl", title: title, children: showBulkEditor && enableBulkEdit ? ((0, jsx_runtime_1.jsx)(SetColorDialogBulkEditPanel_1.default, { currLayout: currLayout, onClose: arg => {
33
+ if (arg) {
34
+ setCurrLayout(arg);
35
+ }
36
+ setShowBulkEditor(false);
37
+ } })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { className: classes.content, children: [(0, jsx_runtime_1.jsxs)("div", { className: classes.fr, children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: () => {
38
+ setShowTips(!showTips);
39
+ }, children: showTips ? 'Hide tips' : 'Show tips' }), enableBulkEdit ? ((0, jsx_runtime_1.jsx)(material_1.Button, { color: "secondary", variant: "contained", onClick: () => {
40
+ setShowBulkEditor(!showBulkEditor);
41
+ }, children: "Show Bulk row editor" })) : null] }), showTips ? (0, jsx_runtime_1.jsx)(SetColorDialogHelpfulTips_1.default, {}) : null, enableRowPalettizer ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(SetColorDialogRowPalettizer_1.default, { currLayout: currLayout, setCurrLayout: setCurrLayout })] })) : null, (0, jsx_runtime_1.jsx)(SourcesGridComponent, { rows: currLayout, onChange: setCurrLayout, showTips: showTips })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", type: "submit", color: "inherit", onClick: () => {
42
+ model.clearLayout();
43
+ setCurrLayout(model.sources || []);
44
+ }, children: "Clear custom settings" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
45
+ handleClose();
46
+ setCurrLayout([...(model.sources || [])]);
47
+ }, children: "Cancel" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", type: "submit", onClick: () => {
48
+ model.setLayout(currLayout);
49
+ handleClose();
50
+ }, children: "Submit" })] })] })) }));
51
+ }
@@ -0,0 +1,10 @@
1
+ export default function SetColorDialogBulkEditPanel({ onClose, currLayout, }: {
2
+ currLayout: {
3
+ name: string;
4
+ [key: string]: unknown;
5
+ }[];
6
+ onClose: (arg?: {
7
+ name: string;
8
+ [key: string]: unknown;
9
+ }[]) => void;
10
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = SetColorDialogBulkEditPanel;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const ui_1 = require("@jbrowse/core/ui");
7
+ const material_1 = require("@mui/material");
8
+ const mui_1 = require("tss-react/mui");
9
+ const useStyles = (0, mui_1.makeStyles)()({
10
+ textAreaFont: {
11
+ fontFamily: 'Courier New',
12
+ },
13
+ });
14
+ function SetColorDialogBulkEditPanel({ onClose, currLayout, }) {
15
+ const { classes } = useStyles();
16
+ const [val, setVal] = (0, react_1.useState)('');
17
+ const [error, setError] = (0, react_1.useState)();
18
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.DialogContent, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: "Paste CSV or TSV. If a header column is present. First line is a header. If a column called \"name\" is present, it uses that to connect to IDs in the table, otherwise it uses the first column no." }), error ? (0, jsx_runtime_1.jsx)(ui_1.ErrorMessage, { error: error }) : null, (0, jsx_runtime_1.jsx)(material_1.TextField, { variant: "outlined", multiline: true, minRows: 5, placeholder: 'name,population\nHG00098,GBR\nHG00101,GBR\nHG00459,CHS\n...', maxRows: 10, fullWidth: true, value: val, onChange: event => {
19
+ setVal(event.target.value);
20
+ }, slotProps: {
21
+ input: {
22
+ classes: {
23
+ input: classes.textAreaFont,
24
+ },
25
+ },
26
+ } })] }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
27
+ const lines = val
28
+ .split('\n')
29
+ .map(f => f.trim())
30
+ .filter(f => !!f);
31
+ const fields = lines[0].split(/[,\t]/gm);
32
+ if (fields.includes('name')) {
33
+ setError('');
34
+ const oldLayout = Object.fromEntries(currLayout.map(record => [record.name, record]));
35
+ const newData = Object.fromEntries(lines.slice(1).map(line => {
36
+ const cols = line.split(/[,\t]/gm);
37
+ const newRecord = Object.fromEntries(cols.map((col, idx) => [fields[idx], col]));
38
+ return [
39
+ newRecord.name,
40
+ {
41
+ ...newRecord,
42
+ ...oldLayout[newRecord.name],
43
+ },
44
+ ];
45
+ }));
46
+ onClose(currLayout.map(record => ({
47
+ ...record,
48
+ ...newData[record.name],
49
+ })));
50
+ }
51
+ else {
52
+ setError(new Error('No "name" column found on line 1'));
53
+ }
54
+ }, children: "Update rows" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", onClick: () => {
55
+ const lines = val
56
+ .split('\n')
57
+ .map(f => f.trim())
58
+ .filter(f => !!f);
59
+ const fields = lines[0].split(/[,\t]/gm);
60
+ if (fields.includes('name')) {
61
+ setError('');
62
+ const oldLayout = Object.fromEntries(currLayout.map(record => [record.name, record]));
63
+ const newData = Object.fromEntries(lines.slice(1).map(line => {
64
+ const cols = line.split(/[,\t]/gm);
65
+ const newRecord = Object.fromEntries(cols.map((col, idx) => [fields[idx], col]));
66
+ return [
67
+ newRecord.name,
68
+ {
69
+ ...newRecord,
70
+ ...oldLayout[newRecord.name],
71
+ },
72
+ ];
73
+ }));
74
+ onClose(currLayout.map(record => ({
75
+ ...newData[record.name],
76
+ })));
77
+ }
78
+ else {
79
+ setError(new Error('No "name" column found on line 1'));
80
+ }
81
+ }, children: "Replace rows" }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "inherit", onClick: () => {
82
+ onClose();
83
+ }, children: "Cancel" })] })] }));
84
+ }
@@ -0,0 +1 @@
1
+ export default function SetColorDialogHelpfulTips(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = SetColorDialogHelpfulTips;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ function SetColorDialogHelpfulTips() {
6
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Helpful tips", (0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "You can select rows in the table with the checkboxes" }), (0, jsx_runtime_1.jsx)("li", { children: "Multi-select is enabled with shift-click and control-click" }), (0, jsx_runtime_1.jsx)("li", { children: "The \"Move selected items up/down\" can re-arrange subtracks" }), (0, jsx_runtime_1.jsx)("li", { children: "Sorting the data grid itself can also re-arrange subtracks" }), (0, jsx_runtime_1.jsx)("li", { children: "Changes are applied when you hit Submit" }), (0, jsx_runtime_1.jsx)("li", { children: "You can click and drag the dialog box to move it on the screen" }), (0, jsx_runtime_1.jsx)("li", { children: "Columns in the table can be hidden using a vertical '...' menu on the right side of each column" })] })] }));
7
+ }
@@ -0,0 +1,10 @@
1
+ export default function SetColorDialogRowPalettizer({ setCurrLayout, currLayout, }: {
2
+ currLayout: {
3
+ name: string;
4
+ [key: string]: unknown;
5
+ }[];
6
+ setCurrLayout: (arg: {
7
+ name: string;
8
+ [key: string]: unknown;
9
+ }[]) => void;
10
+ }): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = SetColorDialogRowPalettizer;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const colors_1 = require("@jbrowse/core/ui/colors");
6
+ const color_1 = require("@jbrowse/core/util/color");
7
+ const material_1 = require("@mui/material");
8
+ function SetColorDialogRowPalettizer({ setCurrLayout, currLayout, }) {
9
+ if (!currLayout.length || !currLayout[0]) {
10
+ return null;
11
+ }
12
+ const fields = Object.keys(currLayout[0]).filter(f => f !== 'name' &&
13
+ f !== 'color' &&
14
+ f !== 'label' &&
15
+ f !== 'id' &&
16
+ f !== 'HP');
17
+ return ((0, jsx_runtime_1.jsxs)("div", { children: ["Create color palette based on...", fields.map(r => ((0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "inherit", onClick: () => {
18
+ const map = new Map();
19
+ for (const row of currLayout) {
20
+ const val = map.get(row[r]);
21
+ if (!val) {
22
+ map.set(row[r], 1);
23
+ }
24
+ else {
25
+ map.set(row[r], val + 1);
26
+ }
27
+ }
28
+ const ret = Object.fromEntries([...map.entries()]
29
+ .sort((a, b) => a[1] - b[1])
30
+ .map((r, idx) => [r[0], colors_1.set1[idx] || (0, color_1.randomColor)(r[0])]));
31
+ setCurrLayout(currLayout.map(row => ({
32
+ ...row,
33
+ color: ret[row[r]],
34
+ })));
35
+ }, children: r }, r))), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: () => {
36
+ setCurrLayout(currLayout.map(row => ({
37
+ ...row,
38
+ color: undefined,
39
+ })));
40
+ }, children: "Clear colors" })] }));
41
+ }
@@ -1,3 +1,2 @@
1
1
  export declare function fillRectCtx(x: number, y: number, width: number, height: number, ctx: CanvasRenderingContext2D, color?: string): void;
2
- export declare function randomColor(str: string): string;
3
2
  export declare function colorify(n: number): string;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fillRectCtx = fillRectCtx;
4
- exports.randomColor = randomColor;
5
4
  exports.colorify = colorify;
6
5
  function fillRectCtx(x, y, width, height, ctx, color) {
7
6
  if (width < 0) {
@@ -17,13 +16,6 @@ function fillRectCtx(x, y, width, height, ctx, color) {
17
16
  }
18
17
  ctx.fillRect(x, y, width, height);
19
18
  }
20
- function randomColor(str) {
21
- let sum = 0;
22
- for (let i = 0; i < str.length; i++) {
23
- sum += str.charCodeAt(i);
24
- }
25
- return colorify(sum * 10);
26
- }
27
19
  function colorify(n) {
28
20
  return `hsl(${n % 255}, 50%, 50%)`;
29
21
  }
@@ -181,6 +181,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
181
181
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
182
182
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
183
183
  } & {
184
+ mouseoverExtraInformation: string | undefined;
184
185
  featureIdUnderMouse: undefined | string;
185
186
  contextMenuFeature: undefined | Feature;
186
187
  } & {
@@ -195,9 +196,22 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
195
196
  } & {
196
197
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
197
198
  readonly featureUnderMouse: Feature | undefined;
199
+ readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
200
+ label?: string;
201
+ description?: string;
202
+ refName: string;
203
+ }]>;
198
204
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
199
- getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
200
- searchFeatureByID(id: string): [number, number, number, number] | undefined;
205
+ getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
206
+ label?: string;
207
+ description?: string;
208
+ refName: string;
209
+ }]) | undefined;
210
+ searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
211
+ label?: string;
212
+ description?: string;
213
+ refName: string;
214
+ }]) | undefined;
201
215
  } & {
202
216
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
203
217
  deleteBlock(key: string): void;
@@ -206,6 +220,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
206
220
  clearFeatureSelection(): void;
207
221
  setFeatureIdUnderMouse(feature?: string): void;
208
222
  setContextMenuFeature(feature?: Feature): void;
223
+ setMouseoverExtraInformation(extra?: string): void;
209
224
  } & {
210
225
  reload(): Promise<void>;
211
226
  } & {
@@ -189,6 +189,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
189
189
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
190
190
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
191
191
  } & {
192
+ mouseoverExtraInformation: string | undefined;
192
193
  featureIdUnderMouse: undefined | string;
193
194
  contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
194
195
  } & {
@@ -203,9 +204,22 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
203
204
  } & {
204
205
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
205
206
  readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
207
+ readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
208
+ label?: string;
209
+ description?: string;
210
+ refName: string;
211
+ }]>;
206
212
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
207
- getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
208
- searchFeatureByID(id: string): [number, number, number, number] | undefined;
213
+ getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
214
+ label?: string;
215
+ description?: string;
216
+ refName: string;
217
+ }]) | undefined;
218
+ searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
219
+ label?: string;
220
+ description?: string;
221
+ refName: string;
222
+ }]) | undefined;
209
223
  } & {
210
224
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
211
225
  deleteBlock(key: string): void;
@@ -214,6 +228,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
214
228
  clearFeatureSelection(): void;
215
229
  setFeatureIdUnderMouse(feature?: string): void;
216
230
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature): void;
231
+ setMouseoverExtraInformation(extra?: string): void;
217
232
  } & {
218
233
  reload(): Promise<void>;
219
234
  } & {
@@ -189,6 +189,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
189
189
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
190
190
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
191
191
  } & {
192
+ mouseoverExtraInformation: string | undefined;
192
193
  featureIdUnderMouse: undefined | string;
193
194
  contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
194
195
  } & {
@@ -203,9 +204,22 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
203
204
  } & {
204
205
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
205
206
  readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
207
+ readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
208
+ label?: string;
209
+ description?: string;
210
+ refName: string;
211
+ }]>;
206
212
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
207
- getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
208
- searchFeatureByID(id: string): [number, number, number, number] | undefined;
213
+ getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
214
+ label?: string;
215
+ description?: string;
216
+ refName: string;
217
+ }]) | undefined;
218
+ searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
219
+ label?: string;
220
+ description?: string;
221
+ refName: string;
222
+ }]) | undefined;
209
223
  } & {
210
224
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
211
225
  deleteBlock(key: string): void;
@@ -214,6 +228,7 @@ export default function stateModelFactory(configSchema: AnyConfigurationSchemaTy
214
228
  clearFeatureSelection(): void;
215
229
  setFeatureIdUnderMouse(feature?: string): void;
216
230
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature): void;
231
+ setMouseoverExtraInformation(extra?: string): void;
217
232
  } & {
218
233
  reload(): Promise<void>;
219
234
  } & {