@jbrowse/plugin-dotplot-view 2.18.0 → 3.0.1
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.
- package/dist/DotplotDisplay/components/DotplotDisplay.d.ts +1 -2
- package/dist/DotplotDisplay/components/DotplotDisplay.js +6 -11
- package/dist/DotplotDisplay/stateModelFactory.d.ts +1 -2
- package/dist/DotplotDisplay/stateModelFactory.js +2 -3
- package/dist/DotplotRenderer/DotplotRenderer.d.ts +3 -3
- package/dist/DotplotRenderer/DotplotRenderer.js +17 -7
- package/dist/DotplotRenderer/components/DotplotRendering.d.ts +1 -2
- package/dist/DotplotRenderer/components/DotplotRendering.js +2 -5
- package/dist/DotplotView/components/Axes.d.ts +4 -5
- package/dist/DotplotView/components/Axes.js +23 -36
- package/dist/DotplotView/components/CursorIcon.d.ts +2 -3
- package/dist/DotplotView/components/CursorIcon.js +3 -5
- package/dist/DotplotView/components/DotplotControls.d.ts +1 -2
- package/dist/DotplotView/components/DotplotControls.js +89 -91
- package/dist/DotplotView/components/DotplotTooltipClick.d.ts +1 -2
- package/dist/DotplotView/components/DotplotTooltipClick.js +2 -6
- package/dist/DotplotView/components/DotplotTooltipMouseover.d.ts +1 -2
- package/dist/DotplotView/components/DotplotTooltipMouseover.js +3 -7
- package/dist/DotplotView/components/DotplotView.d.ts +1 -2
- package/dist/DotplotView/components/DotplotView.js +75 -80
- package/dist/DotplotView/components/DotplotWarnings.d.ts +1 -2
- package/dist/DotplotView/components/DotplotWarnings.js +26 -20
- package/dist/DotplotView/components/ExportSvgDialog.d.ts +1 -2
- package/dist/DotplotView/components/ExportSvgDialog.js +31 -64
- package/dist/DotplotView/components/Grid.d.ts +2 -3
- package/dist/DotplotView/components/Grid.js +17 -28
- package/dist/DotplotView/components/Header.d.ts +1 -2
- package/dist/DotplotView/components/Header.js +2 -21
- package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +7 -0
- package/dist/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +129 -0
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +3 -5
- package/dist/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +12 -38
- package/dist/DotplotView/components/ImportForm/TrackSelector.d.ts +7 -0
- package/dist/DotplotView/components/ImportForm/TrackSelector.js +23 -0
- package/dist/DotplotView/components/ImportForm/getAdapter.d.ts +117 -0
- package/dist/DotplotView/components/ImportForm/getAdapter.js +68 -0
- package/dist/DotplotView/components/ImportForm/index.d.ts +2 -3
- package/dist/DotplotView/components/ImportForm/index.js +43 -92
- package/dist/DotplotView/components/PanButtons.d.ts +1 -2
- package/dist/DotplotView/components/PanButtons.js +14 -32
- package/dist/DotplotView/components/WarningDialog.d.ts +1 -2
- package/dist/DotplotView/components/WarningDialog.js +2 -9
- package/dist/DotplotView/index.js +17 -7
- package/dist/DotplotView/model.d.ts +6 -4
- package/dist/DotplotView/model.js +40 -30
- package/dist/DotplotView/svgcomponents/SVGBackground.d.ts +1 -2
- package/dist/DotplotView/svgcomponents/SVGBackground.js +2 -5
- package/dist/DotplotView/svgcomponents/SVGDotplotView.js +2 -16
- package/dist/DotplotView/types.d.ts +12 -0
- package/dist/DotplotView/types.js +2 -0
- package/dist/ServerSideRenderedBlockContent.d.ts +1 -2
- package/dist/ServerSideRenderedBlockContent.js +9 -34
- package/dist/ServerSideSyntenyRendering.d.ts +1 -2
- package/dist/ServerSideSyntenyRendering.js +3 -25
- package/esm/DotplotDisplay/components/DotplotDisplay.d.ts +1 -2
- package/esm/DotplotDisplay/components/DotplotDisplay.js +6 -8
- package/esm/DotplotDisplay/stateModelFactory.d.ts +1 -2
- package/esm/DotplotDisplay/stateModelFactory.js +2 -3
- package/esm/DotplotRenderer/DotplotRenderer.d.ts +3 -3
- package/esm/DotplotRenderer/components/DotplotRendering.d.ts +1 -2
- package/esm/DotplotRenderer/components/DotplotRendering.js +2 -2
- package/esm/DotplotView/components/Axes.d.ts +4 -5
- package/esm/DotplotView/components/Axes.js +23 -33
- package/esm/DotplotView/components/CursorIcon.d.ts +2 -3
- package/esm/DotplotView/components/CursorIcon.js +3 -5
- package/esm/DotplotView/components/DotplotControls.d.ts +1 -2
- package/esm/DotplotView/components/DotplotControls.js +89 -91
- package/esm/DotplotView/components/DotplotTooltipClick.d.ts +1 -2
- package/esm/DotplotView/components/DotplotTooltipClick.js +2 -6
- package/esm/DotplotView/components/DotplotTooltipMouseover.d.ts +1 -2
- package/esm/DotplotView/components/DotplotTooltipMouseover.js +3 -7
- package/esm/DotplotView/components/DotplotView.d.ts +1 -2
- package/esm/DotplotView/components/DotplotView.js +58 -73
- package/esm/DotplotView/components/DotplotWarnings.d.ts +1 -2
- package/esm/DotplotView/components/DotplotWarnings.js +9 -13
- package/esm/DotplotView/components/ExportSvgDialog.d.ts +1 -2
- package/esm/DotplotView/components/ExportSvgDialog.js +31 -41
- package/esm/DotplotView/components/Grid.d.ts +2 -3
- package/esm/DotplotView/components/Grid.js +17 -25
- package/esm/DotplotView/components/Header.d.ts +1 -2
- package/esm/DotplotView/components/Header.js +2 -21
- package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.d.ts +7 -0
- package/esm/DotplotView/components/ImportForm/ImportSyntenyOpenCustomTrack.js +124 -0
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.d.ts +3 -5
- package/esm/DotplotView/components/ImportForm/ImportSyntenyTrackSelector.js +12 -15
- package/esm/DotplotView/components/ImportForm/TrackSelector.d.ts +7 -0
- package/esm/DotplotView/components/ImportForm/TrackSelector.js +18 -0
- package/esm/DotplotView/components/ImportForm/getAdapter.d.ts +117 -0
- package/esm/DotplotView/components/ImportForm/getAdapter.js +65 -0
- package/esm/DotplotView/components/ImportForm/index.d.ts +2 -3
- package/esm/DotplotView/components/ImportForm/index.js +45 -71
- package/esm/DotplotView/components/PanButtons.d.ts +1 -2
- package/esm/DotplotView/components/PanButtons.js +14 -32
- package/esm/DotplotView/components/WarningDialog.d.ts +1 -2
- package/esm/DotplotView/components/WarningDialog.js +2 -6
- package/esm/DotplotView/model.d.ts +6 -4
- package/esm/DotplotView/model.js +25 -25
- package/esm/DotplotView/svgcomponents/SVGBackground.d.ts +1 -2
- package/esm/DotplotView/svgcomponents/SVGBackground.js +2 -2
- package/esm/DotplotView/svgcomponents/SVGDotplotView.js +2 -16
- package/esm/DotplotView/types.d.ts +12 -0
- package/esm/DotplotView/types.js +1 -0
- package/esm/ServerSideRenderedBlockContent.d.ts +1 -2
- package/esm/ServerSideRenderedBlockContent.js +9 -11
- package/esm/ServerSideSyntenyRendering.d.ts +1 -2
- package/esm/ServerSideSyntenyRendering.js +3 -2
- package/package.json +10 -10
- package/dist/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +0 -11
- package/dist/DotplotView/components/ImportForm/ImportCustomTrack.js +0 -194
- package/esm/DotplotView/components/ImportForm/ImportCustomTrack.d.ts +0 -11
- package/esm/DotplotView/components/ImportForm/ImportCustomTrack.js +0 -169
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { Dialog, ErrorMessage } from '@jbrowse/core/ui';
|
|
3
4
|
import { getSession, useLocalStorage } from '@jbrowse/core/util';
|
|
4
5
|
import { Button, Checkbox, CircularProgress, DialogActions, DialogContent, FormControlLabel, MenuItem, TextField, Typography, } from '@mui/material';
|
|
5
6
|
function LoadingMessage() {
|
|
6
|
-
return (
|
|
7
|
-
React.createElement(CircularProgress, { size: 20, style: { marginRight: 20 } }),
|
|
8
|
-
React.createElement(Typography, { display: "inline" }, "Creating SVG")));
|
|
7
|
+
return (_jsxs("div", { children: [_jsx(CircularProgress, { size: 20, style: { marginRight: 20 } }), _jsx(Typography, { display: "inline", children: "Creating SVG" })] }));
|
|
9
8
|
}
|
|
10
9
|
function TextField2({ children, ...rest }) {
|
|
11
|
-
return (
|
|
12
|
-
React.createElement(TextField, { ...rest }, children)));
|
|
10
|
+
return (_jsx("div", { children: _jsx(TextField, { ...rest, children: children }) }));
|
|
13
11
|
}
|
|
14
12
|
function useSvgLocal(key, val) {
|
|
15
13
|
return useLocalStorage(`svg-${key}`, val);
|
|
@@ -22,39 +20,31 @@ export default function ExportSvgDialog({ model, handleClose, }) {
|
|
|
22
20
|
const [error, setError] = useState();
|
|
23
21
|
const [filename, setFilename] = useSvgLocal('file', 'jbrowse.svg');
|
|
24
22
|
const [themeName, setThemeName] = useSvgLocal('theme', session.themeName || 'default');
|
|
25
|
-
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
catch (e) {
|
|
53
|
-
console.error(e);
|
|
54
|
-
setError(e);
|
|
55
|
-
}
|
|
56
|
-
finally {
|
|
57
|
-
setLoading(false);
|
|
58
|
-
}
|
|
59
|
-
} }, "Submit"))));
|
|
23
|
+
return (_jsxs(Dialog, { open: true, onClose: handleClose, title: "Export SVG", children: [_jsxs(DialogContent, { children: [error ? (_jsx(ErrorMessage, { error: error })) : loading ? (_jsx(LoadingMessage, {})) : null, _jsx(TextField2, { helperText: "filename", value: filename, onChange: event => {
|
|
24
|
+
setFilename(event.target.value);
|
|
25
|
+
} }), session.allThemes ? (_jsx(TextField2, { select: true, label: "Theme", value: themeName, onChange: event => {
|
|
26
|
+
setThemeName(event.target.value);
|
|
27
|
+
}, children: Object.entries(session.allThemes()).map(([key, val]) => (_jsx(MenuItem, { value: key, children: val.name || '(Unknown name)' }, key))) })) : null, offscreenCanvas ? (_jsx(FormControlLabel, { control: _jsx(Checkbox, { checked: rasterizeLayers, onChange: () => {
|
|
28
|
+
setRasterizeLayers(val => !val);
|
|
29
|
+
} }), label: "Rasterize canvas based tracks? File may be much larger if this is turned off" })) : (_jsx(Typography, { children: "Note: rasterizing layers not yet supported in this browser, so SVG size may be large" }))] }), _jsxs(DialogActions, { children: [_jsx(Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
30
|
+
handleClose();
|
|
31
|
+
}, children: "Cancel" }), _jsx(Button, { variant: "contained", color: "primary", type: "submit", onClick: async () => {
|
|
32
|
+
setLoading(true);
|
|
33
|
+
setError(undefined);
|
|
34
|
+
try {
|
|
35
|
+
await model.exportSvg({
|
|
36
|
+
rasterizeLayers,
|
|
37
|
+
filename,
|
|
38
|
+
themeName,
|
|
39
|
+
});
|
|
40
|
+
handleClose();
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
console.error(e);
|
|
44
|
+
setError(e);
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
setLoading(false);
|
|
48
|
+
}
|
|
49
|
+
}, children: "Submit" })] })] }));
|
|
60
50
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { DotplotViewModel } from '../model';
|
|
3
2
|
export declare const GridRaw: ({ model, children, }: {
|
|
4
3
|
model: DotplotViewModel;
|
|
5
4
|
children?: React.ReactNode;
|
|
6
|
-
}) =>
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
6
|
export default function Grid({ model, children, }: {
|
|
8
7
|
model: DotplotViewModel;
|
|
9
8
|
children?: React.ReactNode;
|
|
10
|
-
}):
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { getFillProps, getStrokeProps } from '@jbrowse/core/util';
|
|
3
3
|
import { useTheme } from '@mui/material';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
@@ -21,31 +21,23 @@ export const GridRaw = observer(function ({ model, children, }) {
|
|
|
21
21
|
const h = Math.min(viewHeight - vbottom - ry, viewHeight);
|
|
22
22
|
let lastx = Number.POSITIVE_INFINITY;
|
|
23
23
|
let lasty = Number.POSITIVE_INFINITY;
|
|
24
|
-
return (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
lasty = y;
|
|
40
|
-
}
|
|
41
|
-
return render ? (React.createElement("line", { key: JSON.stringify(region), x1: 0, y1: y, x2: viewWidth, y2: y, ...getStrokeProps(stroke) })) : null;
|
|
42
|
-
}),
|
|
43
|
-
React.createElement("line", { x1: htop, y1: 0, x2: htop, y2: viewHeight, ...getStrokeProps(stroke) }),
|
|
44
|
-
React.createElement("line", { x1: 0, y1: viewHeight - vtop, x2: viewWidth, y2: viewHeight - vtop, ...getStrokeProps(stroke) })),
|
|
45
|
-
children));
|
|
24
|
+
return (_jsxs(_Fragment, { children: [_jsx("rect", { x: rx, y: ry, width: w, height: h, ...getFillProps(theme.palette.background.default) }), _jsxs("g", { children: [hblocks.map(region => {
|
|
25
|
+
const x = region.offsetPx - hview.offsetPx;
|
|
26
|
+
const render = Math.floor(x) !== Math.floor(lastx);
|
|
27
|
+
if (render) {
|
|
28
|
+
lastx = x;
|
|
29
|
+
}
|
|
30
|
+
return render ? (_jsx("line", { x1: x, y1: 0, x2: x, y2: viewHeight, ...getStrokeProps(stroke) }, JSON.stringify(region))) : null;
|
|
31
|
+
}), vblocks.map(region => {
|
|
32
|
+
const y = viewHeight - (region.offsetPx - vview.offsetPx);
|
|
33
|
+
const render = Math.floor(y) !== Math.floor(lasty);
|
|
34
|
+
if (render) {
|
|
35
|
+
lasty = y;
|
|
36
|
+
}
|
|
37
|
+
return render ? (_jsx("line", { x1: 0, y1: y, x2: viewWidth, y2: y, ...getStrokeProps(stroke) }, JSON.stringify(region))) : null;
|
|
38
|
+
}), _jsx("line", { x1: htop, y1: 0, x2: htop, y2: viewHeight, ...getStrokeProps(stroke) }), _jsx("line", { x1: 0, y1: viewHeight - vtop, x2: viewWidth, y2: viewHeight - vtop, ...getStrokeProps(stroke) })] }), children] }));
|
|
46
39
|
});
|
|
47
40
|
export default function Grid({ model, children, }) {
|
|
48
41
|
const { viewWidth, viewHeight } = model;
|
|
49
|
-
return (
|
|
50
|
-
React.createElement(GridRaw, { model: model }, children)));
|
|
42
|
+
return (_jsx("svg", { width: viewWidth, height: viewHeight, style: { background: 'rgba(0,0,0,0.12)' }, children: _jsx(GridRaw, { model: model, children: children }) }));
|
|
51
43
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { DotplotViewModel } from '../model';
|
|
3
2
|
declare const DotplotHeader: ({ model, selection, }: {
|
|
4
3
|
model: DotplotViewModel;
|
|
@@ -6,5 +5,5 @@ declare const DotplotHeader: ({ model, selection, }: {
|
|
|
6
5
|
width: number;
|
|
7
6
|
height: number;
|
|
8
7
|
};
|
|
9
|
-
}) =>
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export default DotplotHeader;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getBpDisplayStr } from '@jbrowse/core/util';
|
|
3
3
|
import { Typography } from '@mui/material';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
@@ -23,25 +23,6 @@ const useStyles = makeStyles()({
|
|
|
23
23
|
const DotplotHeader = observer(function ({ model, selection, }) {
|
|
24
24
|
const { classes } = useStyles();
|
|
25
25
|
const { hview, vview, showPanButtons } = model;
|
|
26
|
-
return (
|
|
27
|
-
React.createElement(DotplotControls, { model: model }),
|
|
28
|
-
React.createElement(Typography, { className: classes.bp, variant: "body2", color: "textSecondary" },
|
|
29
|
-
"x: ",
|
|
30
|
-
hview.assemblyNames.join(','),
|
|
31
|
-
" ",
|
|
32
|
-
getBpDisplayStr(hview.currBp),
|
|
33
|
-
React.createElement("br", null),
|
|
34
|
-
"y: ",
|
|
35
|
-
vview.assemblyNames.join(','),
|
|
36
|
-
" ",
|
|
37
|
-
getBpDisplayStr(vview.currBp)),
|
|
38
|
-
selection ? (React.createElement(Typography, { className: classes.bp, variant: "body2", color: "textSecondary" },
|
|
39
|
-
`width:${getBpDisplayStr(hview.bpPerPx * selection.width)}`,
|
|
40
|
-
" ",
|
|
41
|
-
React.createElement("br", null),
|
|
42
|
-
`height:${getBpDisplayStr(vview.bpPerPx * selection.height)}`)) : null,
|
|
43
|
-
React.createElement("div", { className: classes.spacer }),
|
|
44
|
-
React.createElement(DotplotWarnings, { model: model }),
|
|
45
|
-
showPanButtons ? React.createElement(PanButtons, { model: model }) : null));
|
|
26
|
+
return (_jsxs("div", { className: classes.headerBar, children: [_jsx(DotplotControls, { model: model }), _jsxs(Typography, { className: classes.bp, variant: "body2", color: "textSecondary", children: ["x: ", hview.assemblyNames.join(','), " ", getBpDisplayStr(hview.currBp), _jsx("br", {}), "y: ", vview.assemblyNames.join(','), " ", getBpDisplayStr(vview.currBp)] }), selection ? (_jsxs(Typography, { className: classes.bp, variant: "body2", color: "textSecondary", children: [`width:${getBpDisplayStr(hview.bpPerPx * selection.width)}`, " ", _jsx("br", {}), `height:${getBpDisplayStr(vview.bpPerPx * selection.height)}`] })) : null, _jsx("div", { className: classes.spacer }), _jsx(DotplotWarnings, { model: model }), showPanButtons ? _jsx(PanButtons, { model: model }) : null] }));
|
|
46
27
|
});
|
|
47
28
|
export default DotplotHeader;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DotplotViewModel } from '../../model';
|
|
2
|
+
declare const ImportSyntenyOpenCustomTrack: ({ model, assembly1, assembly2, }: {
|
|
3
|
+
model: DotplotViewModel;
|
|
4
|
+
assembly1: string;
|
|
5
|
+
assembly2: string;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ImportSyntenyOpenCustomTrack;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { ErrorMessage, FileSelector } from '@jbrowse/core/ui';
|
|
4
|
+
import HelpIcon from '@mui/icons-material/Help';
|
|
5
|
+
import { Button, FormControlLabel, Grid2, Paper, Radio, RadioGroup, Tooltip, Typography, } from '@mui/material';
|
|
6
|
+
import { observer } from 'mobx-react';
|
|
7
|
+
import { getAdapter } from './getAdapter';
|
|
8
|
+
import { basename, extName, getName, stripGz } from './util';
|
|
9
|
+
const ImportSyntenyOpenCustomTrack = observer(function ({ model, assembly1, assembly2, }) {
|
|
10
|
+
const [swap, setSwap] = useState(false);
|
|
11
|
+
const [bed2Location, setBed2Location] = useState();
|
|
12
|
+
const [bed1Location, setBed1Location] = useState();
|
|
13
|
+
const [fileLocation, setFileLocation] = useState();
|
|
14
|
+
const [indexFileLocation, setIndexFileLocation] = useState();
|
|
15
|
+
const [value, setValue] = useState('');
|
|
16
|
+
const [error, setError] = useState();
|
|
17
|
+
const fileName = getName(fileLocation);
|
|
18
|
+
const radioOption = value || (fileName ? extName(stripGz(fileName)) : '');
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
try {
|
|
21
|
+
if (fileLocation) {
|
|
22
|
+
const fn = fileName ? basename(fileName) : 'MyTrack';
|
|
23
|
+
const trackId = `${fn}-${Date.now()}-sessionTrack`;
|
|
24
|
+
setError(undefined);
|
|
25
|
+
model.setImportFormSyntenyTrack(0, {
|
|
26
|
+
type: 'userOpened',
|
|
27
|
+
value: {
|
|
28
|
+
trackId,
|
|
29
|
+
name: fn,
|
|
30
|
+
assemblyNames: [assembly2, assembly1],
|
|
31
|
+
type: 'SyntenyTrack',
|
|
32
|
+
adapter: getAdapter({
|
|
33
|
+
radioOption,
|
|
34
|
+
assembly1: swap ? assembly2 : assembly1,
|
|
35
|
+
assembly2: swap ? assembly1 : assembly2,
|
|
36
|
+
fileLocation,
|
|
37
|
+
indexFileLocation,
|
|
38
|
+
bed1Location,
|
|
39
|
+
bed2Location,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
catch (e) {
|
|
46
|
+
console.error(e);
|
|
47
|
+
setError(e);
|
|
48
|
+
}
|
|
49
|
+
}, [
|
|
50
|
+
swap,
|
|
51
|
+
model,
|
|
52
|
+
fileName,
|
|
53
|
+
assembly1,
|
|
54
|
+
assembly2,
|
|
55
|
+
bed1Location,
|
|
56
|
+
bed2Location,
|
|
57
|
+
fileLocation,
|
|
58
|
+
indexFileLocation,
|
|
59
|
+
radioOption,
|
|
60
|
+
]);
|
|
61
|
+
const helpStrings = {
|
|
62
|
+
'.paf': 'minimap2 target.fa query.fa',
|
|
63
|
+
'.pif.gz': 'minimap2 target.fa query.fa',
|
|
64
|
+
'.out': 'mashmap target.fa query.fa',
|
|
65
|
+
'.delta': 'mummer target.fa query.fa',
|
|
66
|
+
'.chain': 'e.g. queryToTarget.chain',
|
|
67
|
+
};
|
|
68
|
+
return (_jsxs(Paper, { style: { padding: 12 }, children: [error ? _jsx(ErrorMessage, { error: error }) : null, _jsx(Typography, { style: { textAlign: 'center' }, children: "Add a .paf (minimap2), .delta (Mummer), .chain (UCSC liftover), .anchors or .anchors.simple (MCScan), or .pif.gz (jbrowse CLI make-pif) file to view. These file types can also be gzipped." }), _jsx(RadioGroup, { value: radioOption, onChange: event => {
|
|
69
|
+
setValue(event.target.value);
|
|
70
|
+
}, children: _jsx(Grid2, { container: true, justifyContent: "center", children: [
|
|
71
|
+
'.paf',
|
|
72
|
+
'.delta',
|
|
73
|
+
'.out',
|
|
74
|
+
'.chain',
|
|
75
|
+
'.anchors',
|
|
76
|
+
'.anchors.simple',
|
|
77
|
+
'.pif.gz',
|
|
78
|
+
].map(extension => (_jsx(FormControlLabel, { value: extension, control: _jsx(Radio, {}), label: extension }, extension))) }) }), _jsx(Grid2, { container: true, justifyContent: "center", children: radioOption === '.paf' ||
|
|
79
|
+
radioOption === '.out' ||
|
|
80
|
+
radioOption === '.delta' ||
|
|
81
|
+
radioOption === '.chain' ||
|
|
82
|
+
radioOption === '.pif.gz' ? (_jsxs("div", { style: {
|
|
83
|
+
display: 'flex',
|
|
84
|
+
flexDirection: 'column',
|
|
85
|
+
gap: 10,
|
|
86
|
+
}, children: [_jsx(FileSelector, { name: `${radioOption} location`, inline: true, description: "", location: fileLocation, setLocation: loc => {
|
|
87
|
+
setFileLocation(loc);
|
|
88
|
+
} }), _jsxs("div", { children: [_jsxs("div", { children: ["Verify or click swap", _jsx(Tooltip, { title: _jsx("code", { children: helpStrings[radioOption] }), children: _jsx(HelpIcon, {}) })] }), _jsxs("div", { style: {
|
|
89
|
+
display: 'flex',
|
|
90
|
+
gap: 20,
|
|
91
|
+
}, children: [_jsxs("div", { style: {
|
|
92
|
+
display: 'grid',
|
|
93
|
+
gridTemplateColumns: '1fr 1fr',
|
|
94
|
+
gap: 4,
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
}, children: [_jsx("div", { children: _jsx("i", { children: swap ? assembly2 : assembly1 }) }), _jsx("div", { children: "query assembly" }), _jsx("div", { children: _jsx("i", { children: swap ? assembly1 : assembly2 }) }), _jsx("div", { children: "target assembly" })] }), _jsx(Button, { variant: "contained", onClick: () => {
|
|
97
|
+
setSwap(!swap);
|
|
98
|
+
}, children: "Swap?" })] })] })] })) : value === '.anchors' || value === '.anchors.simple' ? (_jsxs("div", { children: [_jsxs("div", { style: { margin: 20 }, children: ["Open the ", value, " and .bed files for both genome assemblies from the MCScan (Python version) pipeline", ' ', _jsx("a", { href: "https://github.com/tanghaibao/jcvi/wiki/MCscan-(Python-version)", children: "(more info)" })] }), _jsxs("div", { children: [_jsx(FileSelector, { inline: true, name: value, location: fileLocation, setLocation: loc => {
|
|
99
|
+
setFileLocation(loc);
|
|
100
|
+
} }), _jsx(FileSelector, { inline: true, name: "genome 1 .bed (left column of anchors file)", description: "", location: bed1Location, setLocation: loc => {
|
|
101
|
+
setBed1Location(loc);
|
|
102
|
+
} }), _jsx(FileSelector, { inline: true, name: "genome 2 .bed (right column of anchors file)", description: "", location: bed2Location, setLocation: loc => {
|
|
103
|
+
setBed2Location(loc);
|
|
104
|
+
} })] }), _jsxs("div", { style: {
|
|
105
|
+
margin: 'auto',
|
|
106
|
+
display: 'flex',
|
|
107
|
+
justifyContent: 'center',
|
|
108
|
+
gap: 20,
|
|
109
|
+
}, children: [_jsxs("div", { style: {
|
|
110
|
+
display: 'grid',
|
|
111
|
+
gridTemplateColumns: '1fr 1fr',
|
|
112
|
+
gap: 4,
|
|
113
|
+
alignItems: 'center',
|
|
114
|
+
}, children: [_jsx("div", { children: _jsx("i", { children: swap ? assembly2 : assembly1 }) }), _jsx("div", { children: "bed1 assembly" }), _jsx("div", { children: _jsx("i", { children: swap ? assembly1 : assembly2 }) }), _jsx("div", { children: "bed2 assembly" })] }), _jsx(Button, { variant: "contained", onClick: () => {
|
|
115
|
+
setSwap(!swap);
|
|
116
|
+
}, children: "Swap?" })] })] })) : value === '.pif.gz' ? (_jsxs("div", { style: { display: 'flex' }, children: [_jsx("div", { children: _jsx(FileSelector, { name: `${value} location`, description: "", location: fileLocation, setLocation: loc => {
|
|
117
|
+
setFileLocation(loc);
|
|
118
|
+
} }) }), _jsx("div", { children: _jsx(FileSelector, { name: `${value} index location`, description: "", location: indexFileLocation, setLocation: loc => {
|
|
119
|
+
setIndexFileLocation(loc);
|
|
120
|
+
} }) })] })) : (_jsx(FileSelector, { name: value ? `${value} location` : '', description: "", location: fileLocation, setLocation: loc => {
|
|
121
|
+
setFileLocation(loc);
|
|
122
|
+
} })) })] }));
|
|
123
|
+
});
|
|
124
|
+
export default ImportSyntenyOpenCustomTrack;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { DotplotViewModel } from '../../model';
|
|
3
|
-
declare const
|
|
2
|
+
declare const ImportSyntenyTrackSelector: ({ model, assembly1, assembly2, }: {
|
|
4
3
|
model: DotplotViewModel;
|
|
5
4
|
assembly1: string;
|
|
6
5
|
assembly2: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export default Selector;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default ImportSyntenyTrackSelector;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
2
3
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
3
4
|
import { ErrorMessage } from '@jbrowse/core/ui';
|
|
4
5
|
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons';
|
|
@@ -12,7 +13,7 @@ function f(track, assembly1, assembly2) {
|
|
|
12
13
|
assemblyNames.includes(assembly2) &&
|
|
13
14
|
track.type.includes('Synteny'));
|
|
14
15
|
}
|
|
15
|
-
const
|
|
16
|
+
const ImportSyntenyTrackSelector = observer(function ({ model, assembly1, assembly2, }) {
|
|
16
17
|
var _a;
|
|
17
18
|
const session = getSession(model);
|
|
18
19
|
const { tracks, sessionTracks } = session;
|
|
@@ -27,17 +28,13 @@ const Selector = observer(({ model, assembly1, assembly2, setShowTrackId, }) =>
|
|
|
27
28
|
setValue(resetTrack);
|
|
28
29
|
}, [resetTrack]);
|
|
29
30
|
useEffect(() => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
React.createElement(TrackSelectorIcon, null)),
|
|
39
|
-
filteredTracks.length ? (React.createElement(Select, { value: value, onChange: event => {
|
|
40
|
-
setValue(event.target.value);
|
|
41
|
-
} }, filteredTracks.map(track => (React.createElement(MenuItem, { key: track.trackId, value: track.trackId }, getTrackName(track, session)))))) : (React.createElement(ErrorMessage, { error: `No synteny tracks found for ${assembly1},${assembly2}` }))));
|
|
31
|
+
model.setImportFormSyntenyTrack(0, {
|
|
32
|
+
type: 'preConfigured',
|
|
33
|
+
value,
|
|
34
|
+
});
|
|
35
|
+
}, [model, value]);
|
|
36
|
+
return (_jsxs(Paper, { style: { padding: 12 }, children: [_jsxs(Typography, { children: ["Select a track from the select box below, the track will be shown when you hit \"Launch\". Note: there is a track selector ", _jsx("i", { children: "inside" }), " the DotplotView, which can turn on one or more SyntenyTracks (more than one can be displayed at once). Look for the track selector icon", ' ', _jsx(TrackSelectorIcon, {})] }), filteredTracks.length ? (_jsx(Select, { value: value, onChange: event => {
|
|
37
|
+
setValue(event.target.value);
|
|
38
|
+
}, children: filteredTracks.map(track => (_jsx(MenuItem, { value: track.trackId, children: getTrackName(track, session) }, track.trackId))) })) : (_jsx(ErrorMessage, { error: `No synteny tracks found for ${assembly1},${assembly2}` }))] }));
|
|
42
39
|
});
|
|
43
|
-
export default
|
|
40
|
+
export default ImportSyntenyTrackSelector;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DotplotViewModel } from '../../model';
|
|
2
|
+
declare const TrackSelector: ({ assembly1, assembly2, model, }: {
|
|
3
|
+
model: DotplotViewModel;
|
|
4
|
+
assembly1: string;
|
|
5
|
+
assembly2: string;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default TrackSelector;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { FormControl, FormControlLabel, FormLabel, Radio, RadioGroup, } from '@mui/material';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
import ImportSyntenyOpenCustomTrack from './ImportSyntenyOpenCustomTrack';
|
|
6
|
+
import ImportSyntenyTrackSelector from './ImportSyntenyTrackSelector';
|
|
7
|
+
const TrackSelector = observer(function ({ assembly1, assembly2, model, }) {
|
|
8
|
+
const [choice, setChoice] = useState('tracklist');
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (choice === 'none') {
|
|
11
|
+
model.setImportFormSyntenyTrack(0, { type: 'none' });
|
|
12
|
+
}
|
|
13
|
+
}, [model, choice]);
|
|
14
|
+
return (_jsxs(_Fragment, { children: [_jsxs(FormControl, { children: [_jsx(FormLabel, { id: "group-label", children: "(Optional) Select or add a synteny track" }), _jsxs(RadioGroup, { row: true, value: choice, onChange: event => {
|
|
15
|
+
setChoice(event.target.value);
|
|
16
|
+
}, "aria-labelledby": "group-label", children: [_jsx(FormControlLabel, { value: "none", control: _jsx(Radio, {}), label: "None" }), _jsx(FormControlLabel, { value: "tracklist", control: _jsx(Radio, {}), label: "Existing track" }), _jsx(FormControlLabel, { value: "custom", control: _jsx(Radio, {}), label: "New track" })] })] }), choice === 'custom' ? (_jsx(ImportSyntenyOpenCustomTrack, { model: model, assembly2: assembly2, assembly1: assembly1 })) : null, choice === 'tracklist' ? (_jsx(ImportSyntenyTrackSelector, { model: model, assembly1: assembly1, assembly2: assembly2 })) : null] }));
|
|
17
|
+
});
|
|
18
|
+
export default TrackSelector;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { FileLocation } from '@jbrowse/core/util';
|
|
2
|
+
export declare function getAdapter({ radioOption, assembly1, assembly2, fileLocation, indexFileLocation, bed1Location, bed2Location, }: {
|
|
3
|
+
radioOption: string;
|
|
4
|
+
assembly1: string;
|
|
5
|
+
assembly2: string;
|
|
6
|
+
fileLocation?: FileLocation;
|
|
7
|
+
indexFileLocation?: FileLocation;
|
|
8
|
+
bed1Location?: FileLocation;
|
|
9
|
+
bed2Location?: FileLocation;
|
|
10
|
+
}): {
|
|
11
|
+
type: string;
|
|
12
|
+
pafLocation: FileLocation | undefined;
|
|
13
|
+
queryAssembly: string;
|
|
14
|
+
targetAssembly: string;
|
|
15
|
+
outLocation?: undefined;
|
|
16
|
+
deltaLocation?: undefined;
|
|
17
|
+
chainLocation?: undefined;
|
|
18
|
+
mcscanAnchorsLocation?: undefined;
|
|
19
|
+
bed1Location?: undefined;
|
|
20
|
+
bed2Location?: undefined;
|
|
21
|
+
assemblyNames?: undefined;
|
|
22
|
+
mcscanSimpleAnchorsLocation?: undefined;
|
|
23
|
+
pifGzLocation?: undefined;
|
|
24
|
+
index?: undefined;
|
|
25
|
+
} | {
|
|
26
|
+
type: string;
|
|
27
|
+
outLocation: FileLocation | undefined;
|
|
28
|
+
queryAssembly: string;
|
|
29
|
+
targetAssembly: string;
|
|
30
|
+
pafLocation?: undefined;
|
|
31
|
+
deltaLocation?: undefined;
|
|
32
|
+
chainLocation?: undefined;
|
|
33
|
+
mcscanAnchorsLocation?: undefined;
|
|
34
|
+
bed1Location?: undefined;
|
|
35
|
+
bed2Location?: undefined;
|
|
36
|
+
assemblyNames?: undefined;
|
|
37
|
+
mcscanSimpleAnchorsLocation?: undefined;
|
|
38
|
+
pifGzLocation?: undefined;
|
|
39
|
+
index?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
type: string;
|
|
42
|
+
deltaLocation: FileLocation | undefined;
|
|
43
|
+
queryAssembly: string;
|
|
44
|
+
targetAssembly: string;
|
|
45
|
+
pafLocation?: undefined;
|
|
46
|
+
outLocation?: undefined;
|
|
47
|
+
chainLocation?: undefined;
|
|
48
|
+
mcscanAnchorsLocation?: undefined;
|
|
49
|
+
bed1Location?: undefined;
|
|
50
|
+
bed2Location?: undefined;
|
|
51
|
+
assemblyNames?: undefined;
|
|
52
|
+
mcscanSimpleAnchorsLocation?: undefined;
|
|
53
|
+
pifGzLocation?: undefined;
|
|
54
|
+
index?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
type: string;
|
|
57
|
+
chainLocation: FileLocation | undefined;
|
|
58
|
+
queryAssembly: string;
|
|
59
|
+
targetAssembly: string;
|
|
60
|
+
pafLocation?: undefined;
|
|
61
|
+
outLocation?: undefined;
|
|
62
|
+
deltaLocation?: undefined;
|
|
63
|
+
mcscanAnchorsLocation?: undefined;
|
|
64
|
+
bed1Location?: undefined;
|
|
65
|
+
bed2Location?: undefined;
|
|
66
|
+
assemblyNames?: undefined;
|
|
67
|
+
mcscanSimpleAnchorsLocation?: undefined;
|
|
68
|
+
pifGzLocation?: undefined;
|
|
69
|
+
index?: undefined;
|
|
70
|
+
} | {
|
|
71
|
+
type: string;
|
|
72
|
+
mcscanAnchorsLocation: FileLocation | undefined;
|
|
73
|
+
bed1Location: FileLocation | undefined;
|
|
74
|
+
bed2Location: FileLocation | undefined;
|
|
75
|
+
assemblyNames: string[];
|
|
76
|
+
pafLocation?: undefined;
|
|
77
|
+
queryAssembly?: undefined;
|
|
78
|
+
targetAssembly?: undefined;
|
|
79
|
+
outLocation?: undefined;
|
|
80
|
+
deltaLocation?: undefined;
|
|
81
|
+
chainLocation?: undefined;
|
|
82
|
+
mcscanSimpleAnchorsLocation?: undefined;
|
|
83
|
+
pifGzLocation?: undefined;
|
|
84
|
+
index?: undefined;
|
|
85
|
+
} | {
|
|
86
|
+
type: string;
|
|
87
|
+
mcscanSimpleAnchorsLocation: FileLocation | undefined;
|
|
88
|
+
bed1Location: FileLocation | undefined;
|
|
89
|
+
bed2Location: FileLocation | undefined;
|
|
90
|
+
assemblyNames: string[];
|
|
91
|
+
pafLocation?: undefined;
|
|
92
|
+
queryAssembly?: undefined;
|
|
93
|
+
targetAssembly?: undefined;
|
|
94
|
+
outLocation?: undefined;
|
|
95
|
+
deltaLocation?: undefined;
|
|
96
|
+
chainLocation?: undefined;
|
|
97
|
+
mcscanAnchorsLocation?: undefined;
|
|
98
|
+
pifGzLocation?: undefined;
|
|
99
|
+
index?: undefined;
|
|
100
|
+
} | {
|
|
101
|
+
type: string;
|
|
102
|
+
pifGzLocation: FileLocation | undefined;
|
|
103
|
+
index: {
|
|
104
|
+
location: FileLocation | undefined;
|
|
105
|
+
};
|
|
106
|
+
assemblyNames: string[];
|
|
107
|
+
pafLocation?: undefined;
|
|
108
|
+
queryAssembly?: undefined;
|
|
109
|
+
targetAssembly?: undefined;
|
|
110
|
+
outLocation?: undefined;
|
|
111
|
+
deltaLocation?: undefined;
|
|
112
|
+
chainLocation?: undefined;
|
|
113
|
+
mcscanAnchorsLocation?: undefined;
|
|
114
|
+
bed1Location?: undefined;
|
|
115
|
+
bed2Location?: undefined;
|
|
116
|
+
mcscanSimpleAnchorsLocation?: undefined;
|
|
117
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export function getAdapter({ radioOption, assembly1, assembly2, fileLocation, indexFileLocation, bed1Location, bed2Location, }) {
|
|
2
|
+
if (radioOption === '.paf') {
|
|
3
|
+
return {
|
|
4
|
+
type: 'PAFAdapter',
|
|
5
|
+
pafLocation: fileLocation,
|
|
6
|
+
queryAssembly: assembly1,
|
|
7
|
+
targetAssembly: assembly2,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
else if (radioOption === '.out') {
|
|
11
|
+
return {
|
|
12
|
+
type: 'MashMapAdapter',
|
|
13
|
+
outLocation: fileLocation,
|
|
14
|
+
queryAssembly: assembly1,
|
|
15
|
+
targetAssembly: assembly2,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
else if (radioOption === '.delta') {
|
|
19
|
+
return {
|
|
20
|
+
type: 'DeltaAdapter',
|
|
21
|
+
deltaLocation: fileLocation,
|
|
22
|
+
queryAssembly: assembly1,
|
|
23
|
+
targetAssembly: assembly2,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
else if (radioOption === '.chain') {
|
|
27
|
+
return {
|
|
28
|
+
type: 'ChainAdapter',
|
|
29
|
+
chainLocation: fileLocation,
|
|
30
|
+
queryAssembly: assembly1,
|
|
31
|
+
targetAssembly: assembly2,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
else if (radioOption === '.anchors') {
|
|
35
|
+
return {
|
|
36
|
+
type: 'MCScanAnchorsAdapter',
|
|
37
|
+
mcscanAnchorsLocation: fileLocation,
|
|
38
|
+
bed1Location,
|
|
39
|
+
bed2Location,
|
|
40
|
+
assemblyNames: [assembly1, assembly2],
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else if (radioOption === '.anchors.simple') {
|
|
44
|
+
return {
|
|
45
|
+
type: 'MCScanSimpleAnchorsAdapter',
|
|
46
|
+
mcscanSimpleAnchorsLocation: fileLocation,
|
|
47
|
+
bed1Location,
|
|
48
|
+
bed2Location,
|
|
49
|
+
assemblyNames: [assembly1, assembly2],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
else if (radioOption === '.pif.gz') {
|
|
53
|
+
return {
|
|
54
|
+
type: 'PairwiseIndexedPAFAdapter',
|
|
55
|
+
pifGzLocation: fileLocation,
|
|
56
|
+
index: {
|
|
57
|
+
location: indexFileLocation,
|
|
58
|
+
},
|
|
59
|
+
assemblyNames: [assembly1, assembly2],
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
throw new Error(`Unknown to detect type ${radioOption} from filename (select radio button to clarify)`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { DotplotViewModel } from '../../model';
|
|
3
|
-
declare const DotplotImportForm: ({ model }: {
|
|
2
|
+
declare const DotplotImportForm: ({ model, }: {
|
|
4
3
|
model: DotplotViewModel;
|
|
5
|
-
}) =>
|
|
4
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export default DotplotImportForm;
|