@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
|
@@ -1,1445 +1,1068 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.RESIZE_HANDLE_HEIGHT = exports.INTER_REGION_PADDING_WIDTH = exports.HEADER_OVERVIEW_HEIGHT = exports.HEADER_BAR_HEIGHT = void 0;
|
|
9
|
-
Object.defineProperty(exports, "ReactComponent", {
|
|
10
|
-
enumerable: true,
|
|
11
|
-
get: function get() {
|
|
12
|
-
return _LinearGenomeView.default;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
Object.defineProperty(exports, "RefNameAutocomplete", {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function get() {
|
|
18
|
-
return _RefNameAutocomplete.default;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
exports.SPACING = exports.SCALE_BAR_HEIGHT = void 0;
|
|
22
|
-
Object.defineProperty(exports, "SearchBox", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function get() {
|
|
25
|
-
return _SearchBox.default;
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
exports.WIDGET_HEIGHT = void 0;
|
|
29
|
-
Object.defineProperty(exports, "renderToSvg", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function get() {
|
|
32
|
-
return _LinearGenomeViewSvg.renderToSvg;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
exports.stateModelFactory = stateModelFactory;
|
|
36
|
-
|
|
37
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
38
|
-
|
|
39
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
40
|
-
|
|
41
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
42
|
-
|
|
43
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
44
|
-
|
|
45
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
46
|
-
|
|
47
|
-
var _configuration = require("@jbrowse/core/configuration");
|
|
48
|
-
|
|
49
|
-
var _models = require("@jbrowse/core/pluggableElementTypes/models");
|
|
50
|
-
|
|
51
|
-
var _mst = require("@jbrowse/core/util/types/mst");
|
|
52
|
-
|
|
53
|
-
var _ui = require("@jbrowse/core/ui");
|
|
54
|
-
|
|
55
|
-
var _util = require("@jbrowse/core/util");
|
|
56
|
-
|
|
57
|
-
var _calculateDynamicBlocks = _interopRequireDefault(require("@jbrowse/core/util/calculateDynamicBlocks"));
|
|
58
|
-
|
|
59
|
-
var _calculateStaticBlocks = _interopRequireDefault(require("@jbrowse/core/util/calculateStaticBlocks"));
|
|
60
|
-
|
|
61
|
-
var _tracks = require("@jbrowse/core/util/tracks");
|
|
62
|
-
|
|
63
|
-
var _mobx = require("mobx");
|
|
64
|
-
|
|
65
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
66
|
-
|
|
67
|
-
var _Base1DViewModel = _interopRequireDefault(require("@jbrowse/core/util/Base1DViewModel"));
|
|
68
|
-
|
|
69
|
-
var _clone = _interopRequireDefault(require("clone"));
|
|
70
|
-
|
|
71
|
-
var _fileSaver = require("file-saver");
|
|
72
|
-
|
|
73
|
-
var _Icons = require("@jbrowse/core/ui/Icons");
|
|
74
|
-
|
|
75
|
-
var _SyncAlt = _interopRequireDefault(require("@material-ui/icons/SyncAlt"));
|
|
76
|
-
|
|
77
|
-
var _Visibility = _interopRequireDefault(require("@material-ui/icons/Visibility"));
|
|
78
|
-
|
|
79
|
-
var _Label = _interopRequireDefault(require("@material-ui/icons/Label"));
|
|
80
|
-
|
|
81
|
-
var _FolderOpen = _interopRequireDefault(require("@material-ui/icons/FolderOpen"));
|
|
82
|
-
|
|
83
|
-
var _PhotoCamera = _interopRequireDefault(require("@material-ui/icons/PhotoCamera"));
|
|
84
|
-
|
|
85
|
-
var _ZoomIn = _interopRequireDefault(require("@material-ui/icons/ZoomIn"));
|
|
86
|
-
|
|
87
|
-
var _MenuOpen = _interopRequireDefault(require("@material-ui/icons/MenuOpen"));
|
|
88
|
-
|
|
89
|
-
var _LinearGenomeViewSvg = require("./components/LinearGenomeViewSvg");
|
|
90
|
-
|
|
91
|
-
var _RefNameAutocomplete = _interopRequireDefault(require("./components/RefNameAutocomplete"));
|
|
92
|
-
|
|
93
|
-
var _SearchBox = _interopRequireDefault(require("./components/SearchBox"));
|
|
94
|
-
|
|
95
|
-
var _ExportSvgDialog = _interopRequireDefault(require("./components/ExportSvgDialog"));
|
|
96
|
-
|
|
97
|
-
var _LinearGenomeView = _interopRequireDefault(require("./components/LinearGenomeView"));
|
|
98
|
-
|
|
99
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
100
|
-
|
|
101
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
102
|
-
|
|
103
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
104
|
-
|
|
105
|
-
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; }
|
|
106
|
-
|
|
107
|
-
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; }
|
|
108
|
-
|
|
109
|
-
function calculateVisibleLocStrings(contentBlocks) {
|
|
110
|
-
if (!contentBlocks.length) {
|
|
111
|
-
return '';
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var isSingleAssemblyName = contentBlocks.every(function (block) {
|
|
115
|
-
return block.assemblyName === contentBlocks[0].assemblyName;
|
|
116
|
-
});
|
|
117
|
-
var locs = contentBlocks.map(function (block) {
|
|
118
|
-
return (0, _util.assembleLocString)(_objectSpread(_objectSpread({}, block), {}, {
|
|
119
|
-
start: Math.round(block.start),
|
|
120
|
-
end: Math.round(block.end),
|
|
121
|
-
assemblyName: isSingleAssemblyName ? undefined : block.assemblyName
|
|
122
|
-
}));
|
|
123
|
-
});
|
|
124
|
-
return locs.join(' ');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
var HEADER_BAR_HEIGHT = 48;
|
|
128
|
-
exports.HEADER_BAR_HEIGHT = HEADER_BAR_HEIGHT;
|
|
129
|
-
var HEADER_OVERVIEW_HEIGHT = 20;
|
|
130
|
-
exports.HEADER_OVERVIEW_HEIGHT = HEADER_OVERVIEW_HEIGHT;
|
|
131
|
-
var SCALE_BAR_HEIGHT = 17;
|
|
132
|
-
exports.SCALE_BAR_HEIGHT = SCALE_BAR_HEIGHT;
|
|
133
|
-
var RESIZE_HANDLE_HEIGHT = 3;
|
|
134
|
-
exports.RESIZE_HANDLE_HEIGHT = RESIZE_HANDLE_HEIGHT;
|
|
135
|
-
var INTER_REGION_PADDING_WIDTH = 2;
|
|
136
|
-
exports.INTER_REGION_PADDING_WIDTH = INTER_REGION_PADDING_WIDTH;
|
|
137
|
-
var SPACING = 7;
|
|
138
|
-
exports.SPACING = SPACING;
|
|
139
|
-
var WIDGET_HEIGHT = 32;
|
|
140
|
-
exports.WIDGET_HEIGHT = WIDGET_HEIGHT;
|
|
141
|
-
|
|
142
|
-
function localStorageGetItem(item) {
|
|
143
|
-
return typeof localStorage !== 'undefined' ? localStorage.getItem(item) : undefined;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
function stateModelFactory(pluginManager) {
|
|
147
|
-
return _mobxStateTree.types.compose(_models.BaseViewModel, _mobxStateTree.types.model('LinearGenomeView', {
|
|
148
|
-
id: _mst.ElementId,
|
|
149
|
-
type: _mobxStateTree.types.literal('LinearGenomeView'),
|
|
150
|
-
offsetPx: 0,
|
|
151
|
-
bpPerPx: 1,
|
|
152
|
-
displayedRegions: _mobxStateTree.types.array(_mst.Region),
|
|
153
|
-
// we use an array for the tracks because the tracks are displayed in a
|
|
154
|
-
// specific order that we need to keep.
|
|
155
|
-
tracks: _mobxStateTree.types.array(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
156
|
-
hideHeader: false,
|
|
157
|
-
hideHeaderOverview: false,
|
|
158
|
-
hideNoTracksActive: false,
|
|
159
|
-
trackSelectorType: _mobxStateTree.types.optional(_mobxStateTree.types.enumeration(['hierarchical']), 'hierarchical'),
|
|
160
|
-
trackLabels: _mobxStateTree.types.optional(_mobxStateTree.types.string, function () {
|
|
161
|
-
return localStorageGetItem('lgv-trackLabels') || 'overlapping';
|
|
162
|
-
}),
|
|
163
|
-
showCenterLine: _mobxStateTree.types.optional(_mobxStateTree.types.boolean, function () {
|
|
164
|
-
var setting = localStorageGetItem('lgv-showCenterLine');
|
|
165
|
-
return setting !== undefined && setting !== null ? !!+setting : false;
|
|
166
|
-
}),
|
|
167
|
-
showCytobandsSetting: _mobxStateTree.types.optional(_mobxStateTree.types.boolean, function () {
|
|
168
|
-
var setting = localStorageGetItem('lgv-showCytobands');
|
|
169
|
-
return setting !== undefined && setting !== null ? !!+setting : true;
|
|
170
|
-
})
|
|
171
|
-
})).volatile(function () {
|
|
172
|
-
return {
|
|
173
|
-
volatileWidth: undefined,
|
|
174
|
-
minimumBlockWidth: 3,
|
|
175
|
-
draggingTrackId: undefined,
|
|
176
|
-
volatileError: undefined,
|
|
177
|
-
// array of callbacks to run after the next set of the displayedRegions,
|
|
178
|
-
// which is basically like an onLoad
|
|
179
|
-
afterDisplayedRegionsSetCallbacks: [],
|
|
180
|
-
scaleFactor: 1,
|
|
181
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
182
|
-
trackRefs: {},
|
|
183
|
-
coarseDynamicBlocks: [],
|
|
184
|
-
coarseTotalBp: 0,
|
|
185
|
-
leftOffset: undefined,
|
|
186
|
-
rightOffset: undefined,
|
|
187
|
-
searchResults: undefined,
|
|
188
|
-
searchQuery: undefined,
|
|
189
|
-
seqDialogDisplayed: false
|
|
190
|
-
};
|
|
191
|
-
}).views(function (self) {
|
|
192
|
-
return {
|
|
193
|
-
get width() {
|
|
194
|
-
if (self.volatileWidth === undefined) {
|
|
195
|
-
throw new Error('width undefined, make sure to check for model.initialized');
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
196
8
|
}
|
|
197
|
-
|
|
198
|
-
return self.volatileWidth;
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
get interRegionPaddingWidth() {
|
|
202
|
-
return INTER_REGION_PADDING_WIDTH;
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
get assemblyNames() {
|
|
206
|
-
return (0, _toConsumableArray2.default)(new Set(self.displayedRegions.map(function (region) {
|
|
207
|
-
return region.assemblyName;
|
|
208
|
-
})));
|
|
209
|
-
}
|
|
210
|
-
|
|
9
|
+
return t;
|
|
211
10
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
+
if (!m) return o;
|
|
52
|
+
var i = m.call(o), r, ar = [], e;
|
|
53
|
+
try {
|
|
54
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
+
}
|
|
56
|
+
catch (error) { e = { error: error }; }
|
|
57
|
+
finally {
|
|
58
|
+
try {
|
|
59
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
259
60
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
61
|
+
finally { if (e) throw e.error; }
|
|
62
|
+
}
|
|
63
|
+
return ar;
|
|
64
|
+
};
|
|
65
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
66
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
67
|
+
if (ar || !(i in from)) {
|
|
68
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
69
|
+
ar[i] = from[i];
|
|
263
70
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
get trackHeightsWithResizeHandles() {
|
|
277
|
-
return this.trackHeights + self.tracks.length * RESIZE_HANDLE_HEIGHT;
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
get height() {
|
|
281
|
-
return this.trackHeightsWithResizeHandles + this.headerHeight + this.scaleBarHeight;
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
get totalBp() {
|
|
285
|
-
return self.displayedRegions.reduce(function (a, b) {
|
|
286
|
-
return a + b.end - b.start;
|
|
287
|
-
}, 0);
|
|
288
|
-
},
|
|
289
|
-
|
|
290
|
-
get maxBpPerPx() {
|
|
291
|
-
return this.totalBp / (self.width * 0.9);
|
|
292
|
-
},
|
|
293
|
-
|
|
294
|
-
get minBpPerPx() {
|
|
295
|
-
return 1 / 50;
|
|
296
|
-
},
|
|
297
|
-
|
|
298
|
-
get error() {
|
|
299
|
-
return self.volatileError || this.assemblyErrors;
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
get maxOffset() {
|
|
303
|
-
// objectively determined to keep the linear genome on the main screen
|
|
304
|
-
var leftPadding = 10;
|
|
305
|
-
return this.displayedRegionsTotalPx - leftPadding;
|
|
306
|
-
},
|
|
307
|
-
|
|
308
|
-
get minOffset() {
|
|
309
|
-
// objectively determined to keep the linear genome on the main screen
|
|
310
|
-
var rightPadding = 30;
|
|
311
|
-
return -self.width + rightPadding;
|
|
312
|
-
},
|
|
313
|
-
|
|
314
|
-
get displayedRegionsTotalPx() {
|
|
315
|
-
return this.totalBp / self.bpPerPx;
|
|
316
|
-
},
|
|
317
|
-
|
|
318
|
-
renderProps: function renderProps() {
|
|
319
|
-
return _objectSpread(_objectSpread({}, (0, _tracks.getParentRenderProps)(self)), {}, {
|
|
320
|
-
bpPerPx: self.bpPerPx,
|
|
321
|
-
highResolutionScaling: (0, _configuration.getConf)((0, _util.getSession)(self), 'highResolutionScaling')
|
|
322
|
-
});
|
|
323
|
-
},
|
|
324
|
-
searchScope: function searchScope(assemblyName) {
|
|
325
|
-
return {
|
|
326
|
-
assemblyName: assemblyName,
|
|
327
|
-
includeAggregateIndexes: true,
|
|
328
|
-
tracks: self.tracks
|
|
329
|
-
};
|
|
330
|
-
},
|
|
331
|
-
bpToPx: function bpToPx(_ref) {
|
|
332
|
-
var refName = _ref.refName,
|
|
333
|
-
coord = _ref.coord,
|
|
334
|
-
regionNumber = _ref.regionNumber;
|
|
335
|
-
return (0, _util.viewBpToPx)({
|
|
336
|
-
refName: refName,
|
|
337
|
-
coord: coord,
|
|
338
|
-
regionNumber: regionNumber,
|
|
339
|
-
self: self
|
|
340
|
-
});
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
/**
|
|
344
|
-
*
|
|
345
|
-
* @param px - px in the view area, return value is the displayed regions
|
|
346
|
-
* @returns BpOffset of the displayed region that it lands in
|
|
347
|
-
*/
|
|
348
|
-
pxToBp: function pxToBp(px) {
|
|
349
|
-
var bpSoFar = 0;
|
|
350
|
-
var bp = (self.offsetPx + px) * self.bpPerPx;
|
|
351
|
-
var n = self.displayedRegions.length;
|
|
352
|
-
|
|
353
|
-
if (bp < 0) {
|
|
354
|
-
var region = self.displayedRegions[0];
|
|
355
|
-
var offset = bp;
|
|
356
|
-
return _objectSpread(_objectSpread({}, (0, _mobxStateTree.getSnapshot)(region)), {}, {
|
|
357
|
-
oob: true,
|
|
358
|
-
coord: region.reversed ? Math.floor(region.end - offset) + 1 : Math.floor(region.start + offset) + 1,
|
|
359
|
-
offset: offset,
|
|
360
|
-
index: 0
|
|
361
|
-
});
|
|
71
|
+
}
|
|
72
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
73
|
+
};
|
|
74
|
+
var __values = (this && this.__values) || function(o) {
|
|
75
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
76
|
+
if (m) return m.call(o);
|
|
77
|
+
if (o && typeof o.length === "number") return {
|
|
78
|
+
next: function () {
|
|
79
|
+
if (o && i >= o.length) o = void 0;
|
|
80
|
+
return { value: o && o[i++], done: !o };
|
|
362
81
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
82
|
+
};
|
|
83
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
84
|
+
};
|
|
85
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
86
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
87
|
+
};
|
|
88
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
|
+
exports.ReactComponent = exports.SearchBox = exports.RefNameAutocomplete = exports.renderToSvg = exports.stateModelFactory = exports.WIDGET_HEIGHT = exports.SPACING = exports.INTER_REGION_PADDING_WIDTH = exports.RESIZE_HANDLE_HEIGHT = exports.SCALE_BAR_HEIGHT = exports.HEADER_OVERVIEW_HEIGHT = exports.HEADER_BAR_HEIGHT = void 0;
|
|
90
|
+
var configuration_1 = require("@jbrowse/core/configuration");
|
|
91
|
+
var models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
92
|
+
var mst_1 = require("@jbrowse/core/util/types/mst");
|
|
93
|
+
var ui_1 = require("@jbrowse/core/ui");
|
|
94
|
+
var util_1 = require("@jbrowse/core/util");
|
|
95
|
+
var calculateDynamicBlocks_1 = __importDefault(require("@jbrowse/core/util/calculateDynamicBlocks"));
|
|
96
|
+
var calculateStaticBlocks_1 = __importDefault(require("@jbrowse/core/util/calculateStaticBlocks"));
|
|
97
|
+
var tracks_1 = require("@jbrowse/core/util/tracks");
|
|
98
|
+
var mobx_1 = require("mobx");
|
|
99
|
+
var mobx_state_tree_1 = require("mobx-state-tree");
|
|
100
|
+
var Base1DViewModel_1 = __importDefault(require("@jbrowse/core/util/Base1DViewModel"));
|
|
101
|
+
var Base1DUtils_1 = require("@jbrowse/core/util/Base1DUtils");
|
|
102
|
+
var file_saver_1 = require("file-saver");
|
|
103
|
+
var clone_1 = __importDefault(require("clone"));
|
|
104
|
+
// icons
|
|
105
|
+
var Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
106
|
+
var SyncAlt_1 = __importDefault(require("@mui/icons-material/SyncAlt"));
|
|
107
|
+
var Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
108
|
+
var Label_1 = __importDefault(require("@mui/icons-material/Label"));
|
|
109
|
+
var FolderOpen_1 = __importDefault(require("@mui/icons-material/FolderOpen"));
|
|
110
|
+
var PhotoCamera_1 = __importDefault(require("@mui/icons-material/PhotoCamera"));
|
|
111
|
+
var ZoomIn_1 = __importDefault(require("@mui/icons-material/ZoomIn"));
|
|
112
|
+
var MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
|
|
113
|
+
// locals
|
|
114
|
+
var LinearGenomeViewSvg_1 = require("./components/LinearGenomeViewSvg");
|
|
115
|
+
Object.defineProperty(exports, "renderToSvg", { enumerable: true, get: function () { return LinearGenomeViewSvg_1.renderToSvg; } });
|
|
116
|
+
var RefNameAutocomplete_1 = __importDefault(require("./components/RefNameAutocomplete"));
|
|
117
|
+
exports.RefNameAutocomplete = RefNameAutocomplete_1.default;
|
|
118
|
+
var SearchBox_1 = __importDefault(require("./components/SearchBox"));
|
|
119
|
+
exports.SearchBox = SearchBox_1.default;
|
|
120
|
+
var ExportSvgDialog_1 = __importDefault(require("./components/ExportSvgDialog"));
|
|
121
|
+
function calculateVisibleLocStrings(contentBlocks) {
|
|
122
|
+
if (!contentBlocks.length) {
|
|
123
|
+
return '';
|
|
124
|
+
}
|
|
125
|
+
var isSingleAssemblyName = contentBlocks.every(function (block) { return block.assemblyName === contentBlocks[0].assemblyName; });
|
|
126
|
+
var locs = contentBlocks.map(function (block) {
|
|
127
|
+
return (0, util_1.assembleLocString)(__assign(__assign({}, block), { start: Math.round(block.start), end: Math.round(block.end), assemblyName: isSingleAssemblyName ? undefined : block.assemblyName }));
|
|
128
|
+
});
|
|
129
|
+
return locs.join(' ');
|
|
130
|
+
}
|
|
131
|
+
exports.HEADER_BAR_HEIGHT = 48;
|
|
132
|
+
exports.HEADER_OVERVIEW_HEIGHT = 20;
|
|
133
|
+
exports.SCALE_BAR_HEIGHT = 17;
|
|
134
|
+
exports.RESIZE_HANDLE_HEIGHT = 3;
|
|
135
|
+
exports.INTER_REGION_PADDING_WIDTH = 2;
|
|
136
|
+
exports.SPACING = 7;
|
|
137
|
+
exports.WIDGET_HEIGHT = 32;
|
|
138
|
+
function localStorageGetItem(item) {
|
|
139
|
+
return typeof localStorage !== 'undefined'
|
|
140
|
+
? localStorage.getItem(item)
|
|
141
|
+
: undefined;
|
|
142
|
+
}
|
|
143
|
+
function stateModelFactory(pluginManager) {
|
|
144
|
+
return mobx_state_tree_1.types
|
|
145
|
+
.compose(models_1.BaseViewModel, mobx_state_tree_1.types.model('LinearGenomeView', {
|
|
146
|
+
id: mst_1.ElementId,
|
|
147
|
+
type: mobx_state_tree_1.types.literal('LinearGenomeView'),
|
|
148
|
+
offsetPx: 0,
|
|
149
|
+
bpPerPx: 1,
|
|
150
|
+
displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
|
|
151
|
+
// we use an array for the tracks because the tracks are displayed in a
|
|
152
|
+
// specific order that we need to keep.
|
|
153
|
+
tracks: mobx_state_tree_1.types.array(pluginManager.pluggableMstType('track', 'stateModel')),
|
|
154
|
+
hideHeader: false,
|
|
155
|
+
hideHeaderOverview: false,
|
|
156
|
+
hideNoTracksActive: false,
|
|
157
|
+
trackSelectorType: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.enumeration(['hierarchical']), 'hierarchical'),
|
|
158
|
+
trackLabels: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.string, function () { return localStorageGetItem('lgv-trackLabels') || 'overlapping'; }),
|
|
159
|
+
showCenterLine: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, function () {
|
|
160
|
+
var setting = localStorageGetItem('lgv-showCenterLine');
|
|
161
|
+
return setting !== undefined && setting !== null ? !!+setting : false;
|
|
162
|
+
}),
|
|
163
|
+
showCytobandsSetting: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, function () {
|
|
164
|
+
var setting = localStorageGetItem('lgv-showCytobands');
|
|
165
|
+
return setting !== undefined && setting !== null ? !!+setting : true;
|
|
166
|
+
}),
|
|
167
|
+
showGridlines: true,
|
|
168
|
+
}))
|
|
169
|
+
.volatile(function () { return ({
|
|
170
|
+
volatileWidth: undefined,
|
|
171
|
+
minimumBlockWidth: 3,
|
|
172
|
+
draggingTrackId: undefined,
|
|
173
|
+
volatileError: undefined,
|
|
174
|
+
// array of callbacks to run after the next set of the displayedRegions,
|
|
175
|
+
// which is basically like an onLoad
|
|
176
|
+
afterDisplayedRegionsSetCallbacks: [],
|
|
177
|
+
scaleFactor: 1,
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
+
trackRefs: {},
|
|
180
|
+
coarseDynamicBlocks: [],
|
|
181
|
+
coarseTotalBp: 0,
|
|
182
|
+
leftOffset: undefined,
|
|
183
|
+
rightOffset: undefined,
|
|
184
|
+
searchResults: undefined,
|
|
185
|
+
searchQuery: undefined,
|
|
186
|
+
seqDialogDisplayed: false,
|
|
187
|
+
}); })
|
|
188
|
+
.views(function (self) { return ({
|
|
189
|
+
get width() {
|
|
190
|
+
if (self.volatileWidth === undefined) {
|
|
191
|
+
throw new Error('width undefined, make sure to check for model.initialized');
|
|
192
|
+
}
|
|
193
|
+
return self.volatileWidth;
|
|
194
|
+
},
|
|
195
|
+
get interRegionPaddingWidth() {
|
|
196
|
+
return exports.INTER_REGION_PADDING_WIDTH;
|
|
197
|
+
},
|
|
198
|
+
get assemblyNames() {
|
|
199
|
+
return __spreadArray([], __read(new Set(self.displayedRegions.map(function (region) { return region.assemblyName; }))), false);
|
|
200
|
+
},
|
|
201
|
+
}); })
|
|
202
|
+
.views(function (self) { return ({
|
|
203
|
+
get assemblyErrors() {
|
|
204
|
+
var assemblyManager = (0, util_1.getSession)(self).assemblyManager;
|
|
205
|
+
var assemblyNames = self.assemblyNames;
|
|
206
|
+
return assemblyNames
|
|
207
|
+
.map(function (a) { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.error; })
|
|
208
|
+
.filter(function (f) { return !!f; })
|
|
209
|
+
.join(', ');
|
|
210
|
+
},
|
|
211
|
+
get assembliesInitialized() {
|
|
212
|
+
var assemblyManager = (0, util_1.getSession)(self).assemblyManager;
|
|
213
|
+
var assemblyNames = self.assemblyNames;
|
|
214
|
+
return assemblyNames.every(function (a) { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.initialized; });
|
|
215
|
+
},
|
|
216
|
+
get initialized() {
|
|
217
|
+
return self.volatileWidth !== undefined && this.assembliesInitialized;
|
|
218
|
+
},
|
|
219
|
+
get hasDisplayedRegions() {
|
|
220
|
+
return self.displayedRegions.length > 0;
|
|
221
|
+
},
|
|
222
|
+
get isSearchDialogDisplayed() {
|
|
223
|
+
return self.searchResults !== undefined;
|
|
224
|
+
},
|
|
225
|
+
get scaleBarHeight() {
|
|
226
|
+
return exports.SCALE_BAR_HEIGHT + exports.RESIZE_HANDLE_HEIGHT;
|
|
227
|
+
},
|
|
228
|
+
get headerHeight() {
|
|
229
|
+
if (self.hideHeader) {
|
|
230
|
+
return 0;
|
|
231
|
+
}
|
|
232
|
+
if (self.hideHeaderOverview) {
|
|
233
|
+
return exports.HEADER_BAR_HEIGHT;
|
|
234
|
+
}
|
|
235
|
+
return exports.HEADER_BAR_HEIGHT + exports.HEADER_OVERVIEW_HEIGHT;
|
|
236
|
+
},
|
|
237
|
+
get trackHeights() {
|
|
238
|
+
return self.tracks
|
|
239
|
+
.map(function (t) { return t.displays[0].height; })
|
|
240
|
+
.reduce(function (a, b) { return a + b; }, 0);
|
|
241
|
+
},
|
|
242
|
+
get trackHeightsWithResizeHandles() {
|
|
243
|
+
return this.trackHeights + self.tracks.length * exports.RESIZE_HANDLE_HEIGHT;
|
|
244
|
+
},
|
|
245
|
+
get height() {
|
|
246
|
+
return (this.trackHeightsWithResizeHandles +
|
|
247
|
+
this.headerHeight +
|
|
248
|
+
this.scaleBarHeight);
|
|
249
|
+
},
|
|
250
|
+
get totalBp() {
|
|
251
|
+
return self.displayedRegions.reduce(function (a, b) { return a + b.end - b.start; }, 0);
|
|
252
|
+
},
|
|
253
|
+
get maxBpPerPx() {
|
|
254
|
+
return this.totalBp / (self.width * 0.9);
|
|
255
|
+
},
|
|
256
|
+
get minBpPerPx() {
|
|
257
|
+
return 1 / 50;
|
|
258
|
+
},
|
|
259
|
+
get error() {
|
|
260
|
+
return self.volatileError || this.assemblyErrors;
|
|
261
|
+
},
|
|
262
|
+
get maxOffset() {
|
|
263
|
+
// objectively determined to keep the linear genome on the main screen
|
|
264
|
+
var leftPadding = 10;
|
|
265
|
+
return this.displayedRegionsTotalPx - leftPadding;
|
|
266
|
+
},
|
|
267
|
+
get minOffset() {
|
|
268
|
+
// objectively determined to keep the linear genome on the main screen
|
|
269
|
+
var rightPadding = 30;
|
|
270
|
+
return -self.width + rightPadding;
|
|
271
|
+
},
|
|
272
|
+
get displayedRegionsTotalPx() {
|
|
273
|
+
return this.totalBp / self.bpPerPx;
|
|
274
|
+
},
|
|
275
|
+
renderProps: function () {
|
|
276
|
+
return __assign(__assign({}, (0, tracks_1.getParentRenderProps)(self)), { bpPerPx: self.bpPerPx, highResolutionScaling: (0, configuration_1.getConf)((0, util_1.getSession)(self), 'highResolutionScaling') });
|
|
277
|
+
},
|
|
278
|
+
searchScope: function (assemblyName) {
|
|
279
|
+
return {
|
|
280
|
+
assemblyName: assemblyName,
|
|
281
|
+
includeAggregateIndexes: true,
|
|
282
|
+
tracks: self.tracks,
|
|
283
|
+
};
|
|
284
|
+
},
|
|
285
|
+
getTrack: function (id) {
|
|
286
|
+
return self.tracks.find(function (t) { return t.configuration.trackId === id; });
|
|
287
|
+
},
|
|
288
|
+
rankSearchResults: function (results) {
|
|
289
|
+
// order of rank
|
|
290
|
+
var openTrackIds = self.tracks.map(function (track) { return track.configuration.trackId; });
|
|
291
|
+
results.forEach(function (result) {
|
|
292
|
+
if (openTrackIds.includes(result.trackId)) {
|
|
293
|
+
result.updateScore(result.getScore() + 1);
|
|
294
|
+
}
|
|
379
295
|
});
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
return {
|
|
407
|
-
coord: 0,
|
|
408
|
-
index: 0,
|
|
409
|
-
refName: '',
|
|
410
|
-
oob: true,
|
|
411
|
-
assemblyName: '',
|
|
412
|
-
offset: 0,
|
|
413
|
-
start: 0,
|
|
414
|
-
end: 0,
|
|
415
|
-
reversed: false
|
|
416
|
-
};
|
|
417
|
-
},
|
|
418
|
-
getTrack: function getTrack(id) {
|
|
419
|
-
return self.tracks.find(function (t) {
|
|
420
|
-
return t.configuration.trackId === id;
|
|
421
|
-
});
|
|
422
|
-
},
|
|
423
|
-
rankSearchResults: function rankSearchResults(results) {
|
|
424
|
-
// order of rank
|
|
425
|
-
var openTrackIds = self.tracks.map(function (track) {
|
|
426
|
-
return track.configuration.trackId;
|
|
427
|
-
});
|
|
428
|
-
results.forEach(function (result) {
|
|
429
|
-
if (openTrackIds.includes(result.trackId)) {
|
|
430
|
-
result.updateScore(result.getScore() + 1);
|
|
431
|
-
}
|
|
432
|
-
});
|
|
433
|
-
return results;
|
|
434
|
-
},
|
|
435
|
-
// modifies view menu action onClick to apply to all tracks of same type
|
|
436
|
-
rewriteOnClicks: function rewriteOnClicks(trackType, viewMenuActions) {
|
|
437
|
-
var _this = this;
|
|
438
|
-
|
|
439
|
-
viewMenuActions.forEach(function (action) {
|
|
440
|
-
// go to lowest level menu
|
|
441
|
-
if ('subMenu' in action) {
|
|
442
|
-
_this.rewriteOnClicks(trackType, action.subMenu);
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if ('onClick' in action) {
|
|
446
|
-
var holdOnClick = action.onClick;
|
|
447
|
-
|
|
448
|
-
action.onClick = function () {
|
|
449
|
-
for (var _len2 = arguments.length, args = new Array(_len2), _key = 0; _key < _len2; _key++) {
|
|
450
|
-
args[_key] = arguments[_key];
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
self.tracks.forEach(function (track) {
|
|
454
|
-
if (track.type === trackType) {
|
|
455
|
-
holdOnClick.apply(track, [track].concat(args));
|
|
296
|
+
return results;
|
|
297
|
+
},
|
|
298
|
+
// modifies view menu action onClick to apply to all tracks of same type
|
|
299
|
+
rewriteOnClicks: function (trackType, viewMenuActions) {
|
|
300
|
+
var _this = this;
|
|
301
|
+
viewMenuActions.forEach(function (action) {
|
|
302
|
+
// go to lowest level menu
|
|
303
|
+
if ('subMenu' in action) {
|
|
304
|
+
_this.rewriteOnClicks(trackType, action.subMenu);
|
|
305
|
+
}
|
|
306
|
+
if ('onClick' in action) {
|
|
307
|
+
var holdOnClick_1 = action.onClick;
|
|
308
|
+
action.onClick = function () {
|
|
309
|
+
var args = [];
|
|
310
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
311
|
+
args[_i] = arguments[_i];
|
|
312
|
+
}
|
|
313
|
+
self.tracks.forEach(function (track) {
|
|
314
|
+
if (track.type === trackType) {
|
|
315
|
+
holdOnClick_1.apply(track, __spreadArray([track], __read(args), false));
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
};
|
|
456
319
|
}
|
|
457
|
-
});
|
|
458
|
-
};
|
|
459
|
-
}
|
|
460
|
-
});
|
|
461
|
-
},
|
|
462
|
-
|
|
463
|
-
get trackTypeActions() {
|
|
464
|
-
var _this2 = this;
|
|
465
|
-
|
|
466
|
-
var allActions = new Map();
|
|
467
|
-
self.tracks.forEach(function (track) {
|
|
468
|
-
var trackInMap = allActions.get(track.type);
|
|
469
|
-
|
|
470
|
-
if (!trackInMap) {
|
|
471
|
-
var viewMenuActions = (0, _clone.default)(track.viewMenuActions);
|
|
472
|
-
|
|
473
|
-
_this2.rewriteOnClicks(track.type, viewMenuActions);
|
|
474
|
-
|
|
475
|
-
allActions.set(track.type, viewMenuActions);
|
|
476
|
-
}
|
|
477
|
-
});
|
|
478
|
-
return allActions;
|
|
479
|
-
},
|
|
480
|
-
|
|
481
|
-
get centerLineInfo() {
|
|
482
|
-
return self.displayedRegions.length ? this.pxToBp(self.width / 2) : undefined;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
};
|
|
486
|
-
}).actions(function (self) {
|
|
487
|
-
return {
|
|
488
|
-
setShowCytobands: function setShowCytobands(flag) {
|
|
489
|
-
self.showCytobandsSetting = flag;
|
|
490
|
-
localStorage.setItem('lgv-showCytobands', "".concat(+flag));
|
|
491
|
-
},
|
|
492
|
-
setWidth: function setWidth(newWidth) {
|
|
493
|
-
self.volatileWidth = newWidth;
|
|
494
|
-
},
|
|
495
|
-
setError: function setError(error) {
|
|
496
|
-
self.volatileError = error;
|
|
497
|
-
},
|
|
498
|
-
toggleHeader: function toggleHeader() {
|
|
499
|
-
self.hideHeader = !self.hideHeader;
|
|
500
|
-
},
|
|
501
|
-
toggleHeaderOverview: function toggleHeaderOverview() {
|
|
502
|
-
self.hideHeaderOverview = !self.hideHeaderOverview;
|
|
503
|
-
},
|
|
504
|
-
toggleNoTracksActive: function toggleNoTracksActive() {
|
|
505
|
-
self.hideNoTracksActive = !self.hideNoTracksActive;
|
|
506
|
-
},
|
|
507
|
-
scrollTo: function scrollTo(offsetPx) {
|
|
508
|
-
var newOffsetPx = (0, _util.clamp)(offsetPx, self.minOffset, self.maxOffset);
|
|
509
|
-
self.offsetPx = newOffsetPx;
|
|
510
|
-
return newOffsetPx;
|
|
511
|
-
},
|
|
512
|
-
zoomTo: function zoomTo(bpPerPx) {
|
|
513
|
-
var newBpPerPx = (0, _util.clamp)(bpPerPx, self.minBpPerPx, self.maxBpPerPx);
|
|
514
|
-
|
|
515
|
-
if (newBpPerPx === self.bpPerPx) {
|
|
516
|
-
return newBpPerPx;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
var oldBpPerPx = self.bpPerPx;
|
|
520
|
-
self.bpPerPx = newBpPerPx;
|
|
521
|
-
|
|
522
|
-
if (Math.abs(oldBpPerPx - newBpPerPx) < 0.000001) {
|
|
523
|
-
console.warn('zoomTo bpPerPx rounding error');
|
|
524
|
-
return oldBpPerPx;
|
|
525
|
-
} // tweak the offset so that the center of the view remains at the same coordinate
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
var viewWidth = self.width;
|
|
529
|
-
this.scrollTo(Math.round((self.offsetPx + viewWidth / 2) * oldBpPerPx / newBpPerPx - viewWidth / 2));
|
|
530
|
-
return newBpPerPx;
|
|
531
|
-
},
|
|
532
|
-
setOffsets: function setOffsets(left, right) {
|
|
533
|
-
// sets offsets used in the get sequence dialog
|
|
534
|
-
self.leftOffset = left;
|
|
535
|
-
self.rightOffset = right;
|
|
536
|
-
},
|
|
537
|
-
setSearchResults: function setSearchResults(results, query) {
|
|
538
|
-
self.searchResults = results;
|
|
539
|
-
self.searchQuery = query;
|
|
540
|
-
},
|
|
541
|
-
setSequenceDialogOpen: function setSequenceDialogOpen(open) {
|
|
542
|
-
self.seqDialogDisplayed = open;
|
|
543
|
-
},
|
|
544
|
-
setNewView: function setNewView(bpPerPx, offsetPx) {
|
|
545
|
-
this.zoomTo(bpPerPx);
|
|
546
|
-
this.scrollTo(offsetPx);
|
|
547
|
-
},
|
|
548
|
-
horizontallyFlip: function horizontallyFlip() {
|
|
549
|
-
self.displayedRegions = (0, _mobxStateTree.cast)(self.displayedRegions.slice().reverse().map(function (region) {
|
|
550
|
-
return _objectSpread(_objectSpread({}, region), {}, {
|
|
551
|
-
reversed: !region.reversed
|
|
552
|
-
});
|
|
553
|
-
}));
|
|
554
|
-
this.scrollTo(self.totalBp / self.bpPerPx - self.offsetPx - self.width);
|
|
555
|
-
},
|
|
556
|
-
showTrack: function showTrack(trackId) {
|
|
557
|
-
var initialSnapshot = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
558
|
-
var displayInitialSnapshot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
559
|
-
var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
|
|
560
|
-
var configuration = (0, _mobxStateTree.resolveIdentifier)(trackConfigSchema, (0, _mobxStateTree.getRoot)(self), trackId);
|
|
561
|
-
|
|
562
|
-
if (!configuration) {
|
|
563
|
-
throw new Error("Could not resolve identifier \"".concat(trackId, "\""));
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
var trackType = pluginManager.getTrackType(configuration === null || configuration === void 0 ? void 0 : configuration.type);
|
|
567
|
-
|
|
568
|
-
if (!trackType) {
|
|
569
|
-
throw new Error("Unknown track type ".concat(configuration.type));
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
var viewType = pluginManager.getViewType(self.type);
|
|
573
|
-
var supportedDisplays = viewType.displayTypes.map(function (displayType) {
|
|
574
|
-
return displayType.name;
|
|
575
|
-
});
|
|
576
|
-
var displayConf = configuration.displays.find(function (d) {
|
|
577
|
-
return supportedDisplays.includes(d.type);
|
|
578
|
-
});
|
|
579
|
-
|
|
580
|
-
if (!displayConf) {
|
|
581
|
-
throw new Error("Could not find a compatible display for view type ".concat(self.type));
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
var shownTracks = self.tracks.filter(function (t) {
|
|
585
|
-
return t.configuration === configuration;
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
if (shownTracks.length === 0) {
|
|
589
|
-
var track = trackType.stateModel.create(_objectSpread(_objectSpread({}, initialSnapshot), {}, {
|
|
590
|
-
type: configuration.type,
|
|
591
|
-
configuration: configuration,
|
|
592
|
-
displays: [_objectSpread({
|
|
593
|
-
type: displayConf.type,
|
|
594
|
-
configuration: displayConf
|
|
595
|
-
}, displayInitialSnapshot)]
|
|
596
|
-
}));
|
|
597
|
-
self.tracks.push(track);
|
|
598
|
-
return track;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
return shownTracks[0];
|
|
602
|
-
},
|
|
603
|
-
hideTrack: function hideTrack(trackId) {
|
|
604
|
-
var trackConfigSchema = pluginManager.pluggableConfigSchemaType('track');
|
|
605
|
-
var configuration = (0, _mobxStateTree.resolveIdentifier)(trackConfigSchema, (0, _mobxStateTree.getRoot)(self), trackId); // if we have any tracks with that configuration, turn them off
|
|
606
|
-
|
|
607
|
-
var shownTracks = self.tracks.filter(function (t) {
|
|
608
|
-
return t.configuration === configuration;
|
|
609
|
-
});
|
|
610
|
-
(0, _mobx.transaction)(function () {
|
|
611
|
-
return shownTracks.forEach(function (t) {
|
|
612
|
-
return self.tracks.remove(t);
|
|
613
|
-
});
|
|
614
|
-
});
|
|
615
|
-
return shownTracks.length;
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
}).actions(function (self) {
|
|
619
|
-
return {
|
|
620
|
-
moveTrack: function moveTrack(movingTrackId, targetTrackId) {
|
|
621
|
-
var oldIndex = self.tracks.findIndex(function (track) {
|
|
622
|
-
return track.id === movingTrackId;
|
|
623
|
-
});
|
|
624
|
-
|
|
625
|
-
if (oldIndex === -1) {
|
|
626
|
-
throw new Error("Track ID ".concat(movingTrackId, " not found"));
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
var newIndex = self.tracks.findIndex(function (track) {
|
|
630
|
-
return track.id === targetTrackId;
|
|
631
|
-
});
|
|
632
|
-
|
|
633
|
-
if (newIndex === -1) {
|
|
634
|
-
throw new Error("Track ID ".concat(targetTrackId, " not found"));
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
var track = (0, _mobxStateTree.getSnapshot)(self.tracks[oldIndex]);
|
|
638
|
-
self.tracks.splice(oldIndex, 1);
|
|
639
|
-
self.tracks.splice(newIndex, 0, track);
|
|
640
|
-
},
|
|
641
|
-
closeView: function closeView() {
|
|
642
|
-
var parent = (0, _util.getContainingView)(self);
|
|
643
|
-
|
|
644
|
-
if (parent) {
|
|
645
|
-
// I am embedded in a some other view
|
|
646
|
-
if ((0, _util.isViewContainer)(parent)) {
|
|
647
|
-
parent.removeView(self);
|
|
648
|
-
}
|
|
649
|
-
} else {
|
|
650
|
-
// I am part of a session
|
|
651
|
-
(0, _util.getSession)(self).removeView(self);
|
|
652
|
-
}
|
|
653
|
-
},
|
|
654
|
-
toggleTrack: function toggleTrack(trackId) {
|
|
655
|
-
// if we have any tracks with that configuration, turn them off
|
|
656
|
-
var hiddenCount = self.hideTrack(trackId); // if none had that configuration, turn one on
|
|
657
|
-
|
|
658
|
-
if (!hiddenCount) {
|
|
659
|
-
self.showTrack(trackId);
|
|
660
|
-
}
|
|
661
|
-
},
|
|
662
|
-
setTrackLabels: function setTrackLabels(setting) {
|
|
663
|
-
self.trackLabels = setting;
|
|
664
|
-
localStorage.setItem('lgv-trackLabels', setting);
|
|
665
|
-
},
|
|
666
|
-
toggleCenterLine: function toggleCenterLine() {
|
|
667
|
-
self.showCenterLine = !self.showCenterLine;
|
|
668
|
-
localStorage.setItem('lgv-showCenterLine', "".concat(+self.showCenterLine));
|
|
669
|
-
},
|
|
670
|
-
setDisplayedRegions: function setDisplayedRegions(regions) {
|
|
671
|
-
self.displayedRegions = (0, _mobxStateTree.cast)(regions);
|
|
672
|
-
self.zoomTo(self.bpPerPx);
|
|
673
|
-
},
|
|
674
|
-
activateTrackSelector: function activateTrackSelector() {
|
|
675
|
-
if (self.trackSelectorType === 'hierarchical') {
|
|
676
|
-
var session = (0, _util.getSession)(self);
|
|
677
|
-
|
|
678
|
-
if ((0, _util.isSessionModelWithWidgets)(session)) {
|
|
679
|
-
var selector = session.addWidget('HierarchicalTrackSelectorWidget', 'hierarchicalTrackSelector', {
|
|
680
|
-
view: self
|
|
681
320
|
});
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
var _getSession3 = (0, _util.getSession)(self),
|
|
695
|
-
assemblyManager = _getSession3.assemblyManager;
|
|
696
|
-
|
|
697
|
-
var isValidRefName = assemblyManager.isValidRefName;
|
|
698
|
-
var assemblyName = optAssemblyName || assemblyNames[0];
|
|
699
|
-
var parsedLocStrings;
|
|
700
|
-
var inputs = locString.split(/(\s+)/).map(function (f) {
|
|
701
|
-
return f.trim();
|
|
702
|
-
}).filter(function (f) {
|
|
703
|
-
return !!f;
|
|
704
|
-
}); // first try interpreting as a whitespace-separated sequence of
|
|
705
|
-
// multiple locstrings
|
|
706
|
-
|
|
707
|
-
try {
|
|
708
|
-
parsedLocStrings = inputs.map(function (l) {
|
|
709
|
-
return (0, _util.parseLocString)(l, function (ref) {
|
|
710
|
-
return isValidRefName(ref, assemblyName);
|
|
321
|
+
},
|
|
322
|
+
get trackTypeActions() {
|
|
323
|
+
var _this = this;
|
|
324
|
+
var allActions = new Map();
|
|
325
|
+
self.tracks.forEach(function (track) {
|
|
326
|
+
var trackInMap = allActions.get(track.type);
|
|
327
|
+
if (!trackInMap) {
|
|
328
|
+
var viewMenuActions = (0, clone_1.default)(track.viewMenuActions);
|
|
329
|
+
_this.rewriteOnClicks(track.type, viewMenuActions);
|
|
330
|
+
allActions.set(track.type, viewMenuActions);
|
|
331
|
+
}
|
|
711
332
|
});
|
|
712
|
-
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
if (!canonicalRefName) {
|
|
748
|
-
throw new Error("Could not find refName ".concat(refName, " in ").concat(asm.name));
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
var parentRegion = regions.find(function (region) {
|
|
752
|
-
return region.refName === canonicalRefName;
|
|
753
|
-
});
|
|
754
|
-
|
|
755
|
-
if (!parentRegion) {
|
|
756
|
-
throw new Error("Could not find refName ".concat(refName, " in ").concat(asmName));
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
return _objectSpread(_objectSpread({}, region), {}, {
|
|
760
|
-
assemblyName: asmName,
|
|
761
|
-
parentRegion: parentRegion
|
|
762
|
-
});
|
|
763
|
-
});
|
|
764
|
-
|
|
765
|
-
if (locations.length === 1) {
|
|
766
|
-
var loc = locations[0];
|
|
767
|
-
this.setDisplayedRegions([_objectSpread({
|
|
768
|
-
reversed: loc.reversed
|
|
769
|
-
}, loc.parentRegion)]);
|
|
770
|
-
var _start = loc.start,
|
|
771
|
-
_end = loc.end,
|
|
772
|
-
parentRegion = loc.parentRegion;
|
|
773
|
-
this.navTo(_objectSpread(_objectSpread({}, loc), {}, {
|
|
774
|
-
start: (0, _util.clamp)(_start !== null && _start !== void 0 ? _start : 0, 0, parentRegion.end),
|
|
775
|
-
end: (0, _util.clamp)(_end !== null && _end !== void 0 ? _end : parentRegion.end, 0, parentRegion.end)
|
|
776
|
-
}));
|
|
777
|
-
} else {
|
|
778
|
-
this.setDisplayedRegions( // @ts-ignore
|
|
779
|
-
locations.map(function (r) {
|
|
780
|
-
return r.start === undefined ? r.parentRegion : r;
|
|
781
|
-
}));
|
|
782
|
-
this.showAllRegions();
|
|
783
|
-
}
|
|
784
|
-
},
|
|
785
|
-
|
|
786
|
-
/**
|
|
787
|
-
* Navigate to a location based on its refName and optionally start, end,
|
|
788
|
-
* and assemblyName. Can handle if there are multiple displayedRegions
|
|
789
|
-
* from same refName. Only navigates to a location if it is entirely
|
|
790
|
-
* within a displayedRegion. Navigates to the first matching location
|
|
791
|
-
* encountered.
|
|
792
|
-
*
|
|
793
|
-
* Throws an error if navigation was unsuccessful
|
|
794
|
-
*
|
|
795
|
-
* @param location - a proposed location to navigate to
|
|
796
|
-
*/
|
|
797
|
-
navTo: function navTo(query) {
|
|
798
|
-
this.navToMultiple([query]);
|
|
799
|
-
},
|
|
800
|
-
navToMultiple: function navToMultiple(locations) {
|
|
801
|
-
var firstLocation = locations[0];
|
|
802
|
-
var refName = firstLocation.refName;
|
|
803
|
-
var start = firstLocation.start,
|
|
804
|
-
end = firstLocation.end,
|
|
805
|
-
_firstLocation$assemb = firstLocation.assemblyName,
|
|
806
|
-
assemblyName = _firstLocation$assemb === void 0 ? self.assemblyNames[0] : _firstLocation$assemb;
|
|
807
|
-
|
|
808
|
-
if (start !== undefined && end !== undefined && start > end) {
|
|
809
|
-
throw new Error("start \"".concat(start + 1, "\" is greater than end \"").concat(end, "\""));
|
|
810
|
-
}
|
|
811
|
-
|
|
812
|
-
var session = (0, _util.getSession)(self);
|
|
813
|
-
var assemblyManager = session.assemblyManager;
|
|
814
|
-
var assembly = assemblyManager.get(assemblyName);
|
|
815
|
-
|
|
816
|
-
if (assembly) {
|
|
817
|
-
var canonicalRefName = assembly.getCanonicalRefName(refName);
|
|
818
|
-
|
|
819
|
-
if (canonicalRefName) {
|
|
820
|
-
refName = canonicalRefName;
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
var s = start;
|
|
825
|
-
var e = end;
|
|
826
|
-
var refNameMatched = false;
|
|
827
|
-
|
|
828
|
-
var predicate = function predicate(r) {
|
|
829
|
-
if (refName === r.refName) {
|
|
830
|
-
refNameMatched = true;
|
|
831
|
-
|
|
832
|
-
if (s === undefined) {
|
|
833
|
-
s = r.start;
|
|
333
|
+
return allActions;
|
|
334
|
+
},
|
|
335
|
+
}); })
|
|
336
|
+
.actions(function (self) { return ({
|
|
337
|
+
setShowCytobands: function (flag) {
|
|
338
|
+
self.showCytobandsSetting = flag;
|
|
339
|
+
localStorage.setItem('lgv-showCytobands', "".concat(+flag));
|
|
340
|
+
},
|
|
341
|
+
setWidth: function (newWidth) {
|
|
342
|
+
self.volatileWidth = newWidth;
|
|
343
|
+
},
|
|
344
|
+
setError: function (error) {
|
|
345
|
+
self.volatileError = error;
|
|
346
|
+
},
|
|
347
|
+
toggleHeader: function () {
|
|
348
|
+
self.hideHeader = !self.hideHeader;
|
|
349
|
+
},
|
|
350
|
+
toggleHeaderOverview: function () {
|
|
351
|
+
self.hideHeaderOverview = !self.hideHeaderOverview;
|
|
352
|
+
},
|
|
353
|
+
toggleNoTracksActive: function () {
|
|
354
|
+
self.hideNoTracksActive = !self.hideNoTracksActive;
|
|
355
|
+
},
|
|
356
|
+
toggleShowGridlines: function () {
|
|
357
|
+
self.showGridlines = !self.showGridlines;
|
|
358
|
+
},
|
|
359
|
+
scrollTo: function (offsetPx) {
|
|
360
|
+
var newOffsetPx = (0, util_1.clamp)(offsetPx, self.minOffset, self.maxOffset);
|
|
361
|
+
self.offsetPx = newOffsetPx;
|
|
362
|
+
return newOffsetPx;
|
|
363
|
+
},
|
|
364
|
+
zoomTo: function (bpPerPx) {
|
|
365
|
+
var newBpPerPx = (0, util_1.clamp)(bpPerPx, self.minBpPerPx, self.maxBpPerPx);
|
|
366
|
+
if (newBpPerPx === self.bpPerPx) {
|
|
367
|
+
return newBpPerPx;
|
|
834
368
|
}
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
369
|
+
var oldBpPerPx = self.bpPerPx;
|
|
370
|
+
self.bpPerPx = newBpPerPx;
|
|
371
|
+
if (Math.abs(oldBpPerPx - newBpPerPx) < 0.000001) {
|
|
372
|
+
console.warn('zoomTo bpPerPx rounding error');
|
|
373
|
+
return oldBpPerPx;
|
|
838
374
|
}
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
375
|
+
// tweak the offset so that the center of the view remains at the same coordinate
|
|
376
|
+
var viewWidth = self.width;
|
|
377
|
+
this.scrollTo(Math.round(((self.offsetPx + viewWidth / 2) * oldBpPerPx) / newBpPerPx -
|
|
378
|
+
viewWidth / 2));
|
|
379
|
+
return newBpPerPx;
|
|
380
|
+
},
|
|
381
|
+
setOffsets: function (left, right) {
|
|
382
|
+
// sets offsets used in the get sequence dialog
|
|
383
|
+
self.leftOffset = left;
|
|
384
|
+
self.rightOffset = right;
|
|
385
|
+
},
|
|
386
|
+
setSearchResults: function (results, query) {
|
|
387
|
+
self.searchResults = results;
|
|
388
|
+
self.searchQuery = query;
|
|
389
|
+
},
|
|
390
|
+
setSequenceDialogOpen: function (open) {
|
|
391
|
+
self.seqDialogDisplayed = open;
|
|
392
|
+
},
|
|
393
|
+
setNewView: function (bpPerPx, offsetPx) {
|
|
394
|
+
this.zoomTo(bpPerPx);
|
|
395
|
+
this.scrollTo(offsetPx);
|
|
396
|
+
},
|
|
397
|
+
horizontallyFlip: function () {
|
|
398
|
+
self.displayedRegions = (0, mobx_state_tree_1.cast)(self.displayedRegions
|
|
399
|
+
.slice()
|
|
400
|
+
.reverse()
|
|
401
|
+
.map(function (region) { return (__assign(__assign({}, region), { reversed: !region.reversed })); }));
|
|
402
|
+
this.scrollTo(self.totalBp / self.bpPerPx - self.offsetPx - self.width);
|
|
403
|
+
},
|
|
404
|
+
showTrack: function (trackId, initialSnapshot, displayInitialSnapshot) {
|
|
405
|
+
if (initialSnapshot === void 0) { initialSnapshot = {}; }
|
|
406
|
+
if (displayInitialSnapshot === void 0) { displayInitialSnapshot = {}; }
|
|
407
|
+
var schema = pluginManager.pluggableConfigSchemaType('track');
|
|
408
|
+
var conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
409
|
+
if (!conf) {
|
|
410
|
+
throw new Error("Could not resolve identifier \"".concat(trackId, "\""));
|
|
842
411
|
}
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
return false;
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
var lastIndex = (0, _util.findLastIndex)(self.displayedRegions, predicate);
|
|
852
|
-
var index;
|
|
853
|
-
|
|
854
|
-
while (index !== lastIndex) {
|
|
855
|
-
try {
|
|
856
|
-
var previousIndex = index;
|
|
857
|
-
index = self.displayedRegions.slice(previousIndex === undefined ? 0 : previousIndex + 1).findIndex(predicate);
|
|
858
|
-
|
|
859
|
-
if (previousIndex !== undefined) {
|
|
860
|
-
index += previousIndex + 1;
|
|
412
|
+
var trackType = pluginManager.getTrackType(conf === null || conf === void 0 ? void 0 : conf.type);
|
|
413
|
+
if (!trackType) {
|
|
414
|
+
throw new Error("Unknown track type ".concat(conf.type));
|
|
861
415
|
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
416
|
+
var viewType = pluginManager.getViewType(self.type);
|
|
417
|
+
var supportedDisplays = viewType.displayTypes.map(function (d) { return d.name; });
|
|
418
|
+
var displayConf = conf.displays.find(function (d) {
|
|
419
|
+
return supportedDisplays.includes(d.type);
|
|
420
|
+
});
|
|
421
|
+
if (!displayConf) {
|
|
422
|
+
throw new Error("Could not find a compatible display for view type ".concat(self.type));
|
|
865
423
|
}
|
|
866
|
-
|
|
867
|
-
if (
|
|
868
|
-
|
|
424
|
+
var t = self.tracks.filter(function (t) { return t.configuration === conf; });
|
|
425
|
+
if (t.length === 0) {
|
|
426
|
+
var track = trackType.stateModel.create(__assign(__assign({}, initialSnapshot), { type: conf.type, configuration: conf, displays: [
|
|
427
|
+
__assign({ type: displayConf.type, configuration: displayConf }, displayInitialSnapshot),
|
|
428
|
+
] }));
|
|
429
|
+
self.tracks.push(track);
|
|
430
|
+
return track;
|
|
869
431
|
}
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
432
|
+
return t[0];
|
|
433
|
+
},
|
|
434
|
+
hideTrack: function (trackId) {
|
|
435
|
+
var schema = pluginManager.pluggableConfigSchemaType('track');
|
|
436
|
+
var conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
437
|
+
var t = self.tracks.filter(function (t) { return t.configuration === conf; });
|
|
438
|
+
(0, mobx_1.transaction)(function () { return t.forEach(function (t) { return self.tracks.remove(t); }); });
|
|
439
|
+
return t.length;
|
|
440
|
+
},
|
|
441
|
+
}); })
|
|
442
|
+
.actions(function (self) { return ({
|
|
443
|
+
moveTrack: function (movingId, targetId) {
|
|
444
|
+
var oldIndex = self.tracks.findIndex(function (track) { return track.id === movingId; });
|
|
445
|
+
if (oldIndex === -1) {
|
|
446
|
+
throw new Error("Track ID ".concat(movingId, " not found"));
|
|
873
447
|
}
|
|
874
|
-
|
|
875
|
-
if (
|
|
876
|
-
|
|
448
|
+
var newIndex = self.tracks.findIndex(function (track) { return track.id === targetId; });
|
|
449
|
+
if (newIndex === -1) {
|
|
450
|
+
throw new Error("Track ID ".concat(targetId, " not found"));
|
|
877
451
|
}
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
452
|
+
var track = (0, mobx_state_tree_1.getSnapshot)(self.tracks[oldIndex]);
|
|
453
|
+
self.tracks.splice(oldIndex, 1);
|
|
454
|
+
self.tracks.splice(newIndex, 0, track);
|
|
455
|
+
},
|
|
456
|
+
closeView: function () {
|
|
457
|
+
var parent = (0, util_1.getContainingView)(self);
|
|
458
|
+
if (parent) {
|
|
459
|
+
// I am embedded in a some other view
|
|
460
|
+
if ((0, util_1.isViewContainer)(parent)) {
|
|
461
|
+
parent.removeView(self);
|
|
462
|
+
}
|
|
889
463
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
var locationEnd = 0;
|
|
894
|
-
|
|
895
|
-
for (locationIndex; locationIndex < locations.length; locationIndex++) {
|
|
896
|
-
var location = locations[locationIndex];
|
|
897
|
-
var region = self.displayedRegions[index + locationIndex];
|
|
898
|
-
locationStart = location.start || region.start;
|
|
899
|
-
locationEnd = location.end || region.end;
|
|
900
|
-
|
|
901
|
-
if (location.refName !== region.refName) {
|
|
902
|
-
throw new Error("Entered location ".concat((0, _util.assembleLocString)(location), " does not match with displayed regions"));
|
|
903
|
-
}
|
|
464
|
+
else {
|
|
465
|
+
// I am part of a session
|
|
466
|
+
(0, util_1.getSession)(self).removeView(self);
|
|
904
467
|
}
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
var
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
}, {
|
|
913
|
-
index: index + locationIndex,
|
|
914
|
-
offset: endDisplayedRegion.reversed ? endDisplayedRegion.end - locationStart : locationEnd - endDisplayedRegion.start
|
|
915
|
-
});
|
|
916
|
-
return;
|
|
917
|
-
} catch (error) {
|
|
918
|
-
if (index === lastIndex) {
|
|
919
|
-
throw error;
|
|
468
|
+
},
|
|
469
|
+
toggleTrack: function (trackId) {
|
|
470
|
+
// if we have any tracks with that configuration, turn them off
|
|
471
|
+
var hiddenCount = self.hideTrack(trackId);
|
|
472
|
+
// if none had that configuration, turn one on
|
|
473
|
+
if (!hiddenCount) {
|
|
474
|
+
self.showTrack(trackId);
|
|
920
475
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
;
|
|
943
|
-
var _ref2 = [rightPx, leftPx];
|
|
944
|
-
leftPx = _ref2[0];
|
|
945
|
-
rightPx = _ref2[1];
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
var startOffset = {
|
|
949
|
-
start: leftPx.start,
|
|
950
|
-
end: leftPx.end,
|
|
951
|
-
index: leftPx.index,
|
|
952
|
-
offset: leftPx.offset
|
|
953
|
-
};
|
|
954
|
-
var endOffset = {
|
|
955
|
-
start: rightPx.start,
|
|
956
|
-
end: rightPx.end,
|
|
957
|
-
index: rightPx.index,
|
|
958
|
-
offset: rightPx.offset
|
|
959
|
-
};
|
|
960
|
-
|
|
961
|
-
if (startOffset && endOffset) {
|
|
962
|
-
this.moveTo(startOffset, endOffset);
|
|
963
|
-
} else {
|
|
964
|
-
var session = (0, _util.getSession)(self);
|
|
965
|
-
session.notify('No regions found to navigate to', 'warning');
|
|
966
|
-
}
|
|
967
|
-
},
|
|
968
|
-
|
|
969
|
-
/**
|
|
970
|
-
* Helper method for the fetchSequence.
|
|
971
|
-
* Retrieves the corresponding regions that were selected by the rubberband
|
|
972
|
-
*
|
|
973
|
-
* @param leftOffset - `object as {start, end, index, offset}`, offset = start of user drag
|
|
974
|
-
* @param rightOffset - `object as {start, end, index, offset}`, offset = end of user drag
|
|
975
|
-
* @returns array of Region[]
|
|
976
|
-
*/
|
|
977
|
-
getSelectedRegions: function getSelectedRegions(leftOffset, rightOffset) {
|
|
978
|
-
var simView = _Base1DViewModel.default.create(_objectSpread(_objectSpread({}, (0, _mobxStateTree.getSnapshot)(self)), {}, {
|
|
979
|
-
interRegionPaddingWidth: self.interRegionPaddingWidth
|
|
980
|
-
}));
|
|
981
|
-
|
|
982
|
-
simView.setVolatileWidth(self.width);
|
|
983
|
-
simView.zoomToDisplayedRegions(leftOffset, rightOffset);
|
|
984
|
-
return simView.dynamicBlocks.contentBlocks.map(function (region) {
|
|
985
|
-
return _objectSpread(_objectSpread({}, region), {}, {
|
|
986
|
-
start: Math.floor(region.start),
|
|
987
|
-
end: Math.ceil(region.end)
|
|
988
|
-
});
|
|
989
|
-
});
|
|
990
|
-
},
|
|
991
|
-
// schedule something to be run after the next time displayedRegions is set
|
|
992
|
-
afterDisplayedRegionsSet: function afterDisplayedRegionsSet(cb) {
|
|
993
|
-
self.afterDisplayedRegionsSetCallbacks.push(cb);
|
|
994
|
-
},
|
|
995
|
-
|
|
996
|
-
/**
|
|
997
|
-
* offset is the base-pair-offset in the displayed region, index is the index of the
|
|
998
|
-
* displayed region in the linear genome view
|
|
999
|
-
*
|
|
1000
|
-
* @param start - object as `{start, end, offset, index}`
|
|
1001
|
-
* @param end - object as `{start, end, offset, index}`
|
|
1002
|
-
*/
|
|
1003
|
-
moveTo: function moveTo(start, end) {
|
|
1004
|
-
// find locations in the modellist
|
|
1005
|
-
var bpSoFar = 0;
|
|
1006
|
-
|
|
1007
|
-
if (start.index === end.index) {
|
|
1008
|
-
bpSoFar += end.offset - start.offset;
|
|
1009
|
-
} else {
|
|
1010
|
-
var s = self.displayedRegions[start.index];
|
|
1011
|
-
bpSoFar += s.end - s.start - start.offset;
|
|
1012
|
-
|
|
1013
|
-
if (end.index - start.index >= 2) {
|
|
1014
|
-
for (var i = start.index + 1; i < end.index; i += 1) {
|
|
1015
|
-
bpSoFar += self.displayedRegions[i].end - self.displayedRegions[i].start;
|
|
476
|
+
},
|
|
477
|
+
setTrackLabels: function (setting) {
|
|
478
|
+
self.trackLabels = setting;
|
|
479
|
+
localStorage.setItem('lgv-trackLabels', setting);
|
|
480
|
+
},
|
|
481
|
+
toggleCenterLine: function () {
|
|
482
|
+
self.showCenterLine = !self.showCenterLine;
|
|
483
|
+
localStorage.setItem('lgv-showCenterLine', "".concat(+self.showCenterLine));
|
|
484
|
+
},
|
|
485
|
+
setDisplayedRegions: function (regions) {
|
|
486
|
+
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
487
|
+
self.zoomTo(self.bpPerPx);
|
|
488
|
+
},
|
|
489
|
+
activateTrackSelector: function () {
|
|
490
|
+
if (self.trackSelectorType === 'hierarchical') {
|
|
491
|
+
var session = (0, util_1.getSession)(self);
|
|
492
|
+
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
493
|
+
var selector = session.addWidget('HierarchicalTrackSelectorWidget', 'hierarchicalTrackSelector', { view: self });
|
|
494
|
+
session.showWidget(selector);
|
|
495
|
+
return selector;
|
|
496
|
+
}
|
|
1016
497
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
var newOffsetPx = self.scrollTo(self.offsetPx + distance);
|
|
1051
|
-
return newOffsetPx - oldOffsetPx;
|
|
1052
|
-
},
|
|
1053
|
-
|
|
1054
|
-
/**
|
|
1055
|
-
* scrolls the view to center on the given bp. if that is not in any
|
|
1056
|
-
* of the displayed regions, does nothing
|
|
1057
|
-
* @param bp - basepair at which you want to center the view
|
|
1058
|
-
* @param refName - refName of the displayedRegion you are centering at
|
|
1059
|
-
* @param regionIndex - index of the displayedRegion
|
|
1060
|
-
*/
|
|
1061
|
-
centerAt: function centerAt(bp, refName, regionIndex) {
|
|
1062
|
-
var centerPx = self.bpToPx({
|
|
1063
|
-
refName: refName,
|
|
1064
|
-
coord: bp,
|
|
1065
|
-
regionNumber: regionIndex
|
|
1066
|
-
});
|
|
1067
|
-
|
|
1068
|
-
if (centerPx) {
|
|
1069
|
-
self.scrollTo(Math.round(centerPx.offsetPx - self.width / 2));
|
|
1070
|
-
}
|
|
1071
|
-
},
|
|
1072
|
-
center: function center() {
|
|
1073
|
-
var centerBp = self.totalBp / 2;
|
|
1074
|
-
self.scrollTo(Math.round(centerBp / self.bpPerPx - self.width / 2));
|
|
1075
|
-
},
|
|
1076
|
-
showAllRegions: function showAllRegions() {
|
|
1077
|
-
self.zoomTo(self.maxBpPerPx);
|
|
1078
|
-
this.center();
|
|
1079
|
-
},
|
|
1080
|
-
showAllRegionsInAssembly: function showAllRegionsInAssembly(assemblyName) {
|
|
1081
|
-
var session = (0, _util.getSession)(self);
|
|
1082
|
-
var assemblyManager = session.assemblyManager;
|
|
1083
|
-
|
|
1084
|
-
if (!assemblyName) {
|
|
1085
|
-
var assemblyNames = (0, _toConsumableArray2.default)(new Set(self.displayedRegions.map(function (region) {
|
|
1086
|
-
return region.assemblyName;
|
|
1087
|
-
})));
|
|
1088
|
-
|
|
1089
|
-
if (assemblyNames.length > 1) {
|
|
1090
|
-
session.notify("Can't perform this with multiple assemblies currently");
|
|
1091
|
-
return;
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
;
|
|
1095
|
-
|
|
1096
|
-
var _assemblyNames = (0, _slicedToArray2.default)(assemblyNames, 1);
|
|
1097
|
-
|
|
1098
|
-
assemblyName = _assemblyNames[0];
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
var assembly = assemblyManager.get(assemblyName);
|
|
1102
|
-
|
|
1103
|
-
if (assembly) {
|
|
1104
|
-
var regions = assembly.regions;
|
|
1105
|
-
|
|
1106
|
-
if (regions) {
|
|
1107
|
-
this.setDisplayedRegions(regions);
|
|
498
|
+
throw new Error("invalid track selector type ".concat(self.trackSelectorType));
|
|
499
|
+
},
|
|
500
|
+
/**
|
|
501
|
+
* Helper method for the fetchSequence.
|
|
502
|
+
* Retrieves the corresponding regions that were selected by the rubberband
|
|
503
|
+
*
|
|
504
|
+
* @param leftOffset - `object as {start, end, index, offset}`, offset = start of user drag
|
|
505
|
+
* @param rightOffset - `object as {start, end, index, offset}`, offset = end of user drag
|
|
506
|
+
* @returns array of Region[]
|
|
507
|
+
*/
|
|
508
|
+
getSelectedRegions: function (leftOffset, rightOffset) {
|
|
509
|
+
var snap = (0, mobx_state_tree_1.getSnapshot)(self);
|
|
510
|
+
var simView = Base1DViewModel_1.default.create(__assign(__assign({}, snap), { interRegionPaddingWidth: self.interRegionPaddingWidth }));
|
|
511
|
+
simView.setVolatileWidth(self.width);
|
|
512
|
+
simView.moveTo(leftOffset, rightOffset);
|
|
513
|
+
return simView.dynamicBlocks.contentBlocks.map(function (region) { return (__assign(__assign({}, region), { start: Math.floor(region.start), end: Math.ceil(region.end) })); });
|
|
514
|
+
},
|
|
515
|
+
// schedule something to be run after the next time displayedRegions is set
|
|
516
|
+
afterDisplayedRegionsSet: function (cb) {
|
|
517
|
+
self.afterDisplayedRegionsSetCallbacks.push(cb);
|
|
518
|
+
},
|
|
519
|
+
horizontalScroll: function (distance) {
|
|
520
|
+
var oldOffsetPx = self.offsetPx;
|
|
521
|
+
// newOffsetPx is the actual offset after the scroll is clamped
|
|
522
|
+
var newOffsetPx = self.scrollTo(self.offsetPx + distance);
|
|
523
|
+
return newOffsetPx - oldOffsetPx;
|
|
524
|
+
},
|
|
525
|
+
center: function () {
|
|
526
|
+
var centerBp = self.totalBp / 2;
|
|
527
|
+
var centerPx = centerBp / self.bpPerPx;
|
|
528
|
+
self.scrollTo(Math.round(centerPx - self.width / 2));
|
|
529
|
+
},
|
|
530
|
+
showAllRegions: function () {
|
|
1108
531
|
self.zoomTo(self.maxBpPerPx);
|
|
1109
532
|
this.center();
|
|
1110
|
-
|
|
533
|
+
},
|
|
534
|
+
showAllRegionsInAssembly: function (assemblyName) {
|
|
535
|
+
var _a;
|
|
536
|
+
var session = (0, util_1.getSession)(self);
|
|
537
|
+
var assemblyManager = session.assemblyManager;
|
|
538
|
+
if (!assemblyName) {
|
|
539
|
+
var assemblyNames = __spreadArray([], __read(new Set(self.displayedRegions.map(function (region) { return region.assemblyName; }))), false);
|
|
540
|
+
if (assemblyNames.length > 1) {
|
|
541
|
+
session.notify("Can't perform this with multiple assemblies currently");
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
;
|
|
545
|
+
_a = __read(assemblyNames, 1), assemblyName = _a[0];
|
|
546
|
+
}
|
|
547
|
+
var assembly = assemblyManager.get(assemblyName);
|
|
548
|
+
if (assembly) {
|
|
549
|
+
var regions = assembly.regions;
|
|
550
|
+
if (regions) {
|
|
551
|
+
this.setDisplayedRegions(regions);
|
|
552
|
+
self.zoomTo(self.maxBpPerPx);
|
|
553
|
+
this.center();
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
},
|
|
557
|
+
setDraggingTrackId: function (idx) {
|
|
558
|
+
self.draggingTrackId = idx;
|
|
559
|
+
},
|
|
560
|
+
setScaleFactor: function (factor) {
|
|
561
|
+
self.scaleFactor = factor;
|
|
562
|
+
},
|
|
563
|
+
}); })
|
|
564
|
+
.actions(function (self) {
|
|
565
|
+
var cancelLastAnimation = function () { };
|
|
566
|
+
function slide(viewWidths) {
|
|
567
|
+
var _a = __read((0, util_1.springAnimate)(self.offsetPx, self.offsetPx + self.width * viewWidths, self.scrollTo), 2), animate = _a[0], cancelAnimation = _a[1];
|
|
568
|
+
cancelLastAnimation();
|
|
569
|
+
cancelLastAnimation = cancelAnimation;
|
|
570
|
+
animate();
|
|
1111
571
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
572
|
+
return { slide: slide };
|
|
573
|
+
})
|
|
574
|
+
.actions(function (self) {
|
|
575
|
+
var cancelLastAnimation = function () { };
|
|
576
|
+
function zoom(targetBpPerPx) {
|
|
577
|
+
self.zoomTo(self.bpPerPx);
|
|
578
|
+
if (
|
|
579
|
+
// already zoomed all the way in
|
|
580
|
+
(targetBpPerPx < self.bpPerPx && self.bpPerPx === self.minBpPerPx) ||
|
|
581
|
+
// already zoomed all the way out
|
|
582
|
+
(targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx)) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
var factor = self.bpPerPx / targetBpPerPx;
|
|
586
|
+
var _a = __read((0, util_1.springAnimate)(1, factor, self.setScaleFactor, function () {
|
|
587
|
+
self.zoomTo(targetBpPerPx);
|
|
588
|
+
self.setScaleFactor(1);
|
|
589
|
+
}), 2), animate = _a[0], cancelAnimation = _a[1];
|
|
590
|
+
cancelLastAnimation();
|
|
591
|
+
cancelLastAnimation = cancelAnimation;
|
|
592
|
+
animate();
|
|
593
|
+
}
|
|
594
|
+
return { zoom: zoom };
|
|
595
|
+
})
|
|
596
|
+
.views(function (self) { return ({
|
|
597
|
+
get canShowCytobands() {
|
|
598
|
+
return self.displayedRegions.length === 1 && this.anyCytobandsExist;
|
|
599
|
+
},
|
|
600
|
+
get showCytobands() {
|
|
601
|
+
return this.canShowCytobands && self.showCytobandsSetting;
|
|
602
|
+
},
|
|
603
|
+
get anyCytobandsExist() {
|
|
604
|
+
var assemblyManager = (0, util_1.getSession)(self).assemblyManager;
|
|
605
|
+
var assemblyNames = self.assemblyNames;
|
|
606
|
+
return assemblyNames.some(function (asm) { var _a, _b; return (_b = (_a = assemblyManager.get(asm)) === null || _a === void 0 ? void 0 : _a.cytobands) === null || _b === void 0 ? void 0 : _b.length; });
|
|
607
|
+
},
|
|
608
|
+
get cytobandOffset() {
|
|
609
|
+
return this.showCytobands
|
|
610
|
+
? (0, util_1.measureText)(self.displayedRegions[0].refName, 12) + 15
|
|
611
|
+
: 0;
|
|
612
|
+
},
|
|
613
|
+
}); })
|
|
614
|
+
.views(function (self) { return ({
|
|
615
|
+
menuItems: function () {
|
|
616
|
+
var e_1, _a;
|
|
617
|
+
var canShowCytobands = self.canShowCytobands, showCytobands = self.showCytobands;
|
|
618
|
+
var menuItems = __spreadArray([
|
|
619
|
+
{
|
|
620
|
+
label: 'Return to import form',
|
|
621
|
+
onClick: function () {
|
|
622
|
+
(0, util_1.getSession)(self).queueDialog(function (handleClose) { return [
|
|
623
|
+
ui_1.ReturnToImportFormDialog,
|
|
624
|
+
{ model: self, handleClose: handleClose },
|
|
625
|
+
]; });
|
|
626
|
+
},
|
|
627
|
+
icon: FolderOpen_1.default,
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
label: 'Export SVG',
|
|
631
|
+
icon: PhotoCamera_1.default,
|
|
632
|
+
onClick: function () {
|
|
633
|
+
(0, util_1.getSession)(self).queueDialog(function (handleClose) { return [
|
|
634
|
+
ExportSvgDialog_1.default,
|
|
635
|
+
{ model: self, handleClose: handleClose },
|
|
636
|
+
]; });
|
|
637
|
+
},
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
label: 'Open track selector',
|
|
641
|
+
onClick: self.activateTrackSelector,
|
|
642
|
+
icon: Icons_1.TrackSelector,
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
label: 'Horizontally flip',
|
|
646
|
+
icon: SyncAlt_1.default,
|
|
647
|
+
onClick: self.horizontallyFlip,
|
|
648
|
+
},
|
|
649
|
+
{ type: 'divider' },
|
|
650
|
+
{
|
|
651
|
+
label: 'Show all regions in assembly',
|
|
652
|
+
icon: Visibility_1.default,
|
|
653
|
+
onClick: self.showAllRegionsInAssembly,
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
label: 'Show center line',
|
|
657
|
+
icon: Visibility_1.default,
|
|
658
|
+
type: 'checkbox',
|
|
659
|
+
checked: self.showCenterLine,
|
|
660
|
+
onClick: self.toggleCenterLine,
|
|
661
|
+
},
|
|
662
|
+
{
|
|
663
|
+
label: 'Show header',
|
|
664
|
+
icon: Visibility_1.default,
|
|
665
|
+
type: 'checkbox',
|
|
666
|
+
checked: !self.hideHeader,
|
|
667
|
+
onClick: self.toggleHeader,
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
label: 'Show header overview',
|
|
671
|
+
icon: Visibility_1.default,
|
|
672
|
+
type: 'checkbox',
|
|
673
|
+
checked: !self.hideHeaderOverview,
|
|
674
|
+
onClick: self.toggleHeaderOverview,
|
|
675
|
+
disabled: self.hideHeader,
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
label: 'Show no tracks active button',
|
|
679
|
+
icon: Visibility_1.default,
|
|
680
|
+
type: 'checkbox',
|
|
681
|
+
checked: !self.hideNoTracksActive,
|
|
682
|
+
onClick: self.toggleNoTracksActive,
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
label: 'Show gridlines',
|
|
686
|
+
icon: Visibility_1.default,
|
|
687
|
+
type: 'checkbox',
|
|
688
|
+
checked: self.showGridlines,
|
|
689
|
+
onClick: self.toggleShowGridlines,
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
label: 'Track labels',
|
|
693
|
+
icon: Label_1.default,
|
|
694
|
+
subMenu: [
|
|
695
|
+
{
|
|
696
|
+
label: 'Overlapping',
|
|
697
|
+
icon: Visibility_1.default,
|
|
698
|
+
type: 'radio',
|
|
699
|
+
checked: self.trackLabels === 'overlapping',
|
|
700
|
+
onClick: function () { return self.setTrackLabels('overlapping'); },
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
label: 'Offset',
|
|
704
|
+
icon: Visibility_1.default,
|
|
705
|
+
type: 'radio',
|
|
706
|
+
checked: self.trackLabels === 'offset',
|
|
707
|
+
onClick: function () { return self.setTrackLabels('offset'); },
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
label: 'Hidden',
|
|
711
|
+
icon: Visibility_1.default,
|
|
712
|
+
type: 'radio',
|
|
713
|
+
checked: self.trackLabels === 'hidden',
|
|
714
|
+
onClick: function () { return self.setTrackLabels('hidden'); },
|
|
715
|
+
},
|
|
716
|
+
],
|
|
717
|
+
}
|
|
718
|
+
], __read((canShowCytobands
|
|
719
|
+
? [
|
|
720
|
+
{
|
|
721
|
+
label: showCytobands ? 'Hide ideogram' : 'Show ideograms',
|
|
722
|
+
onClick: function () {
|
|
723
|
+
self.setShowCytobands(!showCytobands);
|
|
724
|
+
},
|
|
725
|
+
},
|
|
726
|
+
]
|
|
727
|
+
: [])), false);
|
|
728
|
+
try {
|
|
729
|
+
// add track's view level menu options
|
|
730
|
+
for (var _b = __values(self.trackTypeActions.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
731
|
+
var _d = __read(_c.value, 2), key = _d[0], value = _d[1];
|
|
732
|
+
if (value.length) {
|
|
733
|
+
menuItems.push({ type: 'divider' }, { type: 'subHeader', label: key });
|
|
734
|
+
value.forEach(function (action) {
|
|
735
|
+
menuItems.push(action);
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
741
|
+
finally {
|
|
742
|
+
try {
|
|
743
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
744
|
+
}
|
|
745
|
+
finally { if (e_1) throw e_1.error; }
|
|
746
|
+
}
|
|
747
|
+
return menuItems;
|
|
748
|
+
},
|
|
749
|
+
}); })
|
|
750
|
+
.views(function (self) {
|
|
751
|
+
var currentlyCalculatedStaticBlocks;
|
|
752
|
+
var stringifiedCurrentlyCalculatedStaticBlocks = '';
|
|
753
|
+
return {
|
|
754
|
+
get staticBlocks() {
|
|
755
|
+
var ret = (0, calculateStaticBlocks_1.default)(self);
|
|
756
|
+
var sret = JSON.stringify(ret);
|
|
757
|
+
if (stringifiedCurrentlyCalculatedStaticBlocks !== sret) {
|
|
758
|
+
currentlyCalculatedStaticBlocks = ret;
|
|
759
|
+
stringifiedCurrentlyCalculatedStaticBlocks = sret;
|
|
760
|
+
}
|
|
761
|
+
return currentlyCalculatedStaticBlocks;
|
|
762
|
+
},
|
|
763
|
+
get dynamicBlocks() {
|
|
764
|
+
return (0, calculateDynamicBlocks_1.default)(self);
|
|
765
|
+
},
|
|
766
|
+
get roundedDynamicBlocks() {
|
|
767
|
+
return this.dynamicBlocks.contentBlocks.map(function (block) {
|
|
768
|
+
return __assign(__assign({}, block), { start: Math.floor(block.start), end: Math.ceil(block.end) });
|
|
769
|
+
});
|
|
770
|
+
},
|
|
771
|
+
get visibleLocStrings() {
|
|
772
|
+
return calculateVisibleLocStrings(this.dynamicBlocks.contentBlocks);
|
|
773
|
+
},
|
|
774
|
+
get coarseVisibleLocStrings() {
|
|
775
|
+
return calculateVisibleLocStrings(self.coarseDynamicBlocks);
|
|
776
|
+
},
|
|
777
|
+
};
|
|
778
|
+
})
|
|
779
|
+
.actions(function (self) { return ({
|
|
780
|
+
// this "clears the view" and makes the view return to the import form
|
|
781
|
+
clearView: function () {
|
|
782
|
+
self.setDisplayedRegions([]);
|
|
783
|
+
self.tracks.clear();
|
|
784
|
+
// it is necessary to run these after setting displayed regions empty
|
|
785
|
+
// or else model.offsetPx gets set to Infinity and breaks
|
|
786
|
+
// mobx-state-tree snapshot
|
|
787
|
+
self.scrollTo(0);
|
|
788
|
+
self.zoomTo(10);
|
|
789
|
+
},
|
|
790
|
+
setCoarseDynamicBlocks: function (blocks) {
|
|
791
|
+
self.coarseDynamicBlocks = blocks.contentBlocks;
|
|
792
|
+
self.coarseTotalBp = blocks.totalBp;
|
|
793
|
+
},
|
|
794
|
+
afterAttach: function () {
|
|
795
|
+
var _this = this;
|
|
796
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(function () {
|
|
797
|
+
if (self.initialized) {
|
|
798
|
+
_this.setCoarseDynamicBlocks(self.dynamicBlocks);
|
|
799
|
+
}
|
|
800
|
+
}, { delay: 150 }));
|
|
801
|
+
},
|
|
802
|
+
}); })
|
|
803
|
+
.actions(function (self) { return ({
|
|
804
|
+
exportSvg: function (opts) {
|
|
805
|
+
if (opts === void 0) { opts = {}; }
|
|
806
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
807
|
+
var html, blob;
|
|
808
|
+
return __generator(this, function (_a) {
|
|
809
|
+
switch (_a.label) {
|
|
810
|
+
case 0: return [4 /*yield*/, (0, LinearGenomeViewSvg_1.renderToSvg)(self, opts)];
|
|
811
|
+
case 1:
|
|
812
|
+
html = _a.sent();
|
|
813
|
+
blob = new Blob([html], { type: 'image/svg+xml' });
|
|
814
|
+
(0, file_saver_1.saveAs)(blob, opts.filename || 'image.svg');
|
|
815
|
+
return [2 /*return*/];
|
|
816
|
+
}
|
|
817
|
+
});
|
|
1207
818
|
});
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
819
|
+
},
|
|
820
|
+
/**
|
|
821
|
+
* offset is the base-pair-offset in the displayed region, index is the index of the
|
|
822
|
+
* displayed region in the linear genome view
|
|
823
|
+
*
|
|
824
|
+
* @param start - object as `{start, end, offset, index}`
|
|
825
|
+
* @param end - object as `{start, end, offset, index}`
|
|
826
|
+
*/
|
|
827
|
+
moveTo: function (start, end) {
|
|
828
|
+
(0, Base1DUtils_1.moveTo)(self, start, end);
|
|
829
|
+
},
|
|
830
|
+
navToLocString: function (locString, optAssemblyName) {
|
|
831
|
+
var assemblyNames = self.assemblyNames;
|
|
832
|
+
var assemblyManager = (0, util_1.getSession)(self).assemblyManager;
|
|
833
|
+
var isValidRefName = assemblyManager.isValidRefName;
|
|
834
|
+
var assemblyName = optAssemblyName || assemblyNames[0];
|
|
835
|
+
var parsedLocStrings;
|
|
836
|
+
var inputs = locString
|
|
837
|
+
.split(/(\s+)/)
|
|
838
|
+
.map(function (f) { return f.trim(); })
|
|
839
|
+
.filter(function (f) { return !!f; });
|
|
840
|
+
// first try interpreting as a whitespace-separated sequence of
|
|
841
|
+
// multiple locstrings
|
|
842
|
+
try {
|
|
843
|
+
parsedLocStrings = inputs.map(function (l) {
|
|
844
|
+
return (0, util_1.parseLocString)(l, function (ref) { return isValidRefName(ref, assemblyName); });
|
|
845
|
+
});
|
|
846
|
+
}
|
|
847
|
+
catch (e) {
|
|
848
|
+
// if this fails, try interpreting as a whitespace-separated refname,
|
|
849
|
+
// start, end if start and end are integer inputs
|
|
850
|
+
var _a = __read(inputs, 3), refName = _a[0], start = _a[1], end = _a[2];
|
|
851
|
+
if ("".concat(e).match(/Unknown reference sequence/) &&
|
|
852
|
+
Number.isInteger(+start) &&
|
|
853
|
+
Number.isInteger(+end)) {
|
|
854
|
+
parsedLocStrings = [
|
|
855
|
+
(0, util_1.parseLocString)(refName + ':' + start + '..' + end, function (ref) {
|
|
856
|
+
return isValidRefName(ref, assemblyName);
|
|
857
|
+
}),
|
|
858
|
+
];
|
|
859
|
+
}
|
|
860
|
+
else {
|
|
861
|
+
throw e;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
var locations = parsedLocStrings === null || parsedLocStrings === void 0 ? void 0 : parsedLocStrings.map(function (region) {
|
|
865
|
+
var asmName = region.assemblyName || assemblyName;
|
|
866
|
+
var asm = assemblyManager.get(asmName);
|
|
867
|
+
var refName = region.refName;
|
|
868
|
+
if (!asm) {
|
|
869
|
+
throw new Error("assembly ".concat(asmName, " not found"));
|
|
870
|
+
}
|
|
871
|
+
var regions = asm.regions;
|
|
872
|
+
if (!regions) {
|
|
873
|
+
throw new Error("regions not loaded yet for ".concat(asmName));
|
|
874
|
+
}
|
|
875
|
+
var canonicalRefName = asm.getCanonicalRefName(region.refName);
|
|
876
|
+
if (!canonicalRefName) {
|
|
877
|
+
throw new Error("Could not find refName ".concat(refName, " in ").concat(asm.name));
|
|
878
|
+
}
|
|
879
|
+
var parentRegion = regions.find(function (region) { return region.refName === canonicalRefName; });
|
|
880
|
+
if (!parentRegion) {
|
|
881
|
+
throw new Error("Could not find refName ".concat(refName, " in ").concat(asmName));
|
|
882
|
+
}
|
|
883
|
+
return __assign(__assign({}, region), { assemblyName: asmName, parentRegion: parentRegion });
|
|
1219
884
|
});
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
icon: _SyncAlt.default,
|
|
1228
|
-
onClick: self.horizontallyFlip
|
|
1229
|
-
}, {
|
|
1230
|
-
type: 'divider'
|
|
1231
|
-
}, {
|
|
1232
|
-
label: 'Show all regions in assembly',
|
|
1233
|
-
icon: _Visibility.default,
|
|
1234
|
-
onClick: self.showAllRegionsInAssembly
|
|
1235
|
-
}, {
|
|
1236
|
-
label: 'Show center line',
|
|
1237
|
-
icon: _Visibility.default,
|
|
1238
|
-
type: 'checkbox',
|
|
1239
|
-
checked: self.showCenterLine,
|
|
1240
|
-
onClick: self.toggleCenterLine
|
|
1241
|
-
}, {
|
|
1242
|
-
label: 'Show header',
|
|
1243
|
-
icon: _Visibility.default,
|
|
1244
|
-
type: 'checkbox',
|
|
1245
|
-
checked: !self.hideHeader,
|
|
1246
|
-
onClick: self.toggleHeader
|
|
1247
|
-
}, {
|
|
1248
|
-
label: 'Show header overview',
|
|
1249
|
-
icon: _Visibility.default,
|
|
1250
|
-
type: 'checkbox',
|
|
1251
|
-
checked: !self.hideHeaderOverview,
|
|
1252
|
-
onClick: self.toggleHeaderOverview,
|
|
1253
|
-
disabled: self.hideHeader
|
|
1254
|
-
}, {
|
|
1255
|
-
label: 'Show no tracks active button',
|
|
1256
|
-
icon: _Visibility.default,
|
|
1257
|
-
type: 'checkbox',
|
|
1258
|
-
checked: !self.hideNoTracksActive,
|
|
1259
|
-
onClick: self.toggleNoTracksActive
|
|
1260
|
-
}, {
|
|
1261
|
-
label: 'Track labels',
|
|
1262
|
-
icon: _Label.default,
|
|
1263
|
-
subMenu: [{
|
|
1264
|
-
label: 'Overlapping',
|
|
1265
|
-
icon: _Visibility.default,
|
|
1266
|
-
type: 'radio',
|
|
1267
|
-
checked: self.trackLabels === 'overlapping',
|
|
1268
|
-
onClick: function onClick() {
|
|
1269
|
-
return self.setTrackLabels('overlapping');
|
|
885
|
+
if (locations.length === 1) {
|
|
886
|
+
var loc = locations[0];
|
|
887
|
+
self.setDisplayedRegions([
|
|
888
|
+
__assign({ reversed: loc.reversed }, loc.parentRegion),
|
|
889
|
+
]);
|
|
890
|
+
var start = loc.start, end = loc.end, parentRegion = loc.parentRegion;
|
|
891
|
+
this.navTo(__assign(__assign({}, loc), { start: (0, util_1.clamp)(start !== null && start !== void 0 ? start : 0, 0, parentRegion.end), end: (0, util_1.clamp)(end !== null && end !== void 0 ? end : parentRegion.end, 0, parentRegion.end) }));
|
|
1270
892
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
onClick: function onClick() {
|
|
1277
|
-
return self.setTrackLabels('offset');
|
|
893
|
+
else {
|
|
894
|
+
self.setDisplayedRegions(
|
|
895
|
+
// @ts-ignore
|
|
896
|
+
locations.map(function (r) { return (r.start === undefined ? r.parentRegion : r); }));
|
|
897
|
+
self.showAllRegions();
|
|
1278
898
|
}
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
899
|
+
},
|
|
900
|
+
/**
|
|
901
|
+
* Navigate to a location based on its refName and optionally start, end,
|
|
902
|
+
* and assemblyName. Can handle if there are multiple displayedRegions
|
|
903
|
+
* from same refName. Only navigates to a location if it is entirely
|
|
904
|
+
* within a displayedRegion. Navigates to the first matching location
|
|
905
|
+
* encountered.
|
|
906
|
+
*
|
|
907
|
+
* Throws an error if navigation was unsuccessful
|
|
908
|
+
*
|
|
909
|
+
* @param location - a proposed location to navigate to
|
|
910
|
+
*/
|
|
911
|
+
navTo: function (query) {
|
|
912
|
+
this.navToMultiple([query]);
|
|
913
|
+
},
|
|
914
|
+
navToMultiple: function (locations) {
|
|
915
|
+
var firstLocation = locations[0];
|
|
916
|
+
var refName = firstLocation.refName;
|
|
917
|
+
var start = firstLocation.start, end = firstLocation.end, _a = firstLocation.assemblyName, assemblyName = _a === void 0 ? self.assemblyNames[0] : _a;
|
|
918
|
+
if (start !== undefined && end !== undefined && start > end) {
|
|
919
|
+
throw new Error("start \"".concat(start + 1, "\" is greater than end \"").concat(end, "\""));
|
|
1286
920
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
var _iterator = _createForOfIteratorHelper(self.trackTypeActions.entries()),
|
|
1296
|
-
_step;
|
|
1297
|
-
|
|
1298
|
-
try {
|
|
1299
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1300
|
-
var _step$value = (0, _slicedToArray2.default)(_step.value, 2),
|
|
1301
|
-
_key2 = _step$value[0],
|
|
1302
|
-
value = _step$value[1];
|
|
1303
|
-
|
|
1304
|
-
if (value.length) {
|
|
1305
|
-
menuItems.push({
|
|
1306
|
-
type: 'divider'
|
|
1307
|
-
}, {
|
|
1308
|
-
type: 'subHeader',
|
|
1309
|
-
label: _key2
|
|
1310
|
-
});
|
|
1311
|
-
value.forEach(function (action) {
|
|
1312
|
-
menuItems.push(action);
|
|
1313
|
-
});
|
|
921
|
+
var session = (0, util_1.getSession)(self);
|
|
922
|
+
var assemblyManager = session.assemblyManager;
|
|
923
|
+
var assembly = assemblyManager.get(assemblyName);
|
|
924
|
+
if (assembly) {
|
|
925
|
+
var canonicalRefName = assembly.getCanonicalRefName(refName);
|
|
926
|
+
if (canonicalRefName) {
|
|
927
|
+
refName = canonicalRefName;
|
|
928
|
+
}
|
|
1314
929
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
var opts, html, blob;
|
|
1397
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
1398
|
-
while (1) {
|
|
1399
|
-
switch (_context.prev = _context.next) {
|
|
1400
|
-
case 0:
|
|
1401
|
-
opts = _arguments.length > 0 && _arguments[0] !== undefined ? _arguments[0] : {};
|
|
1402
|
-
_context.next = 3;
|
|
1403
|
-
return (0, _LinearGenomeViewSvg.renderToSvg)(self, opts);
|
|
1404
|
-
|
|
1405
|
-
case 3:
|
|
1406
|
-
html = _context.sent;
|
|
1407
|
-
blob = new Blob([html], {
|
|
1408
|
-
type: 'image/svg+xml'
|
|
1409
|
-
});
|
|
1410
|
-
(0, _fileSaver.saveAs)(blob, opts.filename || 'image.svg');
|
|
1411
|
-
|
|
1412
|
-
case 6:
|
|
1413
|
-
case "end":
|
|
1414
|
-
return _context.stop();
|
|
1415
|
-
}
|
|
930
|
+
var s = start;
|
|
931
|
+
var e = end;
|
|
932
|
+
var refNameMatched = false;
|
|
933
|
+
var predicate = function (r) {
|
|
934
|
+
if (refName === r.refName) {
|
|
935
|
+
refNameMatched = true;
|
|
936
|
+
if (s === undefined) {
|
|
937
|
+
s = r.start;
|
|
938
|
+
}
|
|
939
|
+
if (e === undefined) {
|
|
940
|
+
e = r.end;
|
|
941
|
+
}
|
|
942
|
+
if (s >= r.start && s <= r.end && e <= r.end && e >= r.start) {
|
|
943
|
+
return true;
|
|
944
|
+
}
|
|
945
|
+
s = start;
|
|
946
|
+
e = end;
|
|
947
|
+
}
|
|
948
|
+
return false;
|
|
949
|
+
};
|
|
950
|
+
var lastIndex = (0, util_1.findLastIndex)(self.displayedRegions, predicate);
|
|
951
|
+
var index;
|
|
952
|
+
while (index !== lastIndex) {
|
|
953
|
+
try {
|
|
954
|
+
var previousIndex = index;
|
|
955
|
+
index = self.displayedRegions
|
|
956
|
+
.slice(previousIndex === undefined ? 0 : previousIndex + 1)
|
|
957
|
+
.findIndex(predicate);
|
|
958
|
+
if (previousIndex !== undefined) {
|
|
959
|
+
index += previousIndex + 1;
|
|
960
|
+
}
|
|
961
|
+
if (!refNameMatched) {
|
|
962
|
+
throw new Error("could not find a region with refName \"".concat(refName, "\""));
|
|
963
|
+
}
|
|
964
|
+
if (s === undefined) {
|
|
965
|
+
throw new Error("could not find a region with refName \"".concat(refName, "\" that contained an end position ").concat(e));
|
|
966
|
+
}
|
|
967
|
+
if (e === undefined) {
|
|
968
|
+
throw new Error("could not find a region with refName \"".concat(refName, "\" that contained a start position ").concat(s + 1));
|
|
969
|
+
}
|
|
970
|
+
if (index === -1) {
|
|
971
|
+
throw new Error("could not find a region that completely contained \"".concat((0, util_1.assembleLocString)(firstLocation), "\""));
|
|
972
|
+
}
|
|
973
|
+
if (locations.length === 1) {
|
|
974
|
+
var f = self.displayedRegions[index];
|
|
975
|
+
this.moveTo({ index: index, offset: f.reversed ? f.end - e : s - f.start }, { index: index, offset: f.reversed ? f.end - s : e - f.start });
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
var locationIndex = 0;
|
|
979
|
+
var locationStart = 0;
|
|
980
|
+
var locationEnd = 0;
|
|
981
|
+
for (locationIndex; locationIndex < locations.length; locationIndex++) {
|
|
982
|
+
var location_1 = locations[locationIndex];
|
|
983
|
+
var region = self.displayedRegions[index + locationIndex];
|
|
984
|
+
locationStart = location_1.start || region.start;
|
|
985
|
+
locationEnd = location_1.end || region.end;
|
|
986
|
+
if (location_1.refName !== region.refName) {
|
|
987
|
+
throw new Error("Entered location ".concat((0, util_1.assembleLocString)(location_1), " does not match with displayed regions"));
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
locationIndex -= 1;
|
|
991
|
+
var startDisplayedRegion = self.displayedRegions[index];
|
|
992
|
+
var endDisplayedRegion = self.displayedRegions[index + locationIndex];
|
|
993
|
+
this.moveTo({
|
|
994
|
+
index: index,
|
|
995
|
+
offset: startDisplayedRegion.reversed
|
|
996
|
+
? startDisplayedRegion.end - e
|
|
997
|
+
: s - startDisplayedRegion.start,
|
|
998
|
+
}, {
|
|
999
|
+
index: index + locationIndex,
|
|
1000
|
+
offset: endDisplayedRegion.reversed
|
|
1001
|
+
? endDisplayedRegion.end - locationStart
|
|
1002
|
+
: locationEnd - endDisplayedRegion.start,
|
|
1003
|
+
});
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
catch (error) {
|
|
1007
|
+
if (index === lastIndex) {
|
|
1008
|
+
throw error;
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1416
1011
|
}
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1012
|
+
},
|
|
1013
|
+
}); })
|
|
1014
|
+
.views(function (self) { return ({
|
|
1015
|
+
rubberBandMenuItems: function () {
|
|
1016
|
+
return [
|
|
1017
|
+
{
|
|
1018
|
+
label: 'Zoom to region',
|
|
1019
|
+
icon: ZoomIn_1.default,
|
|
1020
|
+
onClick: function () {
|
|
1021
|
+
var leftOffset = self.leftOffset, rightOffset = self.rightOffset;
|
|
1022
|
+
self.moveTo(leftOffset, rightOffset);
|
|
1023
|
+
},
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
label: 'Get sequence',
|
|
1027
|
+
icon: MenuOpen_1.default,
|
|
1028
|
+
onClick: function () {
|
|
1029
|
+
self.setSequenceDialogOpen(true);
|
|
1030
|
+
},
|
|
1031
|
+
},
|
|
1032
|
+
];
|
|
1033
|
+
},
|
|
1034
|
+
bpToPx: function (_a) {
|
|
1035
|
+
var refName = _a.refName, coord = _a.coord, regionNumber = _a.regionNumber;
|
|
1036
|
+
return (0, Base1DUtils_1.bpToPx)({ refName: refName, coord: coord, regionNumber: regionNumber, self: self });
|
|
1037
|
+
},
|
|
1038
|
+
/**
|
|
1039
|
+
* scrolls the view to center on the given bp. if that is not in any
|
|
1040
|
+
* of the displayed regions, does nothing
|
|
1041
|
+
* @param coord - basepair at which you want to center the view
|
|
1042
|
+
* @param refName - refName of the displayedRegion you are centering at
|
|
1043
|
+
* @param regionNumber - index of the displayedRegion
|
|
1044
|
+
*/
|
|
1045
|
+
centerAt: function (coord, refName, regionNumber) {
|
|
1046
|
+
var centerPx = this.bpToPx({
|
|
1047
|
+
refName: refName,
|
|
1048
|
+
coord: coord,
|
|
1049
|
+
regionNumber: regionNumber,
|
|
1050
|
+
});
|
|
1051
|
+
if (centerPx) {
|
|
1052
|
+
self.scrollTo(Math.round(centerPx.offsetPx - self.width / 2));
|
|
1433
1053
|
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
self.
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
};
|
|
1444
|
-
|
|
1445
|
-
|
|
1054
|
+
},
|
|
1055
|
+
pxToBp: function (px) {
|
|
1056
|
+
return (0, Base1DUtils_1.pxToBp)(self, px);
|
|
1057
|
+
},
|
|
1058
|
+
get centerLineInfo() {
|
|
1059
|
+
return self.displayedRegions.length
|
|
1060
|
+
? this.pxToBp(self.width / 2)
|
|
1061
|
+
: undefined;
|
|
1062
|
+
},
|
|
1063
|
+
}); });
|
|
1064
|
+
}
|
|
1065
|
+
exports.stateModelFactory = stateModelFactory;
|
|
1066
|
+
var LinearGenomeView_1 = require("./components/LinearGenomeView");
|
|
1067
|
+
Object.defineProperty(exports, "ReactComponent", { enumerable: true, get: function () { return __importDefault(LinearGenomeView_1).default; } });
|
|
1068
|
+
//# sourceMappingURL=index.js.map
|