@jbrowse/plugin-dotplot-view 2.15.0 → 2.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/DotplotDisplay/stateModelFactory.d.ts +6 -1
  2. package/dist/DotplotRenderer/DotplotRenderer.d.ts +1 -9
  3. package/dist/DotplotRenderer/DotplotRenderer.js +25 -214
  4. package/dist/DotplotRenderer/drawDotplot.d.ts +21 -0
  5. package/dist/DotplotRenderer/drawDotplot.js +216 -0
  6. package/dist/DotplotView/components/{DotplotTooltip.d.ts → DotplotTooltipClick.d.ts} +2 -8
  7. package/dist/DotplotView/components/DotplotTooltipClick.js +21 -0
  8. package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +10 -0
  9. package/dist/DotplotView/components/DotplotTooltipMouseover.js +20 -0
  10. package/dist/DotplotView/components/DotplotView.js +6 -3
  11. package/dist/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +2 -2
  12. package/dist/DotplotView/components/ImportForm/ImportCustomTrack.js +27 -6
  13. package/dist/DotplotView/model.d.ts +1 -0
  14. package/esm/DotplotDisplay/stateModelFactory.d.ts +6 -1
  15. package/esm/DotplotRenderer/DotplotRenderer.d.ts +1 -9
  16. package/esm/DotplotRenderer/DotplotRenderer.js +2 -214
  17. package/esm/DotplotRenderer/drawDotplot.d.ts +21 -0
  18. package/esm/DotplotRenderer/drawDotplot.js +213 -0
  19. package/esm/DotplotView/components/{DotplotTooltip.d.ts → DotplotTooltipClick.d.ts} +2 -8
  20. package/esm/DotplotView/components/DotplotTooltipClick.js +15 -0
  21. package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +10 -0
  22. package/esm/DotplotView/components/DotplotTooltipMouseover.js +15 -0
  23. package/esm/DotplotView/components/DotplotView.js +7 -4
  24. package/esm/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +2 -2
  25. package/esm/DotplotView/components/ImportForm/ImportCustomTrack.js +27 -6
  26. package/esm/DotplotView/model.d.ts +1 -0
  27. package/package.json +2 -2
  28. package/dist/DotplotView/components/DotplotTooltip.js +0 -84
  29. package/esm/DotplotView/components/DotplotTooltip.js +0 -78
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { observer } from 'mobx-react';
3
+ import BaseTooltip from '@jbrowse/core/ui/BaseTooltip';
4
+ import { locstr } from './util';
5
+ const DotplotTooltipMouseover = observer(function ({ model, mouserect, mouserectClient, xdistance, }) {
6
+ const { hview, vview, viewHeight } = model;
7
+ return mouserect ? (React.createElement(BaseTooltip, { placement: xdistance < 0 ? 'left' : 'right', clientPoint: mouserectClient
8
+ ? { x: mouserectClient[0], y: mouserectClient[1] }
9
+ : undefined },
10
+ `x - ${locstr(mouserect[0], hview)}`,
11
+ React.createElement("br", null),
12
+ `y - ${locstr(viewHeight - mouserect[1], vview)}`,
13
+ React.createElement("br", null))) : null;
14
+ });
15
+ export default DotplotTooltipMouseover;
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useRef } from 'react';
1
+ import React, { useState, useEffect, useRef, lazy, Suspense } from 'react';
2
2
  import { LoadingEllipses, Menu, ResizeHandle } from '@jbrowse/core/ui';
3
3
  import { observer } from 'mobx-react';
4
4
  import { transaction } from 'mobx';
@@ -7,7 +7,8 @@ import ImportForm from './ImportForm';
7
7
  import Header from './Header';
8
8
  import Grid from './Grid';
9
9
  import { VerticalAxis, HorizontalAxis } from './Axes';
10
- import { TooltipWhereClicked, TooltipWhereMouseovered } from './DotplotTooltip';
10
+ const TooltipWhereClicked = lazy(() => import('./DotplotTooltipClick'));
11
+ const TooltipWhereMouseovered = lazy(() => import('./DotplotTooltipMouseover'));
11
12
  const blank = { left: 0, top: 0, width: 0, height: 0 };
