@jbrowse/plugin-wiggle 3.6.5 → 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 (73) hide show
  1. package/dist/CreateMultiWiggleExtension/ConfirmDialog.js +1 -1
  2. package/dist/CreateMultiWiggleExtension/index.js +1 -1
  3. package/dist/LinearWiggleDisplay/model.d.ts +17 -2
  4. package/dist/MultiLinearWiggleDisplay/components/ColorLegend.js +2 -1
  5. package/dist/MultiLinearWiggleDisplay/components/LegendItem.js +1 -3
  6. package/dist/MultiLinearWiggleDisplay/components/LegendItemText.d.ts +10 -0
  7. package/dist/MultiLinearWiggleDisplay/components/LegendItemText.js +13 -0
  8. package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js +2 -32
  9. package/dist/MultiLinearWiggleDisplay/components/SourcesGrid.js +1 -1
  10. package/dist/MultiLinearWiggleDisplay/components/Tooltip.js +10 -6
  11. package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogAuto.js +11 -3
  12. package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogManual.js +14 -6
  13. package/dist/MultiLinearWiggleDisplay/components/WiggleClusterDialog/types.d.ts +2 -1
  14. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialog.d.ts +31 -0
  15. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialog.js +51 -0
  16. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialogBulkEditPanel.d.ts +10 -0
  17. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialogBulkEditPanel.js +84 -0
  18. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialogHelpfulTips.d.ts +1 -0
  19. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialogHelpfulTips.js +7 -0
  20. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialogRowPalettizer.d.ts +10 -0
  21. package/dist/MultiLinearWiggleDisplay/components/ui/SetColorDialogRowPalettizer.js +42 -0
  22. package/dist/MultiLinearWiggleDisplay/components/util.d.ts +4 -8
  23. package/dist/MultiLinearWiggleDisplay/model.d.ts +19 -2
  24. package/dist/MultiLinearWiggleDisplay/model.js +2 -2
  25. package/dist/MultiLinearWiggleDisplay/types.d.ts +1 -0
  26. package/dist/MultiLinearWiggleDisplay/util.d.ts +0 -1
  27. package/dist/MultiLinearWiggleDisplay/util.js +0 -9
  28. package/dist/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +2 -1
  29. package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js +36 -11
  30. package/dist/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +1 -1
  31. package/dist/getMultiWiggleSourcesAutorun.d.ts +1 -0
  32. package/dist/shared/SharedWiggleMixin.d.ts +17 -2
  33. package/dist/util.d.ts +1 -0
  34. package/dist/util.js +1 -1
  35. package/esm/CreateMultiWiggleExtension/ConfirmDialog.js +1 -1
  36. package/esm/CreateMultiWiggleExtension/index.js +1 -1
  37. package/esm/LinearWiggleDisplay/model.d.ts +17 -2
  38. package/esm/MultiLinearWiggleDisplay/components/ColorLegend.js +2 -1
  39. package/esm/MultiLinearWiggleDisplay/components/LegendItem.js +1 -3
  40. package/esm/MultiLinearWiggleDisplay/components/LegendItemText.d.ts +10 -0
  41. package/esm/MultiLinearWiggleDisplay/components/LegendItemText.js +11 -0
  42. package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js +3 -33
  43. package/esm/MultiLinearWiggleDisplay/components/SourcesGrid.js +1 -1
  44. package/esm/MultiLinearWiggleDisplay/components/Tooltip.js +10 -6
  45. package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogAuto.js +11 -3
  46. package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/WiggleClusterDialogManual.js +14 -6
  47. package/esm/MultiLinearWiggleDisplay/components/WiggleClusterDialog/types.d.ts +2 -1
  48. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialog.d.ts +31 -0
  49. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialog.js +45 -0
  50. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialogBulkEditPanel.d.ts +10 -0
  51. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialogBulkEditPanel.js +81 -0
  52. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialogHelpfulTips.d.ts +1 -0
  53. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialogHelpfulTips.js +4 -0
  54. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialogRowPalettizer.d.ts +10 -0
  55. package/esm/MultiLinearWiggleDisplay/components/ui/SetColorDialogRowPalettizer.js +39 -0
  56. package/esm/MultiLinearWiggleDisplay/components/util.d.ts +4 -8
  57. package/esm/MultiLinearWiggleDisplay/model.d.ts +19 -2
  58. package/esm/MultiLinearWiggleDisplay/model.js +2 -2
  59. package/esm/MultiLinearWiggleDisplay/types.d.ts +1 -0
  60. package/esm/MultiLinearWiggleDisplay/util.d.ts +0 -1
  61. package/esm/MultiLinearWiggleDisplay/util.js +1 -7
  62. package/esm/MultiWiggleAdapter/MultiWiggleAdapter.d.ts +2 -1
  63. package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +36 -11
  64. package/esm/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +1 -1
  65. package/esm/getMultiWiggleSourcesAutorun.d.ts +1 -0
  66. package/esm/shared/SharedWiggleMixin.d.ts +17 -2
  67. package/esm/util.d.ts +1 -0
  68. package/esm/util.js +1 -1
  69. package/package.json +5 -5
  70. package/dist/WiggleRPC/type.d.ts +0 -0
  71. package/dist/WiggleRPC/type.js +0 -1
  72. package/esm/WiggleRPC/type.d.ts +0 -0
  73. package/esm/WiggleRPC/type.js +0 -1
