@jbrowse/plugin-linear-genome-view 1.6.7 → 1.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/BaseLinearDisplay.js +232 -0
- package/dist/BaseLinearDisplay/components/Block.js +86 -0
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +110 -0
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +192 -0
- package/dist/BaseLinearDisplay/index.js +41 -0
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +763 -0
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +24 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +328 -0
- package/dist/LinearBareDisplay/configSchema.js +19 -0
- package/dist/LinearBareDisplay/index.js +21 -0
- package/dist/LinearBareDisplay/index.test.js +33 -0
- package/dist/LinearBareDisplay/model.d.ts +7 -7
- package/dist/LinearBareDisplay/model.js +44 -0
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +94 -0
- package/dist/LinearBasicDisplay/configSchema.js +25 -0
- package/dist/LinearBasicDisplay/index.js +23 -0
- package/dist/LinearBasicDisplay/model.d.ts +7 -7
- package/dist/LinearBasicDisplay/model.js +162 -0
- package/dist/LinearGenomeView/components/CenterLine.js +80 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +137 -0
- package/dist/LinearGenomeView/components/Header.js +144 -0
- package/dist/LinearGenomeView/components/HelpDialog.js +48 -0
- package/dist/LinearGenomeView/components/ImportForm.js +330 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.js +129 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.test.js +234 -0
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +349 -0
- package/dist/LinearGenomeView/components/MiniControls.js +83 -0
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +310 -0
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +6 -6
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +403 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +331 -0
- package/dist/LinearGenomeView/components/RubberBand.js +309 -0
- package/dist/LinearGenomeView/components/Ruler.js +101 -0
- package/dist/LinearGenomeView/components/ScaleBar.js +184 -0
- package/dist/LinearGenomeView/components/ScaleBar.test.js +180 -0
- package/dist/LinearGenomeView/components/SearchBox.js +201 -0
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +159 -0
- package/dist/LinearGenomeView/components/SequenceDialog.js +304 -0
- package/dist/LinearGenomeView/components/TrackContainer.js +179 -0
- package/dist/LinearGenomeView/components/TrackLabel.js +165 -0
- package/dist/LinearGenomeView/components/TracksContainer.js +214 -0
- package/dist/LinearGenomeView/components/VerticalGuides.js +116 -0
- package/dist/LinearGenomeView/components/ZoomControls.js +92 -0
- package/dist/LinearGenomeView/components/util.js +16 -0
- package/dist/LinearGenomeView/index.js +1418 -0
- package/dist/LinearGenomeView/index.test.js +1170 -0
- package/dist/LinearGenomeView/util.js +93 -0
- package/dist/LinearGenomeView/util.test.js +78 -0
- package/dist/index.d.ts +21 -21
- package/dist/index.js +293 -6
- package/dist/plugin-linear-genome-view.cjs.development.js +37 -22
- package/dist/plugin-linear-genome-view.cjs.development.js.map +1 -1
- package/dist/plugin-linear-genome-view.cjs.production.min.js +1 -1
- package/dist/plugin-linear-genome-view.cjs.production.min.js.map +1 -1
- package/dist/plugin-linear-genome-view.esm.js +37 -22
- package/dist/plugin-linear-genome-view.esm.js.map +1 -1
- package/package.json +4 -8
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +9 -12
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +2 -0
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +10 -8
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +21 -12
- package/src/LinearBasicDisplay/model.ts +17 -18
- package/src/LinearGenomeView/components/Header.tsx +1 -1
- package/src/LinearGenomeView/components/ImportForm.tsx +10 -4
- package/src/LinearGenomeView/components/LinearGenomeView.test.js +1 -0
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +2 -2
- package/src/LinearGenomeView/components/RubberBand.tsx +14 -24
- package/src/LinearGenomeView/components/ScaleBar.test.tsx +1 -0
- package/src/LinearGenomeView/components/ScaleBar.tsx +3 -6
- package/src/LinearGenomeView/components/SequenceDialog.tsx +1 -1
- package/src/LinearGenomeView/components/TrackContainer.tsx +31 -24
- package/src/LinearGenomeView/components/TrackLabel.tsx +1 -1
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +23 -47
- package/src/LinearGenomeView/index.tsx +2 -3
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.Polygon = exports.Cytobands = void 0;
|
|
9
|
+
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _core = require("@material-ui/core");
|
|
17
|
+
|
|
18
|
+
var _mobxReact = require("mobx-react");
|
|
19
|
+
|
|
20
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
21
|
+
|
|
22
|
+
var _Base1DViewModel = _interopRequireDefault(require("@jbrowse/core/util/Base1DViewModel"));
|
|
23
|
+
|
|
24
|
+
var _util = require("@jbrowse/core/util");
|
|
25
|
+
|
|
26
|
+
var _blockTypes = require("@jbrowse/core/util/blockTypes");
|
|
27
|
+
|
|
28
|
+
var _ = require("..");
|
|
29
|
+
|
|
30
|
+
var _util2 = require("../util");
|
|
31
|
+
|
|
32
|
+
var _OverviewRubberBand = _interopRequireDefault(require("./OverviewRubberBand"));
|
|
33
|
+
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
+
|
|
38
|
+
var wholeSeqSpacer = 2;
|
|
39
|
+
var useStyles = (0, _core.makeStyles)(function (theme) {
|
|
40
|
+
return {
|
|
41
|
+
scaleBar: {
|
|
42
|
+
height: _.HEADER_OVERVIEW_HEIGHT
|
|
43
|
+
},
|
|
44
|
+
scaleBarBorder: {
|
|
45
|
+
border: '1px solid'
|
|
46
|
+
},
|
|
47
|
+
scaleBarContig: {
|
|
48
|
+
backgroundColor: theme.palette.background["default"],
|
|
49
|
+
position: 'absolute',
|
|
50
|
+
top: 0,
|
|
51
|
+
height: _.HEADER_OVERVIEW_HEIGHT
|
|
52
|
+
},
|
|
53
|
+
scaleBarContigForward: {
|
|
54
|
+
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\")",
|
|
55
|
+
backgroundRepeat: 'repeat'
|
|
56
|
+
},
|
|
57
|
+
scaleBarContigReverse: {
|
|
58
|
+
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\")",
|
|
59
|
+
backgroundRepeat: 'repeat'
|
|
60
|
+
},
|
|
61
|
+
scaleBarRefName: {
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
fontWeight: 'bold',
|
|
64
|
+
pointerEvents: 'none',
|
|
65
|
+
zIndex: 100
|
|
66
|
+
},
|
|
67
|
+
scaleBarLabel: {
|
|
68
|
+
height: _.HEADER_OVERVIEW_HEIGHT,
|
|
69
|
+
width: 1,
|
|
70
|
+
position: 'absolute',
|
|
71
|
+
display: 'flex',
|
|
72
|
+
justifyContent: 'center',
|
|
73
|
+
pointerEvents: 'none'
|
|
74
|
+
},
|
|
75
|
+
scaleBarVisibleRegion: {
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
height: _.HEADER_OVERVIEW_HEIGHT,
|
|
78
|
+
pointerEvents: 'none',
|
|
79
|
+
zIndex: 100,
|
|
80
|
+
border: '1px solid'
|
|
81
|
+
},
|
|
82
|
+
overview: {
|
|
83
|
+
height: _.HEADER_BAR_HEIGHT,
|
|
84
|
+
position: 'relative'
|
|
85
|
+
},
|
|
86
|
+
overviewSvg: {
|
|
87
|
+
width: '100%',
|
|
88
|
+
position: 'absolute'
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
var Polygon = (0, _mobxReact.observer)(function (_ref) {
|
|
93
|
+
var model = _ref.model,
|
|
94
|
+
overview = _ref.overview,
|
|
95
|
+
_ref$useOffset = _ref.useOffset,
|
|
96
|
+
useOffset = _ref$useOffset === void 0 ? true : _ref$useOffset;
|
|
97
|
+
var theme = (0, _core.useTheme)();
|
|
98
|
+
var multiplier = Number(useOffset);
|
|
99
|
+
var interRegionPaddingWidth = model.interRegionPaddingWidth,
|
|
100
|
+
offsetPx = model.offsetPx,
|
|
101
|
+
dynamicBlocks = model.dynamicBlocks,
|
|
102
|
+
cytobandOffset = model.cytobandOffset;
|
|
103
|
+
var contentBlocks = dynamicBlocks.contentBlocks,
|
|
104
|
+
totalWidthPxWithoutBorders = dynamicBlocks.totalWidthPxWithoutBorders;
|
|
105
|
+
var _theme$palette = theme.palette,
|
|
106
|
+
tertiary = _theme$palette.tertiary,
|
|
107
|
+
primary = _theme$palette.primary;
|
|
108
|
+
var polygonColor = tertiary ? tertiary.light : primary.light;
|
|
109
|
+
|
|
110
|
+
if (!contentBlocks.length) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var first = contentBlocks[0];
|
|
115
|
+
var last = contentBlocks[contentBlocks.length - 1];
|
|
116
|
+
var topLeft = (overview.bpToPx(_objectSpread(_objectSpread({}, first), {}, {
|
|
117
|
+
coord: first.reversed ? first.end : first.start
|
|
118
|
+
})) || 0) + cytobandOffset * multiplier;
|
|
119
|
+
var topRight = (overview.bpToPx(_objectSpread(_objectSpread({}, last), {}, {
|
|
120
|
+
coord: last.reversed ? last.start : last.end
|
|
121
|
+
})) || 0) + cytobandOffset * multiplier;
|
|
122
|
+
var startPx = Math.max(0, -offsetPx);
|
|
123
|
+
var endPx = startPx + totalWidthPxWithoutBorders + contentBlocks.length * interRegionPaddingWidth / 2;
|
|
124
|
+
var points = [[startPx, _.HEADER_BAR_HEIGHT], [endPx, _.HEADER_BAR_HEIGHT], [topRight, 0], [topLeft, 0]];
|
|
125
|
+
return /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
126
|
+
points: points.toString(),
|
|
127
|
+
fill: (0, _core.alpha)(polygonColor, 0.3),
|
|
128
|
+
stroke: (0, _core.alpha)(polygonColor, 0.8)
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
exports.Polygon = Polygon;
|
|
132
|
+
|
|
133
|
+
// rounded rect from https://stackoverflow.com/a/45889603/2129219
|
|
134
|
+
// prettier-ignore
|
|
135
|
+
function rightRoundedRect(x, y, width, height, radius) {
|
|
136
|
+
return "M" + x + "," + y + "h" + (width - radius) + "a" + radius + "," + radius + " 0 0 1 " + radius + "," + radius + "v" + (height - 2 * radius) + "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + radius + "h" + (radius - width) + "z";
|
|
137
|
+
} // prettier-ignore
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
function leftRoundedRect(x, y, width, height, radius) {
|
|
141
|
+
return "M" + (x + radius) + "," + y + "h" + (width - radius) + "v" + height + "h" + (radius - width) + "a" + radius + "," + radius + " 0 0 1 " + -radius + "," + -radius + "v" + (2 * radius - height) + "a" + radius + "," + radius + " 0 0 1 " + radius + "," + -radius + "z";
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
var colorMap = {
|
|
145
|
+
gneg: 'rgb(227,227,227)',
|
|
146
|
+
gpos25: 'rgb(142,142,142)',
|
|
147
|
+
gpos50: 'rgb(85,85,85)',
|
|
148
|
+
gpos100: 'rgb(0,0,0)',
|
|
149
|
+
gpos75: 'rgb(57,57,57)',
|
|
150
|
+
gvar: 'rgb(0,0,0)',
|
|
151
|
+
stalk: 'rgb(127,127,127)',
|
|
152
|
+
acen: '#800'
|
|
153
|
+
};
|
|
154
|
+
var Cytobands = (0, _mobxReact.observer)(function (_ref2) {
|
|
155
|
+
var _assembly$cytobands;
|
|
156
|
+
|
|
157
|
+
var overview = _ref2.overview,
|
|
158
|
+
block = _ref2.block,
|
|
159
|
+
assembly = _ref2.assembly;
|
|
160
|
+
var offsetPx = block.offsetPx,
|
|
161
|
+
reversed = block.reversed;
|
|
162
|
+
var cytobands = assembly === null || assembly === void 0 ? void 0 : (_assembly$cytobands = assembly.cytobands) === null || _assembly$cytobands === void 0 ? void 0 : _assembly$cytobands.map(function (f) {
|
|
163
|
+
return {
|
|
164
|
+
refName: assembly.getCanonicalRefName(f.get('refName')),
|
|
165
|
+
start: f.get('start'),
|
|
166
|
+
end: f.get('end'),
|
|
167
|
+
type: f.get('type')
|
|
168
|
+
};
|
|
169
|
+
}).filter(function (f) {
|
|
170
|
+
return f.refName === block.refName;
|
|
171
|
+
}).map(function (f) {
|
|
172
|
+
var refName = f.refName,
|
|
173
|
+
start = f.start,
|
|
174
|
+
end = f.end,
|
|
175
|
+
type = f.type;
|
|
176
|
+
return [overview.bpToPx({
|
|
177
|
+
refName: refName,
|
|
178
|
+
coord: start
|
|
179
|
+
}), overview.bpToPx({
|
|
180
|
+
refName: refName,
|
|
181
|
+
coord: end
|
|
182
|
+
}), type];
|
|
183
|
+
});
|
|
184
|
+
var arr = cytobands || [];
|
|
185
|
+
var lcap = reversed ? arr.length - 1 : 0;
|
|
186
|
+
var rcap = reversed ? 0 : arr.length - 1;
|
|
187
|
+
var firstCent = true;
|
|
188
|
+
return cytobands ? /*#__PURE__*/_react["default"].createElement("g", {
|
|
189
|
+
transform: "translate(-".concat(offsetPx, ")")
|
|
190
|
+
}, cytobands.map(function (_ref3, index) {
|
|
191
|
+
var _ref4 = (0, _slicedToArray2["default"])(_ref3, 3),
|
|
192
|
+
start = _ref4[0],
|
|
193
|
+
end = _ref4[1],
|
|
194
|
+
type = _ref4[2];
|
|
195
|
+
|
|
196
|
+
var key = "".concat(start, "-").concat(end, "-").concat(type);
|
|
197
|
+
|
|
198
|
+
if (type === 'acen' && firstCent) {
|
|
199
|
+
firstCent = false;
|
|
200
|
+
return /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
201
|
+
key: key,
|
|
202
|
+
points: [[start, 0], [end, _.HEADER_OVERVIEW_HEIGHT / 2], [start, _.HEADER_OVERVIEW_HEIGHT]].toString(),
|
|
203
|
+
fill: colorMap[type]
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (type === 'acen' && !firstCent) {
|
|
208
|
+
return /*#__PURE__*/_react["default"].createElement("polygon", {
|
|
209
|
+
key: key,
|
|
210
|
+
points: [[start, _.HEADER_OVERVIEW_HEIGHT / 2], [end, 0], [end, _.HEADER_OVERVIEW_HEIGHT]].toString(),
|
|
211
|
+
fill: colorMap[type]
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (lcap === index) {
|
|
216
|
+
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
217
|
+
key: key,
|
|
218
|
+
d: leftRoundedRect(Math.min(start, end), 0, Math.abs(end - start), _.HEADER_OVERVIEW_HEIGHT, 8),
|
|
219
|
+
fill: colorMap[type]
|
|
220
|
+
});
|
|
221
|
+
} else if (rcap === index) {
|
|
222
|
+
return /*#__PURE__*/_react["default"].createElement("path", {
|
|
223
|
+
key: key,
|
|
224
|
+
d: rightRoundedRect(Math.min(start, end), 0, Math.abs(end - start) - 2, _.HEADER_OVERVIEW_HEIGHT, 8),
|
|
225
|
+
fill: colorMap[type]
|
|
226
|
+
});
|
|
227
|
+
} else {
|
|
228
|
+
return /*#__PURE__*/_react["default"].createElement("rect", {
|
|
229
|
+
key: key,
|
|
230
|
+
x: Math.min(start, end),
|
|
231
|
+
y: 0,
|
|
232
|
+
width: Math.abs(end - start),
|
|
233
|
+
height: _.HEADER_OVERVIEW_HEIGHT,
|
|
234
|
+
fill: colorMap[type]
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
})) : null;
|
|
238
|
+
});
|
|
239
|
+
exports.Cytobands = Cytobands;
|
|
240
|
+
var OverviewBox = (0, _mobxReact.observer)(function (_ref5) {
|
|
241
|
+
var scale = _ref5.scale,
|
|
242
|
+
model = _ref5.model,
|
|
243
|
+
block = _ref5.block,
|
|
244
|
+
overview = _ref5.overview;
|
|
245
|
+
var classes = useStyles();
|
|
246
|
+
var cytobandOffset = model.cytobandOffset,
|
|
247
|
+
showCytobands = model.showCytobands;
|
|
248
|
+
var start = block.start,
|
|
249
|
+
end = block.end,
|
|
250
|
+
reversed = block.reversed,
|
|
251
|
+
refName = block.refName,
|
|
252
|
+
assemblyName = block.assemblyName;
|
|
253
|
+
|
|
254
|
+
var _chooseGridPitch = (0, _util2.chooseGridPitch)(scale, 120, 15),
|
|
255
|
+
majorPitch = _chooseGridPitch.majorPitch;
|
|
256
|
+
|
|
257
|
+
var _getSession = (0, _util.getSession)(model),
|
|
258
|
+
assemblyManager = _getSession.assemblyManager;
|
|
259
|
+
|
|
260
|
+
var assembly = assemblyManager.get(assemblyName);
|
|
261
|
+
var refNameColor = assembly === null || assembly === void 0 ? void 0 : assembly.getRefNameColor(refName);
|
|
262
|
+
var tickLabels = [];
|
|
263
|
+
|
|
264
|
+
for (var i = 0; i < Math.floor((end - start) / majorPitch); i++) {
|
|
265
|
+
var offsetLabel = (i + 1) * majorPitch;
|
|
266
|
+
tickLabels.push(reversed ? end - offsetLabel : start + offsetLabel);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_core.Typography, {
|
|
270
|
+
style: {
|
|
271
|
+
left: block.offsetPx + 3,
|
|
272
|
+
color: showCytobands ? 'black' : refNameColor
|
|
273
|
+
},
|
|
274
|
+
className: classes.scaleBarRefName
|
|
275
|
+
}, refName), /*#__PURE__*/_react["default"].createElement("div", {
|
|
276
|
+
className: (0, _clsx["default"])(classes.scaleBarContig, showCytobands ? undefined : reversed ? classes.scaleBarContigReverse : classes.scaleBarContigForward, !showCytobands ? classes.scaleBarBorder : undefined),
|
|
277
|
+
style: {
|
|
278
|
+
left: block.offsetPx + cytobandOffset,
|
|
279
|
+
width: block.widthPx,
|
|
280
|
+
borderColor: refNameColor
|
|
281
|
+
}
|
|
282
|
+
}, !showCytobands ? tickLabels.map(function (tickLabel, labelIdx) {
|
|
283
|
+
return /*#__PURE__*/_react["default"].createElement(_core.Typography, {
|
|
284
|
+
key: "".concat(JSON.stringify(block), "-").concat(tickLabel, "-").concat(labelIdx),
|
|
285
|
+
className: classes.scaleBarLabel,
|
|
286
|
+
variant: "body2",
|
|
287
|
+
style: {
|
|
288
|
+
left: (labelIdx + 1) * majorPitch / scale,
|
|
289
|
+
pointerEvents: 'none',
|
|
290
|
+
color: refNameColor
|
|
291
|
+
}
|
|
292
|
+
}, tickLabel.toLocaleString('en-US'));
|
|
293
|
+
}) : null, showCytobands ? /*#__PURE__*/_react["default"].createElement("svg", {
|
|
294
|
+
style: {
|
|
295
|
+
width: '100%'
|
|
296
|
+
}
|
|
297
|
+
}, /*#__PURE__*/_react["default"].createElement(Cytobands, {
|
|
298
|
+
overview: overview,
|
|
299
|
+
assembly: assembly,
|
|
300
|
+
block: block
|
|
301
|
+
})) : null));
|
|
302
|
+
});
|
|
303
|
+
var ScaleBar = (0, _mobxReact.observer)(function (_ref6) {
|
|
304
|
+
var model = _ref6.model,
|
|
305
|
+
scale = _ref6.scale,
|
|
306
|
+
overview = _ref6.overview;
|
|
307
|
+
var classes = useStyles();
|
|
308
|
+
var theme = (0, _core.useTheme)();
|
|
309
|
+
var dynamicBlocks = model.dynamicBlocks,
|
|
310
|
+
showCytobands = model.showCytobands,
|
|
311
|
+
cytobandOffset = model.cytobandOffset;
|
|
312
|
+
var visibleRegions = dynamicBlocks.contentBlocks;
|
|
313
|
+
var overviewVisibleRegions = overview.dynamicBlocks;
|
|
314
|
+
var _theme$palette2 = theme.palette,
|
|
315
|
+
tertiary = _theme$palette2.tertiary,
|
|
316
|
+
primary = _theme$palette2.primary;
|
|
317
|
+
var scaleBarColor = tertiary ? tertiary.light : primary.light;
|
|
318
|
+
|
|
319
|
+
if (!visibleRegions.length) {
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
var first = visibleRegions[0];
|
|
324
|
+
var firstOverviewPx = overview.bpToPx(_objectSpread(_objectSpread({}, first), {}, {
|
|
325
|
+
coord: first.reversed ? first.end : first.start
|
|
326
|
+
})) || 0;
|
|
327
|
+
var last = visibleRegions[visibleRegions.length - 1];
|
|
328
|
+
var lastOverviewPx = overview.bpToPx(_objectSpread(_objectSpread({}, last), {}, {
|
|
329
|
+
coord: last.reversed ? last.start : last.end
|
|
330
|
+
})) || 0;
|
|
331
|
+
var color = showCytobands ? '#f00' : scaleBarColor;
|
|
332
|
+
var transparency = showCytobands ? 0.1 : 0.3;
|
|
333
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
334
|
+
className: classes.scaleBar
|
|
335
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
336
|
+
className: classes.scaleBarVisibleRegion,
|
|
337
|
+
style: {
|
|
338
|
+
width: lastOverviewPx - firstOverviewPx,
|
|
339
|
+
left: firstOverviewPx + cytobandOffset,
|
|
340
|
+
background: (0, _core.alpha)(color, transparency),
|
|
341
|
+
borderColor: color
|
|
342
|
+
}
|
|
343
|
+
}), overviewVisibleRegions.map(function (block, idx) {
|
|
344
|
+
return !(block instanceof _blockTypes.ContentBlock) ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
345
|
+
key: "".concat(JSON.stringify(block), "-").concat(idx),
|
|
346
|
+
className: classes.scaleBarContig,
|
|
347
|
+
style: {
|
|
348
|
+
width: block.widthPx,
|
|
349
|
+
left: block.offsetPx,
|
|
350
|
+
backgroundColor: '#999',
|
|
351
|
+
backgroundImage: 'repeating-linear-gradient(90deg, transparent, transparent 1px, rgba(255,255,255,.5) 1px, rgba(255,255,255,.5) 3px)'
|
|
352
|
+
}
|
|
353
|
+
}) : /*#__PURE__*/_react["default"].createElement(OverviewBox, {
|
|
354
|
+
scale: scale,
|
|
355
|
+
block: block,
|
|
356
|
+
model: model,
|
|
357
|
+
overview: overview,
|
|
358
|
+
key: "".concat(JSON.stringify(block), "-").concat(idx)
|
|
359
|
+
});
|
|
360
|
+
}));
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
function OverviewScaleBar(_ref7) {
|
|
364
|
+
var model = _ref7.model,
|
|
365
|
+
children = _ref7.children;
|
|
366
|
+
var classes = useStyles();
|
|
367
|
+
var totalBp = model.totalBp,
|
|
368
|
+
width = model.width,
|
|
369
|
+
cytobandOffset = model.cytobandOffset,
|
|
370
|
+
displayedRegions = model.displayedRegions;
|
|
371
|
+
|
|
372
|
+
var overview = _Base1DViewModel["default"].create({
|
|
373
|
+
displayedRegions: JSON.parse(JSON.stringify(displayedRegions)),
|
|
374
|
+
interRegionPaddingWidth: 0,
|
|
375
|
+
minimumBlockWidth: model.minimumBlockWidth
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
var modWidth = width - cytobandOffset;
|
|
379
|
+
overview.setVolatileWidth(modWidth);
|
|
380
|
+
overview.showAllRegions();
|
|
381
|
+
var scale = totalBp / (modWidth - (displayedRegions.length - 1) * wholeSeqSpacer);
|
|
382
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_OverviewRubberBand["default"], {
|
|
383
|
+
model: model,
|
|
384
|
+
overview: overview,
|
|
385
|
+
ControlComponent: /*#__PURE__*/_react["default"].createElement(ScaleBar, {
|
|
386
|
+
model: model,
|
|
387
|
+
overview: overview,
|
|
388
|
+
scale: scale
|
|
389
|
+
})
|
|
390
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
391
|
+
className: classes.overview
|
|
392
|
+
}, /*#__PURE__*/_react["default"].createElement("svg", {
|
|
393
|
+
height: _.HEADER_BAR_HEIGHT,
|
|
394
|
+
className: classes.overviewSvg
|
|
395
|
+
}, /*#__PURE__*/_react["default"].createElement(Polygon, {
|
|
396
|
+
model: model,
|
|
397
|
+
overview: overview
|
|
398
|
+
})), children));
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
var _default = (0, _mobxReact.observer)(OverviewScaleBar);
|
|
402
|
+
|
|
403
|
+
exports["default"] = _default;
|