@jbrowse/plugin-linear-genome-view 1.7.11 → 2.1.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/BaseLinearDisplay.js +119 -139
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Block.js +53 -74
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -0
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +11 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +64 -103
- package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +146 -175
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Tooltip.js +109 -116
- package/dist/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/dist/BaseLinearDisplay/index.js +13 -40
- package/dist/BaseLinearDisplay/index.js.map +1 -0
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +19 -14
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +605 -684
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +15 -22
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +7 -8
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +266 -312
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/dist/LinearBareDisplay/configSchema.js +11 -17
- package/dist/LinearBareDisplay/configSchema.js.map +1 -0
- package/dist/LinearBareDisplay/index.js +7 -20
- package/dist/LinearBareDisplay/index.js.map +1 -0
- package/dist/LinearBareDisplay/model.d.ts +15 -13
- package/dist/LinearBareDisplay/model.js +36 -42
- package/dist/LinearBareDisplay/model.js.map +1 -0
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +76 -85
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/dist/LinearBasicDisplay/configSchema.js +15 -23
- package/dist/LinearBasicDisplay/configSchema.js.map +1 -0
- package/dist/LinearBasicDisplay/index.js +10 -22
- package/dist/LinearBasicDisplay/index.js.map +1 -0
- package/dist/LinearBasicDisplay/model.d.ts +20 -14
- package/dist/LinearBasicDisplay/model.js +180 -159
- package/dist/LinearBasicDisplay/model.js.map +1 -0
- package/dist/LinearGenomeView/components/CenterLine.d.ts +2 -8
- package/dist/LinearGenomeView/components/CenterLine.js +60 -74
- package/dist/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +141 -141
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/Gridlines.d.ts +8 -0
- package/dist/LinearGenomeView/components/Gridlines.js +78 -0
- package/dist/LinearGenomeView/components/Gridlines.js.map +1 -0
- package/dist/LinearGenomeView/components/Header.d.ts +1 -0
- package/dist/LinearGenomeView/components/Header.js +70 -125
- package/dist/LinearGenomeView/components/Header.js.map +1 -0
- package/dist/LinearGenomeView/components/HelpDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/HelpDialog.js +62 -44
- package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/ImportForm.d.ts +1 -0
- package/dist/LinearGenomeView/components/ImportForm.js +222 -289
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.js +60 -124
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +198 -337
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/dist/LinearGenomeView/components/MiniControls.js +64 -78
- package/dist/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +229 -293
- package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +3 -3
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +275 -370
- package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +237 -324
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/dist/LinearGenomeView/components/RubberBand.js +228 -296
- package/dist/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/Ruler.js +45 -90
- package/dist/LinearGenomeView/components/Ruler.js.map +1 -0
- package/dist/LinearGenomeView/components/ScaleBar.d.ts +8 -403
- package/dist/LinearGenomeView/components/ScaleBar.js +121 -172
- package/dist/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchBox.js +155 -166
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +105 -149
- package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/SequenceDialog.js +219 -272
- package/dist/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackContainer.d.ts +2 -1
- package/dist/LinearGenomeView/components/TrackContainer.js +113 -158
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackLabel.d.ts +6 -42
- package/dist/LinearGenomeView/components/TrackLabel.js +113 -133
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +172 -199
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/ZoomControls.js +72 -87
- package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/dist/LinearGenomeView/components/util.js +94 -71
- package/dist/LinearGenomeView/components/util.js.map +1 -0
- package/dist/LinearGenomeView/index.d.ts +64 -77
- package/dist/LinearGenomeView/index.js +1035 -1412
- package/dist/LinearGenomeView/index.js.map +1 -0
- package/dist/LinearGenomeView/util.js +76 -83
- package/dist/LinearGenomeView/util.js.map +1 -0
- package/dist/index.d.ts +98 -48
- package/dist/index.js +225 -295
- package/dist/index.js.map +1 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +9 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +68 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Block.d.ts +15 -0
- package/esm/BaseLinearDisplay/components/Block.js +46 -0
- package/esm/BaseLinearDisplay/components/Block.js.map +1 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +22 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +62 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +4 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +114 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js +64 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/esm/BaseLinearDisplay/index.d.ts +5 -0
- package/esm/BaseLinearDisplay/index.js +4 -0
- package/esm/BaseLinearDisplay/index.js.map +1 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +232 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +541 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +14 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +96 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +225 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/esm/LinearBareDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBareDisplay/configSchema.js +9 -0
- package/esm/LinearBareDisplay/configSchema.js.map +1 -0
- package/esm/LinearBareDisplay/index.d.ts +2 -0
- package/esm/LinearBareDisplay/index.js +3 -0
- package/esm/LinearBareDisplay/index.js.map +1 -0
- package/esm/LinearBareDisplay/model.d.ts +194 -0
- package/esm/LinearBareDisplay/model.js +28 -0
- package/esm/LinearBareDisplay/model.js.map +1 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +10 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +40 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/esm/LinearBasicDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBasicDisplay/configSchema.js +14 -0
- package/esm/LinearBasicDisplay/configSchema.js.map +1 -0
- package/esm/LinearBasicDisplay/index.d.ts +2 -0
- package/esm/LinearBasicDisplay/index.js +3 -0
- package/esm/LinearBasicDisplay/index.js.map +1 -0
- package/esm/LinearBasicDisplay/model.d.ts +218 -0
- package/esm/LinearBasicDisplay/model.js +127 -0
- package/esm/LinearBasicDisplay/model.js.map +1 -0
- package/esm/LinearGenomeView/components/CenterLine.d.ts +8 -0
- package/esm/LinearGenomeView/components/CenterLine.js +40 -0
- package/esm/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +6 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +52 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/Gridlines.d.ts +8 -0
- package/esm/LinearGenomeView/components/Gridlines.js +71 -0
- package/esm/LinearGenomeView/components/Gridlines.js.map +1 -0
- package/esm/LinearGenomeView/components/Header.d.ts +7 -0
- package/esm/LinearGenomeView/components/Header.js +81 -0
- package/esm/LinearGenomeView/components/Header.js.map +1 -0
- package/esm/LinearGenomeView/components/HelpDialog.d.ts +4 -0
- package/esm/LinearGenomeView/components/HelpDialog.js +58 -0
- package/esm/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/ImportForm.d.ts +7 -0
- package/esm/LinearGenomeView/components/ImportForm.js +141 -0
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +7 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js +63 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +4 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +132 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/esm/LinearGenomeView/components/MiniControls.d.ts +6 -0
- package/esm/LinearGenomeView/components/MiniControls.js +25 -0
- package/esm/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +22 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js +197 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +148 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js +287 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +22 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +136 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/esm/LinearGenomeView/components/RubberBand.d.ts +9 -0
- package/esm/LinearGenomeView/components/RubberBand.js +197 -0
- package/esm/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/Ruler.d.ts +27 -0
- package/esm/LinearGenomeView/components/Ruler.js +50 -0
- package/esm/LinearGenomeView/components/Ruler.js.map +1 -0
- package/esm/LinearGenomeView/components/ScaleBar.d.ts +10 -0
- package/esm/LinearGenomeView/components/ScaleBar.js +112 -0
- package/esm/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchBox.d.ts +8 -0
- package/esm/LinearGenomeView/components/SearchBox.js +94 -0
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +7 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js +107 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/SequenceDialog.d.ts +8 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js +147 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +10 -0
- package/esm/LinearGenomeView/components/TrackContainer.js +104 -0
- package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackLabel.d.ts +8 -0
- package/esm/LinearGenomeView/components/TrackLabel.js +88 -0
- package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/{dist/LinearGenomeView/components/VerticalGuides.d.ts → esm/LinearGenomeView/components/TracksContainer.d.ts} +4 -3
- package/esm/LinearGenomeView/components/TracksContainer.js +142 -0
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/ZoomControls.d.ts +7 -0
- package/esm/LinearGenomeView/components/ZoomControls.js +32 -0
- package/esm/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/esm/LinearGenomeView/components/util.d.ts +14 -0
- package/esm/LinearGenomeView/components/util.js +17 -0
- package/esm/LinearGenomeView/components/util.js.map +1 -0
- package/esm/LinearGenomeView/index.d.ts +275 -0
- package/esm/LinearGenomeView/index.js +978 -0
- package/esm/LinearGenomeView/index.js.map +1 -0
- package/esm/LinearGenomeView/util.d.ts +14 -0
- package/esm/LinearGenomeView/util.js +62 -0
- package/esm/LinearGenomeView/util.js.map +1 -0
- package/esm/index.d.ts +615 -0
- package/esm/index.js +127 -0
- package/esm/index.js.map +1 -0
- package/package.json +22 -15
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +4 -4
- package/src/BaseLinearDisplay/components/Block.tsx +5 -5
- package/src/BaseLinearDisplay/components/LinearBlocks.tsx +4 -4
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +9 -9
- package/src/BaseLinearDisplay/components/Tooltip.tsx +14 -4
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +6 -4
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +10 -7
- package/src/LinearBasicDisplay/model.ts +19 -11
- package/src/LinearGenomeView/components/CenterLine.tsx +6 -11
- package/src/LinearGenomeView/components/ExportSvgDialog.tsx +5 -5
- package/src/LinearGenomeView/components/{VerticalGuides.tsx → Gridlines.tsx} +9 -11
- package/src/LinearGenomeView/components/Header.tsx +10 -15
- package/src/LinearGenomeView/components/HelpDialog.tsx +5 -5
- package/src/LinearGenomeView/components/ImportForm.tsx +6 -12
- package/src/LinearGenomeView/components/LinearGenomeView.test.js +16 -6
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +6 -9
- package/src/LinearGenomeView/components/MiniControls.tsx +29 -40
- package/src/LinearGenomeView/components/OverviewRubberBand.tsx +20 -29
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +61 -59
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +13 -44
- package/src/LinearGenomeView/components/RubberBand.tsx +12 -18
- package/src/LinearGenomeView/components/Ruler.tsx +5 -11
- package/src/LinearGenomeView/components/ScaleBar.tsx +23 -27
- package/src/LinearGenomeView/components/SearchBox.tsx +4 -3
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +7 -6
- package/src/LinearGenomeView/components/SequenceDialog.tsx +10 -10
- package/src/LinearGenomeView/components/TrackContainer.tsx +29 -39
- package/src/LinearGenomeView/components/TrackLabel.tsx +76 -79
- package/src/LinearGenomeView/components/TracksContainer.tsx +10 -15
- package/src/LinearGenomeView/components/ZoomControls.tsx +12 -13
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +500 -550
- package/src/LinearGenomeView/index.test.ts +15 -36
- package/src/LinearGenomeView/index.tsx +390 -564
- package/src/index.ts +1 -1
- package/dist/LinearBareDisplay/index.test.js +0 -33
- package/dist/LinearGenomeView/components/LinearGenomeView.test.js +0 -234
- package/dist/LinearGenomeView/components/ScaleBar.test.js +0 -180
- package/dist/LinearGenomeView/components/VerticalGuides.js +0 -116
- package/dist/LinearGenomeView/index.test.js +0 -1187
- package/dist/LinearGenomeView/util.test.js +0 -78
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import React, { useRef, useEffect, useState } from 'react';
|
|
2
|
+
import { Popover, Tooltip, Typography, alpha } from '@mui/material';
|
|
3
|
+
import { makeStyles } from 'tss-react/mui';
|
|
4
|
+
import { getSession, stringify } from '@jbrowse/core/util';
|
|
5
|
+
import { observer, PropTypes as MobxPropTypes } from 'mobx-react';
|
|
6
|
+
import ReactPropTypes from 'prop-types';
|
|
7
|
+
import { HEADER_OVERVIEW_HEIGHT } from '..';
|
|
8
|
+
const useStyles = makeStyles()(theme => {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
const { tertiary, primary } = theme.palette;
|
|
11
|
+
const background = tertiary
|
|
12
|
+
? alpha(tertiary.main, 0.7)
|
|
13
|
+
: alpha(primary.main, 0.7);
|
|
14
|
+
return {
|
|
15
|
+
rubberBand: {
|
|
16
|
+
height: '100%',
|
|
17
|
+
background,
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
zIndex: 10,
|
|
20
|
+
textAlign: 'center',
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
},
|
|
23
|
+
rubberBandControl: {
|
|
24
|
+
cursor: 'crosshair',
|
|
25
|
+
width: '100%',
|
|
26
|
+
minHeight: 8,
|
|
27
|
+
},
|
|
28
|
+
rubberBandText: {
|
|
29
|
+
color: tertiary ? tertiary.contrastText : primary.contrastText,
|
|
30
|
+
},
|
|
31
|
+
popover: {
|
|
32
|
+
mouseEvents: 'none',
|
|
33
|
+
cursor: 'crosshair',
|
|
34
|
+
},
|
|
35
|
+
paper: {
|
|
36
|
+
paddingLeft: theme.spacing(1),
|
|
37
|
+
paddingRight: theme.spacing(1),
|
|
38
|
+
},
|
|
39
|
+
guide: {
|
|
40
|
+
pointerEvents: 'none',
|
|
41
|
+
height: '100%',
|
|
42
|
+
width: 1,
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
zIndex: 10,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
const HoverTooltip = observer(({ model, open, guideX, overview, }) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const { classes } = useStyles();
|
|
51
|
+
const { cytobandOffset } = model;
|
|
52
|
+
const { assemblyManager } = getSession(model);
|
|
53
|
+
const px = overview.pxToBp(guideX - cytobandOffset);
|
|
54
|
+
const assembly = assemblyManager.get(px.assemblyName);
|
|
55
|
+
const cytoband = (_a = assembly === null || assembly === void 0 ? void 0 : assembly.cytobands) === null || _a === void 0 ? void 0 : _a.find(f => px.coord > f.get('start') &&
|
|
56
|
+
px.coord < f.get('end') &&
|
|
57
|
+
px.refName === assembly.getCanonicalRefName(f.get('refName')));
|
|
58
|
+
return (React.createElement(Tooltip, { open: open, placement: "top", title: [stringify(px), cytoband === null || cytoband === void 0 ? void 0 : cytoband.get('name')].join(' '), arrow: true },
|
|
59
|
+
React.createElement("div", { className: classes.guide, style: {
|
|
60
|
+
left: guideX,
|
|
61
|
+
} })));
|
|
62
|
+
});
|
|
63
|
+
function OverviewRubberBand({ model, overview, ControlComponent = React.createElement("div", null), }) {
|
|
64
|
+
const { cytobandOffset } = model;
|
|
65
|
+
const [startX, setStartX] = useState();
|
|
66
|
+
const [currentX, setCurrentX] = useState();
|
|
67
|
+
const [guideX, setGuideX] = useState();
|
|
68
|
+
const controlsRef = useRef(null);
|
|
69
|
+
const rubberBandRef = useRef(null);
|
|
70
|
+
const { classes } = useStyles();
|
|
71
|
+
const mouseDragging = startX !== undefined;
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
function globalMouseMove(event) {
|
|
74
|
+
const ref = controlsRef.current;
|
|
75
|
+
if (ref && mouseDragging) {
|
|
76
|
+
const relativeX = event.clientX - ref.getBoundingClientRect().left;
|
|
77
|
+
setCurrentX(relativeX);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function globalMouseUp() {
|
|
81
|
+
// click and drag
|
|
82
|
+
if (startX !== undefined && currentX !== undefined) {
|
|
83
|
+
if (Math.abs(currentX - startX) > 3) {
|
|
84
|
+
model.moveTo(overview.pxToBp(startX - cytobandOffset), overview.pxToBp(currentX - cytobandOffset));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
// just a click
|
|
88
|
+
if (startX !== undefined && currentX === undefined) {
|
|
89
|
+
const click = overview.pxToBp(startX - cytobandOffset);
|
|
90
|
+
if (!click.refName) {
|
|
91
|
+
getSession(model).notify('unknown position clicked');
|
|
92
|
+
console.error('unknown position clicked', click);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
model.centerAt(Math.round(click.coord), click.refName, click.index);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
setStartX(undefined);
|
|
99
|
+
setCurrentX(undefined);
|
|
100
|
+
if (startX !== undefined) {
|
|
101
|
+
setGuideX(undefined);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function globalKeyDown(event) {
|
|
105
|
+
if (event.key === 'Escape') {
|
|
106
|
+
setStartX(undefined);
|
|
107
|
+
setCurrentX(undefined);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (mouseDragging) {
|
|
111
|
+
window.addEventListener('mousemove', globalMouseMove, true);
|
|
112
|
+
window.addEventListener('mouseup', globalMouseUp, true);
|
|
113
|
+
window.addEventListener('keydown', globalKeyDown, true);
|
|
114
|
+
return () => {
|
|
115
|
+
window.removeEventListener('mousemove', globalMouseMove, true);
|
|
116
|
+
window.removeEventListener('mouseup', globalMouseUp, true);
|
|
117
|
+
window.removeEventListener('keydown', globalKeyDown, true);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return () => { };
|
|
121
|
+
}, [mouseDragging, currentX, startX, model, overview, cytobandOffset]);
|
|
122
|
+
function mouseDown(event) {
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
event.stopPropagation();
|
|
125
|
+
if (controlsRef.current) {
|
|
126
|
+
setStartX(event.clientX - controlsRef.current.getBoundingClientRect().left);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function mouseMove(event) {
|
|
130
|
+
if (controlsRef.current) {
|
|
131
|
+
setGuideX(event.clientX - controlsRef.current.getBoundingClientRect().left);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function mouseOut() {
|
|
135
|
+
setGuideX(undefined);
|
|
136
|
+
}
|
|
137
|
+
if (startX === undefined) {
|
|
138
|
+
return (React.createElement("div", { style: { position: 'relative' } },
|
|
139
|
+
guideX !== undefined ? (React.createElement(HoverTooltip, { model: model, open: !mouseDragging, overview: overview, guideX: guideX })) : null,
|
|
140
|
+
React.createElement("div", { className: classes.rubberBandControl, role: "presentation", ref: controlsRef, onMouseDown: mouseDown, onMouseOut: mouseOut, onMouseMove: mouseMove }, ControlComponent)));
|
|
141
|
+
}
|
|
142
|
+
let left = startX || 0;
|
|
143
|
+
let width = 0;
|
|
144
|
+
if (startX !== undefined && currentX !== undefined) {
|
|
145
|
+
left = currentX < startX ? currentX : startX;
|
|
146
|
+
width = currentX - startX;
|
|
147
|
+
}
|
|
148
|
+
// calculate the start and end bp of drag
|
|
149
|
+
let leftBpOffset;
|
|
150
|
+
let rightBpOffset;
|
|
151
|
+
if (startX) {
|
|
152
|
+
leftBpOffset = overview.pxToBp(startX - cytobandOffset);
|
|
153
|
+
rightBpOffset = overview.pxToBp(startX + width - cytobandOffset);
|
|
154
|
+
if (currentX && currentX < startX) {
|
|
155
|
+
;
|
|
156
|
+
[leftBpOffset, rightBpOffset] = [rightBpOffset, leftBpOffset];
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return (React.createElement("div", { style: { position: 'relative' } },
|
|
160
|
+
rubberBandRef.current ? (React.createElement(React.Fragment, null,
|
|
161
|
+
React.createElement(Popover, { className: classes.popover, classes: {
|
|
162
|
+
paper: classes.paper,
|
|
163
|
+
}, open: true, anchorEl: rubberBandRef.current, anchorOrigin: {
|
|
164
|
+
vertical: 'top',
|
|
165
|
+
horizontal: 'left',
|
|
166
|
+
}, transformOrigin: {
|
|
167
|
+
vertical: 'bottom',
|
|
168
|
+
horizontal: 'right',
|
|
169
|
+
}, keepMounted: true, disableRestoreFocus: true },
|
|
170
|
+
React.createElement(Typography, null, leftBpOffset ? stringify(leftBpOffset) : '')),
|
|
171
|
+
React.createElement(Popover, { className: classes.popover, classes: {
|
|
172
|
+
paper: classes.paper,
|
|
173
|
+
}, open: true, anchorEl: rubberBandRef.current, anchorOrigin: {
|
|
174
|
+
vertical: 'top',
|
|
175
|
+
horizontal: 'right',
|
|
176
|
+
}, transformOrigin: {
|
|
177
|
+
vertical: 'bottom',
|
|
178
|
+
horizontal: 'left',
|
|
179
|
+
}, keepMounted: true, disableRestoreFocus: true },
|
|
180
|
+
React.createElement(Typography, null, rightBpOffset ? stringify(rightBpOffset) : '')))) : null,
|
|
181
|
+
React.createElement("div", { ref: rubberBandRef, className: classes.rubberBand, style: {
|
|
182
|
+
left,
|
|
183
|
+
width: Math.abs(width),
|
|
184
|
+
height: HEADER_OVERVIEW_HEIGHT,
|
|
185
|
+
} }),
|
|
186
|
+
React.createElement("div", { "data-testid": "rubberBand_controls", className: classes.rubberBandControl, role: "presentation", ref: controlsRef, onMouseDown: mouseDown, onMouseOut: mouseOut, onMouseMove: mouseMove }, ControlComponent)));
|
|
187
|
+
}
|
|
188
|
+
OverviewRubberBand.propTypes = {
|
|
189
|
+
model: MobxPropTypes.objectOrObservableObject.isRequired,
|
|
190
|
+
overview: MobxPropTypes.objectOrObservableObject.isRequired,
|
|
191
|
+
ControlComponent: ReactPropTypes.node,
|
|
192
|
+
};
|
|
193
|
+
OverviewRubberBand.defaultProps = {
|
|
194
|
+
ControlComponent: React.createElement("div", null),
|
|
195
|
+
};
|
|
196
|
+
export default observer(OverviewRubberBand);
|
|
197
|
+
//# sourceMappingURL=OverviewRubberBand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OverviewRubberBand.js","sourceRoot":"","sources":["../../../src/LinearGenomeView/components/OverviewRubberBand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,EAAE,QAAQ,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAC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ACrB,EACD,IAAI,QACJ,QAAQ,EAAE,aAAa,CAAC,OAAO,EAC/B,YAAY,EAAE;oBACZ,QAAQ,EAAE,KAAK;oBACf,UAAU,EAAE,OAAO;iBACpB,EACD,eAAe,EAAE;oBACf,QAAQ,EAAE,QAAQ;oBAClB,UAAU,EAAE,MAAM;iBACnB,EACD,WAAW,QACX,mBAAmB;gBAEnB,oBAAC,UAAU,QACR,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,CACnC,CACL,CACT,CACJ,CAAC,CAAC,CAAC,IAAI;QACR,6BACE,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,OAAO,CAAC,UAAU,EAC7B,KAAK,EAAE;gBACL,IAAI;gBACJ,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;gBACtB,MAAM,EAAE,sBAAsB;aAC/B,GACD;QACF,4CACc,qBAAqB,EACjC,SAAS,EAAE,OAAO,CAAC,iBAAiB,EACpC,IAAI,EAAC,cAAc,EACnB,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,SAAS,EACtB,UAAU,EAAE,QAAQ,EACpB,WAAW,EAAE,SAAS,IAErB,gBAAgB,CACb,CACF,CACP,CAAA;AACH,CAAC;AAED,kBAAkB,CAAC,SAAS,GAAG;IAC7B,KAAK,EAAE,aAAa,CAAC,wBAAwB,CAAC,UAAU;IACxD,QAAQ,EAAE,aAAa,CAAC,wBAAwB,CAAC,UAAU;IAC3D,gBAAgB,EAAE,cAAc,CAAC,IAAI;CACtC,CAAA;AAED,kBAAkB,CAAC,YAAY,GAAG;IAChC,gBAAgB,EAAE,gCAAO;CAC1B,CAAA;AAED,eAAe,QAAQ,CAAC,kBAAkB,CAAC,CAAA"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Instance } from 'mobx-state-tree';
|
|
3
|
+
import { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel';
|
|
4
|
+
import { ContentBlock } from '@jbrowse/core/util/blockTypes';
|
|
5
|
+
import { Assembly } from '@jbrowse/core/assemblyManager/assembly';
|
|
6
|
+
import { LinearGenomeViewModel } from '..';
|
|
7
|
+
declare const Polygon: ({ model, overview, useOffset, }: {
|
|
8
|
+
model: LGV;
|
|
9
|
+
overview: Instance<Base1DViewModel>;
|
|
10
|
+
useOffset?: boolean | undefined;
|
|
11
|
+
}) => JSX.Element | null;
|
|
12
|
+
declare type LGV = LinearGenomeViewModel;
|
|
13
|
+
declare const Cytobands: ({ overview, block, assembly, }: {
|
|
14
|
+
overview: Base1DViewModel;
|
|
15
|
+
assembly?: ({
|
|
16
|
+
configuration: any;
|
|
17
|
+
} & import("mobx-state-tree/dist/internal").NonEmptyObject & {
|
|
18
|
+
error: Error | undefined;
|
|
19
|
+
regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
20
|
+
refNameAliases: {
|
|
21
|
+
[x: string]: string;
|
|
22
|
+
} | undefined;
|
|
23
|
+
lowerCaseRefNameAliases: {
|
|
24
|
+
[x: string]: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
cytobands: import("@jbrowse/core/util").Feature[] | undefined;
|
|
27
|
+
} & {
|
|
28
|
+
readonly initialized: boolean;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly aliases: string[];
|
|
31
|
+
hasName(name: string): boolean;
|
|
32
|
+
readonly allAliases: string[];
|
|
33
|
+
readonly refNames: string[] | undefined;
|
|
34
|
+
readonly allRefNames: string[] | undefined;
|
|
35
|
+
readonly rpcManager: any;
|
|
36
|
+
readonly refNameColors: string[];
|
|
37
|
+
} & {
|
|
38
|
+
getCanonicalRefName(refName: string): string;
|
|
39
|
+
getRefNameColor(refName: string): string | undefined;
|
|
40
|
+
isValidRefName(refName: string): boolean;
|
|
41
|
+
} & {
|
|
42
|
+
setLoading(): void;
|
|
43
|
+
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: {
|
|
44
|
+
adapterRegionsWithAssembly: import("@jbrowse/core/util").Region[];
|
|
45
|
+
refNameAliases: {
|
|
46
|
+
[x: string]: string;
|
|
47
|
+
};
|
|
48
|
+
lowerCaseRefNameAliases: {
|
|
49
|
+
[x: string]: string;
|
|
50
|
+
};
|
|
51
|
+
cytobands: import("@jbrowse/core/util").Feature[];
|
|
52
|
+
}): void;
|
|
53
|
+
setError(e: Error): void;
|
|
54
|
+
setRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
55
|
+
setRefNameAliases(refNameAliases: {
|
|
56
|
+
[x: string]: string;
|
|
57
|
+
}, lowerCaseRefNameAliases: {
|
|
58
|
+
[x: string]: string;
|
|
59
|
+
}): void;
|
|
60
|
+
setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
|
|
61
|
+
afterAttach(): void;
|
|
62
|
+
} & {
|
|
63
|
+
getAdapterMapEntry(adapterConf: unknown, options: import("@jbrowse/core/assemblyManager/assembly").BaseOptions): Promise<{
|
|
64
|
+
forwardMap: {
|
|
65
|
+
[k: string]: string;
|
|
66
|
+
};
|
|
67
|
+
reverseMap: {
|
|
68
|
+
[k: string]: string;
|
|
69
|
+
};
|
|
70
|
+
}>;
|
|
71
|
+
getRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/assemblyManager/assembly").BaseOptions): Promise<{
|
|
72
|
+
[k: string]: string;
|
|
73
|
+
}>;
|
|
74
|
+
getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/assemblyManager/assembly").BaseOptions): Promise<{
|
|
75
|
+
[k: string]: string;
|
|
76
|
+
}>;
|
|
77
|
+
} & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
|
|
78
|
+
configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
|
|
79
|
+
}, {
|
|
80
|
+
error: Error | undefined;
|
|
81
|
+
regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
|
|
82
|
+
refNameAliases: {
|
|
83
|
+
[x: string]: string;
|
|
84
|
+
} | undefined;
|
|
85
|
+
lowerCaseRefNameAliases: {
|
|
86
|
+
[x: string]: string;
|
|
87
|
+
} | undefined;
|
|
88
|
+
cytobands: import("@jbrowse/core/util").Feature[] | undefined;
|
|
89
|
+
} & {
|
|
90
|
+
readonly initialized: boolean;
|
|
91
|
+
readonly name: string;
|
|
92
|
+
readonly aliases: string[];
|
|
93
|
+
hasName(name: string): boolean;
|
|
94
|
+
readonly allAliases: string[];
|
|
95
|
+
readonly refNames: string[] | undefined;
|
|
96
|
+
readonly allRefNames: string[] | undefined;
|
|
97
|
+
readonly rpcManager: any;
|
|
98
|
+
readonly refNameColors: string[];
|
|
99
|
+
} & {
|
|
100
|
+
getCanonicalRefName(refName: string): string;
|
|
101
|
+
getRefNameColor(refName: string): string | undefined;
|
|
102
|
+
isValidRefName(refName: string): boolean;
|
|
103
|
+
} & {
|
|
104
|
+
setLoading(): void;
|
|
105
|
+
setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: {
|
|
106
|
+
adapterRegionsWithAssembly: import("@jbrowse/core/util").Region[];
|
|
107
|
+
refNameAliases: {
|
|
108
|
+
[x: string]: string;
|
|
109
|
+
};
|
|
110
|
+
lowerCaseRefNameAliases: {
|
|
111
|
+
[x: string]: string;
|
|
112
|
+
};
|
|
113
|
+
cytobands: import("@jbrowse/core/util").Feature[];
|
|
114
|
+
}): void;
|
|
115
|
+
setError(e: Error): void;
|
|
116
|
+
setRegions(regions: import("@jbrowse/core/util").Region[]): void;
|
|
117
|
+
setRefNameAliases(refNameAliases: {
|
|
118
|
+
[x: string]: string;
|
|
119
|
+
}, lowerCaseRefNameAliases: {
|
|
120
|
+
[x: string]: string;
|
|
121
|
+
}): void;
|
|
122
|
+
setCytobands(cytobands: import("@jbrowse/core/util").Feature[]): void;
|
|
123
|
+
afterAttach(): void;
|
|
124
|
+
} & {
|
|
125
|
+
getAdapterMapEntry(adapterConf: unknown, options: import("@jbrowse/core/assemblyManager/assembly").BaseOptions): Promise<{
|
|
126
|
+
forwardMap: {
|
|
127
|
+
[k: string]: string;
|
|
128
|
+
};
|
|
129
|
+
reverseMap: {
|
|
130
|
+
[k: string]: string;
|
|
131
|
+
};
|
|
132
|
+
}>;
|
|
133
|
+
getRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/assemblyManager/assembly").BaseOptions): Promise<{
|
|
134
|
+
[k: string]: string;
|
|
135
|
+
}>;
|
|
136
|
+
getReverseRefNameMapForAdapter(adapterConf: unknown, opts: import("@jbrowse/core/assemblyManager/assembly").BaseOptions): Promise<{
|
|
137
|
+
[k: string]: string;
|
|
138
|
+
}>;
|
|
139
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>) | undefined;
|
|
140
|
+
block: ContentBlock;
|
|
141
|
+
}) => JSX.Element;
|
|
142
|
+
declare function OverviewScaleBar({ model, children, }: {
|
|
143
|
+
model: LGV;
|
|
144
|
+
children: React.ReactNode;
|
|
145
|
+
}): JSX.Element;
|
|
146
|
+
declare const _default: typeof OverviewScaleBar;
|
|
147
|
+
export default _default;
|
|
148
|
+
export { Cytobands, Polygon };
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Typography, useTheme, alpha } from '@mui/material';
|
|
3
|
+
import { makeStyles } from 'tss-react/mui';
|
|
4
|
+
import { observer } from 'mobx-react';
|
|
5
|
+
import Base1DView from '@jbrowse/core/util/Base1DViewModel';
|
|
6
|
+
import { getSession, getTickDisplayStr } from '@jbrowse/core/util';
|
|
7
|
+
import { ContentBlock } from '@jbrowse/core/util/blockTypes';
|
|
8
|
+
// locals
|
|
9
|
+
import { HEADER_BAR_HEIGHT, HEADER_OVERVIEW_HEIGHT, } from '..';
|
|
10
|
+
import { chooseGridPitch } from '../util';
|
|
11
|
+
import OverviewRubberBand from './OverviewRubberBand';
|
|
12
|
+
const wholeSeqSpacer = 2;
|
|
13
|
+
const useStyles = makeStyles()(theme => ({
|
|
14
|
+
scaleBar: {
|
|
15
|
+
height: HEADER_OVERVIEW_HEIGHT,
|
|
16
|
+
},
|
|
17
|
+
scaleBarBorder: {
|
|
18
|
+
border: '1px solid',
|
|
19
|
+
},
|
|
20
|
+
scaleBarContig: {
|
|
21
|
+
backgroundColor: theme.palette.background.default,
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
top: 0,
|
|
24
|
+
height: HEADER_OVERVIEW_HEIGHT,
|
|
25
|
+
},
|
|
26
|
+
scaleBarContigForward: {
|
|
27
|
+
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M-.1 0L6 4.5L-.1 9' fill='none' stroke='%23ddd'/%3E%3C/svg%3E")`,
|
|
28
|
+
backgroundRepeat: 'repeat',
|
|
29
|
+
},
|
|
30
|
+
scaleBarContigReverse: {
|
|
31
|
+
backgroundImage: `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 15 9'%3E%3Cpath d='M6 0L0 4.5L6 9' fill='none' stroke='%23ddd'/%3E%3C/svg%3E")`,
|
|
32
|
+
backgroundRepeat: 'repeat',
|
|
33
|
+
},
|
|
34
|
+
scaleBarRefName: {
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
fontWeight: 'bold',
|
|
37
|
+
pointerEvents: 'none',
|
|
38
|
+
zIndex: 100,
|
|
39
|
+
},
|
|
40
|
+
scaleBarLabel: {
|
|
41
|
+
height: HEADER_OVERVIEW_HEIGHT,
|
|
42
|
+
position: 'absolute',
|
|
43
|
+
display: 'flex',
|
|
44
|
+
justifyContent: 'center',
|
|
45
|
+
pointerEvents: 'none',
|
|
46
|
+
},
|
|
47
|
+
scaleBarVisibleRegion: {
|
|
48
|
+
position: 'absolute',
|
|
49
|
+
height: HEADER_OVERVIEW_HEIGHT,
|
|
50
|
+
pointerEvents: 'none',
|
|
51
|
+
zIndex: 100,
|
|
52
|
+
border: '1px solid',
|
|
53
|
+
},
|
|
54
|
+
overview: {
|
|
55
|
+
height: HEADER_BAR_HEIGHT,
|
|
56
|
+
position: 'relative',
|
|
57
|
+
},
|
|
58
|
+
overviewSvg: {
|
|
59
|
+
width: '100%',
|
|
60
|
+
position: 'absolute',
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
63
|
+
const Polygon = observer(({ model, overview, useOffset = true, }) => {
|
|
64
|
+
const theme = useTheme();
|
|
65
|
+
const multiplier = Number(useOffset);
|
|
66
|
+
const { interRegionPaddingWidth, offsetPx, dynamicBlocks, cytobandOffset } = model;
|
|
67
|
+
const { contentBlocks, totalWidthPxWithoutBorders } = dynamicBlocks;
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
const { tertiary, primary } = theme.palette;
|
|
70
|
+
const polygonColor = tertiary ? tertiary.light : primary.light;
|
|
71
|
+
if (!contentBlocks.length) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
const first = contentBlocks[0];
|
|
75
|
+
const last = contentBlocks[contentBlocks.length - 1];
|
|
76
|
+
const topLeft = (overview.bpToPx({
|
|
77
|
+
...first,
|
|
78
|
+
coord: first.reversed ? first.end : first.start,
|
|
79
|
+
}) || 0) +
|
|
80
|
+
cytobandOffset * multiplier;
|
|
81
|
+
const topRight = (overview.bpToPx({
|
|
82
|
+
...last,
|
|
83
|
+
coord: last.reversed ? last.start : last.end,
|
|
84
|
+
}) || 0) +
|
|
85
|
+
cytobandOffset * multiplier;
|
|
86
|
+
const startPx = Math.max(0, -offsetPx);
|
|
87
|
+
const endPx = startPx +
|
|
88
|
+
totalWidthPxWithoutBorders +
|
|
89
|
+
(contentBlocks.length * interRegionPaddingWidth) / 2;
|
|
90
|
+
const points = [
|
|
91
|
+
[startPx, HEADER_BAR_HEIGHT],
|
|
92
|
+
[endPx, HEADER_BAR_HEIGHT],
|
|
93
|
+
[topRight, 0],
|
|
94
|
+
[topLeft, 0],
|
|
95
|
+
];
|
|
96
|
+
return (React.createElement("polygon", { points: points.toString(), fill: alpha(polygonColor, 0.3), stroke: alpha(polygonColor, 0.8) }));
|
|
97
|
+
});
|
|
98
|
+
// rounded rect from https://stackoverflow.com/a/45889603/2129219
|
|
99
|
+
// prettier-ignore
|
|
100
|
+
function rightRoundedRect(x, y, width, height, radius) {
|
|
101
|
+
return "M" + x + "," + y
|
|
102
|
+
+ "h" + (width - radius)
|
|
103
|
+
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius
|
|
104
|
+
+ "v" + (height - 2 * radius)
|
|
105
|
+
+ "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius
|
|
106
|
+
+ "h" + (radius - width)
|
|
107
|
+
+ "z";
|
|
108
|
+
}
|
|
109
|
+
// prettier-ignore
|
|
110
|
+
function leftRoundedRect(x, y, width, height, radius) {
|
|
111
|
+
return "M" + (x + radius) + "," + y
|
|
112
|
+
+ "h" + (width - radius)
|
|
113
|
+
+ "v" + height
|
|
114
|
+
+ "h" + (radius - width)
|
|
115
|
+
+ "a" + radius + "," + radius + " 0 0 1 " + (-radius) + "," + (-radius)
|
|
116
|
+
+ "v" + (2 * radius - height)
|
|
117
|
+
+ "a" + radius + "," + radius + " 0 0 1 " + radius + "," + (-radius)
|
|
118
|
+
+ "z";
|
|
119
|
+
}
|
|
120
|
+
const colorMap = {
|
|
121
|
+
gneg: 'rgb(227,227,227)',
|
|
122
|
+
gpos25: 'rgb(142,142,142)',
|
|
123
|
+
gpos50: 'rgb(85,85,85)',
|
|
124
|
+
gpos100: 'rgb(0,0,0)',
|
|
125
|
+
gpos75: 'rgb(57,57,57)',
|
|
126
|
+
gvar: 'rgb(0,0,0)',
|
|
127
|
+
stalk: 'rgb(127,127,127)',
|
|
128
|
+
acen: '#800',
|
|
129
|
+
};
|
|
130
|
+
function getCytobands(assembly, refName) {
|
|
131
|
+
var _a;
|
|
132
|
+
return (((_a = assembly === null || assembly === void 0 ? void 0 : assembly.cytobands) === null || _a === void 0 ? void 0 : _a.map(f => ({
|
|
133
|
+
refName: assembly.getCanonicalRefName(f.get('refName')),
|
|
134
|
+
start: f.get('start'),
|
|
135
|
+
end: f.get('end'),
|
|
136
|
+
type: f.get('type'),
|
|
137
|
+
})).filter(f => f.refName === refName)) || []);
|
|
138
|
+
}
|
|
139
|
+
const Cytobands = observer(({ overview, block, assembly, }) => {
|
|
140
|
+
const { offsetPx, reversed } = block;
|
|
141
|
+
const cytobands = getCytobands(assembly, block.refName);
|
|
142
|
+
const coords = cytobands.map(f => {
|
|
143
|
+
const { refName, start, end, type } = f;
|
|
144
|
+
return [
|
|
145
|
+
overview.bpToPx({
|
|
146
|
+
refName,
|
|
147
|
+
coord: start,
|
|
148
|
+
}),
|
|
149
|
+
overview.bpToPx({
|
|
150
|
+
refName,
|
|
151
|
+
coord: end,
|
|
152
|
+
}),
|
|
153
|
+
type,
|
|
154
|
+
];
|
|
155
|
+
});
|
|
156
|
+
const arr = cytobands || [];
|
|
157
|
+
const lcap = reversed ? arr.length - 1 : 0;
|
|
158
|
+
const rcap = reversed ? 0 : arr.length - 1;
|
|
159
|
+
let firstCent = true;
|
|
160
|
+
return (React.createElement("g", { transform: `translate(-${offsetPx})` }, coords.map(([start, end, type], index) => {
|
|
161
|
+
const key = `${start}-${end}-${type}`;
|
|
162
|
+
if (type === 'acen' && firstCent) {
|
|
163
|
+
firstCent = false;
|
|
164
|
+
return (React.createElement("polygon", { key: key, points: [
|
|
165
|
+
[start, 0],
|
|
166
|
+
[end, HEADER_OVERVIEW_HEIGHT / 2],
|
|
167
|
+
[start, HEADER_OVERVIEW_HEIGHT],
|
|
168
|
+
].toString(), fill: colorMap[type] }));
|
|
169
|
+
}
|
|
170
|
+
if (type === 'acen' && !firstCent) {
|
|
171
|
+
return (React.createElement("polygon", { key: key, points: [
|
|
172
|
+
[start, HEADER_OVERVIEW_HEIGHT / 2],
|
|
173
|
+
[end, 0],
|
|
174
|
+
[end, HEADER_OVERVIEW_HEIGHT],
|
|
175
|
+
].toString(), fill: colorMap[type] }));
|
|
176
|
+
}
|
|
177
|
+
if (lcap === index) {
|
|
178
|
+
return (React.createElement("path", { key: key, d: leftRoundedRect(Math.min(start, end), 0, Math.abs(end - start), HEADER_OVERVIEW_HEIGHT, 8), fill: colorMap[type] }));
|
|
179
|
+
}
|
|
180
|
+
else if (rcap === index) {
|
|
181
|
+
return (React.createElement("path", { key: key, d: rightRoundedRect(Math.min(start, end), 0, Math.abs(end - start) - 2, HEADER_OVERVIEW_HEIGHT, 8), fill: colorMap[type] }));
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
return (React.createElement("rect", { key: key, x: Math.min(start, end), y: 0, width: Math.abs(end - start), height: HEADER_OVERVIEW_HEIGHT, fill: colorMap[type] }));
|
|
185
|
+
}
|
|
186
|
+
})));
|
|
187
|
+
});
|
|
188
|
+
const OverviewBox = observer(({ scale, model, block, overview, }) => {
|
|
189
|
+
const { classes, cx } = useStyles();
|
|
190
|
+
const { cytobandOffset, bpPerPx, showCytobands } = model;
|
|
191
|
+
const { start, end, reversed, refName, assemblyName } = block;
|
|
192
|
+
const { majorPitch } = chooseGridPitch(scale, 120, 15);
|
|
193
|
+
const { assemblyManager } = getSession(model);
|
|
194
|
+
const assembly = assemblyManager.get(assemblyName);
|
|
195
|
+
const refNameColor = assembly === null || assembly === void 0 ? void 0 : assembly.getRefNameColor(refName);
|
|
196
|
+
const tickLabels = [];
|
|
197
|
+
for (let i = 0; i < Math.floor((end - start) / majorPitch); i++) {
|
|
198
|
+
const offsetLabel = (i + 1) * majorPitch;
|
|
199
|
+
tickLabels.push(reversed ? end - offsetLabel : start + offsetLabel);
|
|
200
|
+
}
|
|
201
|
+
const canDisplayCytobands = showCytobands && getCytobands(assembly, block.refName).length;
|
|
202
|
+
return (React.createElement("div", null,
|
|
203
|
+
React.createElement(Typography, { style: {
|
|
204
|
+
left: block.offsetPx + 3,
|
|
205
|
+
color: canDisplayCytobands ? 'black' : refNameColor,
|
|
206
|
+
}, className: classes.scaleBarRefName }, refName),
|
|
207
|
+
React.createElement("div", { className: cx(classes.scaleBarContig, canDisplayCytobands
|
|
208
|
+
? undefined
|
|
209
|
+
: reversed
|
|
210
|
+
? classes.scaleBarContigReverse
|
|
211
|
+
: classes.scaleBarContigForward, !canDisplayCytobands ? classes.scaleBarBorder : undefined), style: {
|
|
212
|
+
left: block.offsetPx + cytobandOffset,
|
|
213
|
+
width: block.widthPx,
|
|
214
|
+
borderColor: refNameColor,
|
|
215
|
+
} },
|
|
216
|
+
!canDisplayCytobands
|
|
217
|
+
? tickLabels.map((tickLabel, labelIdx) => (React.createElement(Typography, { key: `${JSON.stringify(block)}-${tickLabel}-${labelIdx}`, className: classes.scaleBarLabel, variant: "body2", style: {
|
|
218
|
+
left: ((labelIdx + 1) * majorPitch) / scale,
|
|
219
|
+
pointerEvents: 'none',
|
|
220
|
+
color: refNameColor,
|
|
221
|
+
} }, getTickDisplayStr(tickLabel, bpPerPx))))
|
|
222
|
+
: null,
|
|
223
|
+
canDisplayCytobands ? (React.createElement("svg", { style: { width: '100%' } },
|
|
224
|
+
React.createElement(Cytobands, { overview: overview, assembly: assembly, block: block }))) : null)));
|
|
225
|
+
});
|
|
226
|
+
const ScaleBar = observer(({ model, scale, overview, }) => {
|
|
227
|
+
const { classes } = useStyles();
|
|
228
|
+
const theme = useTheme();
|
|
229
|
+
const { dynamicBlocks, showCytobands, cytobandOffset } = model;
|
|
230
|
+
const visibleRegions = dynamicBlocks.contentBlocks;
|
|
231
|
+
const overviewVisibleRegions = overview.dynamicBlocks;
|
|
232
|
+
// @ts-ignore
|
|
233
|
+
const { tertiary, primary } = theme.palette;
|
|
234
|
+
const scaleBarColor = tertiary ? tertiary.light : primary.light;
|
|
235
|
+
if (!visibleRegions.length) {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
const first = visibleRegions[0];
|
|
239
|
+
const firstOverviewPx = overview.bpToPx({
|
|
240
|
+
...first,
|
|
241
|
+
coord: first.reversed ? first.end : first.start,
|
|
242
|
+
}) || 0;
|
|
243
|
+
const last = visibleRegions[visibleRegions.length - 1];
|
|
244
|
+
const lastOverviewPx = overview.bpToPx({
|
|
245
|
+
...last,
|
|
246
|
+
coord: last.reversed ? last.start : last.end,
|
|
247
|
+
}) || 0;
|
|
248
|
+
const color = showCytobands ? '#f00' : scaleBarColor;
|
|
249
|
+
const transparency = showCytobands ? 0.1 : 0.3;
|
|
250
|
+
return (React.createElement("div", { className: classes.scaleBar },
|
|
251
|
+
React.createElement("div", { className: classes.scaleBarVisibleRegion, style: {
|
|
252
|
+
width: lastOverviewPx - firstOverviewPx,
|
|
253
|
+
left: firstOverviewPx + cytobandOffset,
|
|
254
|
+
background: alpha(color, transparency),
|
|
255
|
+
borderColor: color,
|
|
256
|
+
} }),
|
|
257
|
+
overviewVisibleRegions.map((block, idx) => {
|
|
258
|
+
return !(block instanceof ContentBlock) ? (React.createElement("div", { key: `${JSON.stringify(block)}-${idx}`, className: classes.scaleBarContig, style: {
|
|
259
|
+
width: block.widthPx,
|
|
260
|
+
left: block.offsetPx,
|
|
261
|
+
backgroundColor: '#999',
|
|
262
|
+
backgroundImage: 'repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,.5) 1px, rgba(255,255,255,.5) 3px)',
|
|
263
|
+
} })) : (React.createElement(OverviewBox, { scale: scale, block: block, model: model, overview: overview, key: `${JSON.stringify(block)}-${idx}` }));
|
|
264
|
+
})));
|
|
265
|
+
});
|
|
266
|
+
function OverviewScaleBar({ model, children, }) {
|
|
267
|
+
const { classes } = useStyles();
|
|
268
|
+
const { totalBp, width, cytobandOffset, displayedRegions } = model;
|
|
269
|
+
const overview = Base1DView.create({
|
|
270
|
+
displayedRegions: JSON.parse(JSON.stringify(displayedRegions)),
|
|
271
|
+
interRegionPaddingWidth: 0,
|
|
272
|
+
minimumBlockWidth: model.minimumBlockWidth,
|
|
273
|
+
});
|
|
274
|
+
const modWidth = width - cytobandOffset;
|
|
275
|
+
overview.setVolatileWidth(modWidth);
|
|
276
|
+
overview.showAllRegions();
|
|
277
|
+
const scale = totalBp / (modWidth - (displayedRegions.length - 1) * wholeSeqSpacer);
|
|
278
|
+
return (React.createElement("div", null,
|
|
279
|
+
React.createElement(OverviewRubberBand, { model: model, overview: overview, ControlComponent: React.createElement(ScaleBar, { model: model, overview: overview, scale: scale }) }),
|
|
280
|
+
React.createElement("div", { className: classes.overview },
|
|
281
|
+
React.createElement("svg", { height: HEADER_BAR_HEIGHT, className: classes.overviewSvg },
|
|
282
|
+
React.createElement(Polygon, { model: model, overview: overview })),
|
|
283
|
+
children)));
|
|
284
|
+
}
|
|
285
|
+
export default observer(OverviewScaleBar);
|
|
286
|
+
export { Cytobands, Polygon };
|
|
287
|
+
//# sourceMappingURL=OverviewScaleBar.js.map
|