@@ -195,6 +195,7 @@ export declare function stateModelFactory(_pluginManager: PluginManager, configS
195
195
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
196
196
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
197
197
  } & {
198
+ mouseoverExtraInformation: string | undefined;
198
199
  featureIdUnderMouse: undefined | string;
199
200
  contextMenuFeature: undefined | Feature;
200
201
  } & {
@@ -209,9 +210,22 @@ export declare function stateModelFactory(_pluginManager: PluginManager, configS
209
210
  } & {
210
211
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
211
212
  readonly featureUnderMouse: Feature | undefined;
213
+ readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
214
+ label?: string;
215
+ description?: string;
216
+ refName: string;
217
+ }]>;
212
218
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
213
- getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
214
- searchFeatureByID(id: string): [number, number, number, number] | undefined;
219
+ getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
220
+ label?: string;
221
+ description?: string;
222
+ refName: string;
223
+ }]) | undefined;
224
+ searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
225
+ label?: string;
226
+ description?: string;
227
+ refName: string;
228
+ }]) | undefined;
215
229
  } & {
216
230
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
217
231
  deleteBlock(key: string): void;
@@ -220,6 +234,7 @@ export declare function stateModelFactory(_pluginManager: PluginManager, configS
220
234
  clearFeatureSelection(): void;
221
235
  setFeatureIdUnderMouse(feature?: string): void;
222
236
  setContextMenuFeature(feature?: Feature): void;
237
+ setMouseoverExtraInformation(extra?: string): void;
223
238
  } & {
224
239
  reload(): Promise<void>;
225
240
  } & {
@@ -351,12 +366,14 @@ export declare function stateModelFactory(_pluginManager: PluginManager, configS
351
366
  color: string;
352
367
  baseUri?: string;
353
368
  name: string;
369
+ source: string;
354
370
  group?: string;
355
371
  }[] | undefined;
356
372
  readonly sources: {
357
373
  color: string;
358
374
  baseUri?: string;
359
375
  name: string;
376
+ source: string;
360
377
  group?: string;
361
378
  }[] | undefined;
362
379
  readonly quantitativeStatsReady: boolean;
@@ -237,10 +237,10 @@ function stateModelFactory(_pluginManager, configSchema) {
237
237
  })
238
238
  .views(self => ({
239
239
  get legendFontSize() {
240
- return Math.min(self.rowHeight, 12);
240
+ return Math.min(self.rowHeight, 8);
241
241
  },
242
242
  get canDisplayLegendLabels() {
243
- return self.rowHeight > 11;
243
+ return self.rowHeight > 7;
244
244
  },
245
245
  get labelWidth() {
246
246
  var _a;
@@ -6,6 +6,7 @@ export interface Source {
6
6
  group?: string;
7
7
  HP?: number;
8
8
  id?: string;
9
+ source: string;
9
10
  [key: string]: unknown;
10
11
  }
11
12
  export interface SampleInfo {
@@ -1 +0,0 @@
1
- export declare function randomColor(str: string): string;
@@ -1,10 +1 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomColor = randomColor;
4
- function randomColor(str) {
5
- let sum = 0;
6
- for (let i = 0; i < str.length; i++) {
7
- sum += str.charCodeAt(i);
8
- }
9
- return `hsl(${sum * 10}, 20%, 50%)`;
10
- }
@@ -8,6 +8,7 @@ interface WiggleOptions extends BaseOptions {
8
8
  interface AdapterEntry {
9
9
  dataAdapter: BaseFeatureDataAdapter;
10
10
  source: string;
11
+ name: string;
11
12
  [key: string]: unknown;
12
13
  }
13
14
  export default class MultiWiggleAdapter extends BaseFeatureDataAdapter {
@@ -24,7 +25,7 @@ export default class MultiWiggleAdapter extends BaseFeatureDataAdapter {
24
25
  }>;
25
26
  getSources(_regions: Region[]): Promise<{
26
27
  name: string;
27
- __name: unknown;
28
+ source: string;
28
29
  }[]>;
29
30
  }
30
31
  export {};
@@ -9,6 +9,27 @@ function getFilename(uri) {
9
9
  const filename = uri.slice(uri.lastIndexOf('/') + 1);
10
10
  return filename.slice(0, filename.lastIndexOf('.'));
11
11
  }
12
+ function getFilenameFromAdapterConfig(config) {
13
+ try {
14
+ if (config.type === 'BigWigAdapter' && config.bigWigLocation) {
15
+ const location = config.bigWigLocation;
16
+ if ('uri' in location && location.uri) {
17
+ return getFilename(location.uri);
18
+ }
19
+ if ('localPath' in location && location.localPath) {
20
+ return getFilename(location.localPath);
21
+ }
22
+ if ('blob' in location && location.blob) {
23
+ const blob = location.blob;
24
+ return blob.name ? getFilename(blob.name) : undefined;
25
+ }
26
+ }
27
+ return undefined;
28
+ }
29
+ catch (e) {
30
+ return undefined;
31
+ }
32
+ }
12
33
  class MultiWiggleAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
13
34
  async getAdapters() {
14
35
  const getSubAdapter = this.getSubAdapter;
@@ -26,15 +47,20 @@ class MultiWiggleAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
26
47
  },
27
48
  }));
28
49
  }
29
- return Promise.all(subConfs.map(async (conf) => {
50
+ const ret = await Promise.all(subConfs.map(async (conf) => {
30
51
  const dataAdapter = (await getSubAdapter(conf))
31
52
  .dataAdapter;
53
+ const source = conf.source ||
54
+ conf.name ||
55
+ getFilenameFromAdapterConfig(conf) ||
56
+ dataAdapter.id;
32
57
  return {
33
- source: conf.name || dataAdapter.id,
34
58
  ...conf,
35
59
  dataAdapter,
60
+ source,
36
61
  };
37
62
  }));
63
+ return ret;
38
64
  }
39
65
  async getRefNames(opts) {
40
66
  const adapters = await this.getAdapters();
@@ -44,11 +70,9 @@ class MultiWiggleAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
44
70
  async getGlobalStats(opts) {
45
71
  const adapters = await this.getAdapters();
46
72
  const stats = (await Promise.all(adapters.map(adp => { var _a, _b; return (_b = (_a = adp.dataAdapter).getGlobalStats) === null || _b === void 0 ? void 0 : _b.call(_a, opts); }))).filter(f => !!f);
47
- const scoreMin = (0, util_1.min)(stats.map(s => s.scoreMin));
48
- const scoreMax = (0, util_1.max)(stats.map(s => s.scoreMax));
49
73
  return {
50
- scoreMin,
51
- scoreMax,
74
+ scoreMin: (0, util_1.min)(stats.map(s => s.scoreMin)),
75
+ scoreMax: (0, util_1.max)(stats.map(s => s.scoreMax)),
52
76
  };
53
77
  }
54
78
  getFeatures(region, opts = {}) {
@@ -70,11 +94,12 @@ class MultiWiggleAdapter extends BaseAdapter_1.BaseFeatureDataAdapter {
70
94
  }
71
95
  async getSources(_regions) {
72
96
  const adapters = await this.getAdapters();
73
- return adapters.map(({ dataAdapter, source, name, ...rest }) => ({
74
- name: source,
75
- __name: name,
76
- ...rest,
77
- }));
97
+ return adapters.map(({ type, bigWigLocation, dataAdapter, ...rest }) => {
98
+ return {
99
+ ...rest,
100
+ name: rest.source,
101
+ };
102
+ });
78
103
  }
79
104
  }
80
105
  MultiWiggleAdapter.capabilities = [
@@ -71,7 +71,7 @@ function doSubmit({ trackName, val, model, }) {
71
71
  const MultiWiggleAddTrackWorkflow = (0, mobx_react_1.observer)(function ({ model, }) {
72
72
  const { classes } = useStyles();
73
73
  const [val, setVal] = (0, react_1.useState)('');
74
- const [trackName, setTrackName] = (0, react_1.useState)(`MultiWiggle${+Date.now()}`);
74
+ const [trackName, setTrackName] = (0, react_1.useState)(`MultiWiggle${Date.now()}`);
75
75
  return ((0, jsx_runtime_1.jsxs)(material_1.Paper, { className: classes.paper, children: [(0, jsx_runtime_1.jsxs)("ul", { children: [(0, jsx_runtime_1.jsx)("li", { children: "Enter list of URLs for bigwig files in the textbox" }), (0, jsx_runtime_1.jsx)("li", { children: "Or, use the button below the text box to select files from your computer" })] }), (0, jsx_runtime_1.jsx)(material_1.TextField, { multiline: true, fullWidth: true, rows: 10, value: val, placeholder: "Paste list of URLs here, or use file selector below", variant: "outlined", onChange: event => {
76
76
  setVal(event.target.value);
77
77
  } }), (0, jsx_runtime_1.jsxs)(material_1.Button, { variant: "outlined", component: "label", children: ["Choose Files from your computer", (0, jsx_runtime_1.jsx)("input", { type: "file", hidden: true, multiple: true, onChange: ({ target }) => {
@@ -1,6 +1,7 @@
1
1
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
2
2
  export interface Source {
3
3
  name: string;
4
+ source: string;
4
5
  color?: string;
5
6
  group?: string;
6
7
  }
@@ -187,6 +187,7 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
187
187
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
188
188
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
189
189
  } & {
190
+ mouseoverExtraInformation: string | undefined;
190
191
  featureIdUnderMouse: undefined | string;
191
192
  contextMenuFeature: undefined | Feature;
192
193
  } & {
@@ -201,9 +202,22 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
201
202
  } & {
202
203
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, Feature>;
203
204
  readonly featureUnderMouse: Feature | undefined;
205
+ readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
206
+ label?: string;
207
+ description?: string;
208
+ refName: string;
209
+ }]>;
204
210
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
205
- getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
206
- searchFeatureByID(id: string): [number, number, number, number] | undefined;
211
+ getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
212
+ label?: string;
213
+ description?: string;
214
+ refName: string;
215
+ }]) | undefined;
216
+ searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
217
+ label?: string;
218
+ description?: string;
219
+ refName: string;
220
+ }]) | undefined;
207
221
  } & {
208
222
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
209
223
  deleteBlock(key: string): void;
@@ -212,6 +226,7 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
212
226
  clearFeatureSelection(): void;
213
227
  setFeatureIdUnderMouse(feature?: string): void;
214
228
  setContextMenuFeature(feature?: Feature): void;
229
+ setMouseoverExtraInformation(extra?: string): void;
215
230
  } & {
216
231
  reload(): Promise<void>;
217
232
  } & {
package/dist/util.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface ScaleOpts {
9
9
  export interface Source {
10
10
  baseUri?: string;
11
11
  name: string;
12
+ source: string;
12
13
  color?: string;
13
14
  group?: string;
14
15
  }
package/dist/util.js CHANGED
@@ -84,7 +84,7 @@ function getNiceDomain({ scaleType, domain, bounds, }) {
84
84
  return scale.domain();
85
85
  }
86
86
  function toP(s = 0) {
87
- return +(+s).toPrecision(6);
87
+ return +s.toPrecision(6);
88
88
  }
89
89
  function round(value) {
90
90
  return Math.round(value * 1e5) / 1e5;
@@ -4,7 +4,7 @@ import { readConfObject } from '@jbrowse/core/configuration';
4
4
  import Dialog from '@jbrowse/core/ui/Dialog';
5
5
  import { Button, DialogActions, DialogContent, TextField, Typography, } from '@mui/material';
6
6
  const ConfirmDialog = ({ tracks, onClose, }) => {
7
- const [val, setVal] = useState(`MultiWiggle ${Date.now()}`);
7
+ const [val, setVal] = useState(() => `MultiWiggle ${Date.now()}`);
8
8
  const allQuant = tracks.every(t => t.type === 'QuantitativeTrack');
9
9
  return (_jsxs(Dialog, { open: true, onClose: () => {
10
10
  onClose(false);
@@ -8,7 +8,7 @@ function makeTrack({ model, arg, }) {
8
8
  const subadapters = tracks
9
9
  .map(c => readConfObject(c, 'adapter'))
10
10
  .map((c, idx) => ({ ...c, source: trackIds[idx] }));
11
- const now = +Date.now();
11
+ const now = Date.now();
12
12
  const trackId = `multitrack-${now}-sessionTrack`;
13
13
  const session = getSession(model);
14
14
  if (isSessionWithAddTracks(session)) {
@@ -193,6 +193,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
193
193
  regionCannotBeRenderedText(_region: import("@jbrowse/core/util").Region): "" | "Force load to see features";
194
194
  regionCannotBeRendered(_region: import("@jbrowse/core/util").Region): import("react/jsx-runtime").JSX.Element | null;
195
195
  } & {
196
+ mouseoverExtraInformation: string | undefined;
196
197
  featureIdUnderMouse: undefined | string;
197
198
  contextMenuFeature: undefined | import("@jbrowse/core/util").Feature;
198
199
  } & {
@@ -207,9 +208,22 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
207
208
  } & {
208
209
  readonly features: import("@jbrowse/core/util/compositeMap").default<string, import("@jbrowse/core/util").Feature>;
209
210
  readonly featureUnderMouse: import("@jbrowse/core/util").Feature | undefined;
211
+ readonly layoutFeatures: import("@jbrowse/core/util/compositeMap").default<string, [number, number, number, number] | [number, number, number, number, {
212
+ label?: string;
213
+ description?: string;
214
+ refName: string;
215
+ }]>;
210
216
  getFeatureOverlapping(blockKey: string, x: number, y: number): string | undefined;
211
- getFeatureByID(blockKey: string, id: string): [number, number, number, number] | undefined;
212
- searchFeatureByID(id: string): [number, number, number, number] | undefined;
217
+ getFeatureByID(blockKey: string, id: string): ([number, number, number, number] | [number, number, number, number, {
218
+ label?: string;
219
+ description?: string;
220
+ refName: string;
221
+ }]) | undefined;
222
+ searchFeatureByID(id: string): ([number, number, number, number] | [number, number, number, number, {
223
+ label?: string;
224
+ description?: string;
225
+ refName: string;
226
+ }]) | undefined;
213
227
  } & {
214
228
  addBlock(key: string, block: import("@jbrowse/core/util/blockTypes").BaseBlock): void;
215
229
  deleteBlock(key: string): void;
@@ -218,6 +232,7 @@ declare function stateModelFactory(pluginManager: PluginManager, configSchema: A
218
232
  clearFeatureSelection(): void;
219
233
  setFeatureIdUnderMouse(feature?: string): void;
220
234
  setContextMenuFeature(feature?: import("@jbrowse/core/util").Feature): void;
235
+ setMouseoverExtraInformation(extra?: string): void;
221
236
  } & {
222
237
  reload(): Promise<void>;
223
238
  } & {
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { observer } from 'mobx-react';
3
3
  import LegendItem from './LegendItem';
4
+ import LegendItemText from './LegendItemText';
4
5
  import RectBg from './RectBg';
5
6
  const ColorLegend = observer(function ({ model, rowHeight, exportSVG, }) {
6
7
  const { graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, sources, labelWidth, } = model;
@@ -8,6 +9,6 @@ const ColorLegend = observer(function ({ model, rowHeight, exportSVG, }) {
8
9
  const legendWidth = labelWidth + colorBoxWidth + 5;
9
10
  const svgOffset = exportSVG ? 10 : 0;
10
11
  const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
11
- return sources ? (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? (_jsx(RectBg, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => (_jsx(LegendItem, { source: source, idx: idx, model: model, rowHeight: rowHeight, exportSVG: exportSVG, labelWidth: labelWidth }, `${source.name}-${idx}`)))] })) : null;
12
+ return sources ? (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? (_jsx(RectBg, { y: 0, x: extraOffset, width: legendWidth, height: (sources.length + 0.25) * rowHeight })) : null, sources.map((source, idx) => (_jsx(LegendItem, { source: source, idx: idx, model: model, rowHeight: rowHeight, exportSVG: exportSVG, labelWidth: labelWidth }, `${source.name}-${idx}`))), sources.map((source, idx) => (_jsx(LegendItemText, { source: source, idx: idx, model: model, rowHeight: rowHeight, exportSVG: exportSVG }, `${source.name}-text-${idx}`)))] })) : null;
12
13
  });
13
14
  export default ColorLegend;
@@ -3,12 +3,10 @@ import RectBg from './RectBg';
3
3
  const LegendItem = function ({ source, idx, rowHeight, labelWidth, model, exportSVG, }) {
4
4
  const boxHeight = Math.min(20, rowHeight);
5
5
  const { needsCustomLegend, graphType, needsFullHeightScalebar, rowHeightTooSmallForScalebar, renderColorBoxes, } = model;
6
- const svgFontSize = Math.min(rowHeight, 12);
7
- const canDisplayLabel = rowHeight > 11;
8
6
  const colorBoxWidth = renderColorBoxes ? 15 : 0;
9
7
  const legendWidth = labelWidth + colorBoxWidth + 5;
10
8
  const svgOffset = exportSVG ? 10 : 0;
11
9
  const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
12
- return (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? null : (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })), source.color ? (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null, canDisplayLabel ? (_jsx("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize, children: source.name })) : null] }));
10
+ return (_jsxs(_Fragment, { children: [needsFullHeightScalebar ? null : (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: legendWidth, height: boxHeight })), source.color ? (_jsx(RectBg, { y: idx * rowHeight + 1, x: extraOffset, width: colorBoxWidth, height: needsCustomLegend ? rowHeight : boxHeight, color: source.color })) : null] }));
13
11
  };
14
12
  export default LegendItem;
@@ -0,0 +1,10 @@
1
+ import type { Source } from '../../util';
2
+ import type { WiggleDisplayModel } from '../model';
3
+ declare const LegendItemText: ({ source, idx, rowHeight, model, exportSVG, }: {
4
+ source: Source;
5
+ idx: number;
6
+ rowHeight: number;
7
+ model: WiggleDisplayModel;
8
+ exportSVG?: boolean;
9
+ }) => import("react/jsx-runtime").JSX.Element | null;
10
+ export default LegendItemText;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ const LegendItemText = function ({ source, idx, rowHeight, model, exportSVG, }) {
3
+ const { graphType, rowHeightTooSmallForScalebar, renderColorBoxes } = model;
4
+ const svgFontSize = Math.min(rowHeight, 12);
5
+ const canDisplayLabel = rowHeight >= 6;
6
+ const colorBoxWidth = renderColorBoxes ? 15 : 0;
7
+ const svgOffset = exportSVG ? 10 : 0;
8
+ const extraOffset = svgOffset || (graphType && !rowHeightTooSmallForScalebar ? 50 : 0);
9
+ return canDisplayLabel ? (_jsx("text", { y: idx * rowHeight + 13, x: extraOffset + colorBoxWidth + 2, fontSize: svgFontSize, children: source.name })) : null;
10
+ };
11
+ export default LegendItemText;
@@ -1,36 +1,6 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState } from 'react';
3
- import DraggableDialog from '@jbrowse/core/ui/DraggableDialog';
4
- import { useLocalStorage } from '@jbrowse/core/util';
5
- import { Button, DialogActions, DialogContent } from '@mui/material';
6
- import { makeStyles } from 'tss-react/mui';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
7
2
  import SourcesGrid from './SourcesGrid';
8
- const useStyles = makeStyles()({
9
- content: {
10
- minWidth: 800,
11
- },
12
- float: {
13
- float: 'right',
14
- },
15
- });
16
- function HelpfulTips() {
17
- return (_jsxs(_Fragment, { children: ["Helpful tips", _jsxs("ul", { children: [_jsx("li", { children: "You can select rows in the table with the checkboxes" }), _jsx("li", { children: "Multi-select is enabled with shift-click and control-click" }), _jsx("li", { children: "The \"Move selected items up/down\" can re-arrange subtracks" }), _jsx("li", { children: "Sorting the data grid itself can also re-arrange subtracks" }), _jsx("li", { children: "Changes are applied when you hit Submit" }), _jsx("li", { children: "You can click and drag the dialog box to move it on the screen" }), _jsx("li", { children: "Columns in the table can be hidden using a vertical '...' menu on the right side of each column" })] })] }));
18
- }
3
+ import SharedSetColorDialog from './ui/SetColorDialog';
19
4
  export default function SetColorDialog({ model, handleClose, }) {
20
- const { classes } = useStyles();
21
- const { sources } = model;
22
- const [currLayout, setCurrLayout] = useState(structuredClone(sources || []));
23
- const [showTips, setShowTips] = useLocalStorage('multiwiggle-showTips', false);
24
- return (_jsxs(DraggableDialog, { open: true, onClose: handleClose, maxWidth: "xl", title: "Multi-wiggle color/arrangement editor", children: [_jsxs(DialogContent, { className: classes.content, children: [_jsx(Button, { variant: "contained", className: classes.float, onClick: () => {
25
- setShowTips(!showTips);
26
- }, children: showTips ? 'Hide tips' : 'Show tips' }), _jsx("br", {}), showTips ? _jsx(HelpfulTips, {}) : null, _jsx(SourcesGrid, { rows: currLayout, onChange: setCurrLayout, showTips: showTips })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", type: "submit", color: "inherit", onClick: () => {
27
- model.clearLayout();
28
- setCurrLayout(model.sources || []);
29
- }, children: "Clear custom settings" }), _jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
30
- handleClose();
31
- setCurrLayout([...(model.sources || [])]);
32
- }, children: "Cancel" }), _jsx(Button, { variant: "contained", color: "primary", type: "submit", onClick: () => {
33
- model.setLayout(currLayout);
34
- handleClose();
35
- }, children: "Submit" })] })] }));
5
+ return (_jsx(SharedSetColorDialog, { model: model, handleClose: handleClose, title: "Multi-wiggle color/arrangement editor", enableBulkEdit: true, enableRowPalettizer: true, showTipsStorageKey: "multiwiggle-showTips", SourcesGridComponent: SourcesGrid }));
36
6
  }
@@ -22,7 +22,7 @@ function SourcesGrid({ rows, onChange, showTips, }) {
22
22
  const { classes } = useStyles();
23
23
  const [anchorEl, setAnchorEl] = useState(null);
24
24
  const [selected, setSelected] = useState([]);
25
- const { name: _name, color: _color, baseUri: _baseUri, ...rest } = rows[0];
25
+ const { name: _name, color: _color, source: _source, baseUri: _baseUri, ...rest } = rows.length > 0 ? rows[0] : {};
26
26
  const [widgetColor, setWidgetColor] = useState('blue');
27
27
  const [currSort, setCurrSort] = useState({
28
28
  idx: 0,
@@ -13,15 +13,19 @@ const TooltipContents = forwardRef(function TooltipContents2({ model, feature },
13
13
  const source = feature.get('source');
14
14
  const summary = feature.get('summary');
15
15
  const obj = Object.fromEntries(model.sources.map(ent => [ent.name, ent]));
16
- return (_jsxs("div", { ref: ref, children: [[refName, coord].filter(f => !!f).join(':'), _jsx("br", {}), sources ? (_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "color" }), _jsx("th", { children: "source" }), _jsx("th", { children: "score" })] }) }), _jsx("tbody", { children: Object.entries(sources).map(([source, data]) => (_jsxs("tr", { children: [_jsx("td", { children: _jsx("div", { style: {
17
- width: 16,
18
- height: 16,
19
- background: obj[source].color,
20
- } }) }), _jsx("td", { children: source }), _jsx("td", { children: toP(data.score) })] }, source))) })] })) : (_jsxs("span", { children: [source, ' ', summary
16
+ const obj2 = obj[source];
17
+ return (_jsxs("div", { ref: ref, children: [[refName, coord].filter(f => !!f).join(':'), _jsx("br", {}), sources ? (_jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "color" }), _jsx("th", { children: "source" }), _jsx("th", { children: "score" })] }) }), _jsx("tbody", { children: Object.entries(sources).map(([source, data]) => {
18
+ const sourceInfo = obj[source];
19
+ return (_jsxs("tr", { children: [_jsx("td", { children: sourceInfo && (_jsx("div", { style: {
20
+ width: 16,
21
+ height: 16,
22
+ background: sourceInfo.color,
23
+ } })) }), _jsx("td", { children: (sourceInfo === null || sourceInfo === void 0 ? void 0 : sourceInfo.name) || source }), _jsx("td", { children: toP(data.score) })] }, source));
24
+ }) })] })) : (_jsxs("span", { children: [(obj2 === null || obj2 === void 0 ? void 0 : obj2.name) || source, ' ', summary
21
25
  ? `min:${toP(feature.get('minScore'))} avg:${toP(feature.get('score'))} max:${toP(feature.get('maxScore'))}`
22
26
  : toP(feature.get('score'))] }))] }));
23
27
  });
24
- const WiggleTooltip = observer((props) => {
28
+ const WiggleTooltip = observer(function (props) {
25
29
  return _jsx(Tooltip, { useClientY: true, TooltipContents: TooltipContents, ...props });
26
30
  });
27
31
  export default WiggleTooltip;
@@ -21,6 +21,7 @@ const WiggleClusterDialogAuto = observer(function ({ model, children, handleClos
21
21
  } })] })) : null] }), _jsxs("div", { children: [loading ? (_jsxs("div", { style: { padding: 50 }, children: [_jsx("span", { children: progress || 'Loading...' }), _jsx(Button, { onClick: () => {
22
22
  stopStopToken(stopToken);
23
23
  }, children: "Stop" })] })) : null, error ? _jsx(ErrorMessage, { error: error }) : null] })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", disabled: loading, onClick: async () => {
