@jbrowse/plugin-wiggle 2.13.1 → 2.14.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 (89) hide show
  1. package/dist/BigWigAdapter/BigWigAdapter.d.ts +1 -1
  2. package/dist/BigWigAdapter/BigWigAdapter.js +1 -1
  3. package/dist/CreateMultiWiggleExtension/ConfirmDialog.js +12 -4
  4. package/dist/LinearWiggleDisplay/components/SetColorDialog.js +12 -4
  5. package/dist/LinearWiggleDisplay/components/Tooltip.d.ts +1 -1
  6. package/dist/LinearWiggleDisplay/components/Tooltip.js +7 -2
  7. package/dist/LinearWiggleDisplay/models/model.d.ts +1 -1
  8. package/dist/LinearWiggleDisplay/models/model.js +10 -4
  9. package/dist/MultiLinearWiggleDisplay/components/ScoreLegend.js +1 -2
  10. package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js +3 -1
  11. package/dist/MultiLinearWiggleDisplay/components/SourcesGrid.js +22 -8
  12. package/dist/MultiLinearWiggleDisplay/components/Tooltip.js +4 -7
  13. package/dist/MultiLinearWiggleDisplay/components/YScaleBars.js +2 -2
  14. package/dist/MultiLinearWiggleDisplay/models/model.d.ts +1 -1
  15. package/dist/MultiLinearWiggleDisplay/models/model.js +16 -6
  16. package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js +1 -1
  17. package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +1 -1
  18. package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js +1 -3
  19. package/dist/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +8 -4
  20. package/dist/MultiWiggleRendering.d.ts +4 -4
  21. package/dist/MultiWiggleRendering.js +6 -3
  22. package/dist/Tooltip.d.ts +1 -1
  23. package/dist/Tooltip.js +1 -1
  24. package/dist/WiggleBaseRenderer.d.ts +1 -1
  25. package/dist/WiggleBaseRenderer.js +1 -1
  26. package/dist/WiggleRPC/MultiWiggleGetSources.d.ts +1 -1
  27. package/dist/WiggleRPC/MultiWiggleGetSources.js +0 -1
  28. package/dist/WiggleRPC/WiggleGetGlobalQuantitativeStats.js +0 -1
  29. package/dist/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.d.ts +2 -2
  30. package/dist/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.js +0 -1
  31. package/dist/WiggleRendering.d.ts +3 -3
  32. package/dist/WiggleRendering.js +3 -3
  33. package/dist/drawDensity.js +5 -3
  34. package/dist/drawLine.js +5 -3
  35. package/dist/drawXY.js +5 -3
  36. package/dist/index.d.ts +3 -3
  37. package/dist/index.js +1 -1
  38. package/dist/shared/SetMinMaxDialog.d.ts +2 -2
  39. package/dist/shared/SetMinMaxDialog.js +6 -2
  40. package/dist/shared/YScaleBar.d.ts +1 -1
  41. package/dist/shared/modelShared.d.ts +5 -5
  42. package/dist/shared/modelShared.js +15 -5
  43. package/dist/util.d.ts +2 -2
  44. package/dist/util.js +8 -11
  45. package/esm/BigWigAdapter/BigWigAdapter.d.ts +1 -1
  46. package/esm/BigWigAdapter/BigWigAdapter.js +1 -1
  47. package/esm/CreateMultiWiggleExtension/ConfirmDialog.js +12 -4
  48. package/esm/LinearWiggleDisplay/components/SetColorDialog.js +12 -4
  49. package/esm/LinearWiggleDisplay/components/Tooltip.d.ts +1 -1
  50. package/esm/LinearWiggleDisplay/components/Tooltip.js +7 -2
  51. package/esm/LinearWiggleDisplay/models/model.d.ts +1 -1
  52. package/esm/LinearWiggleDisplay/models/model.js +10 -4
  53. package/esm/MultiLinearWiggleDisplay/components/ScoreLegend.js +1 -2
  54. package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js +3 -1
  55. package/esm/MultiLinearWiggleDisplay/components/SourcesGrid.js +22 -8
  56. package/esm/MultiLinearWiggleDisplay/components/Tooltip.js +4 -7
  57. package/esm/MultiLinearWiggleDisplay/components/YScaleBars.js +2 -2
  58. package/esm/MultiLinearWiggleDisplay/models/model.d.ts +1 -1
  59. package/esm/MultiLinearWiggleDisplay/models/model.js +16 -6
  60. package/esm/MultiRowLineRenderer/MultiRowLineRenderer.js +1 -1
  61. package/esm/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +1 -1
  62. package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +1 -3
  63. package/esm/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +8 -4
  64. package/esm/MultiWiggleRendering.d.ts +4 -4
  65. package/esm/MultiWiggleRendering.js +6 -3
  66. package/esm/Tooltip.d.ts +1 -1
  67. package/esm/Tooltip.js +1 -1
  68. package/esm/WiggleBaseRenderer.d.ts +1 -1
  69. package/esm/WiggleBaseRenderer.js +1 -1
  70. package/esm/WiggleRPC/MultiWiggleGetSources.d.ts +1 -1
  71. package/esm/WiggleRPC/MultiWiggleGetSources.js +0 -1
  72. package/esm/WiggleRPC/WiggleGetGlobalQuantitativeStats.js +0 -1
  73. package/esm/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.d.ts +2 -2
  74. package/esm/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.js +0 -1
  75. package/esm/WiggleRendering.d.ts +3 -3
  76. package/esm/WiggleRendering.js +3 -3
  77. package/esm/drawDensity.js +5 -3
  78. package/esm/drawLine.js +5 -3
  79. package/esm/drawXY.js +5 -3
  80. package/esm/index.d.ts +3 -3
  81. package/esm/index.js +1 -1
  82. package/esm/shared/SetMinMaxDialog.d.ts +2 -2
  83. package/esm/shared/SetMinMaxDialog.js +6 -2
  84. package/esm/shared/YScaleBar.d.ts +1 -1
  85. package/esm/shared/modelShared.d.ts +5 -5
  86. package/esm/shared/modelShared.js +15 -5
  87. package/esm/util.d.ts +2 -2
  88. package/esm/util.js +8 -11
  89. package/package.json +5 -6
