@jbrowse/plugin-linear-genome-view 2.1.0 → 2.1.2
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 +27 -54
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -1
- package/dist/BaseLinearDisplay/components/Block.js +17 -28
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +19 -21
- package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -1
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +27 -48
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -1
- package/dist/BaseLinearDisplay/components/Tooltip.js +29 -58
- package/dist/BaseLinearDisplay/components/Tooltip.js.map +1 -1
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +242 -363
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -1
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +1 -1
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -1
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +77 -129
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -1
- package/dist/LinearBareDisplay/configSchema.js +2 -2
- package/dist/LinearBareDisplay/configSchema.js.map +1 -1
- package/dist/LinearBareDisplay/model.js +13 -19
- package/dist/LinearBareDisplay/model.js.map +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +14 -31
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -1
- package/dist/LinearBasicDisplay/configSchema.js +3 -3
- package/dist/LinearBasicDisplay/configSchema.js.map +1 -1
- package/dist/LinearBasicDisplay/model.js +119 -147
- package/dist/LinearBasicDisplay/model.js.map +1 -1
- package/dist/LinearGenomeView/components/CenterLine.js +11 -12
- package/dist/LinearGenomeView/components/CenterLine.js.map +1 -1
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +30 -96
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/GetSequenceDialog.d.ts +9 -0
- package/dist/LinearGenomeView/components/GetSequenceDialog.js +172 -0
- package/dist/LinearGenomeView/components/GetSequenceDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/Gridlines.js +18 -20
- package/dist/LinearGenomeView/components/Gridlines.js.map +1 -1
- package/dist/LinearGenomeView/components/Header.js +26 -31
- package/dist/LinearGenomeView/components/Header.js.map +1 -1
- package/dist/LinearGenomeView/components/HelpDialog.js +10 -11
- package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/ImportForm.js +91 -154
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeView.js +20 -21
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +86 -157
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -1
- package/dist/LinearGenomeView/components/MiniControls.js +16 -32
- package/dist/LinearGenomeView/components/MiniControls.js.map +1 -1
- package/dist/LinearGenomeView/components/OverviewRubberBand.d.ts +0 -11
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +44 -76
- package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +1 -1
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +94 -117
- package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +90 -172
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -1
- package/dist/LinearGenomeView/components/RubberBand.js +51 -71
- package/dist/LinearGenomeView/components/RubberBand.js.map +1 -1
- package/dist/LinearGenomeView/components/Ruler.js +17 -18
- package/dist/LinearGenomeView/components/Ruler.js.map +1 -1
- package/dist/LinearGenomeView/components/ScaleBar.js +37 -58
- package/dist/LinearGenomeView/components/ScaleBar.js.map +1 -1
- package/dist/LinearGenomeView/components/SearchBox.js +69 -133
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +32 -33
- package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -1
- package/dist/LinearGenomeView/components/{SequenceDialog.d.ts → SequenceSearchDialog.d.ts} +0 -0
- package/dist/LinearGenomeView/components/SequenceSearchDialog.js +104 -0
- package/dist/LinearGenomeView/components/SequenceSearchDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackContainer.js +28 -30
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/TrackLabel.js +37 -71
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +32 -49
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -1
- package/dist/LinearGenomeView/components/ZoomControls.js +15 -32
- package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -1
- package/dist/LinearGenomeView/components/util.js +14 -87
- package/dist/LinearGenomeView/components/util.js.map +1 -1
- package/dist/LinearGenomeView/index.d.ts +3 -3
- package/dist/LinearGenomeView/index.js +380 -430
- package/dist/LinearGenomeView/index.js.map +1 -1
- package/dist/LinearGenomeView/util.js +17 -36
- package/dist/LinearGenomeView/util.js.map +1 -1
- package/dist/index.js +75 -146
- package/dist/index.js.map +1 -1
- package/esm/LinearGenomeView/components/GetSequenceDialog.d.ts +9 -0
- package/esm/LinearGenomeView/components/{SequenceDialog.js → GetSequenceDialog.js} +4 -7
- package/esm/LinearGenomeView/components/GetSequenceDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/ImportForm.js +1 -0
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -1
- package/esm/LinearGenomeView/components/LinearGenomeView.js +2 -2
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -1
- package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +0 -11
- package/esm/LinearGenomeView/components/OverviewRubberBand.js +4 -12
- package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +1 -1
- package/esm/LinearGenomeView/components/OverviewScaleBar.js +0 -2
- package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +1 -1
- package/esm/LinearGenomeView/components/RubberBand.js +0 -1
- package/esm/LinearGenomeView/components/RubberBand.js.map +1 -1
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -1
- package/esm/LinearGenomeView/components/{SequenceDialog.d.ts → SequenceSearchDialog.d.ts} +0 -0
- package/esm/LinearGenomeView/components/SequenceSearchDialog.js +76 -0
- package/esm/LinearGenomeView/components/SequenceSearchDialog.js.map +1 -0
- package/esm/LinearGenomeView/index.d.ts +3 -3
- package/esm/LinearGenomeView/index.js +26 -19
- package/esm/LinearGenomeView/index.js.map +1 -1
- package/package.json +2 -3
- package/src/LinearGenomeView/components/{SequenceDialog.tsx → GetSequenceDialog.tsx} +4 -17
- package/src/LinearGenomeView/components/ImportForm.tsx +1 -0
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +3 -3
- package/src/LinearGenomeView/components/OverviewRubberBand.tsx +5 -15
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +0 -2
- package/src/LinearGenomeView/components/RubberBand.tsx +0 -1
- package/src/LinearGenomeView/components/SearchBox.tsx +1 -1
- package/src/LinearGenomeView/components/SequenceSearchDialog.tsx +165 -0
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +14 -14
- package/src/LinearGenomeView/index.tsx +32 -25
- package/dist/LinearGenomeView/components/SequenceDialog.js +0 -242
- package/dist/LinearGenomeView/components/SequenceDialog.js.map +0 -1
- package/esm/LinearGenomeView/components/SequenceDialog.js.map +0 -1
|
@@ -1,131 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
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);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
62
7
|
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
var
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (o && i >= o.length) o = void 0;
|
|
80
|
-
return { value: o && o[i++], done: !o };
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
84
24
|
};
|
|
85
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
86
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
87
27
|
};
|
|
88
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
89
29
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
30
|
+
const react_1 = require("react");
|
|
31
|
+
const configuration_1 = require("@jbrowse/core/configuration");
|
|
32
|
+
const models_1 = require("@jbrowse/core/pluggableElementTypes/models");
|
|
33
|
+
const mst_1 = require("@jbrowse/core/util/types/mst");
|
|
34
|
+
const ui_1 = require("@jbrowse/core/ui");
|
|
35
|
+
const util_1 = require("@jbrowse/core/util");
|
|
36
|
+
const calculateDynamicBlocks_1 = __importDefault(require("@jbrowse/core/util/calculateDynamicBlocks"));
|
|
37
|
+
const calculateStaticBlocks_1 = __importDefault(require("@jbrowse/core/util/calculateStaticBlocks"));
|
|
38
|
+
const tracks_1 = require("@jbrowse/core/util/tracks");
|
|
39
|
+
const mobx_1 = require("mobx");
|
|
40
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
41
|
+
const Base1DViewModel_1 = __importDefault(require("@jbrowse/core/util/Base1DViewModel"));
|
|
42
|
+
const Base1DUtils_1 = require("@jbrowse/core/util/Base1DUtils");
|
|
43
|
+
const file_saver_1 = require("file-saver");
|
|
44
|
+
const clone_1 = __importDefault(require("clone"));
|
|
104
45
|
// icons
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
46
|
+
const Icons_1 = require("@jbrowse/core/ui/Icons");
|
|
47
|
+
const SyncAlt_1 = __importDefault(require("@mui/icons-material/SyncAlt"));
|
|
48
|
+
const Visibility_1 = __importDefault(require("@mui/icons-material/Visibility"));
|
|
49
|
+
const Label_1 = __importDefault(require("@mui/icons-material/Label"));
|
|
50
|
+
const FolderOpen_1 = __importDefault(require("@mui/icons-material/FolderOpen"));
|
|
51
|
+
const PhotoCamera_1 = __importDefault(require("@mui/icons-material/PhotoCamera"));
|
|
52
|
+
const ZoomIn_1 = __importDefault(require("@mui/icons-material/ZoomIn"));
|
|
53
|
+
const MenuOpen_1 = __importDefault(require("@mui/icons-material/MenuOpen"));
|
|
113
54
|
// locals
|
|
114
|
-
|
|
55
|
+
const LinearGenomeViewSvg_1 = require("./components/LinearGenomeViewSvg");
|
|
115
56
|
Object.defineProperty(exports, "renderToSvg", { enumerable: true, get: function () { return LinearGenomeViewSvg_1.renderToSvg; } });
|
|
116
|
-
|
|
57
|
+
const RefNameAutocomplete_1 = __importDefault(require("./components/RefNameAutocomplete"));
|
|
117
58
|
exports.RefNameAutocomplete = RefNameAutocomplete_1.default;
|
|
118
|
-
|
|
59
|
+
const SearchBox_1 = __importDefault(require("./components/SearchBox"));
|
|
119
60
|
exports.SearchBox = SearchBox_1.default;
|
|
120
|
-
|
|
61
|
+
const ExportSvgDialog_1 = __importDefault(require("./components/ExportSvgDialog"));
|
|
62
|
+
const SequenceSearchDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./components/SequenceSearchDialog'))));
|
|
121
63
|
function calculateVisibleLocStrings(contentBlocks) {
|
|
122
64
|
if (!contentBlocks.length) {
|
|
123
65
|
return '';
|
|
124
66
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
67
|
+
const isSingleAssemblyName = contentBlocks.every(block => block.assemblyName === contentBlocks[0].assemblyName);
|
|
68
|
+
const locs = contentBlocks.map(block => (0, util_1.assembleLocString)({
|
|
69
|
+
...block,
|
|
70
|
+
start: Math.round(block.start),
|
|
71
|
+
end: Math.round(block.end),
|
|
72
|
+
assemblyName: isSingleAssemblyName ? undefined : block.assemblyName,
|
|
73
|
+
}));
|
|
129
74
|
return locs.join(' ');
|
|
130
75
|
}
|
|
131
76
|
exports.HEADER_BAR_HEIGHT = 48;
|
|
@@ -155,18 +100,18 @@ function stateModelFactory(pluginManager) {
|
|
|
155
100
|
hideHeaderOverview: false,
|
|
156
101
|
hideNoTracksActive: false,
|
|
157
102
|
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,
|
|
159
|
-
showCenterLine: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean,
|
|
160
|
-
|
|
103
|
+
trackLabels: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.string, () => localStorageGetItem('lgv-trackLabels') || 'overlapping'),
|
|
104
|
+
showCenterLine: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, () => {
|
|
105
|
+
const setting = localStorageGetItem('lgv-showCenterLine');
|
|
161
106
|
return setting !== undefined && setting !== null ? !!+setting : false;
|
|
162
107
|
}),
|
|
163
|
-
showCytobandsSetting: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean,
|
|
164
|
-
|
|
108
|
+
showCytobandsSetting: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.boolean, () => {
|
|
109
|
+
const setting = localStorageGetItem('lgv-showCytobands');
|
|
165
110
|
return setting !== undefined && setting !== null ? !!+setting : true;
|
|
166
111
|
}),
|
|
167
112
|
showGridlines: true,
|
|
168
113
|
}))
|
|
169
|
-
.volatile(
|
|
114
|
+
.volatile(() => ({
|
|
170
115
|
volatileWidth: undefined,
|
|
171
116
|
minimumBlockWidth: 3,
|
|
172
117
|
draggingTrackId: undefined,
|
|
@@ -184,8 +129,8 @@ function stateModelFactory(pluginManager) {
|
|
|
184
129
|
searchResults: undefined,
|
|
185
130
|
searchQuery: undefined,
|
|
186
131
|
seqDialogDisplayed: false,
|
|
187
|
-
})
|
|
188
|
-
.views(
|
|
132
|
+
}))
|
|
133
|
+
.views(self => ({
|
|
189
134
|
get width() {
|
|
190
135
|
if (self.volatileWidth === undefined) {
|
|
191
136
|
throw new Error('width undefined, make sure to check for model.initialized');
|
|
@@ -196,22 +141,24 @@ function stateModelFactory(pluginManager) {
|
|
|
196
141
|
return exports.INTER_REGION_PADDING_WIDTH;
|
|
197
142
|
},
|
|
198
143
|
get assemblyNames() {
|
|
199
|
-
return
|
|
144
|
+
return [
|
|
145
|
+
...new Set(self.displayedRegions.map(region => region.assemblyName)),
|
|
146
|
+
];
|
|
200
147
|
},
|
|
201
|
-
})
|
|
202
|
-
.views(
|
|
148
|
+
}))
|
|
149
|
+
.views(self => ({
|
|
203
150
|
get assemblyErrors() {
|
|
204
|
-
|
|
205
|
-
|
|
151
|
+
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
152
|
+
const { assemblyNames } = self;
|
|
206
153
|
return assemblyNames
|
|
207
|
-
.map(
|
|
208
|
-
.filter(
|
|
154
|
+
.map(a => { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.error; })
|
|
155
|
+
.filter(f => !!f)
|
|
209
156
|
.join(', ');
|
|
210
157
|
},
|
|
211
158
|
get assembliesInitialized() {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
return assemblyNames.every(
|
|
159
|
+
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
160
|
+
const { assemblyNames } = self;
|
|
161
|
+
return assemblyNames.every(a => { var _a; return (_a = assemblyManager.get(a)) === null || _a === void 0 ? void 0 : _a.initialized; });
|
|
215
162
|
},
|
|
216
163
|
get initialized() {
|
|
217
164
|
return self.volatileWidth !== undefined && this.assembliesInitialized;
|
|
@@ -236,8 +183,8 @@ function stateModelFactory(pluginManager) {
|
|
|
236
183
|
},
|
|
237
184
|
get trackHeights() {
|
|
238
185
|
return self.tracks
|
|
239
|
-
.map(
|
|
240
|
-
.reduce(
|
|
186
|
+
.map(t => t.displays[0].height)
|
|
187
|
+
.reduce((a, b) => a + b, 0);
|
|
241
188
|
},
|
|
242
189
|
get trackHeightsWithResizeHandles() {
|
|
243
190
|
return this.trackHeights + self.tracks.length * exports.RESIZE_HANDLE_HEIGHT;
|
|
@@ -248,7 +195,7 @@ function stateModelFactory(pluginManager) {
|
|
|
248
195
|
this.scaleBarHeight);
|
|
249
196
|
},
|
|
250
197
|
get totalBp() {
|
|
251
|
-
return self.displayedRegions.reduce(
|
|
198
|
+
return self.displayedRegions.reduce((a, b) => a + b.end - b.start, 0);
|
|
252
199
|
},
|
|
253
200
|
get maxBpPerPx() {
|
|
254
201
|
return this.totalBp / (self.width * 0.9);
|
|
@@ -261,34 +208,38 @@ function stateModelFactory(pluginManager) {
|
|
|
261
208
|
},
|
|
262
209
|
get maxOffset() {
|
|
263
210
|
// objectively determined to keep the linear genome on the main screen
|
|
264
|
-
|
|
211
|
+
const leftPadding = 10;
|
|
265
212
|
return this.displayedRegionsTotalPx - leftPadding;
|
|
266
213
|
},
|
|
267
214
|
get minOffset() {
|
|
268
215
|
// objectively determined to keep the linear genome on the main screen
|
|
269
|
-
|
|
216
|
+
const rightPadding = 30;
|
|
270
217
|
return -self.width + rightPadding;
|
|
271
218
|
},
|
|
272
219
|
get displayedRegionsTotalPx() {
|
|
273
220
|
return this.totalBp / self.bpPerPx;
|
|
274
221
|
},
|
|
275
|
-
renderProps
|
|
276
|
-
return
|
|
222
|
+
renderProps() {
|
|
223
|
+
return {
|
|
224
|
+
...(0, tracks_1.getParentRenderProps)(self),
|
|
225
|
+
bpPerPx: self.bpPerPx,
|
|
226
|
+
highResolutionScaling: (0, configuration_1.getConf)((0, util_1.getSession)(self), 'highResolutionScaling'),
|
|
227
|
+
};
|
|
277
228
|
},
|
|
278
|
-
searchScope
|
|
229
|
+
searchScope(assemblyName) {
|
|
279
230
|
return {
|
|
280
|
-
assemblyName
|
|
231
|
+
assemblyName,
|
|
281
232
|
includeAggregateIndexes: true,
|
|
282
233
|
tracks: self.tracks,
|
|
283
234
|
};
|
|
284
235
|
},
|
|
285
|
-
getTrack
|
|
286
|
-
return self.tracks.find(
|
|
236
|
+
getTrack(id) {
|
|
237
|
+
return self.tracks.find(t => t.configuration.trackId === id);
|
|
287
238
|
},
|
|
288
|
-
rankSearchResults
|
|
239
|
+
rankSearchResults(results) {
|
|
289
240
|
// order of rank
|
|
290
|
-
|
|
291
|
-
results.forEach(
|
|
241
|
+
const openTrackIds = self.tracks.map(track => track.configuration.trackId);
|
|
242
|
+
results.forEach(result => {
|
|
292
243
|
if (openTrackIds.includes(result.trackId)) {
|
|
293
244
|
result.updateScore(result.getScore() + 1);
|
|
294
245
|
}
|
|
@@ -296,23 +247,18 @@ function stateModelFactory(pluginManager) {
|
|
|
296
247
|
return results;
|
|
297
248
|
},
|
|
298
249
|
// modifies view menu action onClick to apply to all tracks of same type
|
|
299
|
-
rewriteOnClicks
|
|
300
|
-
|
|
301
|
-
viewMenuActions.forEach(function (action) {
|
|
250
|
+
rewriteOnClicks(trackType, viewMenuActions) {
|
|
251
|
+
viewMenuActions.forEach(action => {
|
|
302
252
|
// go to lowest level menu
|
|
303
253
|
if ('subMenu' in action) {
|
|
304
|
-
|
|
254
|
+
this.rewriteOnClicks(trackType, action.subMenu);
|
|
305
255
|
}
|
|
306
256
|
if ('onClick' in action) {
|
|
307
|
-
|
|
308
|
-
action.onClick =
|
|
309
|
-
|
|
310
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
311
|
-
args[_i] = arguments[_i];
|
|
312
|
-
}
|
|
313
|
-
self.tracks.forEach(function (track) {
|
|
257
|
+
const holdOnClick = action.onClick;
|
|
258
|
+
action.onClick = (...args) => {
|
|
259
|
+
self.tracks.forEach(track => {
|
|
314
260
|
if (track.type === trackType) {
|
|
315
|
-
|
|
261
|
+
holdOnClick.apply(track, [track, ...args]);
|
|
316
262
|
}
|
|
317
263
|
});
|
|
318
264
|
};
|
|
@@ -320,141 +266,145 @@ function stateModelFactory(pluginManager) {
|
|
|
320
266
|
});
|
|
321
267
|
},
|
|
322
268
|
get trackTypeActions() {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
var trackInMap = allActions.get(track.type);
|
|
269
|
+
const allActions = new Map();
|
|
270
|
+
self.tracks.forEach(track => {
|
|
271
|
+
const trackInMap = allActions.get(track.type);
|
|
327
272
|
if (!trackInMap) {
|
|
328
|
-
|
|
329
|
-
|
|
273
|
+
const viewMenuActions = (0, clone_1.default)(track.viewMenuActions);
|
|
274
|
+
this.rewriteOnClicks(track.type, viewMenuActions);
|
|
330
275
|
allActions.set(track.type, viewMenuActions);
|
|
331
276
|
}
|
|
332
277
|
});
|
|
333
278
|
return allActions;
|
|
334
279
|
},
|
|
335
|
-
})
|
|
336
|
-
.actions(
|
|
337
|
-
setShowCytobands
|
|
280
|
+
}))
|
|
281
|
+
.actions(self => ({
|
|
282
|
+
setShowCytobands(flag) {
|
|
338
283
|
self.showCytobandsSetting = flag;
|
|
339
|
-
localStorage.setItem('lgv-showCytobands',
|
|
284
|
+
localStorage.setItem('lgv-showCytobands', `${+flag}`);
|
|
340
285
|
},
|
|
341
|
-
setWidth
|
|
286
|
+
setWidth(newWidth) {
|
|
342
287
|
self.volatileWidth = newWidth;
|
|
343
288
|
},
|
|
344
|
-
setError
|
|
289
|
+
setError(error) {
|
|
345
290
|
self.volatileError = error;
|
|
346
291
|
},
|
|
347
|
-
toggleHeader
|
|
292
|
+
toggleHeader() {
|
|
348
293
|
self.hideHeader = !self.hideHeader;
|
|
349
294
|
},
|
|
350
|
-
toggleHeaderOverview
|
|
295
|
+
toggleHeaderOverview() {
|
|
351
296
|
self.hideHeaderOverview = !self.hideHeaderOverview;
|
|
352
297
|
},
|
|
353
|
-
toggleNoTracksActive
|
|
298
|
+
toggleNoTracksActive() {
|
|
354
299
|
self.hideNoTracksActive = !self.hideNoTracksActive;
|
|
355
300
|
},
|
|
356
|
-
toggleShowGridlines
|
|
301
|
+
toggleShowGridlines() {
|
|
357
302
|
self.showGridlines = !self.showGridlines;
|
|
358
303
|
},
|
|
359
|
-
scrollTo
|
|
360
|
-
|
|
304
|
+
scrollTo(offsetPx) {
|
|
305
|
+
const newOffsetPx = (0, util_1.clamp)(offsetPx, self.minOffset, self.maxOffset);
|
|
361
306
|
self.offsetPx = newOffsetPx;
|
|
362
307
|
return newOffsetPx;
|
|
363
308
|
},
|
|
364
|
-
zoomTo
|
|
365
|
-
|
|
309
|
+
zoomTo(bpPerPx) {
|
|
310
|
+
const newBpPerPx = (0, util_1.clamp)(bpPerPx, self.minBpPerPx, self.maxBpPerPx);
|
|
366
311
|
if (newBpPerPx === self.bpPerPx) {
|
|
367
312
|
return newBpPerPx;
|
|
368
313
|
}
|
|
369
|
-
|
|
314
|
+
const oldBpPerPx = self.bpPerPx;
|
|
370
315
|
self.bpPerPx = newBpPerPx;
|
|
371
316
|
if (Math.abs(oldBpPerPx - newBpPerPx) < 0.000001) {
|
|
372
317
|
console.warn('zoomTo bpPerPx rounding error');
|
|
373
318
|
return oldBpPerPx;
|
|
374
319
|
}
|
|
375
320
|
// tweak the offset so that the center of the view remains at the same coordinate
|
|
376
|
-
|
|
321
|
+
const viewWidth = self.width;
|
|
377
322
|
this.scrollTo(Math.round(((self.offsetPx + viewWidth / 2) * oldBpPerPx) / newBpPerPx -
|
|
378
323
|
viewWidth / 2));
|
|
379
324
|
return newBpPerPx;
|
|
380
325
|
},
|
|
381
|
-
setOffsets
|
|
326
|
+
setOffsets(left, right) {
|
|
382
327
|
// sets offsets used in the get sequence dialog
|
|
383
328
|
self.leftOffset = left;
|
|
384
329
|
self.rightOffset = right;
|
|
385
330
|
},
|
|
386
|
-
setSearchResults
|
|
331
|
+
setSearchResults(results, query) {
|
|
387
332
|
self.searchResults = results;
|
|
388
333
|
self.searchQuery = query;
|
|
389
334
|
},
|
|
390
|
-
|
|
335
|
+
setGetSequenceDialogOpen(open) {
|
|
391
336
|
self.seqDialogDisplayed = open;
|
|
392
337
|
},
|
|
393
|
-
setNewView
|
|
338
|
+
setNewView(bpPerPx, offsetPx) {
|
|
394
339
|
this.zoomTo(bpPerPx);
|
|
395
340
|
this.scrollTo(offsetPx);
|
|
396
341
|
},
|
|
397
|
-
horizontallyFlip
|
|
342
|
+
horizontallyFlip() {
|
|
398
343
|
self.displayedRegions = (0, mobx_state_tree_1.cast)(self.displayedRegions
|
|
399
344
|
.slice()
|
|
400
345
|
.reverse()
|
|
401
|
-
.map(
|
|
346
|
+
.map(region => ({ ...region, reversed: !region.reversed })));
|
|
402
347
|
this.scrollTo(self.totalBp / self.bpPerPx - self.offsetPx - self.width);
|
|
403
348
|
},
|
|
404
|
-
showTrack
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
var schema = pluginManager.pluggableConfigSchemaType('track');
|
|
408
|
-
var conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
349
|
+
showTrack(trackId, initialSnapshot = {}, displayInitialSnapshot = {}) {
|
|
350
|
+
const schema = pluginManager.pluggableConfigSchemaType('track');
|
|
351
|
+
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
409
352
|
if (!conf) {
|
|
410
|
-
throw new Error(
|
|
353
|
+
throw new Error(`Could not resolve identifier "${trackId}"`);
|
|
411
354
|
}
|
|
412
|
-
|
|
355
|
+
const trackType = pluginManager.getTrackType(conf === null || conf === void 0 ? void 0 : conf.type);
|
|
413
356
|
if (!trackType) {
|
|
414
|
-
throw new Error(
|
|
357
|
+
throw new Error(`Unknown track type ${conf.type}`);
|
|
415
358
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return supportedDisplays.includes(d.type);
|
|
420
|
-
});
|
|
359
|
+
const viewType = pluginManager.getViewType(self.type);
|
|
360
|
+
const supportedDisplays = viewType.displayTypes.map(d => d.name);
|
|
361
|
+
const displayConf = conf.displays.find((d) => supportedDisplays.includes(d.type));
|
|
421
362
|
if (!displayConf) {
|
|
422
|
-
throw new Error(
|
|
363
|
+
throw new Error(`Could not find a compatible display for view type ${self.type}`);
|
|
423
364
|
}
|
|
424
|
-
|
|
365
|
+
const t = self.tracks.filter(t => t.configuration === conf);
|
|
425
366
|
if (t.length === 0) {
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
367
|
+
const track = trackType.stateModel.create({
|
|
368
|
+
...initialSnapshot,
|
|
369
|
+
type: conf.type,
|
|
370
|
+
configuration: conf,
|
|
371
|
+
displays: [
|
|
372
|
+
{
|
|
373
|
+
type: displayConf.type,
|
|
374
|
+
configuration: displayConf,
|
|
375
|
+
...displayInitialSnapshot,
|
|
376
|
+
},
|
|
377
|
+
],
|
|
378
|
+
});
|
|
429
379
|
self.tracks.push(track);
|
|
430
380
|
return track;
|
|
431
381
|
}
|
|
432
382
|
return t[0];
|
|
433
383
|
},
|
|
434
|
-
hideTrack
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
(0, mobx_1.transaction)(
|
|
384
|
+
hideTrack(trackId) {
|
|
385
|
+
const schema = pluginManager.pluggableConfigSchemaType('track');
|
|
386
|
+
const conf = (0, mobx_state_tree_1.resolveIdentifier)(schema, (0, mobx_state_tree_1.getRoot)(self), trackId);
|
|
387
|
+
const t = self.tracks.filter(t => t.configuration === conf);
|
|
388
|
+
(0, mobx_1.transaction)(() => t.forEach(t => self.tracks.remove(t)));
|
|
439
389
|
return t.length;
|
|
440
390
|
},
|
|
441
|
-
})
|
|
442
|
-
.actions(
|
|
443
|
-
moveTrack
|
|
444
|
-
|
|
391
|
+
}))
|
|
392
|
+
.actions(self => ({
|
|
393
|
+
moveTrack(movingId, targetId) {
|
|
394
|
+
const oldIndex = self.tracks.findIndex(track => track.id === movingId);
|
|
445
395
|
if (oldIndex === -1) {
|
|
446
|
-
throw new Error(
|
|
396
|
+
throw new Error(`Track ID ${movingId} not found`);
|
|
447
397
|
}
|
|
448
|
-
|
|
398
|
+
const newIndex = self.tracks.findIndex(track => track.id === targetId);
|
|
449
399
|
if (newIndex === -1) {
|
|
450
|
-
throw new Error(
|
|
400
|
+
throw new Error(`Track ID ${targetId} not found`);
|
|
451
401
|
}
|
|
452
|
-
|
|
402
|
+
const track = (0, mobx_state_tree_1.getSnapshot)(self.tracks[oldIndex]);
|
|
453
403
|
self.tracks.splice(oldIndex, 1);
|
|
454
404
|
self.tracks.splice(newIndex, 0, track);
|
|
455
405
|
},
|
|
456
|
-
closeView
|
|
457
|
-
|
|
406
|
+
closeView() {
|
|
407
|
+
const parent = (0, util_1.getContainingView)(self);
|
|
458
408
|
if (parent) {
|
|
459
409
|
// I am embedded in a some other view
|
|
460
410
|
if ((0, util_1.isViewContainer)(parent)) {
|
|
@@ -466,36 +416,36 @@ function stateModelFactory(pluginManager) {
|
|
|
466
416
|
(0, util_1.getSession)(self).removeView(self);
|
|
467
417
|
}
|
|
468
418
|
},
|
|
469
|
-
toggleTrack
|
|
419
|
+
toggleTrack(trackId) {
|
|
470
420
|
// if we have any tracks with that configuration, turn them off
|
|
471
|
-
|
|
421
|
+
const hiddenCount = self.hideTrack(trackId);
|
|
472
422
|
// if none had that configuration, turn one on
|
|
473
423
|
if (!hiddenCount) {
|
|
474
424
|
self.showTrack(trackId);
|
|
475
425
|
}
|
|
476
426
|
},
|
|
477
|
-
setTrackLabels
|
|
427
|
+
setTrackLabels(setting) {
|
|
478
428
|
self.trackLabels = setting;
|
|
479
429
|
localStorage.setItem('lgv-trackLabels', setting);
|
|
480
430
|
},
|
|
481
|
-
toggleCenterLine
|
|
431
|
+
toggleCenterLine() {
|
|
482
432
|
self.showCenterLine = !self.showCenterLine;
|
|
483
|
-
localStorage.setItem('lgv-showCenterLine',
|
|
433
|
+
localStorage.setItem('lgv-showCenterLine', `${+self.showCenterLine}`);
|
|
484
434
|
},
|
|
485
|
-
setDisplayedRegions
|
|
435
|
+
setDisplayedRegions(regions) {
|
|
486
436
|
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
487
437
|
self.zoomTo(self.bpPerPx);
|
|
488
438
|
},
|
|
489
|
-
activateTrackSelector
|
|
439
|
+
activateTrackSelector() {
|
|
490
440
|
if (self.trackSelectorType === 'hierarchical') {
|
|
491
|
-
|
|
441
|
+
const session = (0, util_1.getSession)(self);
|
|
492
442
|
if ((0, util_1.isSessionModelWithWidgets)(session)) {
|
|
493
|
-
|
|
443
|
+
const selector = session.addWidget('HierarchicalTrackSelectorWidget', 'hierarchicalTrackSelector', { view: self });
|
|
494
444
|
session.showWidget(selector);
|
|
495
445
|
return selector;
|
|
496
446
|
}
|
|
497
447
|
}
|
|
498
|
-
throw new Error(
|
|
448
|
+
throw new Error(`invalid track selector type ${self.trackSelectorType}`);
|
|
499
449
|
},
|
|
500
450
|
/**
|
|
501
451
|
* Helper method for the fetchSequence.
|
|
@@ -505,48 +455,56 @@ function stateModelFactory(pluginManager) {
|
|
|
505
455
|
* @param rightOffset - `object as {start, end, index, offset}`, offset = end of user drag
|
|
506
456
|
* @returns array of Region[]
|
|
507
457
|
*/
|
|
508
|
-
getSelectedRegions
|
|
509
|
-
|
|
510
|
-
|
|
458
|
+
getSelectedRegions(leftOffset, rightOffset) {
|
|
459
|
+
const snap = (0, mobx_state_tree_1.getSnapshot)(self);
|
|
460
|
+
const simView = Base1DViewModel_1.default.create({
|
|
461
|
+
...snap,
|
|
462
|
+
interRegionPaddingWidth: self.interRegionPaddingWidth,
|
|
463
|
+
});
|
|
511
464
|
simView.setVolatileWidth(self.width);
|
|
512
465
|
simView.moveTo(leftOffset, rightOffset);
|
|
513
|
-
return simView.dynamicBlocks.contentBlocks.map(
|
|
466
|
+
return simView.dynamicBlocks.contentBlocks.map(region => ({
|
|
467
|
+
...region,
|
|
468
|
+
start: Math.floor(region.start),
|
|
469
|
+
end: Math.ceil(region.end),
|
|
470
|
+
}));
|
|
514
471
|
},
|
|
515
472
|
// schedule something to be run after the next time displayedRegions is set
|
|
516
|
-
afterDisplayedRegionsSet
|
|
473
|
+
afterDisplayedRegionsSet(cb) {
|
|
517
474
|
self.afterDisplayedRegionsSetCallbacks.push(cb);
|
|
518
475
|
},
|
|
519
|
-
horizontalScroll
|
|
520
|
-
|
|
476
|
+
horizontalScroll(distance) {
|
|
477
|
+
const oldOffsetPx = self.offsetPx;
|
|
521
478
|
// newOffsetPx is the actual offset after the scroll is clamped
|
|
522
|
-
|
|
479
|
+
const newOffsetPx = self.scrollTo(self.offsetPx + distance);
|
|
523
480
|
return newOffsetPx - oldOffsetPx;
|
|
524
481
|
},
|
|
525
|
-
center
|
|
526
|
-
|
|
527
|
-
|
|
482
|
+
center() {
|
|
483
|
+
const centerBp = self.totalBp / 2;
|
|
484
|
+
const centerPx = centerBp / self.bpPerPx;
|
|
528
485
|
self.scrollTo(Math.round(centerPx - self.width / 2));
|
|
529
486
|
},
|
|
530
|
-
showAllRegions
|
|
487
|
+
showAllRegions() {
|
|
531
488
|
self.zoomTo(self.maxBpPerPx);
|
|
532
489
|
this.center();
|
|
533
490
|
},
|
|
534
|
-
showAllRegionsInAssembly
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
var assemblyManager = session.assemblyManager;
|
|
491
|
+
showAllRegionsInAssembly(assemblyName) {
|
|
492
|
+
const session = (0, util_1.getSession)(self);
|
|
493
|
+
const { assemblyManager } = session;
|
|
538
494
|
if (!assemblyName) {
|
|
539
|
-
|
|
495
|
+
const assemblyNames = [
|
|
496
|
+
...new Set(self.displayedRegions.map(region => region.assemblyName)),
|
|
497
|
+
];
|
|
540
498
|
if (assemblyNames.length > 1) {
|
|
541
|
-
session.notify(
|
|
499
|
+
session.notify(`Can't perform this with multiple assemblies currently`);
|
|
542
500
|
return;
|
|
543
501
|
}
|
|
544
502
|
;
|
|
545
|
-
|
|
503
|
+
[assemblyName] = assemblyNames;
|
|
546
504
|
}
|
|
547
|
-
|
|
505
|
+
const assembly = assemblyManager.get(assemblyName);
|
|
548
506
|
if (assembly) {
|
|
549
|
-
|
|
507
|
+
const { regions } = assembly;
|
|
550
508
|
if (regions) {
|
|
551
509
|
this.setDisplayedRegions(regions);
|
|
552
510
|
self.zoomTo(self.maxBpPerPx);
|
|
@@ -554,25 +512,25 @@ function stateModelFactory(pluginManager) {
|
|
|
554
512
|
}
|
|
555
513
|
}
|
|
556
514
|
},
|
|
557
|
-
setDraggingTrackId
|
|
515
|
+
setDraggingTrackId(idx) {
|
|
558
516
|
self.draggingTrackId = idx;
|
|
559
517
|
},
|
|
560
|
-
setScaleFactor
|
|
518
|
+
setScaleFactor(factor) {
|
|
561
519
|
self.scaleFactor = factor;
|
|
562
520
|
},
|
|
563
|
-
})
|
|
564
|
-
.actions(
|
|
565
|
-
|
|
521
|
+
}))
|
|
522
|
+
.actions(self => {
|
|
523
|
+
let cancelLastAnimation = () => { };
|
|
566
524
|
function slide(viewWidths) {
|
|
567
|
-
|
|
525
|
+
const [animate, cancelAnimation] = (0, util_1.springAnimate)(self.offsetPx, self.offsetPx + self.width * viewWidths, self.scrollTo);
|
|
568
526
|
cancelLastAnimation();
|
|
569
527
|
cancelLastAnimation = cancelAnimation;
|
|
570
528
|
animate();
|
|
571
529
|
}
|
|
572
|
-
return { slide
|
|
530
|
+
return { slide };
|
|
573
531
|
})
|
|
574
|
-
.actions(
|
|
575
|
-
|
|
532
|
+
.actions(self => {
|
|
533
|
+
let cancelLastAnimation = () => { };
|
|
576
534
|
function zoom(targetBpPerPx) {
|
|
577
535
|
self.zoomTo(self.bpPerPx);
|
|
578
536
|
if (
|
|
@@ -582,18 +540,18 @@ function stateModelFactory(pluginManager) {
|
|
|
582
540
|
(targetBpPerPx > self.bpPerPx && self.bpPerPx === self.maxBpPerPx)) {
|
|
583
541
|
return;
|
|
584
542
|
}
|
|
585
|
-
|
|
586
|
-
|
|
543
|
+
const factor = self.bpPerPx / targetBpPerPx;
|
|
544
|
+
const [animate, cancelAnimation] = (0, util_1.springAnimate)(1, factor, self.setScaleFactor, () => {
|
|
587
545
|
self.zoomTo(targetBpPerPx);
|
|
588
546
|
self.setScaleFactor(1);
|
|
589
|
-
})
|
|
547
|
+
});
|
|
590
548
|
cancelLastAnimation();
|
|
591
549
|
cancelLastAnimation = cancelAnimation;
|
|
592
550
|
animate();
|
|
593
551
|
}
|
|
594
|
-
return { zoom
|
|
552
|
+
return { zoom };
|
|
595
553
|
})
|
|
596
|
-
.views(
|
|
554
|
+
.views(self => ({
|
|
597
555
|
get canShowCytobands() {
|
|
598
556
|
return self.displayedRegions.length === 1 && this.anyCytobandsExist;
|
|
599
557
|
},
|
|
@@ -601,39 +559,47 @@ function stateModelFactory(pluginManager) {
|
|
|
601
559
|
return this.canShowCytobands && self.showCytobandsSetting;
|
|
602
560
|
},
|
|
603
561
|
get anyCytobandsExist() {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
return assemblyNames.some(
|
|
562
|
+
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
563
|
+
const { assemblyNames } = self;
|
|
564
|
+
return assemblyNames.some(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
565
|
},
|
|
608
566
|
get cytobandOffset() {
|
|
609
567
|
return this.showCytobands
|
|
610
568
|
? (0, util_1.measureText)(self.displayedRegions[0].refName, 12) + 15
|
|
611
569
|
: 0;
|
|
612
570
|
},
|
|
613
|
-
})
|
|
614
|
-
.views(
|
|
615
|
-
menuItems
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
var menuItems = __spreadArray([
|
|
571
|
+
}))
|
|
572
|
+
.views(self => ({
|
|
573
|
+
menuItems() {
|
|
574
|
+
const { canShowCytobands, showCytobands } = self;
|
|
575
|
+
const menuItems = [
|
|
619
576
|
{
|
|
620
577
|
label: 'Return to import form',
|
|
621
|
-
onClick:
|
|
622
|
-
(0, util_1.getSession)(self).queueDialog(
|
|
578
|
+
onClick: () => {
|
|
579
|
+
(0, util_1.getSession)(self).queueDialog(handleClose => [
|
|
623
580
|
ui_1.ReturnToImportFormDialog,
|
|
624
|
-
{ model: self, handleClose
|
|
625
|
-
]
|
|
581
|
+
{ model: self, handleClose },
|
|
582
|
+
]);
|
|
626
583
|
},
|
|
627
584
|
icon: FolderOpen_1.default,
|
|
628
585
|
},
|
|
586
|
+
{
|
|
587
|
+
label: 'Sequence search',
|
|
588
|
+
onClick: () => {
|
|
589
|
+
(0, util_1.getSession)(self).queueDialog(handleClose => [
|
|
590
|
+
SequenceSearchDialog,
|
|
591
|
+
{ model: self, handleClose },
|
|
592
|
+
]);
|
|
593
|
+
},
|
|
594
|
+
},
|
|
629
595
|
{
|
|
630
596
|
label: 'Export SVG',
|
|
631
597
|
icon: PhotoCamera_1.default,
|
|
632
|
-
onClick:
|
|
633
|
-
(0, util_1.getSession)(self).queueDialog(
|
|
598
|
+
onClick: () => {
|
|
599
|
+
(0, util_1.getSession)(self).queueDialog(handleClose => [
|
|
634
600
|
ExportSvgDialog_1.default,
|
|
635
|
-
{ model: self, handleClose
|
|
636
|
-
]
|
|
601
|
+
{ model: self, handleClose },
|
|
602
|
+
]);
|
|
637
603
|
},
|
|
638
604
|
},
|
|
639
605
|
{
|
|
@@ -682,12 +648,23 @@ function stateModelFactory(pluginManager) {
|
|
|
682
648
|
onClick: self.toggleNoTracksActive,
|
|
683
649
|
},
|
|
684
650
|
{
|
|
685
|
-
label: 'Show
|
|
651
|
+
label: 'Show guidelines',
|
|
686
652
|
icon: Visibility_1.default,
|
|
687
653
|
type: 'checkbox',
|
|
688
654
|
checked: self.showGridlines,
|
|
689
655
|
onClick: self.toggleShowGridlines,
|
|
690
656
|
},
|
|
657
|
+
...(canShowCytobands
|
|
658
|
+
? [
|
|
659
|
+
{
|
|
660
|
+
label: 'Show ideogram',
|
|
661
|
+
icon: Visibility_1.default,
|
|
662
|
+
type: 'checkbox',
|
|
663
|
+
checked: self.showCytobands,
|
|
664
|
+
onClick: () => self.setShowCytobands(!showCytobands),
|
|
665
|
+
},
|
|
666
|
+
]
|
|
667
|
+
: []),
|
|
691
668
|
{
|
|
692
669
|
label: 'Track labels',
|
|
693
670
|
icon: Label_1.default,
|
|
@@ -697,63 +674,42 @@ function stateModelFactory(pluginManager) {
|
|
|
697
674
|
icon: Visibility_1.default,
|
|
698
675
|
type: 'radio',
|
|
699
676
|
checked: self.trackLabels === 'overlapping',
|
|
700
|
-
onClick:
|
|
677
|
+
onClick: () => self.setTrackLabels('overlapping'),
|
|
701
678
|
},
|
|
702
679
|
{
|
|
703
680
|
label: 'Offset',
|
|
704
681
|
icon: Visibility_1.default,
|
|
705
682
|
type: 'radio',
|
|
706
683
|
checked: self.trackLabels === 'offset',
|
|
707
|
-
onClick:
|
|
684
|
+
onClick: () => self.setTrackLabels('offset'),
|
|
708
685
|
},
|
|
709
686
|
{
|
|
710
687
|
label: 'Hidden',
|
|
711
688
|
icon: Visibility_1.default,
|
|
712
689
|
type: 'radio',
|
|
713
690
|
checked: self.trackLabels === 'hidden',
|
|
714
|
-
onClick:
|
|
691
|
+
onClick: () => self.setTrackLabels('hidden'),
|
|
715
692
|
},
|
|
716
693
|
],
|
|
694
|
+
},
|
|
695
|
+
];
|
|
696
|
+
// add track's view level menu options
|
|
697
|
+
for (const [key, value] of self.trackTypeActions.entries()) {
|
|
698
|
+
if (value.length) {
|
|
699
|
+
menuItems.push({ type: 'divider' }, { type: 'subHeader', label: key });
|
|
700
|
+
value.forEach(action => menuItems.push(action));
|
|
717
701
|
}
|
|
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
702
|
}
|
|
747
703
|
return menuItems;
|
|
748
704
|
},
|
|
749
|
-
})
|
|
750
|
-
.views(
|
|
751
|
-
|
|
752
|
-
|
|
705
|
+
}))
|
|
706
|
+
.views(self => {
|
|
707
|
+
let currentlyCalculatedStaticBlocks;
|
|
708
|
+
let stringifiedCurrentlyCalculatedStaticBlocks = '';
|
|
753
709
|
return {
|
|
754
710
|
get staticBlocks() {
|
|
755
|
-
|
|
756
|
-
|
|
711
|
+
const ret = (0, calculateStaticBlocks_1.default)(self);
|
|
712
|
+
const sret = JSON.stringify(ret);
|
|
757
713
|
if (stringifiedCurrentlyCalculatedStaticBlocks !== sret) {
|
|
758
714
|
currentlyCalculatedStaticBlocks = ret;
|
|
759
715
|
stringifiedCurrentlyCalculatedStaticBlocks = sret;
|
|
@@ -764,8 +720,12 @@ function stateModelFactory(pluginManager) {
|
|
|
764
720
|
return (0, calculateDynamicBlocks_1.default)(self);
|
|
765
721
|
},
|
|
766
722
|
get roundedDynamicBlocks() {
|
|
767
|
-
return this.dynamicBlocks.contentBlocks.map(
|
|
768
|
-
return
|
|
723
|
+
return this.dynamicBlocks.contentBlocks.map(block => {
|
|
724
|
+
return {
|
|
725
|
+
...block,
|
|
726
|
+
start: Math.floor(block.start),
|
|
727
|
+
end: Math.ceil(block.end),
|
|
728
|
+
};
|
|
769
729
|
});
|
|
770
730
|
},
|
|
771
731
|
get visibleLocStrings() {
|
|
@@ -776,9 +736,9 @@ function stateModelFactory(pluginManager) {
|
|
|
776
736
|
},
|
|
777
737
|
};
|
|
778
738
|
})
|
|
779
|
-
.actions(
|
|
739
|
+
.actions(self => ({
|
|
780
740
|
// this "clears the view" and makes the view return to the import form
|
|
781
|
-
clearView
|
|
741
|
+
clearView() {
|
|
782
742
|
self.setDisplayedRegions([]);
|
|
783
743
|
self.tracks.clear();
|
|
784
744
|
// it is necessary to run these after setting displayed regions empty
|
|
@@ -787,35 +747,24 @@ function stateModelFactory(pluginManager) {
|
|
|
787
747
|
self.scrollTo(0);
|
|
788
748
|
self.zoomTo(10);
|
|
789
749
|
},
|
|
790
|
-
setCoarseDynamicBlocks
|
|
750
|
+
setCoarseDynamicBlocks(blocks) {
|
|
791
751
|
self.coarseDynamicBlocks = blocks.contentBlocks;
|
|
792
752
|
self.coarseTotalBp = blocks.totalBp;
|
|
793
753
|
},
|
|
794
|
-
afterAttach
|
|
795
|
-
|
|
796
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(function () {
|
|
754
|
+
afterAttach() {
|
|
755
|
+
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.autorun)(() => {
|
|
797
756
|
if (self.initialized) {
|
|
798
|
-
|
|
757
|
+
this.setCoarseDynamicBlocks(self.dynamicBlocks);
|
|
799
758
|
}
|
|
800
759
|
}, { delay: 150 }));
|
|
801
760
|
},
|
|
802
|
-
})
|
|
803
|
-
.actions(
|
|
804
|
-
exportSvg
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
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
|
-
});
|
|
818
|
-
});
|
|
761
|
+
}))
|
|
762
|
+
.actions(self => ({
|
|
763
|
+
async exportSvg(opts = {}) {
|
|
764
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
765
|
+
const html = await (0, LinearGenomeViewSvg_1.renderToSvg)(self, opts);
|
|
766
|
+
const blob = new Blob([html], { type: 'image/svg+xml' });
|
|
767
|
+
(0, file_saver_1.saveAs)(blob, opts.filename || 'image.svg');
|
|
819
768
|
},
|
|
820
769
|
/**
|
|
821
770
|
* offset is the base-pair-offset in the displayed region, index is the index of the
|
|
@@ -824,76 +773,80 @@ function stateModelFactory(pluginManager) {
|
|
|
824
773
|
* @param start - object as `{start, end, offset, index}`
|
|
825
774
|
* @param end - object as `{start, end, offset, index}`
|
|
826
775
|
*/
|
|
827
|
-
moveTo
|
|
776
|
+
moveTo(start, end) {
|
|
828
777
|
(0, Base1DUtils_1.moveTo)(self, start, end);
|
|
829
778
|
},
|
|
830
|
-
navToLocString
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
779
|
+
navToLocString(locString, optAssemblyName) {
|
|
780
|
+
const { assemblyNames } = self;
|
|
781
|
+
const { assemblyManager } = (0, util_1.getSession)(self);
|
|
782
|
+
const { isValidRefName } = assemblyManager;
|
|
783
|
+
const assemblyName = optAssemblyName || assemblyNames[0];
|
|
784
|
+
let parsedLocStrings;
|
|
785
|
+
const inputs = locString
|
|
837
786
|
.split(/(\s+)/)
|
|
838
|
-
.map(
|
|
839
|
-
.filter(
|
|
787
|
+
.map(f => f.trim())
|
|
788
|
+
.filter(f => !!f);
|
|
840
789
|
// first try interpreting as a whitespace-separated sequence of
|
|
841
790
|
// multiple locstrings
|
|
842
791
|
try {
|
|
843
|
-
parsedLocStrings = inputs.map(
|
|
844
|
-
return (0, util_1.parseLocString)(l, function (ref) { return isValidRefName(ref, assemblyName); });
|
|
845
|
-
});
|
|
792
|
+
parsedLocStrings = inputs.map(l => (0, util_1.parseLocString)(l, ref => isValidRefName(ref, assemblyName)));
|
|
846
793
|
}
|
|
847
794
|
catch (e) {
|
|
848
795
|
// if this fails, try interpreting as a whitespace-separated refname,
|
|
849
796
|
// start, end if start and end are integer inputs
|
|
850
|
-
|
|
851
|
-
if (
|
|
797
|
+
const [refName, start, end] = inputs;
|
|
798
|
+
if (`${e}`.match(/Unknown reference sequence/) &&
|
|
852
799
|
Number.isInteger(+start) &&
|
|
853
800
|
Number.isInteger(+end)) {
|
|
854
801
|
parsedLocStrings = [
|
|
855
|
-
(0, util_1.parseLocString)(refName + ':' + start + '..' + end,
|
|
856
|
-
return isValidRefName(ref, assemblyName);
|
|
857
|
-
}),
|
|
802
|
+
(0, util_1.parseLocString)(refName + ':' + start + '..' + end, ref => isValidRefName(ref, assemblyName)),
|
|
858
803
|
];
|
|
859
804
|
}
|
|
860
805
|
else {
|
|
861
806
|
throw e;
|
|
862
807
|
}
|
|
863
808
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
809
|
+
const locations = parsedLocStrings === null || parsedLocStrings === void 0 ? void 0 : parsedLocStrings.map(region => {
|
|
810
|
+
const asmName = region.assemblyName || assemblyName;
|
|
811
|
+
const asm = assemblyManager.get(asmName);
|
|
812
|
+
const { refName } = region;
|
|
868
813
|
if (!asm) {
|
|
869
|
-
throw new Error(
|
|
814
|
+
throw new Error(`assembly ${asmName} not found`);
|
|
870
815
|
}
|
|
871
|
-
|
|
816
|
+
const { regions } = asm;
|
|
872
817
|
if (!regions) {
|
|
873
|
-
throw new Error(
|
|
818
|
+
throw new Error(`regions not loaded yet for ${asmName}`);
|
|
874
819
|
}
|
|
875
|
-
|
|
820
|
+
const canonicalRefName = asm.getCanonicalRefName(region.refName);
|
|
876
821
|
if (!canonicalRefName) {
|
|
877
|
-
throw new Error(
|
|
822
|
+
throw new Error(`Could not find refName ${refName} in ${asm.name}`);
|
|
878
823
|
}
|
|
879
|
-
|
|
824
|
+
const parentRegion = regions.find(region => region.refName === canonicalRefName);
|
|
880
825
|
if (!parentRegion) {
|
|
881
|
-
throw new Error(
|
|
826
|
+
throw new Error(`Could not find refName ${refName} in ${asmName}`);
|
|
882
827
|
}
|
|
883
|
-
return
|
|
828
|
+
return {
|
|
829
|
+
...region,
|
|
830
|
+
assemblyName: asmName,
|
|
831
|
+
parentRegion,
|
|
832
|
+
};
|
|
884
833
|
});
|
|
885
834
|
if (locations.length === 1) {
|
|
886
|
-
|
|
835
|
+
const loc = locations[0];
|
|
887
836
|
self.setDisplayedRegions([
|
|
888
|
-
|
|
837
|
+
{ reversed: loc.reversed, ...loc.parentRegion },
|
|
889
838
|
]);
|
|
890
|
-
|
|
891
|
-
this.navTo(
|
|
839
|
+
const { start, end, parentRegion } = loc;
|
|
840
|
+
this.navTo({
|
|
841
|
+
...loc,
|
|
842
|
+
start: (0, util_1.clamp)(start !== null && start !== void 0 ? start : 0, 0, parentRegion.end),
|
|
843
|
+
end: (0, util_1.clamp)(end !== null && end !== void 0 ? end : parentRegion.end, 0, parentRegion.end),
|
|
844
|
+
});
|
|
892
845
|
}
|
|
893
846
|
else {
|
|
894
847
|
self.setDisplayedRegions(
|
|
895
848
|
// @ts-ignore
|
|
896
|
-
locations.map(
|
|
849
|
+
locations.map(r => (r.start === undefined ? r.parentRegion : r)));
|
|
897
850
|
self.showAllRegions();
|
|
898
851
|
}
|
|
899
852
|
},
|
|
@@ -908,29 +861,29 @@ function stateModelFactory(pluginManager) {
|
|
|
908
861
|
*
|
|
909
862
|
* @param location - a proposed location to navigate to
|
|
910
863
|
*/
|
|
911
|
-
navTo
|
|
864
|
+
navTo(query) {
|
|
912
865
|
this.navToMultiple([query]);
|
|
913
866
|
},
|
|
914
|
-
navToMultiple
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
867
|
+
navToMultiple(locations) {
|
|
868
|
+
const firstLocation = locations[0];
|
|
869
|
+
let { refName } = firstLocation;
|
|
870
|
+
const { start, end, assemblyName = self.assemblyNames[0], } = firstLocation;
|
|
918
871
|
if (start !== undefined && end !== undefined && start > end) {
|
|
919
|
-
throw new Error(
|
|
872
|
+
throw new Error(`start "${start + 1}" is greater than end "${end}"`);
|
|
920
873
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
874
|
+
const session = (0, util_1.getSession)(self);
|
|
875
|
+
const { assemblyManager } = session;
|
|
876
|
+
const assembly = assemblyManager.get(assemblyName);
|
|
924
877
|
if (assembly) {
|
|
925
|
-
|
|
878
|
+
const canonicalRefName = assembly.getCanonicalRefName(refName);
|
|
926
879
|
if (canonicalRefName) {
|
|
927
880
|
refName = canonicalRefName;
|
|
928
881
|
}
|
|
929
882
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
883
|
+
let s = start;
|
|
884
|
+
let e = end;
|
|
885
|
+
let refNameMatched = false;
|
|
886
|
+
const predicate = (r) => {
|
|
934
887
|
if (refName === r.refName) {
|
|
935
888
|
refNameMatched = true;
|
|
936
889
|
if (s === undefined) {
|
|
@@ -947,11 +900,11 @@ function stateModelFactory(pluginManager) {
|
|
|
947
900
|
}
|
|
948
901
|
return false;
|
|
949
902
|
};
|
|
950
|
-
|
|
951
|
-
|
|
903
|
+
const lastIndex = (0, util_1.findLastIndex)(self.displayedRegions, predicate);
|
|
904
|
+
let index;
|
|
952
905
|
while (index !== lastIndex) {
|
|
953
906
|
try {
|
|
954
|
-
|
|
907
|
+
const previousIndex = index;
|
|
955
908
|
index = self.displayedRegions
|
|
956
909
|
.slice(previousIndex === undefined ? 0 : previousIndex + 1)
|
|
957
910
|
.findIndex(predicate);
|
|
@@ -959,39 +912,39 @@ function stateModelFactory(pluginManager) {
|
|
|
959
912
|
index += previousIndex + 1;
|
|
960
913
|
}
|
|
961
914
|
if (!refNameMatched) {
|
|
962
|
-
throw new Error(
|
|
915
|
+
throw new Error(`could not find a region with refName "${refName}"`);
|
|
963
916
|
}
|
|
964
917
|
if (s === undefined) {
|
|
965
|
-
throw new Error(
|
|
918
|
+
throw new Error(`could not find a region with refName "${refName}" that contained an end position ${e}`);
|
|
966
919
|
}
|
|
967
920
|
if (e === undefined) {
|
|
968
|
-
throw new Error(
|
|
921
|
+
throw new Error(`could not find a region with refName "${refName}" that contained a start position ${s + 1}`);
|
|
969
922
|
}
|
|
970
923
|
if (index === -1) {
|
|
971
|
-
throw new Error(
|
|
924
|
+
throw new Error(`could not find a region that completely contained "${(0, util_1.assembleLocString)(firstLocation)}"`);
|
|
972
925
|
}
|
|
973
926
|
if (locations.length === 1) {
|
|
974
|
-
|
|
975
|
-
this.moveTo({ index
|
|
927
|
+
const f = self.displayedRegions[index];
|
|
928
|
+
this.moveTo({ index, offset: f.reversed ? f.end - e : s - f.start }, { index, offset: f.reversed ? f.end - s : e - f.start });
|
|
976
929
|
return;
|
|
977
930
|
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
931
|
+
let locationIndex = 0;
|
|
932
|
+
let locationStart = 0;
|
|
933
|
+
let locationEnd = 0;
|
|
981
934
|
for (locationIndex; locationIndex < locations.length; locationIndex++) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
locationStart =
|
|
985
|
-
locationEnd =
|
|
986
|
-
if (
|
|
987
|
-
throw new Error(
|
|
935
|
+
const location = locations[locationIndex];
|
|
936
|
+
const region = self.displayedRegions[index + locationIndex];
|
|
937
|
+
locationStart = location.start || region.start;
|
|
938
|
+
locationEnd = location.end || region.end;
|
|
939
|
+
if (location.refName !== region.refName) {
|
|
940
|
+
throw new Error(`Entered location ${(0, util_1.assembleLocString)(location)} does not match with displayed regions`);
|
|
988
941
|
}
|
|
989
942
|
}
|
|
990
943
|
locationIndex -= 1;
|
|
991
|
-
|
|
992
|
-
|
|
944
|
+
const startDisplayedRegion = self.displayedRegions[index];
|
|
945
|
+
const endDisplayedRegion = self.displayedRegions[index + locationIndex];
|
|
993
946
|
this.moveTo({
|
|
994
|
-
index
|
|
947
|
+
index,
|
|
995
948
|
offset: startDisplayedRegion.reversed
|
|
996
949
|
? startDisplayedRegion.end - e
|
|
997
950
|
: s - startDisplayedRegion.start,
|
|
@@ -1010,30 +963,27 @@ function stateModelFactory(pluginManager) {
|
|
|
1010
963
|
}
|
|
1011
964
|
}
|
|
1012
965
|
},
|
|
1013
|
-
})
|
|
1014
|
-
.views(
|
|
1015
|
-
rubberBandMenuItems
|
|
966
|
+
}))
|
|
967
|
+
.views(self => ({
|
|
968
|
+
rubberBandMenuItems() {
|
|
1016
969
|
return [
|
|
1017
970
|
{
|
|
1018
971
|
label: 'Zoom to region',
|
|
1019
972
|
icon: ZoomIn_1.default,
|
|
1020
|
-
onClick:
|
|
1021
|
-
|
|
973
|
+
onClick: () => {
|
|
974
|
+
const { leftOffset, rightOffset } = self;
|
|
1022
975
|
self.moveTo(leftOffset, rightOffset);
|
|
1023
976
|
},
|
|
1024
977
|
},
|
|
1025
978
|
{
|
|
1026
979
|
label: 'Get sequence',
|
|
1027
980
|
icon: MenuOpen_1.default,
|
|
1028
|
-
onClick:
|
|
1029
|
-
self.setSequenceDialogOpen(true);
|
|
1030
|
-
},
|
|
981
|
+
onClick: () => self.setGetSequenceDialogOpen(true),
|
|
1031
982
|
},
|
|
1032
983
|
];
|
|
1033
984
|
},
|
|
1034
|
-
bpToPx
|
|
1035
|
-
|
|
1036
|
-
return (0, Base1DUtils_1.bpToPx)({ refName: refName, coord: coord, regionNumber: regionNumber, self: self });
|
|
985
|
+
bpToPx({ refName, coord, regionNumber, }) {
|
|
986
|
+
return (0, Base1DUtils_1.bpToPx)({ refName, coord, regionNumber, self });
|
|
1037
987
|
},
|
|
1038
988
|
/**
|
|
1039
989
|
* scrolls the view to center on the given bp. if that is not in any
|
|
@@ -1042,17 +992,17 @@ function stateModelFactory(pluginManager) {
|
|
|
1042
992
|
* @param refName - refName of the displayedRegion you are centering at
|
|
1043
993
|
* @param regionNumber - index of the displayedRegion
|
|
1044
994
|
*/
|
|
1045
|
-
centerAt
|
|
1046
|
-
|
|
1047
|
-
refName
|
|
1048
|
-
coord
|
|
1049
|
-
regionNumber
|
|
995
|
+
centerAt(coord, refName, regionNumber) {
|
|
996
|
+
const centerPx = this.bpToPx({
|
|
997
|
+
refName,
|
|
998
|
+
coord,
|
|
999
|
+
regionNumber,
|
|
1050
1000
|
});
|
|
1051
1001
|
if (centerPx) {
|
|
1052
1002
|
self.scrollTo(Math.round(centerPx.offsetPx - self.width / 2));
|
|
1053
1003
|
}
|
|
1054
1004
|
},
|
|
1055
|
-
pxToBp
|
|
1005
|
+
pxToBp(px) {
|
|
1056
1006
|
return (0, Base1DUtils_1.pxToBp)(self, px);
|
|
1057
1007
|
},
|
|
1058
1008
|
get centerLineInfo() {
|
|
@@ -1060,7 +1010,7 @@ function stateModelFactory(pluginManager) {
|
|
|
1060
1010
|
? this.pxToBp(self.width / 2)
|
|
1061
1011
|
: undefined;
|
|
1062
1012
|
},
|
|
1063
|
-
})
|
|
1013
|
+
}));
|
|
1064
1014
|
}
|
|
1065
1015
|
exports.stateModelFactory = stateModelFactory;
|
|
1066
1016
|
var LinearGenomeView_1 = require("./components/LinearGenomeView");
|