24
+ var _a;
24
25
  try {
25
26
  setError(undefined);
26
27
  setProgress('Initializing');
@@ -46,12 +47,19 @@ const WiggleClusterDialogAuto = observer(function ({ model, children, handleClos
46
47
  setProgress(arg);
47
48
  },
48
49
  }));
50
+ const currentLayout = ((_a = model.layout) === null || _a === void 0 ? void 0 : _a.length)
51
+ ? model.layout
52
+ : sourcesWithoutLayout;
53
+ const sourcesByName = Object.fromEntries(currentLayout.map((s) => [s.name, s]));
49
54
  model.setLayout(ret.order.map(idx => {
50
- const ret = sourcesWithoutLayout[idx];
51
- if (!ret) {
55
+ const sourceItem = sourcesWithoutLayout[idx];
56
+ if (!sourceItem) {
52
57
  throw new Error(`out of bounds at ${idx}`);
53
58
  }
54
- return ret;
59
+ return {
60
+ ...sourceItem,
61
+ ...sourcesByName[sourceItem.name],
62
+ };
55
63
  }));
56
64
  }
57
65
  handleClose();
@@ -61,7 +61,7 @@ const WiggleClusterDialogManuals = observer(function ({ model, handleClose, chil
61
61
  })();
62
62
  }, [model, samplesPerPixel]);