@@ -5,7 +5,7 @@ export default class MultiXYPlotRenderer extends WiggleBaseRenderer {
5
5
  // @ts-expect-error
6
6
  async draw(ctx, props) {
7
7
  const { bpPerPx, sources, regions, features } = props;
8
- const [region] = regions;
8
+ const region = regions[0];
9
9
  const groups = groupBy(features.values(), f => f.get('source'));
10
10
  const height = props.height / sources.length;
11
11
  const width = (region.end - region.start) / bpPerPx;
@@ -24,9 +24,7 @@ class MultiWiggleAdapter extends BaseFeatureDataAdapter {
24
24
  },
25
25
  }));
26
26
  }
27
- return Promise.all(
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- subConfs.map(async (conf) => {
27
+ return Promise.all(subConfs.map(async (conf) => {
30
28
  const dataAdapter = (await getSubAdapter(conf))
31
29
  .dataAdapter;
32
30
  return {
@@ -25,11 +25,13 @@ export default function MultiWiggleWidget({ model }) {
25
25
  React.createElement("ul", null,
26
26
  React.createElement("li", null, "Enter list of URLs for bigwig files in the textbox"),
27
27
  React.createElement("li", null, "Or, use the button below the text box to select files from your computer")),
28
- React.createElement(TextField, { multiline: true, rows: 10, value: val, onChange: event => setVal(event.target.value), placeholder: 'Paste list of URLs here, or use file selector below', variant: "outlined", className: classes.textbox }),
28
+ React.createElement(TextField, { multiline: true, rows: 10, value: val, onChange: event => {
29
+ setVal(event.target.value);
30
+ }, placeholder: 'Paste list of URLs here, or use file selector below', variant: "outlined", className: classes.textbox }),
29
31
  React.createElement(Button, { variant: "outlined", component: "label" },
30
32
  "Choose Files from your computer",
31
33
  React.createElement("input", { type: "file", hidden: true, multiple: true, onChange: ({ target }) => {
32
- const res = [...((target === null || target === void 0 ? void 0 : target.files) || [])].map(file => ({
34
+ const res = [...(target.files || [])].map(file => ({
33
35
  type: 'BigWigAdapter',
34
36
  bigWigLocation: isElectron
35
37
  ? {
@@ -41,13 +43,15 @@ export default function MultiWiggleWidget({ model }) {
41
43
  }));
42
44
  setVal(JSON.stringify(res, null, 2));
43
45
  } })),
44
- React.createElement(TextField, { value: trackName, onChange: event => setTrackName(event.target.value), helperText: "Track name" }),
46
+ React.createElement(TextField, { value: trackName, onChange: event => {
47
+ setTrackName(event.target.value);
48
+ }, helperText: "Track name" }),
45
49
  React.createElement(Button, { variant: "contained", className: classes.submit, onClick: () => {
46
50
  var _a;
47
51
  const session = getSession(model);
48
52
  const trackId = [
49
53
  `${trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
50
- `${session.adminMode ? '' : '-sessionTrack'}`,
54
+ session.adminMode ? '' : '-sessionTrack',
51
55
  ].join('');
52
56
  // allow list of bigwigs in JSON format or line-by-line
53
57
  let bigWigs;
@@ -8,13 +8,13 @@ declare const MultiWiggleRendering: (props: {
8
8
  bpPerPx: number;
9
9
  width: number;
10
10
  height: number;
11
- onMouseLeave: Function;
12
- onMouseMove: Function;
13
- onFeatureClick: Function;
14
11
  blockKey: string;
15
12
  sources: Source[];
16
- displayModel: {
13
+ displayModel?: {
17
14
  isMultiRow: boolean;
18
15
  };
16
+ onMouseLeave?: (event: React.MouseEvent) => void;
17
+ onMouseMove?: (event: React.MouseEvent, arg?: Feature) => void;
18
+ onFeatureClick?: (event: React.MouseEvent, arg?: Feature) => void;
19
19
  }) => React.JSX.Element;
20
20
  export default MultiWiggleRendering;
@@ -4,8 +4,9 @@ import { SimpleFeature } from '@jbrowse/core/util';
4
4
  import { PrerenderedCanvas } from '@jbrowse/core/ui';
5
5
  const MultiWiggleRendering = observer(function (props) {
6
6
  const { regions, features, bpPerPx, width, height, sources, onMouseLeave = () => { }, onMouseMove = () => { }, onFeatureClick = () => { }, displayModel, } = props;
7
- const [region] = regions;
7
+ const region = regions[0];
8
8
  const ref = useRef(null);
9
+ const { isMultiRow } = displayModel || {};
9
10
  function getFeatureUnderMouse(eventClientX, eventClientY) {
10
11
  if (!ref.current) {
11
12
  return;
@@ -20,7 +21,7 @@ const MultiWiggleRendering = observer(function (props) {
20
21
  const px = region.reversed ? width - offsetX : offsetX;
21
22
  const mouseoverBp = region.start + bpPerPx * px;
22
23
  let featureUnderMouse;
23
- if (displayModel.isMultiRow) {
24
+ if (isMultiRow) {
24
25
  for (const feature of features.values()) {
25
26
  if (feature.get('source') !== source.name) {
26
27
  continue;
@@ -66,7 +67,9 @@ const MultiWiggleRendering = observer(function (props) {
66
67
  const { clientX, clientY } = event;
67
68
  const featureUnderMouse = getFeatureUnderMouse(clientX, clientY);
68
69
  onFeatureClick(event, featureUnderMouse);
69
- }, onMouseLeave: event => onMouseLeave(event), style: {
70
+ }, onMouseLeave: event => {
71
+ onMouseLeave(event);
72
+ }, style: {
70
73
  overflow: 'visible',
71
74
  position: 'relative',
72
75
  height,
package/esm/Tooltip.d.ts CHANGED
@@ -7,7 +7,7 @@ export type TooltipContentsComponent = React.ForwardRefExoticComponent<{
7
7
  } & React.RefAttributes<HTMLDivElement>>;
8
8
  declare const Tooltip: ({ model, height, clientMouseCoord, offsetMouseCoord, clientRect, TooltipContents, useClientY, }: {
9
9
  model: {
10
- featureUnderMouse: Feature;
10
+ featureUnderMouse?: Feature;
11
11
  };
12
12
  useClientY?: boolean;
13
13
  height: number;
package/esm/Tooltip.js CHANGED
@@ -45,7 +45,7 @@ const Tooltip = observer(function Tooltip({ model, height, clientMouseCoord, off
45
45
  const y = useClientY ? clientMouseCoord[1] : (clientRect === null || clientRect === void 0 ? void 0 : clientRect.top) || 0;
46
46
  const clientPoint = useClientPoint(context, { x, y });
47
47
  const { getFloatingProps } = useInteractions([clientPoint]);
48
- const popperTheme = (_a = theme === null || theme === void 0 ? void 0 : theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
48
+ const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
49
49
  return featureUnderMouse ? (React.createElement(React.Fragment, null,
50
50
  React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
51
51
  React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
@@ -52,6 +52,6 @@ export default abstract class WiggleBaseRenderer extends FeatureRendererType {
52
52
  * draw features to context given props, to be used by derived renderer
53
53
  * classes
54
54
  */
55
- abstract draw<T extends RenderArgsDeserializedWithFeatures>(ctx: CanvasRenderingContext2D, props: T): Promise<Record<string, unknown> | void>;
55
+ abstract draw<T extends RenderArgsDeserializedWithFeatures>(ctx: CanvasRenderingContext2D, props: T): Promise<Record<string, unknown> | undefined>;
56
56
  }
57
57
  export { type RenderArgsSerialized, type RenderResults, type ResultsDeserialized, type ResultsSerialized, } from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
@@ -8,7 +8,7 @@ export default class WiggleBaseRenderer extends FeatureRendererType {
8
8
  async render(renderProps) {
9
9
  const features = await this.getFeatures(renderProps);
10
10
  const { height, regions, bpPerPx } = renderProps;
11
- const [region] = regions;
11
+ const region = regions[0];
12
12
  const width = (region.end - region.start) / bpPerPx;
13
13
  // @ts-expect-error
14
14
  const { reducedFeatures, ...rest } = await renderToAbstractCanvas(width, height, renderProps, ctx => this.draw(ctx, {
@@ -9,7 +9,7 @@ export declare class MultiWiggleGetSources extends RpcMethodType {
9
9
  serializeArguments(args: RenderArgs & {
10
10
  signal?: AbortSignal;
11
11
  statusCallback?: (arg: string) => void;
12
- }, rpcDriverClassName: string): Promise<{}>;
12
+ }, rpcDriverClassName: string): Promise<Record<string, unknown>>;
13
13
  execute(args: {
14
14
  adapterConfig: AnyConfigurationModel;
15
15
  signal?: RemoteAbortSignal;
@@ -7,7 +7,6 @@ export class MultiWiggleGetSources extends RpcMethodType {
7
7
  super(...arguments);
8
8
  this.name = 'MultiWiggleGetSources';
9
9
  }
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
10
  async deserializeArguments(args, rpcDriverClassName) {
12
11
  const l = await super.deserializeArguments(args, rpcDriverClassName);
13
12
  return {
@@ -6,7 +6,6 @@ export class WiggleGetGlobalQuantitativeStats extends RpcMethodType {
6
6
  super(...arguments);
7
7
  this.name = 'WiggleGetGlobalQuantitativeStats';
8
8
  }
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
9
  async deserializeArguments(args, rpcDriverClassName) {
11
10
  const l = await super.deserializeArguments(args, rpcDriverClassName);
12
11
  return {
@@ -8,9 +8,9 @@ export declare class WiggleGetMultiRegionQuantitativeStats extends RpcMethodType
8
8
  serializeArguments(args: RenderArgs & {
9
9
  signal?: AbortSignal;
10
10
  statusCallback?: (arg: string) => void;
11
- }, rpcDriverClassName: string): Promise<{}>;
11
+ }, rpcDriverClassName: string): Promise<Record<string, unknown>>;
12
12
  execute(args: {
13
- adapterConfig: {};
13
+ adapterConfig: Record<string, unknown>;
14
14
  signal?: RemoteAbortSignal;
15
15
  sessionId: string;
16
16
  headers?: Record<string, string>;
@@ -7,7 +7,6 @@ export class WiggleGetMultiRegionQuantitativeStats extends RpcMethodType {
7
7
  super(...arguments);
8
8
  this.name = 'WiggleGetMultiRegionQuantitativeStats';
9
9
  }
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
10
  async deserializeArguments(args, rpcDriverClassName) {
12
11
  const l = await super.deserializeArguments(args, rpcDriverClassName);
13
12
  return {
@@ -7,9 +7,9 @@ declare const WiggleRendering: (props: {
7
7
  bpPerPx: number;
8
8
  width: number;
9
9
  height: number;
10
- onMouseLeave: Function;
11
- onMouseMove: Function;
12
- onFeatureClick: Function;
13
10
  blockKey: string;
11
+ onMouseLeave?: (event: React.MouseEvent) => void;
12
+ onMouseMove?: (event: React.MouseEvent, arg?: string) => void;
13
+ onFeatureClick?: (event: React.MouseEvent, arg?: string) => void;
14
14
  }) => React.JSX.Element;
15
15
  export default WiggleRendering;
@@ -2,8 +2,8 @@ import { observer } from 'mobx-react';
2
2
  import React, { useRef } from 'react';
3
3
  import { PrerenderedCanvas } from '@jbrowse/core/ui';
4
4
  const WiggleRendering = observer(function (props) {
5
- const { regions, features, bpPerPx, width, height, onMouseLeave = () => { }, onMouseMove = () => { }, onFeatureClick = () => { }, } = props;
6
- const [region] = regions;
5
+ const { regions, features, bpPerPx, width, height, onMouseLeave, onMouseMove, onFeatureClick, } = props;
6
+ const region = regions[0];
7
7
  const ref = useRef(null);
8
8
  function getFeatureUnderMouse(eventClientX) {
9
9
  // calculates feature under mouse
@@ -25,7 +25,7 @@ const WiggleRendering = observer(function (props) {
25
25
  }
26
26
  return featureUnderMouse;
27
27
  }
28
- return (React.createElement("div", { ref: ref, "data-testid": "wiggle-rendering-test", onMouseMove: event => { var _a; return onMouseMove(event, (_a = getFeatureUnderMouse(event.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onClick: event => { var _a; return onFeatureClick(event, (_a = getFeatureUnderMouse(event.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onMouseLeave: event => onMouseLeave(event), style: {
28
+ return (React.createElement("div", { ref: ref, "data-testid": "wiggle-rendering-test", onMouseMove: e => { var _a; return onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(e, (_a = getFeatureUnderMouse(e.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onClick: e => { var _a; return onFeatureClick === null || onFeatureClick === void 0 ? void 0 : onFeatureClick(e, (_a = getFeatureUnderMouse(e.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onMouseLeave: e => onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e), style: {
29
29
  overflow: 'visible',
30
30
  position: 'relative',
31
31
  height,
@@ -6,7 +6,7 @@ const fudgeFactor = 0.3;
6
6
  const clipHeight = 2;
7
7
  export function drawDensity(ctx, props) {
8
8
  const { features, regions, bpPerPx, scaleOpts, height, config } = props;
9
- const [region] = regions;
9
+ const region = regions[0];
10
10
  const pivot = readConfObject(config, 'bicolorPivot');
11
11
  const pivotValue = readConfObject(config, 'bicolorPivotValue');
12
12
  const negColor = readConfObject(config, 'negColor');
@@ -23,8 +23,10 @@ export function drawDensity(ctx, props) {
23
23
  const cb = color === '#f0f'
24
24
  ? (_, score) => scale(score)
25
25
  : (feature, score) => readConfObject(config, 'color', { feature, score });
26
- const [niceMin, niceMax] = scale2.domain();
27
- let prevLeftPx = -Infinity;
26
+ const domain = scale2.domain();
27
+ const niceMin = domain[0];
28
+ const niceMax = domain[1];
29
+ let prevLeftPx = Number.NEGATIVE_INFINITY;
28
30
  let hasClipping = false;
29
31
  const reducedFeatures = [];
30
32
  for (const feature of features.values()) {
package/esm/drawLine.js CHANGED
@@ -6,7 +6,7 @@ const fudgeFactor = 0.3;
6
6
  const clipHeight = 2;
7
7
  export function drawLine(ctx, props) {
8
8
  const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, } = props;
9
- const [region] = regions;
9
+ const region = regions[0];
10
10
  const width = (region.end - region.start) / bpPerPx;
11
11
  // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
12
12
  // wiggle display, and makes the height of the actual drawn area add
@@ -14,10 +14,12 @@ export function drawLine(ctx, props) {
14
14
  const height = unadjustedHeight - offset * 2;
15
15
  const clipColor = readConfObject(config, 'clipColor');
16
16
  const scale = getScale({ ...scaleOpts, range: [0, height] });
17
- const [niceMin, niceMax] = scale.domain();
17
+ const domain = scale.domain();
18
+ const niceMin = domain[0];
19
+ const niceMax = domain[1];
18
20
  const toY = (n) => clamp(height - (scale(n) || 0), 0, height) + offset;
19
21
  let lastVal;
20
- let prevLeftPx = -Infinity;
22
+ let prevLeftPx = Number.NEGATIVE_INFINITY;
21
23
  const reducedFeatures = [];
22
24
  for (const feature of features.values()) {
23
25
  const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
package/esm/drawXY.js CHANGED
@@ -17,7 +17,7 @@ const fudgeFactor = 0.3;
17
17
  const clipHeight = 2;
18
18
  export function drawXY(ctx, props) {
19
19
  const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, } = props;
20
- const [region] = regions;
20
+ const region = regions[0];
21
21
  const width = (region.end - region.start) / bpPerPx;
22
22
  // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
23
23
  // wiggle display, and makes the height of the actual drawn area add
@@ -30,12 +30,14 @@ export function drawXY(ctx, props) {
30
30
  const minSize = readConfObject(config, 'minSize');
31
31
  const scale = getScale({ ...scaleOpts, range: [0, height] });
32
32
  const originY = getOrigin(scaleOpts.scaleType);
33
- const [niceMin, niceMax] = scale.domain();
33
+ const domain = scale.domain();
34
+ const niceMin = domain[0];
35
+ const niceMax = domain[1];
34
36
  const toY = (n) => clamp(height - (scale(n) || 0), 0, height) + offset;
35
37
  const toOrigin = (n) => toY(originY) - toY(n);
36
38
  const getHeight = (n) => (filled ? toOrigin(n) : Math.max(minSize, 1));
37
39
  let hasClipping = false;
38
- let prevLeftPx = -Infinity;
40
+ let prevLeftPx = Number.NEGATIVE_INFINITY;
39
41
  const reducedFeatures = [];
40
42
  const crossingOrigin = niceMin < pivotValue && niceMax > pivotValue;
41
43
  // we handle whiskers separately to render max row, min row, and avg in three
package/esm/index.d.ts CHANGED
@@ -17,10 +17,10 @@ export default class WigglePlugin extends Plugin {
17
17
  bpPerPx: number;
18
18
  width: number;
19
19
  height: number;
20
- onMouseLeave: Function;
21
- onMouseMove: Function;
22
- onFeatureClick: Function;
23
20
  blockKey: string;
21
+ onMouseLeave?: (event: import("react").MouseEvent) => void;
22
+ onMouseMove?: (event: import("react").MouseEvent, arg?: string) => void;
23
+ onFeatureClick?: (event: import("react").MouseEvent, arg?: string) => void;
24
24
  }) => import("react").JSX.Element;
25
25
  XYPlotRenderer: typeof XYPlotRenderer;
26
26
  WiggleBaseRenderer: typeof WiggleBaseRenderer;
package/esm/index.js CHANGED
@@ -65,7 +65,7 @@ export default class WigglePlugin extends Plugin {
65
65
  if (regexGuess.test(fileName) && !hint) {
66
66
  return obj;
67
67
  }
68
- else if (hint === adapterName) {
68
+ if (hint === adapterName) {
69
69
  return obj;
70
70
  }
71
71
  return cb(file, index, hint);
@@ -4,8 +4,8 @@ export default function SetMinMaxDialog(props: {
4
4
  minScore: number;
5
5
  maxScore: number;
6
6
  scaleType: string;
7
- setMinScore: Function;
8
- setMaxScore: Function;
7
+ setMinScore: (arg?: number) => void;
8
+ setMaxScore: (arg?: number) => void;
9
9
  };
10
10
  handleClose: () => void;
11
11
  }): React.JSX.Element;
@@ -15,8 +15,12 @@ export default function SetMinMaxDialog(props) {
15
15
  React.createElement(Typography, null, "Enter min/max score: "),
16
16
  !ok ? (React.createElement(Typography, { color: "error" }, "Max is greater than or equal to min")) : null,
17
17
  !logOk ? (React.createElement(Typography, { color: "error" }, "Min score should be greater than 0 for log scale")) : null,
18
- React.createElement(TextField, { value: min, onChange: event => setMin(event.target.value), placeholder: "Enter min score" }),
19
- React.createElement(TextField, { value: max, onChange: event => setMax(event.target.value), placeholder: "Enter max score" })),
18
+ React.createElement(TextField, { value: min, onChange: event => {
19
+ setMin(event.target.value);
20
+ }, placeholder: "Enter min score" }),
21
+ React.createElement(TextField, { value: max, onChange: event => {
22
+ setMax(event.target.value);
23
+ }, placeholder: "Enter max score" })),
20
24
  React.createElement(DialogActions, null,
21
25
  React.createElement(Button, { variant: "contained", color: "primary", type: "submit", style: { marginLeft: 20 }, disabled: !ok, onClick: () => {
22
26
  model.setMinScore(min !== '' && !Number.isNaN(+min) ? +min : undefined);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { axisPropsFromTickScale } from 'react-d3-axis-mod';
2
+ import type { axisPropsFromTickScale } from 'react-d3-axis-mod';
3
3
  type Ticks = ReturnType<typeof axisPropsFromTickScale>;
4
4
  declare const YScaleBar: ({ model, orientation, }: {
5
5
  model: {
@@ -181,7 +181,7 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
181
181
  error: unknown;
182
182
  message: string | undefined;
183
183
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
184
- onHorizontalScroll?: Function;
184
+ onHorizontalScroll?: () => void;
185
185
  blockState?: Record<string, any>;
186
186
  }>;
187
187
  readonly DisplayBlurb: import("react").FC<{
@@ -407,10 +407,10 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
407
407
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
408
408
  setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
409
409
  [x: string]: any;
410
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
411
- } & import("mobx-state-tree" /**
412
- * #property
413
- */).IStateTreeNode<AnyConfigurationSchemaType>);
410
+ } & import("mobx-state-tree/dist/internal" /**
411
+ * #property
412
+ */).NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
413
+ } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
414
414
  } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
415
415
  /**
416
416
  * #getter
@@ -385,11 +385,15 @@ export default function SharedWiggleMixin(configSchema) {
385
385
  subMenu: [
386
386
  {
387
387
  label: 'Finer resolution',
388
- onClick: () => self.setResolution(self.resolution * 5),
388
+ onClick: () => {
389
+ self.setResolution(self.resolution * 5);
390
+ },
389
391
  },
390
392
  {
391
393
  label: 'Coarser resolution',
392
- onClick: () => self.setResolution(self.resolution / 5),
394
+ onClick: () => {
395
+ self.setResolution(self.resolution / 5);
396
+ },
393
397
  },
394
398
  ],
395
399
  },
@@ -399,14 +403,18 @@ export default function SharedWiggleMixin(configSchema) {
399
403
  label: elt,
400
404
  type: 'radio',
401
405
  checked: self.summaryScoreModeSetting === elt,
402
- onClick: () => self.setSummaryScoreMode(elt),
406
+ onClick: () => {
407
+ self.setSummaryScoreMode(elt);
408
+ },
403
409
  })),
404
410
  },
405
411
  ]
406
412
  : []),
407
413
  {
408
414
  label: self.scaleType === 'log' ? 'Set linear scale' : 'Set log scale',
409
- onClick: () => self.toggleLogScale(),
415
+ onClick: () => {
416
+ self.toggleLogScale();
417
+ },
410
418
  },
411
419
  {
412
420
  label: 'Autoscale type',
@@ -423,7 +431,9 @@ export default function SharedWiggleMixin(configSchema) {
423
431
  label,
424
432
  type: 'radio',
425
433
  checked: self.autoscaleType === val,
426
- onClick: () => self.setAutoscale(val),
434
+ onClick: () => {
435
+ self.setAutoscale(val);
436
+ },
427
437
  })),
428
438
  },
429
439
  {
package/esm/util.d.ts CHANGED
@@ -25,7 +25,7 @@ export interface Source {
25
25
  * - pivotValue (number)
26
26
  * - inverted (boolean)
27
27
  */
28
- export declare function getScale({ domain, range, scaleType, pivotValue, inverted, }: ScaleOpts): import("d3-scale").ScaleLinear<number, number, never> | import("d3-scale").ScaleQuantize<number, never>;
28
+ export declare function getScale({ domain, range, scaleType, pivotValue, inverted, }: ScaleOpts): import("@mui/x-charts-vendor/d3-scale").ScaleLinear<number, number, never> | import("@mui/x-charts-vendor/d3-scale").ScaleLogarithmic<number, number, never> | import("@mui/x-charts-vendor/d3-scale").ScaleQuantize<number, never>;
29
29
  /**
30
30
  * gets the origin for drawing the graph. for linear this is 0, for log this is arbitrarily set to log(1)==0
31
31
  *
@@ -56,7 +56,7 @@ export declare function getQuantitativeStats(self: {
56
56
  }, opts: {
57
57
  headers?: Record<string, string>;
58
58
  signal?: AbortSignal;
59
- filters?: string[];
59
+ filters: string[];
60
60
  }): Promise<QuantitativeStats>;
61
61
  export declare function quantitativeStatsAutorun(self: {
62
62
  featureDensityStatsReady: boolean;
package/esm/util.js CHANGED
@@ -1,4 +1,4 @@
1
- import { scaleLinear, scaleLog, scaleQuantize } from 'd3-scale';
1
+ import { scaleLinear, scaleLog, scaleQuantize, } from '@mui/x-charts-vendor/d3-scale';
2
2
  import { autorun } from 'mobx';
3
3
  import { isAbortException, getSession, getContainingView, } from '@jbrowse/core/util';
4
4
  import { getRpcSessionId } from '@jbrowse/core/util/tracks';
@@ -26,8 +26,7 @@ export function getScale({ domain = [], range = [], scaleType, pivotValue, inver
26
26
  scale = scaleLinear();
27
27
  }
28
28
  else if (scaleType === 'log') {
29
- scale = scaleLog();
30
- scale.base(2);
29
+ scale = scaleLog().base(2);
31
30
  }
32
31
  else if (scaleType === 'quantize') {
33
32
  scale = scaleQuantize();
@@ -97,9 +96,6 @@ export function getNiceDomain({ scaleType, domain, bounds, }) {
97
96
  min = 1;
98
97
  }
99
98
  }
100
- if (min === undefined || max === undefined) {
101
- throw new Error('invalid domain supplied to stats function');
102
- }
103
99
  if (minScore !== undefined && minScore !== Number.MIN_VALUE) {
104
100
  min = minScore;
105
101
  }
@@ -127,7 +123,7 @@ export function getNiceDomain({ scaleType, domain, bounds, }) {
127
123
  }
128
124
  export async function getQuantitativeStats(self, opts) {
129
125
  const { rpcManager } = getSession(self);
130
- const nd = getConf(self, 'numStdDev') || 3;
126
+ const numStdDev = getConf(self, 'numStdDev') || 3;
131
127
  const { adapterConfig, autoscaleType } = self;
132
128
  const sessionId = getRpcSessionId(self);
133
129
  const params = {
@@ -149,8 +145,8 @@ export async function getQuantitativeStats(self, opts) {
149
145
  return autoscaleType === 'globalsd'
150
146
  ? {
151
147
  ...results,
152
- scoreMin: scoreMin >= 0 ? 0 : scoreMean - nd * scoreStdDev,
153
- scoreMax: scoreMean + nd * scoreStdDev,
148
+ scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
149
+ scoreMax: scoreMean + numStdDev * scoreStdDev,
154
150
  }
155
151
  : results;
156
152
  }
@@ -175,8 +171,8 @@ export async function getQuantitativeStats(self, opts) {
175
171
  return autoscaleType === 'localsd'
176
172
  ? {
177
173
  ...results,
178
- scoreMin: scoreMin >= 0 ? 0 : scoreMean - nd * scoreStdDev,
179
- scoreMax: scoreMean + nd * scoreStdDev,
174
+ scoreMin: scoreMin >= 0 ? 0 : scoreMean - numStdDev * scoreStdDev,
175
+ scoreMax: scoreMean + numStdDev * scoreStdDev,
180
176
  }
181
177
  : results;
182
178
  }
@@ -200,6 +196,7 @@ export function quantitativeStatsAutorun(self) {
200
196
  const statsRegion = JSON.stringify(view.dynamicBlocks);
201
197
  const wiggleStats = await getQuantitativeStats(self, {
202
198
  signal: aborter.signal,
199
+ filters: [],
203
200
  ...self.renderProps(),
204
201
  });
205
202
  if (isAlive(self)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-wiggle",
3
- "version": "2.13.1",
3
+ "version": "2.14.0",
4
4
  "description": "JBrowse 2 wiggle adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "build": "npm-run-all build:*",
27
- "test": "cd ../..; jest plugins/wiggle",
27
+ "test": "cd ../..; jest --passWithNoTests plugins/wiggle",
28
28
  "prepublishOnly": "yarn test",
29
29
  "prepack": "yarn build && yarn useDist",
30
30
  "postpack": "yarn useSrc",
@@ -37,12 +37,11 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@floating-ui/react": "^0.26.3",
40
- "@gmod/bbi": "^4.0.0",
40
+ "@gmod/bbi": "^5.0.0",
41
41
  "@mui/icons-material": "^5.0.2",
42
+ "@mui/x-charts-vendor": "^7.12.0",
42
43
  "@mui/x-data-grid": "^7.0.0",
43
44
  "clone": "^2.1.2",
44
- "d3-color": "^3.0.2",
45
- "d3-scale": "^3.0.2",
46
45
  "fast-deep-equal": "^3.1.3",
47
46
  "is-object": "^1.0.1",
48
47
  "react-d3-axis-mod": "^0.1.9",
@@ -66,5 +65,5 @@
66
65
  "distModule": "esm/index.js",
67
66
  "srcModule": "src/index.ts",
68
67
  "module": "esm/index.js",
69
- "gitHead": "fcebca71cc1d066654603e1a9accfa6c6d4f764d"
68
+ "gitHead": "9fb8231d932db40adf0a283081765431756c66ff"
70
69
  }