@jbrowse/plugin-linear-genome-view 2.6.3 → 2.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.
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +4 -14
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +4 -5
- package/dist/BaseLinearDisplay/components/Tooltip.js +1 -1
- package/dist/BaseLinearDisplay/models/util.d.ts +2 -6
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +4 -5
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +3 -3
- package/dist/LinearBasicDisplay/model.d.ts +3 -1
- package/dist/LinearGenomeView/components/CenterLine.d.ts +3 -4
- package/dist/LinearGenomeView/components/CenterLine.js +3 -3
- package/dist/LinearGenomeView/components/Cytobands.d.ts +6 -2
- package/dist/LinearGenomeView/components/Cytobands.js +37 -38
- package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +3 -4
- package/dist/LinearGenomeView/components/GetSequenceDialog.js +3 -3
- package/dist/LinearGenomeView/components/Gridlines.d.ts +3 -4
- package/dist/LinearGenomeView/components/Gridlines.js +21 -18
- package/dist/LinearGenomeView/components/ImportForm.d.ts +2 -2
- package/dist/LinearGenomeView/components/ImportForm.js +2 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.js +19 -1
- package/dist/LinearGenomeView/components/MiniControls.js +13 -5
- package/dist/LinearGenomeView/components/OverviewRubberband.d.ts +2 -2
- package/dist/LinearGenomeView/components/OverviewRubberband.js +2 -1
- package/dist/LinearGenomeView/components/OverviewScalebar.d.ts +2 -2
- package/dist/LinearGenomeView/components/OverviewScalebar.js +41 -13
- package/dist/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +2 -2
- package/dist/LinearGenomeView/components/RefNameAutocomplete/index.js +2 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +1 -3
- package/dist/LinearGenomeView/components/Rubberband.d.ts +4 -5
- package/dist/LinearGenomeView/components/Rubberband.js +3 -3
- package/dist/LinearGenomeView/components/Scalebar.d.ts +2 -2
- package/dist/LinearGenomeView/components/Scalebar.js +29 -24
- package/dist/LinearGenomeView/components/SearchBox.d.ts +4 -5
- package/dist/LinearGenomeView/components/SearchBox.js +3 -3
- package/dist/LinearGenomeView/components/SequenceSearchDialog.d.ts +4 -5
- package/dist/LinearGenomeView/components/SequenceSearchDialog.js +20 -18
- package/dist/LinearGenomeView/components/TrackContainer.d.ts +2 -2
- package/dist/LinearGenomeView/components/TrackContainer.js +2 -1
- package/dist/LinearGenomeView/components/TrackLabel.d.ts +2 -2
- package/dist/LinearGenomeView/components/TrackLabel.js +3 -3
- package/dist/LinearGenomeView/components/TrackRenderingContainer.d.ts +2 -2
- package/dist/LinearGenomeView/components/TrackRenderingContainer.js +2 -1
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +2 -2
- package/dist/LinearGenomeView/components/TracksContainer.js +2 -1
- package/dist/LinearGenomeView/components/VerticalGuide.d.ts +3 -4
- package/dist/LinearGenomeView/components/VerticalGuide.js +3 -3
- package/dist/LinearGenomeView/components/ZoomControls.d.ts +3 -4
- package/dist/LinearGenomeView/components/ZoomControls.js +3 -3
- package/dist/LinearGenomeView/components/util.d.ts +1 -1
- package/dist/LinearGenomeView/model.d.ts +6 -6
- package/dist/LinearGenomeView/model.js +33 -0
- package/dist/LinearGenomeView/svgcomponents/SVGBackground.js +2 -2
- package/dist/LinearGenomeView/svgcomponents/SVGHeader.js +1 -4
- package/dist/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +1 -0
- package/dist/LinearGenomeView/svgcomponents/SVGRuler.js +2 -3
- package/dist/LinearGenomeView/svgcomponents/SVGScalebar.js +1 -2
- package/dist/index.d.ts +37 -37
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +4 -14
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +4 -4
- package/esm/BaseLinearDisplay/components/Tooltip.js +1 -1
- package/esm/BaseLinearDisplay/models/util.d.ts +2 -6
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +4 -5
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +3 -3
- package/esm/LinearBasicDisplay/model.d.ts +3 -1
- package/esm/LinearGenomeView/components/CenterLine.d.ts +3 -4
- package/esm/LinearGenomeView/components/CenterLine.js +3 -3
- package/esm/LinearGenomeView/components/Cytobands.d.ts +6 -2
- package/esm/LinearGenomeView/components/Cytobands.js +37 -38
- package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +3 -4
- package/esm/LinearGenomeView/components/GetSequenceDialog.js +3 -3
- package/esm/LinearGenomeView/components/Gridlines.d.ts +3 -4
- package/esm/LinearGenomeView/components/Gridlines.js +21 -18
- package/esm/LinearGenomeView/components/ImportForm.d.ts +2 -2
- package/esm/LinearGenomeView/components/ImportForm.js +2 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.js +20 -2
- package/esm/LinearGenomeView/components/MiniControls.js +13 -5
- package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +2 -2
- package/esm/LinearGenomeView/components/OverviewRubberband.js +2 -1
- package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +2 -2
- package/esm/LinearGenomeView/components/OverviewScalebar.js +18 -13
- package/esm/LinearGenomeView/components/RefNameAutocomplete/index.d.ts +2 -2
- package/esm/LinearGenomeView/components/RefNameAutocomplete/index.js +2 -1
- package/esm/LinearGenomeView/components/RefNameAutocomplete/util.d.ts +1 -3
- package/esm/LinearGenomeView/components/Rubberband.d.ts +4 -5
- package/esm/LinearGenomeView/components/Rubberband.js +3 -3
- package/esm/LinearGenomeView/components/Scalebar.d.ts +2 -2
- package/esm/LinearGenomeView/components/Scalebar.js +29 -24
- package/esm/LinearGenomeView/components/SearchBox.d.ts +4 -5
- package/esm/LinearGenomeView/components/SearchBox.js +3 -3
- package/esm/LinearGenomeView/components/SequenceSearchDialog.d.ts +4 -5
- package/esm/LinearGenomeView/components/SequenceSearchDialog.js +21 -19
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +2 -2
- package/esm/LinearGenomeView/components/TrackContainer.js +2 -1
- package/esm/LinearGenomeView/components/TrackLabel.d.ts +2 -2
- package/esm/LinearGenomeView/components/TrackLabel.js +3 -3
- package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +2 -2
- package/esm/LinearGenomeView/components/TrackRenderingContainer.js +2 -1
- package/esm/LinearGenomeView/components/TracksContainer.d.ts +2 -2
- package/esm/LinearGenomeView/components/TracksContainer.js +2 -1
- package/esm/LinearGenomeView/components/VerticalGuide.d.ts +3 -4
- package/esm/LinearGenomeView/components/VerticalGuide.js +3 -3
- package/esm/LinearGenomeView/components/ZoomControls.d.ts +3 -4
- package/esm/LinearGenomeView/components/ZoomControls.js +3 -3
- package/esm/LinearGenomeView/components/util.d.ts +1 -1
- package/esm/LinearGenomeView/model.d.ts +6 -6
- package/esm/LinearGenomeView/model.js +33 -0
- package/esm/LinearGenomeView/svgcomponents/SVGBackground.js +2 -2
- package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +2 -5
- package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +1 -0
- package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +3 -4
- package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js +2 -3
- package/esm/index.d.ts +37 -37
- package/package.json +4 -5
|
@@ -20,7 +20,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
20
20
|
padding: theme.spacing(4),
|
|
21
21
|
},
|
|
22
22
|
}));
|
|
23
|
-
|
|
23
|
+
const LinearGenomeViewImportForm = observer(function ({ model, }) {
|
|
24
24
|
var _a;
|
|
25
25
|
const { classes } = useStyles();
|
|
26
26
|
const session = getSession(model);
|
|
@@ -140,3 +140,4 @@ export default observer(function ({ model }) {
|
|
|
140
140
|
model.showAllRegionsInAssembly(selectedAsm);
|
|
141
141
|
}, variant: "contained", color: "secondary" }, "Show all regions in assembly"))))))));
|
|
142
142
|
});
|
|
143
|
+
export default LinearGenomeViewImportForm;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { lazy } from 'react';
|
|
1
|
+
import React, { lazy, useEffect, useRef } from 'react';
|
|
2
2
|
import { Button, Paper, Typography } from '@mui/material';
|
|
3
3
|
import { makeStyles } from 'tss-react/mui';
|
|
4
4
|
import { LoadingEllipses } from '@jbrowse/core/ui';
|
|
@@ -7,6 +7,7 @@ import { observer } from 'mobx-react';
|
|
|
7
7
|
import { TrackSelector as TrackSelectorIcon } from '@jbrowse/core/ui/Icons';
|
|
8
8
|
import TrackContainer from './TrackContainer';
|
|
9
9
|
import TracksContainer from './TracksContainer';
|
|
10
|
+
import { getSession } from '@jbrowse/core/util';
|
|
10
11
|
const ImportForm = lazy(() => import('./ImportForm'));
|
|
11
12
|
const useStyles = makeStyles()(theme => ({
|
|
12
13
|
note: {
|
|
@@ -18,6 +19,23 @@ const useStyles = makeStyles()(theme => ({
|
|
|
18
19
|
const LinearGenomeView = observer(({ model }) => {
|
|
19
20
|
const { tracks, error, initialized, hasDisplayedRegions } = model;
|
|
20
21
|
const { classes } = useStyles();
|
|
22
|
+
const ref = useRef(null);
|
|
23
|
+
const session = getSession(model);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
// sets the focused view id based on a click within the LGV; necessary for subviews to be focused properly
|
|
26
|
+
function handleSelectView(e) {
|
|
27
|
+
var _a, _b;
|
|
28
|
+
if (e.target instanceof Element && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.contains(e.target))) {
|
|
29
|
+
(_b = session.setFocusedViewId) === null || _b === void 0 ? void 0 : _b.call(session, model.id);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
document.addEventListener('mousedown', handleSelectView);
|
|
33
|
+
document.addEventListener('keydown', handleSelectView);
|
|
34
|
+
return () => {
|
|
35
|
+
document.removeEventListener('mousedown', handleSelectView);
|
|
36
|
+
document.removeEventListener('keydown', handleSelectView);
|
|
37
|
+
};
|
|
38
|
+
}, [session, model]);
|
|
21
39
|
if (!initialized && !error) {
|
|
22
40
|
return React.createElement(LoadingEllipses, { variant: "h6" });
|
|
23
41
|
}
|
|
@@ -26,7 +44,7 @@ const LinearGenomeView = observer(({ model }) => {
|
|
|
26
44
|
}
|
|
27
45
|
const MiniControlsComponent = model.MiniControlsComponent();
|
|
28
46
|
const HeaderComponent = model.HeaderComponent();
|
|
29
|
-
return (React.createElement("div", { style: { position: 'relative' } },
|
|
47
|
+
return (React.createElement("div", { style: { position: 'relative' }, ref: ref },
|
|
30
48
|
React.createElement(HeaderComponent, { model: model }),
|
|
31
49
|
React.createElement(MiniControlsComponent, { model: model }),
|
|
32
50
|
React.createElement(TracksContainer, { model: model }, !tracks.length ? (React.createElement(Paper, { variant: "outlined", className: classes.note }, !model.hideNoTracksActive ? (React.createElement(React.Fragment, null,
|
|
@@ -7,23 +7,31 @@ import ZoomOut from '@mui/icons-material/ZoomOut';
|
|
|
7
7
|
import ArrowDown from '@mui/icons-material/KeyboardArrowDown';
|
|
8
8
|
import CascadingMenuButton from '@jbrowse/core/ui/CascadingMenuButton';
|
|
9
9
|
import { makeStyles } from 'tss-react/mui';
|
|
10
|
+
import { getSession } from '@jbrowse/core/util';
|
|
10
11
|
const useStyles = makeStyles()(theme => ({
|
|
11
|
-
|
|
12
|
+
background: {
|
|
12
13
|
position: 'absolute',
|
|
13
14
|
right: 0,
|
|
14
15
|
zIndex: 1001,
|
|
15
16
|
background: theme.palette.background.paper,
|
|
16
17
|
},
|
|
18
|
+
focusedBackground: {
|
|
19
|
+
background: theme.palette.secondary.light,
|
|
20
|
+
svg: {
|
|
21
|
+
fill: theme.palette.secondary.contrastText,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
17
24
|
}));
|
|
18
25
|
const MiniControls = observer(function ({ model, }) {
|
|
19
|
-
const { classes } = useStyles();
|
|
20
|
-
const { bpPerPx, maxBpPerPx, minBpPerPx, scaleFactor, hideHeader } = model;
|
|
21
|
-
|
|
26
|
+
const { classes, cx } = useStyles();
|
|
27
|
+
const { id, bpPerPx, maxBpPerPx, minBpPerPx, scaleFactor, hideHeader } = model;
|
|
28
|
+
const { focusedViewId } = getSession(model);
|
|
29
|
+
return hideHeader ? (React.createElement(Paper, { className: cx(classes.background, focusedViewId === id ? classes.focusedBackground : undefined) },
|
|
22
30
|
React.createElement(CascadingMenuButton, { menuItems: model.menuItems() },
|
|
23
31
|
React.createElement(ArrowDown, { fontSize: "small" })),
|
|
24
32
|
React.createElement(IconButton, { "data-testid": "zoom_out", onClick: () => model.zoom(bpPerPx * 2), disabled: bpPerPx >= maxBpPerPx - 0.0001 || scaleFactor !== 1 },
|
|
25
33
|
React.createElement(ZoomOut, { fontSize: "small" })),
|
|
26
|
-
React.createElement(IconButton, { "data-testid": "zoom_in", onClick: () => model.zoom(
|
|
34
|
+
React.createElement(IconButton, { "data-testid": "zoom_in", onClick: () => model.zoom(bpPerPx / 2), disabled: bpPerPx <= minBpPerPx + 0.0001 || scaleFactor !== 1 },
|
|
27
35
|
React.createElement(ZoomIn, { fontSize: "small" })))) : null;
|
|
28
36
|
});
|
|
29
37
|
export default MiniControls;
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel';
|
|
3
3
|
import { LinearGenomeViewModel } from '..';
|
|
4
4
|
type LGV = LinearGenomeViewModel;
|
|
5
|
-
declare const
|
|
5
|
+
declare const OverviewRubberband: ({ model, overview, ControlComponent, }: {
|
|
6
6
|
model: LGV;
|
|
7
7
|
overview: Base1DViewModel;
|
|
8
8
|
ControlComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
9
9
|
}) => React.JSX.Element;
|
|
10
|
-
export default
|
|
10
|
+
export default OverviewRubberband;
|
|
@@ -32,7 +32,7 @@ const HoverTooltip = observer(function ({ model, open, guideX, overview, }) {
|
|
|
32
32
|
return (React.createElement(Tooltip, { open: open, placement: "top", title: [stringify(px), cytoband === null || cytoband === void 0 ? void 0 : cytoband.get('name')].join(' '), arrow: true },
|
|
33
33
|
React.createElement("div", { className: classes.guide, style: { left: guideX } })));
|
|
34
34
|
});
|
|
35
|
-
|
|
35
|
+
const OverviewRubberband = observer(function OverviewRubberband({ model, overview, ControlComponent = React.createElement("div", null), }) {
|
|
36
36
|
const { cytobandOffset } = model;
|
|
37
37
|
const [startX, setStartX] = useState();
|
|
38
38
|
const [currentX, setCurrentX] = useState();
|
|
@@ -128,3 +128,4 @@ export default observer(function OverviewRubberband({ model, overview, ControlCo
|
|
|
128
128
|
leftBpOffset && rightBpOffset ? (React.createElement(RubberbandSpan, { leftBpOffset: leftBpOffset, rightBpOffset: rightBpOffset, width: Math.abs(width), left: left })) : null,
|
|
129
129
|
React.createElement("div", { "data-testid": "rubberband_controls", className: classes.rubberbandControl, ref: controlsRef, onMouseDown: mouseDown, onMouseOut: mouseOut, onMouseMove: mouseMove }, ControlComponent)));
|
|
130
130
|
});
|
|
131
|
+
export default OverviewRubberband;
|
|
@@ -7,10 +7,10 @@ declare const Polygon: ({ model, overview, useOffset, }: {
|
|
|
7
7
|
useOffset?: boolean | undefined;
|
|
8
8
|
}) => React.JSX.Element | null;
|
|
9
9
|
type LGV = LinearGenomeViewModel;
|
|
10
|
-
declare const
|
|
10
|
+
declare const OverviewScalebar: ({ model, children, }: {
|
|
11
11
|
model: LGV;
|
|
12
12
|
children: React.ReactNode;
|
|
13
13
|
}) => React.JSX.Element;
|
|
14
|
-
export default _default;
|
|
15
14
|
export { Polygon };
|
|
16
15
|
export { default as Cytobands } from './Cytobands';
|
|
16
|
+
export default OverviewScalebar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
2
|
import { Typography, useTheme, alpha } from '@mui/material';
|
|
3
3
|
import { makeStyles } from 'tss-react/mui';
|
|
4
4
|
import { observer } from 'mobx-react';
|
|
@@ -76,9 +76,7 @@ const Polygon = observer(function ({ model, overview, useOffset = true, }) {
|
|
|
76
76
|
if (!contentBlocks.length) {
|
|
77
77
|
return null;
|
|
78
78
|
}
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
80
79
|
const first = contentBlocks.at(0);
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
82
80
|
const last = contentBlocks.at(-1);
|
|
83
81
|
const topLeft = (overview.bpToPx({
|
|
84
82
|
...first,
|
|
@@ -155,9 +153,7 @@ const Scalebar = observer(function ({ model, scale, overview, }) {
|
|
|
155
153
|
if (!visibleRegions.length) {
|
|
156
154
|
return null;
|
|
157
155
|
}
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
159
156
|
const first = visibleRegions.at(0);
|
|
160
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
161
157
|
const last = visibleRegions.at(-1);
|
|
162
158
|
const firstOverviewPx = overview.bpToPx({
|
|
163
159
|
...first,
|
|
@@ -185,17 +181,25 @@ const Scalebar = observer(function ({ model, scale, overview, }) {
|
|
|
185
181
|
} })) : (React.createElement(OverviewBox, { scale: scale, block: block, model: model, overview: overview, key: `${JSON.stringify(block)}-${idx}` }));
|
|
186
182
|
})));
|
|
187
183
|
});
|
|
188
|
-
|
|
184
|
+
const OverviewScalebar = observer(function ({ model, children, }) {
|
|
189
185
|
const { classes } = useStyles();
|
|
190
186
|
const { totalBp, width, cytobandOffset, displayedRegions } = model;
|
|
191
|
-
const overview = Base1DView.create({
|
|
192
|
-
displayedRegions: JSON.parse(JSON.stringify(displayedRegions)),
|
|
193
|
-
interRegionPaddingWidth: 0,
|
|
194
|
-
minimumBlockWidth: model.minimumBlockWidth,
|
|
195
|
-
});
|
|
196
187
|
const modWidth = width - cytobandOffset;
|
|
197
|
-
overview
|
|
198
|
-
|
|
188
|
+
const overview = useMemo(() => {
|
|
189
|
+
const overview = Base1DView.create({
|
|
190
|
+
displayedRegions: JSON.parse(JSON.stringify(displayedRegions)),
|
|
191
|
+
interRegionPaddingWidth: 0,
|
|
192
|
+
minimumBlockWidth: model.minimumBlockWidth,
|
|
193
|
+
});
|
|
194
|
+
overview.setVolatileWidth(modWidth);
|
|
195
|
+
overview.showAllRegions();
|
|
196
|
+
return overview;
|
|
197
|
+
}, [
|
|
198
|
+
JSON.stringify(displayedRegions),
|
|
199
|
+
model.minimumBlockWidth,
|
|
200
|
+
modWidth,
|
|
201
|
+
displayedRegions,
|
|
202
|
+
]);
|
|
199
203
|
const scale = totalBp / (modWidth - (displayedRegions.length - 1) * wholeSeqSpacer);
|
|
200
204
|
return (React.createElement("div", null,
|
|
201
205
|
React.createElement(OverviewRubberband, { model: model, overview: overview, ControlComponent: React.createElement(Scalebar, { model: model, overview: overview, scale: scale }) }),
|
|
@@ -206,3 +210,4 @@ export default observer(function OverviewScalebar({ model, children, }) {
|
|
|
206
210
|
});
|
|
207
211
|
export { Polygon };
|
|
208
212
|
export { default as Cytobands } from './Cytobands';
|
|
213
|
+
export default OverviewScalebar;
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import BaseResult from '@jbrowse/core/TextSearch/BaseResults';
|
|
3
3
|
import { TextFieldProps as TFP } from '@mui/material';
|
|
4
4
|
import { LinearGenomeViewModel } from '../../model';
|
|
5
|
-
declare const
|
|
5
|
+
declare const RefNameAutocomplete: ({ model, onSelect, assemblyName, style, fetchResults, onChange, value, showHelp, minWidth, maxWidth, TextFieldProps, }: {
|
|
6
6
|
model: LinearGenomeViewModel;
|
|
7
7
|
onSelect?: ((region: BaseResult) => void) | undefined;
|
|
8
8
|
onChange?: ((val: string) => void) | undefined;
|
|
@@ -15,4 +15,4 @@ declare const _default: ({ model, onSelect, assemblyName, style, fetchResults, o
|
|
|
15
15
|
showHelp?: boolean | undefined;
|
|
16
16
|
TextFieldProps?: TFP | undefined;
|
|
17
17
|
}) => React.JSX.Element;
|
|
18
|
-
export default
|
|
18
|
+
export default RefNameAutocomplete;
|
|
@@ -5,7 +5,7 @@ import BaseResult, { RefSequenceResult, } from '@jbrowse/core/TextSearch/BaseRes
|
|
|
5
5
|
import { Autocomplete } from '@mui/material';
|
|
6
6
|
import { getDeduplicatedResult, getFiltered } from './util';
|
|
7
7
|
import AutocompleteTextField from './AutocompleteTextField';
|
|
8
|
-
|
|
8
|
+
const RefNameAutocomplete = observer(function ({ model, onSelect, assemblyName, style, fetchResults, onChange, value, showHelp = true, minWidth = 200, maxWidth = 550, TextFieldProps = {}, }) {
|
|
9
9
|
var _a;
|
|
10
10
|
const session = getSession(model);
|
|
11
11
|
const { assemblyManager } = session;
|
|
@@ -80,3 +80,4 @@ export default observer(function RefNameAutocomplete({ model, onSelect, assembly
|
|
|
80
80
|
}))) || []
|
|
81
81
|
: searchOptions, getOptionDisabled: option => option.group === 'limitOption', filterOptions: (opts, { inputValue }) => getFiltered(opts, inputValue), renderInput: params => (React.createElement(AutocompleteTextField, { showHelp: showHelp, params: params, inputBoxVal: inputBoxVal, TextFieldProps: TextFieldProps, setCurrentSearch: setCurrentSearch, setInputValue: setInputValue })), getOptionLabel: opt => typeof opt === 'string' ? opt : opt.result.getDisplayString() })));
|
|
82
82
|
});
|
|
83
|
+
export default RefNameAutocomplete;
|
|
@@ -4,9 +4,7 @@ export interface Option {
|
|
|
4
4
|
result: BaseResult;
|
|
5
5
|
}
|
|
6
6
|
export declare function getFiltered(opts: Option[], inputValue: string): Option[];
|
|
7
|
-
export declare function aggregateResults(results: BaseResult[]):
|
|
8
|
-
[key: string]: BaseResult[];
|
|
9
|
-
};
|
|
7
|
+
export declare function aggregateResults(results: BaseResult[]): Record<string, BaseResult[]>;
|
|
10
8
|
export declare function getDeduplicatedResult(results: BaseResult[]): {
|
|
11
9
|
result: BaseResult;
|
|
12
10
|
}[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinearGenomeViewModel } from '..';
|
|
3
3
|
type LGV = LinearGenomeViewModel;
|
|
4
|
-
declare
|
|
4
|
+
declare const Rubberband: ({ model, ControlComponent, }: {
|
|
5
5
|
model: LGV;
|
|
6
|
-
ControlComponent?: React.ReactElement;
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
export default _default;
|
|
6
|
+
ControlComponent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default Rubberband;
|
|
@@ -13,7 +13,7 @@ const useStyles = makeStyles()({
|
|
|
13
13
|
minHeight: 8,
|
|
14
14
|
},
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
const Rubberband = observer(function ({ model, ControlComponent = React.createElement("div", null), }) {
|
|
17
17
|
const ref = useRef(null);
|
|
18
18
|
const { classes } = useStyles();
|
|
19
19
|
const { guideX, rubberbandOn, leftBpOffset, rightBpOffset, numOfBpSelected, width, left, anchorPosition, handleMenuItemClick, open, handleClose, mouseMove, mouseDown, mouseOut, } = useRangeSelect(ref, model);
|
|
@@ -24,5 +24,5 @@ function Rubberband({ model, ControlComponent = React.createElement("div", null)
|
|
|
24
24
|
top: anchorPosition.clientY,
|
|
25
25
|
}, onMenuItemClick: handleMenuItemClick, open: open, onClose: handleClose, menuItems: model.rubberBandMenuItems() })) : null,
|
|
26
26
|
React.createElement("div", { "data-testid": "rubberband_controls", className: classes.rubberbandControl, ref: ref, onMouseDown: mouseDown, onMouseMove: mouseMove, onMouseOut: mouseOut }, ControlComponent)));
|
|
27
|
-
}
|
|
28
|
-
export default
|
|
27
|
+
});
|
|
28
|
+
export default Rubberband;
|
|
@@ -6,5 +6,5 @@ interface ScalebarProps {
|
|
|
6
6
|
style?: React.CSSProperties;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
declare const
|
|
10
|
-
export default
|
|
9
|
+
declare const Scalebar: React.ForwardRefExoticComponent<ScalebarProps & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default Scalebar;
|
|
@@ -21,7 +21,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
21
21
|
pointerEvents: 'none',
|
|
22
22
|
},
|
|
23
23
|
majorTickLabel: {
|
|
24
|
-
fontSize:
|
|
24
|
+
fontSize: 11,
|
|
25
25
|
zIndex: 1,
|
|
26
26
|
background: theme.palette.background.paper,
|
|
27
27
|
lineHeight: 'normal',
|
|
@@ -35,10 +35,10 @@ const useStyles = makeStyles()(theme => ({
|
|
|
35
35
|
pointerEvents: 'none',
|
|
36
36
|
},
|
|
37
37
|
refLabel: {
|
|
38
|
-
fontSize:
|
|
38
|
+
fontSize: 11,
|
|
39
39
|
position: 'absolute',
|
|
40
|
-
left:
|
|
41
|
-
top:
|
|
40
|
+
left: 2,
|
|
41
|
+
top: -1,
|
|
42
42
|
fontWeight: 'bold',
|
|
43
43
|
lineHeight: 'normal',
|
|
44
44
|
zIndex: 1,
|
|
@@ -65,32 +65,37 @@ const RenderedRefNameLabels = observer(({ model }) => {
|
|
|
65
65
|
}, className: classes.refLabel, "data-testid": `refLabel-${block.refName}` }, block.refName)) : null;
|
|
66
66
|
})));
|
|
67
67
|
});
|
|
68
|
-
const
|
|
68
|
+
const RenderedBlockTicks = function ({ block, bpPerPx, }) {
|
|
69
69
|
const { classes } = useStyles();
|
|
70
|
-
const {
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
const { reversed, start, end } = block;
|
|
71
|
+
const ticks = makeTicks(start, end, bpPerPx, true, false);
|
|
72
|
+
return (React.createElement(ContentBlockComponent, { block: block }, ticks.map(({ type, base }) => {
|
|
73
|
+
if (type === 'major') {
|
|
74
|
+
const x = (reversed ? end - base : base - start) / bpPerPx;
|
|
75
|
+
const baseNumber = base + 1;
|
|
76
|
+
return (React.createElement("div", { key: base, className: classes.tick, style: { left: x } }, baseNumber ? (React.createElement(Typography, { className: classes.majorTickLabel }, getTickDisplayStr(baseNumber, bpPerPx))) : null));
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
})));
|
|
80
|
+
};
|
|
81
|
+
const RenderedScalebarLabels = observer(({ model }) => {
|
|
82
|
+
const { staticBlocks, bpPerPx } = model;
|
|
83
|
+
return (React.createElement(React.Fragment, null, staticBlocks.map((block, idx) => {
|
|
84
|
+
const { key, widthPx } = block;
|
|
85
|
+
const k = `${key}-${idx}`;
|
|
73
86
|
if (block instanceof ContentBlock) {
|
|
74
|
-
|
|
75
|
-
return (React.createElement(ContentBlockComponent, { key: `${key}-${index}`, block: block }, ticks.map(tick => {
|
|
76
|
-
if (tick.type === 'major') {
|
|
77
|
-
const x = (reversed ? end - tick.base : tick.base - start) / bpPerPx;
|
|
78
|
-
const baseNumber = tick.base + 1;
|
|
79
|
-
return (React.createElement("div", { key: tick.base, className: classes.tick, style: { left: x } }, baseNumber ? (React.createElement(Typography, { className: classes.majorTickLabel }, getTickDisplayStr(baseNumber, bpPerPx))) : null));
|
|
80
|
-
}
|
|
81
|
-
return null;
|
|
82
|
-
})));
|
|
87
|
+
return React.createElement(RenderedBlockTicks, { key: k, block: block, bpPerPx: bpPerPx });
|
|
83
88
|
}
|
|
84
|
-
if (block instanceof ElidedBlock) {
|
|
85
|
-
return React.createElement(ElidedBlockComponent, { key:
|
|
89
|
+
else if (block instanceof ElidedBlock) {
|
|
90
|
+
return React.createElement(ElidedBlockComponent, { key: k, width: widthPx });
|
|
86
91
|
}
|
|
87
|
-
if (block instanceof InterRegionPaddingBlock) {
|
|
88
|
-
return (React.createElement(InterRegionPaddingBlockComponent, { key:
|
|
92
|
+
else if (block instanceof InterRegionPaddingBlock) {
|
|
93
|
+
return (React.createElement(InterRegionPaddingBlockComponent, { key: k, width: widthPx, style: { background: 'none' }, boundary: block.variant === 'boundary' }));
|
|
89
94
|
}
|
|
90
95
|
return null;
|
|
91
96
|
})));
|
|
92
97
|
});
|
|
93
|
-
const Scalebar = React.forwardRef(({ model, style, className, ...other }, ref)
|
|
98
|
+
const Scalebar = observer(React.forwardRef(function Scalebar2({ model, style, className, ...other }, ref) {
|
|
94
99
|
const { classes, cx } = useStyles();
|
|
95
100
|
const offsetLeft = model.staticBlocks.offsetPx - model.offsetPx;
|
|
96
101
|
return (React.createElement(Paper, { "data-resizer": "true" // used to avoid click-and-drag scrolls on trackscontainer
|
|
@@ -107,5 +112,5 @@ const Scalebar = React.forwardRef(({ model, style, className, ...other }, ref) =
|
|
|
107
112
|
} },
|
|
108
113
|
React.createElement(RenderedScalebarLabels, { model: model }))),
|
|
109
114
|
React.createElement(RenderedRefNameLabels, { model: model })));
|
|
110
|
-
});
|
|
111
|
-
export default
|
|
115
|
+
}));
|
|
116
|
+
export default Scalebar;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinearGenomeViewModel } from '..';
|
|
3
|
-
declare
|
|
4
|
-
showHelp?: boolean;
|
|
3
|
+
declare const SearchBox: ({ model, showHelp, }: {
|
|
4
|
+
showHelp?: boolean | undefined;
|
|
5
5
|
model: LinearGenomeViewModel;
|
|
6
|
-
})
|
|
7
|
-
|
|
8
|
-
export default _default;
|
|
6
|
+
}) => React.JSX.Element;
|
|
7
|
+
export default SearchBox;
|
|
@@ -12,7 +12,7 @@ const useStyles = makeStyles()(() => ({
|
|
|
12
12
|
minWidth: 100,
|
|
13
13
|
},
|
|
14
14
|
}));
|
|
15
|
-
|
|
15
|
+
const SearchBox = observer(function ({ model, showHelp, }) {
|
|
16
16
|
const { classes } = useStyles();
|
|
17
17
|
const theme = useTheme();
|
|
18
18
|
const session = getSession(model);
|
|
@@ -97,5 +97,5 @@ function SearchBox({ model, showHelp, }) {
|
|
|
97
97
|
},
|
|
98
98
|
},
|
|
99
99
|
} }));
|
|
100
|
-
}
|
|
101
|
-
export default
|
|
100
|
+
});
|
|
101
|
+
export default SearchBox;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare
|
|
2
|
+
declare const SequenceSearchDialog: ({ model, handleClose, }: {
|
|
3
3
|
model: {
|
|
4
4
|
assemblyNames: string[];
|
|
5
|
-
|
|
5
|
+
showTrack: (trackId: string) => void;
|
|
6
6
|
};
|
|
7
7
|
handleClose: () => void;
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
-
export default _default;
|
|
8
|
+
}) => React.JSX.Element;
|
|
9
|
+
export default SequenceSearchDialog;
|
|
@@ -4,13 +4,13 @@ import { Dialog } from '@jbrowse/core/ui';
|
|
|
4
4
|
import { getSnapshot } from 'mobx-state-tree';
|
|
5
5
|
import { makeStyles } from 'tss-react/mui';
|
|
6
6
|
import { observer } from 'mobx-react';
|
|
7
|
-
import { getSession } from '@jbrowse/core/util';
|
|
7
|
+
import { getSession, isSessionWithAddTracks } from '@jbrowse/core/util';
|
|
8
8
|
const useStyles = makeStyles()({
|
|
9
9
|
dialogContent: {
|
|
10
10
|
width: '40em',
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
|
-
function
|
|
13
|
+
const SequenceSearchDialog = observer(function ({ model, handleClose, }) {
|
|
14
14
|
const { classes } = useStyles();
|
|
15
15
|
const [value, setValue] = useState('');
|
|
16
16
|
const [searchForward, setSearchForward] = useState(true);
|
|
@@ -40,24 +40,26 @@ function SequenceDialog({ model, handleClose, }) {
|
|
|
40
40
|
const session = getSession(model);
|
|
41
41
|
const { assemblyManager } = session;
|
|
42
42
|
const assemblyName = model.assemblyNames[0];
|
|
43
|
-
session
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
if (isSessionWithAddTracks(session)) {
|
|
44
|
+
session.addTrackConf({
|
|
45
|
+
trackId,
|
|
46
|
+
name: `Sequence search ${value}`,
|
|
47
|
+
assemblyNames: [assemblyName],
|
|
48
|
+
type: 'FeatureTrack',
|
|
49
|
+
adapter: {
|
|
50
|
+
type: 'SequenceSearchAdapter',
|
|
51
|
+
search: value,
|
|
52
|
+
searchForward,
|
|
53
|
+
searchReverse,
|
|
54
|
+
caseInsensitive,
|
|
55
|
+
sequenceAdapter: getSnapshot((_a = assemblyManager.get(assemblyName)) === null || _a === void 0 ? void 0 : _a.configuration.sequence.adapter),
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
model.showTrack(trackId);
|
|
59
|
+
}
|
|
58
60
|
}
|
|
59
61
|
handleClose();
|
|
60
62
|
}, variant: "contained", color: "primary" }, "Submit"),
|
|
61
63
|
React.createElement(Button, { onClick: () => handleClose(), variant: "contained", color: "secondary" }, "Close"))));
|
|
62
|
-
}
|
|
63
|
-
export default
|
|
64
|
+
});
|
|
65
|
+
export default SequenceSearchDialog;
|
|
@@ -2,8 +2,8 @@ import React from 'react';
|
|
|
2
2
|
import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
3
|
import { LinearGenomeViewModel } from '..';
|
|
4
4
|
type LGV = LinearGenomeViewModel;
|
|
5
|
-
declare const
|
|
5
|
+
declare const TrackContainer: ({ model, track, }: {
|
|
6
6
|
model: LGV;
|
|
7
7
|
track: BaseTrackModel;
|
|
8
8
|
}) => React.JSX.Element;
|
|
9
|
-
export default
|
|
9
|
+
export default TrackContainer;
|
|
@@ -27,7 +27,7 @@ const useStyles = makeStyles()({
|
|
|
27
27
|
zIndex: 3,
|
|
28
28
|
},
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
const TrackContainer = observer(function ({ model, track, }) {
|
|
31
31
|
const { classes } = useStyles();
|
|
32
32
|
const display = track.displays[0];
|
|
33
33
|
const { draggingTrackId } = model;
|
|
@@ -54,3 +54,4 @@ export default observer(function TrackContainer({ model, track, }) {
|
|
|
54
54
|
}, onDragEnter: debouncedOnDragEnter }),
|
|
55
55
|
React.createElement(ResizeHandle, { onDrag: display.resizeHeight, className: classes.resizeHandle })));
|
|
56
56
|
});
|
|
57
|
+
export default TrackContainer;
|
|
@@ -4,5 +4,5 @@ interface Props {
|
|
|
4
4
|
track: BaseTrackModel;
|
|
5
5
|
className?: string;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
8
|
-
export default
|
|
7
|
+
declare const TrackLabel: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export default TrackLabel;
|
|
@@ -41,7 +41,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
41
41
|
padding: theme.spacing(1),
|
|
42
42
|
},
|
|
43
43
|
}));
|
|
44
|
-
const TrackLabel = React.forwardRef(function ({ track, className }, ref) {
|
|
44
|
+
const TrackLabel = observer(React.forwardRef(function TrackLabel2({ track, className }, ref) {
|
|
45
45
|
var _a;
|
|
46
46
|
const { classes, cx } = useStyles();
|
|
47
47
|
const view = getContainingView(track);
|
|
@@ -77,5 +77,5 @@ const TrackLabel = React.forwardRef(function ({ track, className }, ref) {
|
|
|
77
77
|
.join(' ') })),
|
|
78
78
|
React.createElement(CascadingMenuButton, { menuItems: items, "data-testid": "track_menu_icon" },
|
|
79
79
|
React.createElement(MoreVertIcon, { fontSize: "small" }))));
|
|
80
|
-
});
|
|
81
|
-
export default
|
|
80
|
+
}));
|
|
81
|
+
export default TrackLabel;
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
import { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
3
3
|
import { LinearGenomeViewModel } from '..';
|
|
4
4
|
type LGV = LinearGenomeViewModel;
|
|
5
|
-
declare const
|
|
5
|
+
declare const TrackRenderingContainer: ({ model, track, onDragEnter, }: {
|
|
6
6
|
model: LGV;
|
|
7
7
|
track: BaseTrackModel;
|
|
8
8
|
onDragEnter: () => void;
|
|
9
9
|
}) => React.JSX.Element;
|
|
10
|
-
export default
|
|
10
|
+
export default TrackRenderingContainer;
|
|
@@ -22,7 +22,7 @@ const useStyles = makeStyles()({
|
|
|
22
22
|
zIndex: 2,
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
const TrackRenderingContainer = observer(function ({ model, track, onDragEnter, }) {
|
|
26
26
|
const { classes } = useStyles();
|
|
27
27
|
const display = track.displays[0];
|
|
28
28
|
const { height, RenderingComponent, DisplayBlurb } = display;
|
|
@@ -48,3 +48,4 @@ export default observer(function TrackRenderingContainer({ model, track, onDragE
|
|
|
48
48
|
} },
|
|
49
49
|
React.createElement(DisplayBlurb, { model: display }))) : null)) : null));
|
|
50
50
|
});
|
|
51
|
+
export default TrackRenderingContainer;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinearGenomeViewModel } from '..';
|
|
3
3
|
type LGV = LinearGenomeViewModel;
|
|
4
|
-
declare const
|
|
4
|
+
declare const TracksContainer: ({ children, model, }: {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
model: LGV;
|
|
7
7
|
}) => React.JSX.Element;
|
|
8
|
-
export default
|
|
8
|
+
export default TracksContainer;
|
|
@@ -19,7 +19,7 @@ const useStyles = makeStyles()({
|
|
|
19
19
|
overflow: 'hidden',
|
|
20
20
|
},
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
const TracksContainer = observer(function TracksContainer({ children, model, }) {
|
|
23
23
|
const { classes } = useStyles();
|
|
24
24
|
const { pluginManager } = getEnv(model);
|
|
25
25
|
const { mouseDown: mouseDown1, mouseUp } = useSideScroll(model);
|
|
@@ -42,3 +42,4 @@ export default observer(function TracksContainer({ children, model, }) {
|
|
|
42
42
|
additional,
|
|
43
43
|
children));
|
|
44
44
|
});
|
|
45
|
+
export default TracksContainer;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { LinearGenomeViewModel } from '..';
|
|
3
3
|
type LGV = LinearGenomeViewModel;
|
|
4
|
-
declare
|
|
4
|
+
declare const VerticalGuide: ({ model, coordX, }: {
|
|
5
5
|
model: LGV;
|
|
6
6
|
coordX: number;
|
|
7
|
-
})
|
|
8
|
-
|
|
9
|
-
export default _default;
|
|
7
|
+
}) => React.JSX.Element;
|
|
8
|
+
export default VerticalGuide;
|
|
@@ -12,12 +12,12 @@ const useStyles = makeStyles()({
|
|
|
12
12
|
zIndex: 10,
|
|
13
13
|
},
|
|
14
14
|
});
|
|
15
|
-
function VerticalGuide({ model, coordX }) {
|
|
15
|
+
const VerticalGuide = observer(function VerticalGuide({ model, coordX, }) {
|
|
16
16
|
const { classes } = useStyles();
|
|
17
17
|
return (React.createElement(Tooltip, { open: true, placement: "top", title: stringify(model.pxToBp(coordX)), arrow: true },
|
|
18
18
|
React.createElement("div", { className: classes.guide, style: {
|
|
19
19
|
left: coordX,
|
|
20
20
|
background: 'red',
|
|
21
21
|
} })));
|
|
22
|
-
}
|
|
23
|
-
export default
|
|
22
|
+
});
|
|
23
|
+
export default VerticalGuide;
|