63
63
  const results = ret
64
- ? `inputMatrix<-matrix(c(${Object.values(ret)
64
+ ? String.raw `inputMatrix<-matrix(c(${Object.values(ret)
65
65
  .map(val => val.join(','))
66
66
  .join(',\n')}
67
67
  ),nrow=${Object.values(ret).length},byrow=TRUE)
@@ -69,7 +69,7 @@ rownames(inputMatrix)<-c(${Object.keys(ret)
69
69
  .map(key => `'${key}'`)
70
70
  .join(',')})
71
71
  resultClusters<-hclust(dist(inputMatrix), method='${clusterMethod}')
72
- cat(resultClusters$order,sep='\\n')`
72
+ cat(resultClusters$order,sep='\n')`
73
73
  : undefined;
74
74
  const resultsTsv = ret
75
75
  ? Object.entries(ret)
@@ -102,7 +102,7 @@ cat(resultClusters$order,sep='\\n')`
102
102
  setClusterMethod(key);
103
103
  } }), label: val }, key))) }), _jsxs("div", { style: { marginTop: 20 }, children: [_jsx(Typography, { children: "This procedure samples the data at each 'pixel' across the visible by default" }), _jsx(TextField, { label: "Samples per pixel (>1 for denser sampling, between 0-1 for sparser sampling)", variant: "outlined", size: "small", value: samplesPerPixel, onChange: event => {
104
104
  setSamplesPerPixel(event.target.value);
105
- } })] })] })) : null, results ? (_jsx("div", {})) : loading ? (_jsx(LoadingEllipses, { variant: "h6", title: "Generating score matrix" })) : error ? (_jsx(ErrorMessage, { error: error })) : null] }), _jsxs("div", { children: [_jsx(Typography, { variant: "subtitle2", gutterBottom: true, style: { marginTop: '16px' }, children: "Clustering Results:" }), _jsx(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 => {
105
+ } })] })] })) : null, results ? (_jsx("div", {})) : loading ? (_jsx(LoadingEllipses, { variant: "h6", message: "Generating score matrix" })) : error ? (_jsx(ErrorMessage, { error: error })) : null] }), _jsxs("div", { children: [_jsx(Typography, { variant: "subtitle2", gutterBottom: true, style: { marginTop: '16px' }, children: "Clustering Results:" }), _jsx(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 => {
106
106
  setPaste(event.target.value);
107
107
  }, slotProps: {
108
108
  input: {
@@ -111,20 +111,28 @@ cat(resultClusters$order,sep='\\n')`
111
111
  },