12
13
  const useStyles = makeStyles()(theme => ({
13
14
  spacer: {
@@ -194,8 +195,10 @@ const DotplotViewInternal = observer(function ({ model, }) {
194
195
  React.createElement(VerticalAxis, { model: model }),
195
196
  React.createElement(HorizontalAxis, { model: model }),
196
197
  React.createElement("div", { ref: ref, className: classes.content },
197
- mouseOvered && validSelect ? (React.createElement(TooltipWhereMouseovered, { model: model, mouserect: mouserect, mouserectClient: mouserectClient, xdistance: xdistance })) : null,
198
- validSelect ? (React.createElement(TooltipWhereClicked, { model: model, mousedown: mousedown, mousedownClient: mousedownClient, xdistance: xdistance, ydistance: ydistance })) : null,
198
+ mouseOvered && validSelect ? (React.createElement(Suspense, { fallback: null },
199
+ React.createElement(TooltipWhereMouseovered, { model: model, mouserect: mouserect, mouserectClient: mouserectClient, xdistance: xdistance }))) : null,
200
+ validSelect ? (React.createElement(Suspense, { fallback: null },
201
+ React.createElement(TooltipWhereClicked, { model: model, mousedown: mousedown, mousedownClient: mousedownClient, xdistance: xdistance, ydistance: ydistance }))) : null,
199
202
  React.createElement("div", { style: { cursor: ctrlKeyDown ? 'pointer' : cursorMode }, onMouseDown: event => {
200
203
  if (event.button === 0) {
201
204
  const { clientX, clientY } = event;
@@ -2,10 +2,10 @@ import React from 'react';
2
2
  import { SnapshotIn } from 'mobx-state-tree';
3
3
  import { AnyConfigurationModel } from '@jbrowse/core/configuration';
4
4
  type Conf = SnapshotIn<AnyConfigurationModel>;
5
- declare const OpenTrack: ({ assembly1, assembly2, setSessionTrackData, }: {
5
+ declare const ImportCustomTrack: ({ assembly1, assembly2, setSessionTrackData, }: {
6
6
  sessionTrackData: Conf;
7
7
  assembly1: string;
8
8
  assembly2: string;
9
9
  setSessionTrackData: (arg: Conf) => void;
10
10
  }) => React.JSX.Element;
11
- export default OpenTrack;
11
+ export default ImportCustomTrack;
@@ -3,7 +3,7 @@ import { FormControlLabel, Grid, Paper, Radio, RadioGroup, Typography, } from '@
3
3
  import { ErrorMessage, FileSelector } from '@jbrowse/core/ui';
4
4
  import { observer } from 'mobx-react';
5
5
  import { basename, extName, getName, stripGz } from './util';
6
- function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Location, bed2Location, }) {
6
+ function getAdapter({ radioOption, assembly1, assembly2, fileLocation, indexFileLocation, bed1Location, bed2Location, }) {
7
7
  if (radioOption === '.paf') {
8
8
  return {
9
9
  type: 'PAFAdapter',
@@ -54,14 +54,23 @@ function getAdapter({ radioOption, assembly1, assembly2, fileLocation, bed1Locat
54
54
  assemblyNames: [assembly1, assembly2],
55
55
  };
56
56
  }
57
+ else if (radioOption === '.pif.gz') {
58
+ return {
59
+ type: 'PairwiseIndexedPAFAdapter',
60
+ pifGzLocation: fileLocation,
61
+ index: { location: indexFileLocation },
62
+ assemblyNames: [assembly1, assembly2],
63
+ };
64
+ }
57
65
  else {
58
66
  throw new Error(`Unknown to detect type ${radioOption} from filename (select radio button to clarify)`);
59
67
  }
60
68
  }
61
- const OpenTrack = observer(({ assembly1, assembly2, setSessionTrackData, }) => {
69
+ const ImportCustomTrack = observer(function ({ assembly1, assembly2, setSessionTrackData, }) {
62
70
  const [bed2Location, setBed2Location] = useState();
63
71
  const [bed1Location, setBed1Location] = useState();
64
72
  const [fileLocation, setFileLocation] = useState();
73
+ const [indexFileLocation, setIndexFileLocation] = useState();
65
74
  const [value, setValue] = useState('');
66
75
  const [error, setError] = useState();
67
76
  const fileName = getName(fileLocation);
@@ -82,6 +91,7 @@ const OpenTrack = observer(({ assembly1, assembly2, setSessionTrackData, }) => {
82
91
  assembly1,
83
92
  assembly2,
84
93
  fileLocation,
94
+ indexFileLocation,
85
95
  bed1Location,
86
96
  bed2Location,
87
97
  }),
@@ -99,12 +109,13 @@ const OpenTrack = observer(({ assembly1, assembly2, setSessionTrackData, }) => {
99
109
  bed1Location,
100
110
  bed2Location,
101
111
  fileLocation,
112
+ indexFileLocation,
102
113
  radioOption,
103
114
  setSessionTrackData,
104
115
  ]);
105
116
  return (React.createElement(Paper, { style: { padding: 12 } },
106
117
  error ? React.createElement(ErrorMessage, { error: error }) : null,
107
- React.createElement(Typography, { style: { textAlign: 'center' } }, "Add a .paf, .out (MashMap), .delta (Mummer), .chain, .anchors or .anchors.simple (MCScan) file to view in the dotplot. These file types can also be gzipped. The first assembly should be the query sequence (e.g. left column of the PAF) and the second assembly should be the target sequence (e.g. right column of the PAF)"),
118
+ React.createElement(Typography, { style: { textAlign: 'center' } }, "Add a .paf, .out (MashMap), .delta (Mummer), .chain, .anchors or .anchors.simple (MCScan) file to view. These file types can also be gzipped. The first assembly should be the query sequence (e.g. left column of the PAF) and the second assembly should be the target sequence (e.g. right column of the PAF)"),
108
119
  React.createElement(RadioGroup, { value: radioOption, onChange: event => {
109
120
  setValue(event.target.value);
110
121
  } },
@@ -120,7 +131,9 @@ const OpenTrack = observer(({ assembly1, assembly2, setSessionTrackData, }) => {
120
131
  React.createElement(Grid, { item: true },
121
132
  React.createElement(FormControlLabel, { value: ".anchors", control: React.createElement(Radio, null), label: ".anchors" })),
122
133
  React.createElement(Grid, { item: true },
123
- React.createElement(FormControlLabel, { value: ".anchors.simple", control: React.createElement(Radio, null), label: ".anchors.simple" })))),
134
+ React.createElement(FormControlLabel, { value: ".anchors.simple", control: React.createElement(Radio, null), label: ".anchors.simple" })),
135
+ React.createElement(Grid, { item: true },
136
+ React.createElement(FormControlLabel, { value: ".pif.gz", control: React.createElement(Radio, null), label: ".pif.gz" })))),
124
137
  React.createElement(Grid, { container: true, justifyContent: "center" },
125
138
  React.createElement(Grid, { item: true }, value === '.anchors' || value === '.anchors.simple' ? (React.createElement("div", null,
126
139
  React.createElement("div", { style: { margin: 20 } },
@@ -141,8 +154,16 @@ const OpenTrack = observer(({ assembly1, assembly2, setSessionTrackData, }) => {
141
154
  React.createElement("div", null,
142
155
  React.createElement(FileSelector, { name: "genome 2 .bed (right column of anchors file)", description: "", location: bed2Location, setLocation: loc => {
143
156
  setBed2Location(loc);
144
- } }))))) : (React.createElement(FileSelector, { name: value ? `${value} location` : '', description: "", location: fileLocation, setLocation: loc => {
157
+ } }))))) : value === '.pif.gz' ? (React.createElement("div", { style: { display: 'flex' } },
158
+ React.createElement("div", null,
159
+ React.createElement(FileSelector, { name: `${value} location`, description: "", location: fileLocation, setLocation: loc => {
160
+ setFileLocation(loc);
161
+ } })),
162
+ React.createElement("div", null,
163
+ React.createElement(FileSelector, { name: `${value} index location`, description: "", location: indexFileLocation, setLocation: loc => {
164
+ setIndexFileLocation(loc);
165
+ } })))) : (React.createElement(FileSelector, { name: value ? `${value} location` : '', description: "", location: fileLocation, setLocation: loc => {
145
166
  setFileLocation(loc);
146
167
  } }))))));
147
168
  });
148
- export default OpenTrack;
169
+ export default ImportCustomTrack;
@@ -194,6 +194,7 @@ export default function stateModelFactory(pm: PluginManager): import("mobx-state
194
194
  trackMenuItems(): (import("@jbrowse/core/ui").MenuDivider | import("@jbrowse/core/ui").MenuSubHeader | import("@jbrowse/core/ui").NormalMenuItem | import("@jbrowse/core/ui").CheckboxMenuItem | import("@jbrowse/core/ui").RadioMenuItem | import("@jbrowse/core/ui").SubMenuItem | {
195
195
  type: string;
196
196
  label: string;
197
+ priority: number;
197
198
  subMenu: {
198
199
  type: string;
199
200
  label: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-dotplot-view",
3
- "version": "2.15.0",
3
+ "version": "2.15.2",
4
4
  "description": "JBrowse 2 dotplot view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "87eeb1fbf8311dbf88d5e75b5a265f03beffdda8"
64
+ "gitHead": "8a58cefbfe39af4c97bcb6ead354d72c9fef9224"
65
65
  }
@@ -1,84 +0,0 @@
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.TooltipWhereClicked = exports.TooltipWhereMouseovered = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const mobx_react_1 = require("mobx-react");
9
- const mui_1 = require("tss-react/mui");
10
- const util_1 = require("./util");
11
- const material_1 = require("@mui/material");
12
- const react_2 = require("@floating-ui/react");
13
- function round(value) {
14
- return Math.round(value * 1e5) / 1e5;
15
- }
16
- const useStyles = (0, mui_1.makeStyles)()(theme => ({
17
- // these styles come from
18
- // https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
19
- tooltip: {
20
- position: 'absolute',
21
- pointerEvents: 'none',
22
- backgroundColor: (0, material_1.alpha)(theme.palette.grey[700], 0.9),
23
- borderRadius: theme.shape.borderRadius,
24
- color: theme.palette.common.white,
25
- fontFamily: theme.typography.fontFamily,
26
- padding: '4px 8px',
27
- fontSize: theme.typography.pxToRem(12),
28
- lineHeight: `${round(14 / 10)}em`,
29
- maxWidth: 300,
30
- wordWrap: 'break-word',
31
- },
32
- }));
33
- exports.TooltipWhereMouseovered = (0, mobx_react_1.observer)(function ({ model, mouserect, mouserectClient, xdistance, }) {
34
- var _a, _b;
35
- const { classes } = useStyles();
36
- const { hview, vview, viewHeight } = model;
37
- const theme = (0, material_1.useTheme)();
38
- const { refs, floatingStyles, context } = (0, react_2.useFloating)({
39
- placement: xdistance < 0 ? 'left' : 'right',
40
- strategy: 'fixed',
41
- });
42
- const clientPoint = (0, react_2.useClientPoint)(context, mouserectClient
43
- ? {
44
- x: mouserectClient[0],
45
- y: mouserectClient[1],
46
- }
47
- : undefined);
48
- const { getFloatingProps } = (0, react_2.useInteractions)([clientPoint]);
49
- const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
50
- return mouserect ? (react_1.default.createElement(material_1.Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
51
- react_1.default.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
52
- ...floatingStyles,
53
- zIndex: 100000,
54
- pointerEvents: 'none',
55
- }, ...getFloatingProps() },
56
- `x - ${(0, util_1.locstr)(mouserect[0], hview)}`,
57
- react_1.default.createElement("br", null),
58
- `y - ${(0, util_1.locstr)(viewHeight - mouserect[1], vview)}`,
59
- react_1.default.createElement("br", null)))) : null;
60
- });
61
- exports.TooltipWhereClicked = (0, mobx_react_1.observer)(function ({ model, mousedown, mousedownClient, xdistance, ydistance, }) {
62
- var _a, _b;
63
- const { classes } = useStyles();
64
- const { hview, vview, viewHeight } = model;
65
- const theme = (0, material_1.useTheme)();
66
- const x = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[0]) || 0) - (xdistance < 0 ? 0 : 0);
67
- const y = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[1]) || 0) - (ydistance < 0 ? 0 : 0);
68
- const { refs, floatingStyles, context } = (0, react_2.useFloating)({
69
- placement: xdistance < 0 ? 'right' : 'left',
70
- });
71
- const clientPoint = (0, react_2.useClientPoint)(context, { x, y });
72
- const { getFloatingProps } = (0, react_2.useInteractions)([clientPoint]);
73
- const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
74
- return mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (react_1.default.createElement(material_1.Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
75
- react_1.default.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
76
- ...floatingStyles,
77
- zIndex: 100000,
78
- pointerEvents: 'none',
79
- }, ...getFloatingProps() },
80
- `x - ${(0, util_1.locstr)(mousedown[0], hview)}`,
81
- react_1.default.createElement("br", null),
82
- `y - ${(0, util_1.locstr)(viewHeight - mousedown[1], vview)}`,
83
- react_1.default.createElement("br", null)))) : null;
84
- });
@@ -1,78 +0,0 @@
1
- import React from 'react';
2
- import { observer } from 'mobx-react';
3
- import { makeStyles } from 'tss-react/mui';
4
- import { locstr } from './util';
5
- import { Portal, alpha, useTheme } from '@mui/material';
6
- import { useFloating, useClientPoint, useInteractions, } from '@floating-ui/react';
7
- function round(value) {
8
- return Math.round(value * 1e5) / 1e5;
9
- }
10
- const useStyles = makeStyles()(theme => ({
11
- // these styles come from
12
- // https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
13
- tooltip: {
14
- position: 'absolute',
15
- pointerEvents: 'none',
16
- backgroundColor: alpha(theme.palette.grey[700], 0.9),
17
- borderRadius: theme.shape.borderRadius,
18
- color: theme.palette.common.white,
19
- fontFamily: theme.typography.fontFamily,
20
- padding: '4px 8px',
21
- fontSize: theme.typography.pxToRem(12),
22
- lineHeight: `${round(14 / 10)}em`,
23
- maxWidth: 300,
24
- wordWrap: 'break-word',
25
- },
26
- }));
27
- export const TooltipWhereMouseovered = observer(function ({ model, mouserect, mouserectClient, xdistance, }) {
28
- var _a, _b;
29
- const { classes } = useStyles();
30
- const { hview, vview, viewHeight } = model;
31
- const theme = useTheme();
32
- const { refs, floatingStyles, context } = useFloating({
33
- placement: xdistance < 0 ? 'left' : 'right',
34
- strategy: 'fixed',
35
- });
36
- const clientPoint = useClientPoint(context, mouserectClient
37
- ? {
38
- x: mouserectClient[0],
39
- y: mouserectClient[1],
40
- }
41
- : undefined);
42
- const { getFloatingProps } = useInteractions([clientPoint]);
43
- const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
44
- return mouserect ? (React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
45
- React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
46
- ...floatingStyles,
47
- zIndex: 100000,
48
- pointerEvents: 'none',
49
- }, ...getFloatingProps() },
50
- `x - ${locstr(mouserect[0], hview)}`,
51
- React.createElement("br", null),
52
- `y - ${locstr(viewHeight - mouserect[1], vview)}`,
53
- React.createElement("br", null)))) : null;
54
- });
55
- export const TooltipWhereClicked = observer(function ({ model, mousedown, mousedownClient, xdistance, ydistance, }) {
56
- var _a, _b;
57
- const { classes } = useStyles();
58
- const { hview, vview, viewHeight } = model;
59
- const theme = useTheme();
60
- const x = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[0]) || 0) - (xdistance < 0 ? 0 : 0);
61
- const y = ((mousedownClient === null || mousedownClient === void 0 ? void 0 : mousedownClient[1]) || 0) - (ydistance < 0 ? 0 : 0);
62
- const { refs, floatingStyles, context } = useFloating({
63
- placement: xdistance < 0 ? 'right' : 'left',
64
- });
65
- const clientPoint = useClientPoint(context, { x, y });
66
- const { getFloatingProps } = useInteractions([clientPoint]);
67
- const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
68
- return mousedown && Math.abs(xdistance) > 3 && Math.abs(ydistance) > 3 ? (React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
69
- React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
70
- ...floatingStyles,
71
- zIndex: 100000,
72
- pointerEvents: 'none',
73
- }, ...getFloatingProps() },
74
- `x - ${locstr(mousedown[0], hview)}`,
75
- React.createElement("br", null),
76
- `y - ${locstr(viewHeight - mousedown[1], vview)}`,
77
- React.createElement("br", null)))) : null;
78
- });