112
112
  },
113
113
  } })] })] })] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", onClick: () => {
114
+ var _a;
114
115
  const { sourcesWithoutLayout } = model;
115
116
  if (sourcesWithoutLayout) {
116
117
  try {
118
+ const currentLayout = ((_a = model.layout) === null || _a === void 0 ? void 0 : _a.length)
119
+ ? model.layout
120
+ : sourcesWithoutLayout;
121
+ const sourcesByName = Object.fromEntries(currentLayout.map((s) => [s.name, s]));
117
122
  model.setLayout(paste
118
123
  .split('\n')
119
124
  .map(t => t.trim())
120
125
  .filter(f => !!f)
121
126
  .map(r => +r)
122
127
  .map(idx => {
123
- const ret = sourcesWithoutLayout[idx - 1];
124
- if (!ret) {
128
+ const sourceItem = sourcesWithoutLayout[idx - 1];
129
+ if (!sourceItem) {
125
130
  throw new Error(`out of bounds at ${idx}`);
126
131
  }
127
- return ret;
132
+ return {
133
+ ...sourceItem,
134
+ ...sourcesByName[sourceItem.name],
135
+ };
128
136
  }));
129
137
  }
130
138
  catch (e) {
@@ -1,7 +1,8 @@
1
- import type { Source } from '../../types';
1
+ import type { Source } from '../../../util';
2
2
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
3
  export interface ReducedModel {
4
4
  sourcesWithoutLayout?: Source[];
5
+ layout?: Source[];
5
6
  adapterConfig: AnyConfigurationModel;
6
7
  setLayout: (arg: Source[]) => void;
7
8
  }
@@ -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 {};