@jbrowse/plugin-variants 1.6.9 → 1.7.3
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/ChordVariantDisplay/index.d.ts +3 -3
- package/dist/ChordVariantDisplay/index.js +33 -0
- package/dist/ChordVariantDisplay/models/ChordVariantDisplay.d.ts +5 -5
- package/dist/ChordVariantDisplay/models/ChordVariantDisplay.js +76 -0
- package/dist/LinearVariantDisplay/configSchema.d.ts +5 -5
- package/dist/LinearVariantDisplay/configSchema.js +18 -0
- package/dist/LinearVariantDisplay/configSchema.test.js +92 -0
- package/dist/LinearVariantDisplay/index.d.ts +2 -2
- package/dist/LinearVariantDisplay/index.js +23 -0
- package/dist/LinearVariantDisplay/model.d.ts +207 -207
- package/dist/LinearVariantDisplay/model.js +75 -0
- package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +24 -24
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +228 -0
- package/dist/StructuralVariantChordRenderer/index.d.ts +3 -3
- package/dist/StructuralVariantChordRenderer/index.js +48 -0
- package/dist/VariantFeatureWidget/BreakendOptionDialog.d.ts +10 -10
- package/dist/VariantFeatureWidget/BreakendOptionDialog.js +127 -0
- package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +4 -4
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +251 -0
- package/dist/VariantFeatureWidget/VariantFeatureWidget.test.js +56 -0
- package/dist/VariantFeatureWidget/index.d.ts +11 -11
- package/dist/VariantFeatureWidget/index.js +35 -0
- package/dist/VcfAdapter/VcfAdapter.d.ts +24 -24
- package/dist/VcfAdapter/VcfAdapter.js +383 -0
- package/dist/VcfAdapter/VcfAdapter.test.js +55 -0
- package/dist/VcfAdapter/configSchema.d.ts +2 -2
- package/dist/VcfAdapter/configSchema.js +22 -0
- package/dist/VcfAdapter/index.d.ts +1 -1
- package/dist/VcfAdapter/index.js +15 -0
- package/dist/VcfTabixAdapter/VcfFeature.d.ts +59 -59
- package/dist/VcfTabixAdapter/VcfFeature.js +261 -0
- package/dist/VcfTabixAdapter/VcfFeature.test.js +106 -0
- package/dist/VcfTabixAdapter/VcfTabixAdapter.d.ts +35 -35
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +392 -0
- package/dist/VcfTabixAdapter/VcfTabixAdapter.test.js +99 -0
- package/dist/VcfTabixAdapter/configSchema.d.ts +2 -2
- package/dist/VcfTabixAdapter/configSchema.js +38 -0
- package/dist/VcfTabixAdapter/index.d.ts +1 -1
- package/dist/VcfTabixAdapter/index.js +15 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +214 -6
- package/dist/index.test.js +37 -0
- package/package.json +5 -7
- package/dist/LinearVariantDisplay/configSchema.test.d.ts +0 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.test.d.ts +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-variants.cjs.development.js +0 -2897
- package/dist/plugin-variants.cjs.development.js.map +0 -1
- package/dist/plugin-variants.cjs.production.min.js +0 -2
- package/dist/plugin-variants.cjs.production.min.js.map +0 -1
- package/dist/plugin-variants.esm.js +0 -2889
- package/dist/plugin-variants.esm.js.map +0 -1
|
@@ -1,2889 +0,0 @@
|
|
|
1
|
-
import React, { useMemo, lazy, useState } from 'react';
|
|
2
|
-
import { ConfigurationSchema, ConfigurationReference, getConf, readConfObject } from '@jbrowse/core/configuration';
|
|
3
|
-
import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
4
|
-
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
|
|
5
|
-
import { createBaseTrackConfig, createBaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
|
|
6
|
-
import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType';
|
|
7
|
-
import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
8
|
-
import Plugin from '@jbrowse/core/Plugin';
|
|
9
|
-
import { linearBasicDisplayConfigSchemaFactory, linearBasicDisplayModelFactory, BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
10
|
-
import { baseChordDisplayConfig, BaseChordDisplayModel, BaseChordDisplayComponentFactory } from '@jbrowse/plugin-circular-view';
|
|
11
|
-
import { getRpcSessionId, getFileName, makeIndex, makeIndexType } from '@jbrowse/core/util/tracks';
|
|
12
|
-
import { getContainingView, getSession, isSessionModelWithWidgets, getContainingTrack, polarToCartesian, bytesForRegions } from '@jbrowse/core/util';
|
|
13
|
-
import { types, getSnapshot, getEnv } from 'mobx-state-tree';
|
|
14
|
-
import ChordRendererType from '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType';
|
|
15
|
-
import { PropTypes as PropTypes$2, observer } from 'mobx-react';
|
|
16
|
-
import { PropTypes as PropTypes$1, ElementId } from '@jbrowse/core/util/types/mst';
|
|
17
|
-
import VCF, { parseBreakend } from '@gmod/vcf';
|
|
18
|
-
import PropTypes from 'prop-types';
|
|
19
|
-
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
20
|
-
import { openLocation } from '@jbrowse/core/util/io';
|
|
21
|
-
import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
22
|
-
import { TabixIndexedFile } from '@gmod/tabix';
|
|
23
|
-
import IntervalTree from '@flatten-js/interval-tree';
|
|
24
|
-
import { unzip } from '@gmod/bgzf-filehandle';
|
|
25
|
-
import { Dialog, DialogTitle, IconButton, Divider, DialogContent, FormControlLabel, Checkbox, DialogActions, Button, makeStyles, Paper, Typography, TextField, Link } from '@material-ui/core';
|
|
26
|
-
import SimpleFeature from '@jbrowse/core/util/simpleFeature';
|
|
27
|
-
import { DataGrid } from '@mui/x-data-grid';
|
|
28
|
-
import { FeatureDetails, BaseCard } from '@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail';
|
|
29
|
-
import CloseIcon from '@material-ui/icons/Close';
|
|
30
|
-
|
|
31
|
-
function ownKeys(object, enumerableOnly) {
|
|
32
|
-
var keys = Object.keys(object);
|
|
33
|
-
|
|
34
|
-
if (Object.getOwnPropertySymbols) {
|
|
35
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
36
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
37
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
38
|
-
})), keys.push.apply(keys, symbols);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return keys;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _objectSpread2(target) {
|
|
45
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
46
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
47
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
48
|
-
_defineProperty(target, key, source[key]);
|
|
49
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
50
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return target;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
58
|
-
try {
|
|
59
|
-
var info = gen[key](arg);
|
|
60
|
-
var value = info.value;
|
|
61
|
-
} catch (error) {
|
|
62
|
-
reject(error);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (info.done) {
|
|
67
|
-
resolve(value);
|
|
68
|
-
} else {
|
|
69
|
-
Promise.resolve(value).then(_next, _throw);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function _asyncToGenerator(fn) {
|
|
74
|
-
return function () {
|
|
75
|
-
var self = this,
|
|
76
|
-
args = arguments;
|
|
77
|
-
return new Promise(function (resolve, reject) {
|
|
78
|
-
var gen = fn.apply(self, args);
|
|
79
|
-
|
|
80
|
-
function _next(value) {
|
|
81
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function _throw(err) {
|
|
85
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
_next(undefined);
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function _classCallCheck(instance, Constructor) {
|
|
94
|
-
if (!(instance instanceof Constructor)) {
|
|
95
|
-
throw new TypeError("Cannot call a class as a function");
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function _defineProperties(target, props) {
|
|
100
|
-
for (var i = 0; i < props.length; i++) {
|
|
101
|
-
var descriptor = props[i];
|
|
102
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
103
|
-
descriptor.configurable = true;
|
|
104
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
105
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
110
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
111
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
112
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
113
|
-
writable: false
|
|
114
|
-
});
|
|
115
|
-
return Constructor;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function _defineProperty(obj, key, value) {
|
|
119
|
-
if (key in obj) {
|
|
120
|
-
Object.defineProperty(obj, key, {
|
|
121
|
-
value: value,
|
|
122
|
-
enumerable: true,
|
|
123
|
-
configurable: true,
|
|
124
|
-
writable: true
|
|
125
|
-
});
|
|
126
|
-
} else {
|
|
127
|
-
obj[key] = value;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return obj;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function _inherits(subClass, superClass) {
|
|
134
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
135
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
139
|
-
constructor: {
|
|
140
|
-
value: subClass,
|
|
141
|
-
writable: true,
|
|
142
|
-
configurable: true
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
Object.defineProperty(subClass, "prototype", {
|
|
146
|
-
writable: false
|
|
147
|
-
});
|
|
148
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function _getPrototypeOf(o) {
|
|
152
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
153
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
154
|
-
};
|
|
155
|
-
return _getPrototypeOf(o);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function _setPrototypeOf(o, p) {
|
|
159
|
-
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
160
|
-
o.__proto__ = p;
|
|
161
|
-
return o;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
return _setPrototypeOf(o, p);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function _isNativeReflectConstruct() {
|
|
168
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
169
|
-
if (Reflect.construct.sham) return false;
|
|
170
|
-
if (typeof Proxy === "function") return true;
|
|
171
|
-
|
|
172
|
-
try {
|
|
173
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
174
|
-
return true;
|
|
175
|
-
} catch (e) {
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
181
|
-
if (source == null) return {};
|
|
182
|
-
var target = {};
|
|
183
|
-
var sourceKeys = Object.keys(source);
|
|
184
|
-
var key, i;
|
|
185
|
-
|
|
186
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
187
|
-
key = sourceKeys[i];
|
|
188
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
189
|
-
target[key] = source[key];
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
return target;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function _objectWithoutProperties(source, excluded) {
|
|
196
|
-
if (source == null) return {};
|
|
197
|
-
|
|
198
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
199
|
-
|
|
200
|
-
var key, i;
|
|
201
|
-
|
|
202
|
-
if (Object.getOwnPropertySymbols) {
|
|
203
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
204
|
-
|
|
205
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
206
|
-
key = sourceSymbolKeys[i];
|
|
207
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
208
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
209
|
-
target[key] = source[key];
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return target;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function _assertThisInitialized(self) {
|
|
217
|
-
if (self === void 0) {
|
|
218
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return self;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function _possibleConstructorReturn(self, call) {
|
|
225
|
-
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
226
|
-
return call;
|
|
227
|
-
} else if (call !== void 0) {
|
|
228
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
return _assertThisInitialized(self);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function _createSuper(Derived) {
|
|
235
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
236
|
-
|
|
237
|
-
return function _createSuperInternal() {
|
|
238
|
-
var Super = _getPrototypeOf(Derived),
|
|
239
|
-
result;
|
|
240
|
-
|
|
241
|
-
if (hasNativeReflectConstruct) {
|
|
242
|
-
var NewTarget = _getPrototypeOf(this).constructor;
|
|
243
|
-
|
|
244
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
245
|
-
} else {
|
|
246
|
-
result = Super.apply(this, arguments);
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return _possibleConstructorReturn(this, result);
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function _superPropBase(object, property) {
|
|
254
|
-
while (!Object.prototype.hasOwnProperty.call(object, property)) {
|
|
255
|
-
object = _getPrototypeOf(object);
|
|
256
|
-
if (object === null) break;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return object;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function _get() {
|
|
263
|
-
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
264
|
-
_get = Reflect.get;
|
|
265
|
-
} else {
|
|
266
|
-
_get = function _get(target, property, receiver) {
|
|
267
|
-
var base = _superPropBase(target, property);
|
|
268
|
-
|
|
269
|
-
if (!base) return;
|
|
270
|
-
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
271
|
-
|
|
272
|
-
if (desc.get) {
|
|
273
|
-
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
return desc.value;
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
return _get.apply(this, arguments);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function _slicedToArray(arr, i) {
|
|
284
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function _toConsumableArray(arr) {
|
|
288
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function _arrayWithoutHoles(arr) {
|
|
292
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
function _arrayWithHoles(arr) {
|
|
296
|
-
if (Array.isArray(arr)) return arr;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function _iterableToArray(iter) {
|
|
300
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
function _iterableToArrayLimit(arr, i) {
|
|
304
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
305
|
-
|
|
306
|
-
if (_i == null) return;
|
|
307
|
-
var _arr = [];
|
|
308
|
-
var _n = true;
|
|
309
|
-
var _d = false;
|
|
310
|
-
|
|
311
|
-
var _s, _e;
|
|
312
|
-
|
|
313
|
-
try {
|
|
314
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
315
|
-
_arr.push(_s.value);
|
|
316
|
-
|
|
317
|
-
if (i && _arr.length === i) break;
|
|
318
|
-
}
|
|
319
|
-
} catch (err) {
|
|
320
|
-
_d = true;
|
|
321
|
-
_e = err;
|
|
322
|
-
} finally {
|
|
323
|
-
try {
|
|
324
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
325
|
-
} finally {
|
|
326
|
-
if (_d) throw _e;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
return _arr;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
334
|
-
if (!o) return;
|
|
335
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
336
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
337
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
338
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
339
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function _arrayLikeToArray(arr, len) {
|
|
343
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
344
|
-
|
|
345
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
346
|
-
|
|
347
|
-
return arr2;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
function _nonIterableSpread() {
|
|
351
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
function _nonIterableRest() {
|
|
355
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
359
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
360
|
-
|
|
361
|
-
if (!it) {
|
|
362
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
363
|
-
if (it) o = it;
|
|
364
|
-
var i = 0;
|
|
365
|
-
|
|
366
|
-
var F = function () {};
|
|
367
|
-
|
|
368
|
-
return {
|
|
369
|
-
s: F,
|
|
370
|
-
n: function () {
|
|
371
|
-
if (i >= o.length) return {
|
|
372
|
-
done: true
|
|
373
|
-
};
|
|
374
|
-
return {
|
|
375
|
-
done: false,
|
|
376
|
-
value: o[i++]
|
|
377
|
-
};
|
|
378
|
-
},
|
|
379
|
-
e: function (e) {
|
|
380
|
-
throw e;
|
|
381
|
-
},
|
|
382
|
-
f: F
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
var normalCompletion = true,
|
|
390
|
-
didErr = false,
|
|
391
|
-
err;
|
|
392
|
-
return {
|
|
393
|
-
s: function () {
|
|
394
|
-
it = it.call(o);
|
|
395
|
-
},
|
|
396
|
-
n: function () {
|
|
397
|
-
var step = it.next();
|
|
398
|
-
normalCompletion = step.done;
|
|
399
|
-
return step;
|
|
400
|
-
},
|
|
401
|
-
e: function (e) {
|
|
402
|
-
didErr = true;
|
|
403
|
-
err = e;
|
|
404
|
-
},
|
|
405
|
-
f: function () {
|
|
406
|
-
try {
|
|
407
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
408
|
-
} finally {
|
|
409
|
-
if (didErr) throw err;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
var ChordVariantDisplayF = function ChordVariantDisplayF(pluginManager) {
|
|
416
|
-
var jbrequire = pluginManager.jbrequire;
|
|
417
|
-
|
|
418
|
-
var _jbrequire = jbrequire('mobx-state-tree'),
|
|
419
|
-
types = _jbrequire.types;
|
|
420
|
-
|
|
421
|
-
var _jbrequire2 = jbrequire('@jbrowse/core/configuration'),
|
|
422
|
-
ConfigurationSchema = _jbrequire2.ConfigurationSchema,
|
|
423
|
-
ConfigurationReference = _jbrequire2.ConfigurationReference;
|
|
424
|
-
|
|
425
|
-
var _jbrequire3 = jbrequire('@jbrowse/core/util'),
|
|
426
|
-
getContainingView = _jbrequire3.getContainingView;
|
|
427
|
-
|
|
428
|
-
var _jbrequire4 = jbrequire('@jbrowse/core/util/tracks'),
|
|
429
|
-
getParentRenderProps = _jbrequire4.getParentRenderProps;
|
|
430
|
-
|
|
431
|
-
var configSchema = ConfigurationSchema('ChordVariantDisplay', {
|
|
432
|
-
renderer: types.optional(pluginManager.pluggableConfigSchemaType('renderer'), {
|
|
433
|
-
type: 'StructuralVariantChordRenderer'
|
|
434
|
-
})
|
|
435
|
-
}, {
|
|
436
|
-
baseConfiguration: baseChordDisplayConfig,
|
|
437
|
-
explicitlyTyped: true
|
|
438
|
-
});
|
|
439
|
-
var stateModel = types.compose('ChordVariantDisplay', BaseChordDisplayModel, types.model({
|
|
440
|
-
type: types.literal('ChordVariantDisplay'),
|
|
441
|
-
configuration: ConfigurationReference(configSchema)
|
|
442
|
-
})).views(function (self) {
|
|
443
|
-
return {
|
|
444
|
-
get rendererTypeName() {
|
|
445
|
-
return self.configuration.renderer.type;
|
|
446
|
-
},
|
|
447
|
-
|
|
448
|
-
renderProps: function renderProps() {
|
|
449
|
-
var view = getContainingView(self);
|
|
450
|
-
return _objectSpread2(_objectSpread2({}, getParentRenderProps(self)), {}, {
|
|
451
|
-
rpcDriverName: self.rpcDriverName,
|
|
452
|
-
displayModel: self,
|
|
453
|
-
bezierRadius: view.radiusPx * self.bezierRadiusRatio,
|
|
454
|
-
radius: view.radiusPx,
|
|
455
|
-
blockDefinitions: this.blockDefinitions,
|
|
456
|
-
config: self.configuration.renderer,
|
|
457
|
-
onChordClick: self.onChordClick
|
|
458
|
-
});
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
});
|
|
462
|
-
return {
|
|
463
|
-
stateModel: stateModel,
|
|
464
|
-
configSchema: configSchema
|
|
465
|
-
};
|
|
466
|
-
}; // http://localhost:3000/test_data/hs37d5.HG002-SequelII-CCS.sv.vcf.gz.tbi
|
|
467
|
-
|
|
468
|
-
var ChordVariantDisplay = (function (pluginManager) {
|
|
469
|
-
var lib = pluginManager.lib,
|
|
470
|
-
load = pluginManager.load;
|
|
471
|
-
var DisplayType = lib['@jbrowse/core/pluggableElementTypes/DisplayType'];
|
|
472
|
-
|
|
473
|
-
var _load = load(ChordVariantDisplayF),
|
|
474
|
-
stateModel = _load.stateModel,
|
|
475
|
-
configSchema = _load.configSchema;
|
|
476
|
-
|
|
477
|
-
return new DisplayType({
|
|
478
|
-
name: 'ChordVariantDisplay',
|
|
479
|
-
configSchema: configSchema,
|
|
480
|
-
stateModel: stateModel,
|
|
481
|
-
trackType: 'VariantTrack',
|
|
482
|
-
viewType: 'CircularView',
|
|
483
|
-
ReactComponent: BaseChordDisplayComponentFactory(pluginManager)
|
|
484
|
-
});
|
|
485
|
-
});
|
|
486
|
-
|
|
487
|
-
function LinearVariantDisplayConfigFactory(pluginManager) {
|
|
488
|
-
var configSchema = linearBasicDisplayConfigSchemaFactory(pluginManager);
|
|
489
|
-
return ConfigurationSchema('LinearVariantDisplay', {}, {
|
|
490
|
-
baseConfiguration: configSchema,
|
|
491
|
-
explicitlyTyped: true
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
function createCommonjsModule(fn, module) {
|
|
496
|
-
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
500
|
-
/**
|
|
501
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
502
|
-
*
|
|
503
|
-
* This source code is licensed under the MIT license found in the
|
|
504
|
-
* LICENSE file in the root directory of this source tree.
|
|
505
|
-
*/
|
|
506
|
-
var runtime = function (exports) {
|
|
507
|
-
|
|
508
|
-
var Op = Object.prototype;
|
|
509
|
-
var hasOwn = Op.hasOwnProperty;
|
|
510
|
-
var undefined$1; // More compressible than void 0.
|
|
511
|
-
|
|
512
|
-
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
513
|
-
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
514
|
-
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
515
|
-
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
516
|
-
|
|
517
|
-
function define(obj, key, value) {
|
|
518
|
-
Object.defineProperty(obj, key, {
|
|
519
|
-
value: value,
|
|
520
|
-
enumerable: true,
|
|
521
|
-
configurable: true,
|
|
522
|
-
writable: true
|
|
523
|
-
});
|
|
524
|
-
return obj[key];
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
try {
|
|
528
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
529
|
-
define({}, "");
|
|
530
|
-
} catch (err) {
|
|
531
|
-
define = function define(obj, key, value) {
|
|
532
|
-
return obj[key] = value;
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
537
|
-
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
538
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
539
|
-
var generator = Object.create(protoGenerator.prototype);
|
|
540
|
-
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
541
|
-
// .throw, and .return methods.
|
|
542
|
-
|
|
543
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
544
|
-
return generator;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
548
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
549
|
-
// have been (and was previously) designed to take a closure to be
|
|
550
|
-
// invoked without arguments, but in all the cases we care about we
|
|
551
|
-
// already have an existing method we want to call, so there's no need
|
|
552
|
-
// to create a new function object. We can even get away with assuming
|
|
553
|
-
// the method takes exactly one argument, since that happens to be true
|
|
554
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
555
|
-
// only additional allocation required is the completion record, which
|
|
556
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
557
|
-
|
|
558
|
-
function tryCatch(fn, obj, arg) {
|
|
559
|
-
try {
|
|
560
|
-
return {
|
|
561
|
-
type: "normal",
|
|
562
|
-
arg: fn.call(obj, arg)
|
|
563
|
-
};
|
|
564
|
-
} catch (err) {
|
|
565
|
-
return {
|
|
566
|
-
type: "throw",
|
|
567
|
-
arg: err
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
var GenStateSuspendedStart = "suspendedStart";
|
|
573
|
-
var GenStateSuspendedYield = "suspendedYield";
|
|
574
|
-
var GenStateExecuting = "executing";
|
|
575
|
-
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
576
|
-
// breaking out of the dispatch switch statement.
|
|
577
|
-
|
|
578
|
-
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
579
|
-
// .constructor.prototype properties for functions that return Generator
|
|
580
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
581
|
-
// minifier not to mangle the names of these two functions.
|
|
582
|
-
|
|
583
|
-
function Generator() {}
|
|
584
|
-
|
|
585
|
-
function GeneratorFunction() {}
|
|
586
|
-
|
|
587
|
-
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
588
|
-
// don't natively support it.
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
var IteratorPrototype = {};
|
|
592
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
593
|
-
return this;
|
|
594
|
-
});
|
|
595
|
-
var getProto = Object.getPrototypeOf;
|
|
596
|
-
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
597
|
-
|
|
598
|
-
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
599
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
600
|
-
// of the polyfill.
|
|
601
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
605
|
-
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
606
|
-
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
607
|
-
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
608
|
-
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
609
|
-
// Iterator interface in terms of a single ._invoke method.
|
|
610
|
-
|
|
611
|
-
function defineIteratorMethods(prototype) {
|
|
612
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
613
|
-
define(prototype, method, function (arg) {
|
|
614
|
-
return this._invoke(method, arg);
|
|
615
|
-
});
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
exports.isGeneratorFunction = function (genFun) {
|
|
620
|
-
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
621
|
-
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
622
|
-
// do is to check its .name property.
|
|
623
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
624
|
-
};
|
|
625
|
-
|
|
626
|
-
exports.mark = function (genFun) {
|
|
627
|
-
if (Object.setPrototypeOf) {
|
|
628
|
-
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
629
|
-
} else {
|
|
630
|
-
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
631
|
-
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
genFun.prototype = Object.create(Gp);
|
|
635
|
-
return genFun;
|
|
636
|
-
}; // Within the body of any async function, `await x` is transformed to
|
|
637
|
-
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
638
|
-
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
639
|
-
// meant to be awaited.
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
exports.awrap = function (arg) {
|
|
643
|
-
return {
|
|
644
|
-
__await: arg
|
|
645
|
-
};
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
649
|
-
function invoke(method, arg, resolve, reject) {
|
|
650
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
651
|
-
|
|
652
|
-
if (record.type === "throw") {
|
|
653
|
-
reject(record.arg);
|
|
654
|
-
} else {
|
|
655
|
-
var result = record.arg;
|
|
656
|
-
var value = result.value;
|
|
657
|
-
|
|
658
|
-
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
659
|
-
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
660
|
-
invoke("next", value, resolve, reject);
|
|
661
|
-
}, function (err) {
|
|
662
|
-
invoke("throw", err, resolve, reject);
|
|
663
|
-
});
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
667
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
668
|
-
// the .value of the Promise<{value,done}> result for the
|
|
669
|
-
// current iteration.
|
|
670
|
-
result.value = unwrapped;
|
|
671
|
-
resolve(result);
|
|
672
|
-
}, function (error) {
|
|
673
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
674
|
-
// into the async generator function so it can be handled there.
|
|
675
|
-
return invoke("throw", error, resolve, reject);
|
|
676
|
-
});
|
|
677
|
-
}
|
|
678
|
-
}
|
|
679
|
-
|
|
680
|
-
var previousPromise;
|
|
681
|
-
|
|
682
|
-
function enqueue(method, arg) {
|
|
683
|
-
function callInvokeWithMethodAndArg() {
|
|
684
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
685
|
-
invoke(method, arg, resolve, reject);
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
690
|
-
// all previous Promises have been resolved before calling invoke,
|
|
691
|
-
// so that results are always delivered in the correct order. If
|
|
692
|
-
// enqueue has not been called before, then it is important to
|
|
693
|
-
// call invoke immediately, without waiting on a callback to fire,
|
|
694
|
-
// so that the async generator function has the opportunity to do
|
|
695
|
-
// any necessary setup in a predictable way. This predictability
|
|
696
|
-
// is why the Promise constructor synchronously invokes its
|
|
697
|
-
// executor callback, and why async functions synchronously
|
|
698
|
-
// execute code before the first await. Since we implement simple
|
|
699
|
-
// async functions in terms of async generators, it is especially
|
|
700
|
-
// important to get this right, even though it requires care.
|
|
701
|
-
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
702
|
-
// invocations of the iterator.
|
|
703
|
-
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
704
|
-
} // Define the unified helper method that is used to implement .next,
|
|
705
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
this._invoke = enqueue;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
defineIteratorMethods(AsyncIterator.prototype);
|
|
712
|
-
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
713
|
-
return this;
|
|
714
|
-
});
|
|
715
|
-
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
716
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
717
|
-
// the final result produced by the iterator.
|
|
718
|
-
|
|
719
|
-
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
720
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
721
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
722
|
-
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
723
|
-
: iter.next().then(function (result) {
|
|
724
|
-
return result.done ? result.value : iter.next();
|
|
725
|
-
});
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
729
|
-
var state = GenStateSuspendedStart;
|
|
730
|
-
return function invoke(method, arg) {
|
|
731
|
-
if (state === GenStateExecuting) {
|
|
732
|
-
throw new Error("Generator is already running");
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
if (state === GenStateCompleted) {
|
|
736
|
-
if (method === "throw") {
|
|
737
|
-
throw arg;
|
|
738
|
-
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
739
|
-
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
return doneResult();
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
context.method = method;
|
|
746
|
-
context.arg = arg;
|
|
747
|
-
|
|
748
|
-
while (true) {
|
|
749
|
-
var delegate = context.delegate;
|
|
750
|
-
|
|
751
|
-
if (delegate) {
|
|
752
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
753
|
-
|
|
754
|
-
if (delegateResult) {
|
|
755
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
756
|
-
return delegateResult;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
|
|
760
|
-
if (context.method === "next") {
|
|
761
|
-
// Setting context._sent for legacy support of Babel's
|
|
762
|
-
// function.sent implementation.
|
|
763
|
-
context.sent = context._sent = context.arg;
|
|
764
|
-
} else if (context.method === "throw") {
|
|
765
|
-
if (state === GenStateSuspendedStart) {
|
|
766
|
-
state = GenStateCompleted;
|
|
767
|
-
throw context.arg;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
context.dispatchException(context.arg);
|
|
771
|
-
} else if (context.method === "return") {
|
|
772
|
-
context.abrupt("return", context.arg);
|
|
773
|
-
}
|
|
774
|
-
|
|
775
|
-
state = GenStateExecuting;
|
|
776
|
-
var record = tryCatch(innerFn, self, context);
|
|
777
|
-
|
|
778
|
-
if (record.type === "normal") {
|
|
779
|
-
// If an exception is thrown from innerFn, we leave state ===
|
|
780
|
-
// GenStateExecuting and loop back for another invocation.
|
|
781
|
-
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
782
|
-
|
|
783
|
-
if (record.arg === ContinueSentinel) {
|
|
784
|
-
continue;
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
return {
|
|
788
|
-
value: record.arg,
|
|
789
|
-
done: context.done
|
|
790
|
-
};
|
|
791
|
-
} else if (record.type === "throw") {
|
|
792
|
-
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
793
|
-
// context.dispatchException(context.arg) call above.
|
|
794
|
-
|
|
795
|
-
context.method = "throw";
|
|
796
|
-
context.arg = record.arg;
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
};
|
|
800
|
-
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
801
|
-
// result, either by returning a { value, done } result from the
|
|
802
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
803
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
807
|
-
var method = delegate.iterator[context.method];
|
|
808
|
-
|
|
809
|
-
if (method === undefined$1) {
|
|
810
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
811
|
-
// method always terminates the yield* loop.
|
|
812
|
-
context.delegate = null;
|
|
813
|
-
|
|
814
|
-
if (context.method === "throw") {
|
|
815
|
-
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
816
|
-
if (delegate.iterator["return"]) {
|
|
817
|
-
// If the delegate iterator has a return method, give it a
|
|
818
|
-
// chance to clean up.
|
|
819
|
-
context.method = "return";
|
|
820
|
-
context.arg = undefined$1;
|
|
821
|
-
maybeInvokeDelegate(delegate, context);
|
|
822
|
-
|
|
823
|
-
if (context.method === "throw") {
|
|
824
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
825
|
-
// "return" to "throw", let that override the TypeError below.
|
|
826
|
-
return ContinueSentinel;
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
context.method = "throw";
|
|
831
|
-
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
return ContinueSentinel;
|
|
835
|
-
}
|
|
836
|
-
|
|
837
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
838
|
-
|
|
839
|
-
if (record.type === "throw") {
|
|
840
|
-
context.method = "throw";
|
|
841
|
-
context.arg = record.arg;
|
|
842
|
-
context.delegate = null;
|
|
843
|
-
return ContinueSentinel;
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
var info = record.arg;
|
|
847
|
-
|
|
848
|
-
if (!info) {
|
|
849
|
-
context.method = "throw";
|
|
850
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
851
|
-
context.delegate = null;
|
|
852
|
-
return ContinueSentinel;
|
|
853
|
-
}
|
|
854
|
-
|
|
855
|
-
if (info.done) {
|
|
856
|
-
// Assign the result of the finished delegate to the temporary
|
|
857
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
858
|
-
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
859
|
-
|
|
860
|
-
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
861
|
-
// exception, let the outer generator proceed normally. If
|
|
862
|
-
// context.method was "next", forget context.arg since it has been
|
|
863
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
864
|
-
// "return", allow the original .return call to continue in the
|
|
865
|
-
// outer generator.
|
|
866
|
-
|
|
867
|
-
if (context.method !== "return") {
|
|
868
|
-
context.method = "next";
|
|
869
|
-
context.arg = undefined$1;
|
|
870
|
-
}
|
|
871
|
-
} else {
|
|
872
|
-
// Re-yield the result returned by the delegate method.
|
|
873
|
-
return info;
|
|
874
|
-
} // The delegate iterator is finished, so forget it and continue with
|
|
875
|
-
// the outer generator.
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
context.delegate = null;
|
|
879
|
-
return ContinueSentinel;
|
|
880
|
-
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
881
|
-
// unified ._invoke helper method.
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
defineIteratorMethods(Gp);
|
|
885
|
-
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
886
|
-
// @@iterator function is called on it. Some browsers' implementations of the
|
|
887
|
-
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
888
|
-
// object to not be returned from this call. This ensures that doesn't happen.
|
|
889
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
890
|
-
|
|
891
|
-
define(Gp, iteratorSymbol, function () {
|
|
892
|
-
return this;
|
|
893
|
-
});
|
|
894
|
-
define(Gp, "toString", function () {
|
|
895
|
-
return "[object Generator]";
|
|
896
|
-
});
|
|
897
|
-
|
|
898
|
-
function pushTryEntry(locs) {
|
|
899
|
-
var entry = {
|
|
900
|
-
tryLoc: locs[0]
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
if (1 in locs) {
|
|
904
|
-
entry.catchLoc = locs[1];
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
if (2 in locs) {
|
|
908
|
-
entry.finallyLoc = locs[2];
|
|
909
|
-
entry.afterLoc = locs[3];
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
this.tryEntries.push(entry);
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
function resetTryEntry(entry) {
|
|
916
|
-
var record = entry.completion || {};
|
|
917
|
-
record.type = "normal";
|
|
918
|
-
delete record.arg;
|
|
919
|
-
entry.completion = record;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
function Context(tryLocsList) {
|
|
923
|
-
// The root entry object (effectively a try statement without a catch
|
|
924
|
-
// or a finally block) gives us a place to store values thrown from
|
|
925
|
-
// locations where there is no enclosing try statement.
|
|
926
|
-
this.tryEntries = [{
|
|
927
|
-
tryLoc: "root"
|
|
928
|
-
}];
|
|
929
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
930
|
-
this.reset(true);
|
|
931
|
-
}
|
|
932
|
-
|
|
933
|
-
exports.keys = function (object) {
|
|
934
|
-
var keys = [];
|
|
935
|
-
|
|
936
|
-
for (var key in object) {
|
|
937
|
-
keys.push(key);
|
|
938
|
-
}
|
|
939
|
-
|
|
940
|
-
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
941
|
-
// things simple and return the next function itself.
|
|
942
|
-
|
|
943
|
-
return function next() {
|
|
944
|
-
while (keys.length) {
|
|
945
|
-
var key = keys.pop();
|
|
946
|
-
|
|
947
|
-
if (key in object) {
|
|
948
|
-
next.value = key;
|
|
949
|
-
next.done = false;
|
|
950
|
-
return next;
|
|
951
|
-
}
|
|
952
|
-
} // To avoid creating an additional object, we just hang the .value
|
|
953
|
-
// and .done properties off the next function object itself. This
|
|
954
|
-
// also ensures that the minifier will not anonymize the function.
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
next.done = true;
|
|
958
|
-
return next;
|
|
959
|
-
};
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
function values(iterable) {
|
|
963
|
-
if (iterable) {
|
|
964
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
965
|
-
|
|
966
|
-
if (iteratorMethod) {
|
|
967
|
-
return iteratorMethod.call(iterable);
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
if (typeof iterable.next === "function") {
|
|
971
|
-
return iterable;
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
if (!isNaN(iterable.length)) {
|
|
975
|
-
var i = -1,
|
|
976
|
-
next = function next() {
|
|
977
|
-
while (++i < iterable.length) {
|
|
978
|
-
if (hasOwn.call(iterable, i)) {
|
|
979
|
-
next.value = iterable[i];
|
|
980
|
-
next.done = false;
|
|
981
|
-
return next;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
|
|
985
|
-
next.value = undefined$1;
|
|
986
|
-
next.done = true;
|
|
987
|
-
return next;
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
return next.next = next;
|
|
991
|
-
}
|
|
992
|
-
} // Return an iterator with no values.
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
return {
|
|
996
|
-
next: doneResult
|
|
997
|
-
};
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
exports.values = values;
|
|
1001
|
-
|
|
1002
|
-
function doneResult() {
|
|
1003
|
-
return {
|
|
1004
|
-
value: undefined$1,
|
|
1005
|
-
done: true
|
|
1006
|
-
};
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
Context.prototype = {
|
|
1010
|
-
constructor: Context,
|
|
1011
|
-
reset: function reset(skipTempReset) {
|
|
1012
|
-
this.prev = 0;
|
|
1013
|
-
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
1014
|
-
// function.sent implementation.
|
|
1015
|
-
|
|
1016
|
-
this.sent = this._sent = undefined$1;
|
|
1017
|
-
this.done = false;
|
|
1018
|
-
this.delegate = null;
|
|
1019
|
-
this.method = "next";
|
|
1020
|
-
this.arg = undefined$1;
|
|
1021
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
1022
|
-
|
|
1023
|
-
if (!skipTempReset) {
|
|
1024
|
-
for (var name in this) {
|
|
1025
|
-
// Not sure about the optimal order of these conditions:
|
|
1026
|
-
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
1027
|
-
this[name] = undefined$1;
|
|
1028
|
-
}
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
},
|
|
1032
|
-
stop: function stop() {
|
|
1033
|
-
this.done = true;
|
|
1034
|
-
var rootEntry = this.tryEntries[0];
|
|
1035
|
-
var rootRecord = rootEntry.completion;
|
|
1036
|
-
|
|
1037
|
-
if (rootRecord.type === "throw") {
|
|
1038
|
-
throw rootRecord.arg;
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
return this.rval;
|
|
1042
|
-
},
|
|
1043
|
-
dispatchException: function dispatchException(exception) {
|
|
1044
|
-
if (this.done) {
|
|
1045
|
-
throw exception;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
var context = this;
|
|
1049
|
-
|
|
1050
|
-
function handle(loc, caught) {
|
|
1051
|
-
record.type = "throw";
|
|
1052
|
-
record.arg = exception;
|
|
1053
|
-
context.next = loc;
|
|
1054
|
-
|
|
1055
|
-
if (caught) {
|
|
1056
|
-
// If the dispatched exception was caught by a catch block,
|
|
1057
|
-
// then let that catch block handle the exception normally.
|
|
1058
|
-
context.method = "next";
|
|
1059
|
-
context.arg = undefined$1;
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
|
-
return !!caught;
|
|
1063
|
-
}
|
|
1064
|
-
|
|
1065
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1066
|
-
var entry = this.tryEntries[i];
|
|
1067
|
-
var record = entry.completion;
|
|
1068
|
-
|
|
1069
|
-
if (entry.tryLoc === "root") {
|
|
1070
|
-
// Exception thrown outside of any try block that could handle
|
|
1071
|
-
// it, so set the completion value of the entire function to
|
|
1072
|
-
// throw the exception.
|
|
1073
|
-
return handle("end");
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
if (entry.tryLoc <= this.prev) {
|
|
1077
|
-
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
1078
|
-
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1079
|
-
|
|
1080
|
-
if (hasCatch && hasFinally) {
|
|
1081
|
-
if (this.prev < entry.catchLoc) {
|
|
1082
|
-
return handle(entry.catchLoc, true);
|
|
1083
|
-
} else if (this.prev < entry.finallyLoc) {
|
|
1084
|
-
return handle(entry.finallyLoc);
|
|
1085
|
-
}
|
|
1086
|
-
} else if (hasCatch) {
|
|
1087
|
-
if (this.prev < entry.catchLoc) {
|
|
1088
|
-
return handle(entry.catchLoc, true);
|
|
1089
|
-
}
|
|
1090
|
-
} else if (hasFinally) {
|
|
1091
|
-
if (this.prev < entry.finallyLoc) {
|
|
1092
|
-
return handle(entry.finallyLoc);
|
|
1093
|
-
}
|
|
1094
|
-
} else {
|
|
1095
|
-
throw new Error("try statement without catch or finally");
|
|
1096
|
-
}
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
},
|
|
1100
|
-
abrupt: function abrupt(type, arg) {
|
|
1101
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1102
|
-
var entry = this.tryEntries[i];
|
|
1103
|
-
|
|
1104
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1105
|
-
var finallyEntry = entry;
|
|
1106
|
-
break;
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
1111
|
-
// Ignore the finally entry if control is not jumping to a
|
|
1112
|
-
// location outside the try/catch block.
|
|
1113
|
-
finallyEntry = null;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1117
|
-
record.type = type;
|
|
1118
|
-
record.arg = arg;
|
|
1119
|
-
|
|
1120
|
-
if (finallyEntry) {
|
|
1121
|
-
this.method = "next";
|
|
1122
|
-
this.next = finallyEntry.finallyLoc;
|
|
1123
|
-
return ContinueSentinel;
|
|
1124
|
-
}
|
|
1125
|
-
|
|
1126
|
-
return this.complete(record);
|
|
1127
|
-
},
|
|
1128
|
-
complete: function complete(record, afterLoc) {
|
|
1129
|
-
if (record.type === "throw") {
|
|
1130
|
-
throw record.arg;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
if (record.type === "break" || record.type === "continue") {
|
|
1134
|
-
this.next = record.arg;
|
|
1135
|
-
} else if (record.type === "return") {
|
|
1136
|
-
this.rval = this.arg = record.arg;
|
|
1137
|
-
this.method = "return";
|
|
1138
|
-
this.next = "end";
|
|
1139
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
1140
|
-
this.next = afterLoc;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
return ContinueSentinel;
|
|
1144
|
-
},
|
|
1145
|
-
finish: function finish(finallyLoc) {
|
|
1146
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1147
|
-
var entry = this.tryEntries[i];
|
|
1148
|
-
|
|
1149
|
-
if (entry.finallyLoc === finallyLoc) {
|
|
1150
|
-
this.complete(entry.completion, entry.afterLoc);
|
|
1151
|
-
resetTryEntry(entry);
|
|
1152
|
-
return ContinueSentinel;
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
},
|
|
1156
|
-
"catch": function _catch(tryLoc) {
|
|
1157
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1158
|
-
var entry = this.tryEntries[i];
|
|
1159
|
-
|
|
1160
|
-
if (entry.tryLoc === tryLoc) {
|
|
1161
|
-
var record = entry.completion;
|
|
1162
|
-
|
|
1163
|
-
if (record.type === "throw") {
|
|
1164
|
-
var thrown = record.arg;
|
|
1165
|
-
resetTryEntry(entry);
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
return thrown;
|
|
1169
|
-
}
|
|
1170
|
-
} // The context.catch method must only be called with a location
|
|
1171
|
-
// argument that corresponds to a known catch block.
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
throw new Error("illegal catch attempt");
|
|
1175
|
-
},
|
|
1176
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1177
|
-
this.delegate = {
|
|
1178
|
-
iterator: values(iterable),
|
|
1179
|
-
resultName: resultName,
|
|
1180
|
-
nextLoc: nextLoc
|
|
1181
|
-
};
|
|
1182
|
-
|
|
1183
|
-
if (this.method === "next") {
|
|
1184
|
-
// Deliberately forget the last sent value so that we don't
|
|
1185
|
-
// accidentally pass it on to the delegate.
|
|
1186
|
-
this.arg = undefined$1;
|
|
1187
|
-
}
|
|
1188
|
-
|
|
1189
|
-
return ContinueSentinel;
|
|
1190
|
-
}
|
|
1191
|
-
}; // Regardless of whether this script is executing as a CommonJS module
|
|
1192
|
-
// or not, return the runtime object so that we can declare the variable
|
|
1193
|
-
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
1194
|
-
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
1195
|
-
|
|
1196
|
-
return exports;
|
|
1197
|
-
}( // If this script is executing as a CommonJS module, use module.exports
|
|
1198
|
-
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
1199
|
-
// object. Either way, the resulting object will be used to initialize
|
|
1200
|
-
// the regeneratorRuntime variable at the top of this file.
|
|
1201
|
-
module.exports );
|
|
1202
|
-
|
|
1203
|
-
try {
|
|
1204
|
-
regeneratorRuntime = runtime;
|
|
1205
|
-
} catch (accidentalStrictMode) {
|
|
1206
|
-
// This module should not be running in strict mode, so the above
|
|
1207
|
-
// assignment should always work unless something is misconfigured. Just
|
|
1208
|
-
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1209
|
-
// we can explicitly access globalThis. In older engines we can escape
|
|
1210
|
-
// strict mode using a global Function call. This could conceivably fail
|
|
1211
|
-
// if a Content Security Policy forbids using Function, but in that case
|
|
1212
|
-
// the proper solution is to fix the accidental strict mode problem. If
|
|
1213
|
-
// you've misconfigured your bundler to force strict mode and applied a
|
|
1214
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1215
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
1216
|
-
if (typeof globalThis === "object") {
|
|
1217
|
-
globalThis.regeneratorRuntime = runtime;
|
|
1218
|
-
} else {
|
|
1219
|
-
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
});
|
|
1223
|
-
|
|
1224
|
-
function linearVariantDisplayModelFactory (configSchema) {
|
|
1225
|
-
return types.compose('LinearVariantDisplay', linearBasicDisplayModelFactory(configSchema), types.model({
|
|
1226
|
-
type: types.literal('LinearVariantDisplay'),
|
|
1227
|
-
configuration: ConfigurationReference(configSchema)
|
|
1228
|
-
})).actions(function (self) {
|
|
1229
|
-
return {
|
|
1230
|
-
selectFeature: function selectFeature(feature) {
|
|
1231
|
-
return _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1232
|
-
var session, rpcManager, sessionId, track, adapterConfig, header, featureWidget;
|
|
1233
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1234
|
-
while (1) {
|
|
1235
|
-
switch (_context.prev = _context.next) {
|
|
1236
|
-
case 0:
|
|
1237
|
-
session = getSession(self);
|
|
1238
|
-
|
|
1239
|
-
if (!isSessionModelWithWidgets(session)) {
|
|
1240
|
-
_context.next = 11;
|
|
1241
|
-
break;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
rpcManager = session.rpcManager;
|
|
1245
|
-
sessionId = getRpcSessionId(self);
|
|
1246
|
-
track = getContainingTrack(self);
|
|
1247
|
-
adapterConfig = getConf(track, 'adapter');
|
|
1248
|
-
_context.next = 8;
|
|
1249
|
-
return rpcManager.call(sessionId, 'CoreGetMetadata', {
|
|
1250
|
-
adapterConfig: adapterConfig
|
|
1251
|
-
});
|
|
1252
|
-
|
|
1253
|
-
case 8:
|
|
1254
|
-
header = _context.sent;
|
|
1255
|
-
featureWidget = session.addWidget('VariantFeatureWidget', 'variantFeature', {
|
|
1256
|
-
featureData: feature.toJSON(),
|
|
1257
|
-
view: getContainingView(self),
|
|
1258
|
-
descriptions: header
|
|
1259
|
-
});
|
|
1260
|
-
session.showWidget(featureWidget);
|
|
1261
|
-
|
|
1262
|
-
case 11:
|
|
1263
|
-
session.setSelection(feature);
|
|
1264
|
-
|
|
1265
|
-
case 12:
|
|
1266
|
-
case "end":
|
|
1267
|
-
return _context.stop();
|
|
1268
|
-
}
|
|
1269
|
-
}
|
|
1270
|
-
}, _callee);
|
|
1271
|
-
}))();
|
|
1272
|
-
}
|
|
1273
|
-
};
|
|
1274
|
-
});
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
function bpToRadians(block, pos) {
|
|
1278
|
-
var blockStart = block.region.elided ? 0 : block.region.start;
|
|
1279
|
-
var blockEnd = block.region.elided ? 0 : block.region.end;
|
|
1280
|
-
var bpOffset = block.flipped ? blockEnd - pos : pos - blockStart;
|
|
1281
|
-
var radians = bpOffset / block.bpPerRadian + block.startRadians;
|
|
1282
|
-
return radians;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
var Chord = /*#__PURE__*/observer(function Chord(_ref) {
|
|
1286
|
-
var _feature$get;
|
|
1287
|
-
|
|
1288
|
-
var feature = _ref.feature,
|
|
1289
|
-
blocksForRefs = _ref.blocksForRefs,
|
|
1290
|
-
radius = _ref.radius,
|
|
1291
|
-
config = _ref.config,
|
|
1292
|
-
bezierRadius = _ref.bezierRadius,
|
|
1293
|
-
selected = _ref.selected,
|
|
1294
|
-
_onClick = _ref.onClick;
|
|
1295
|
-
// find the blocks that our start and end points belong to
|
|
1296
|
-
var startBlock = blocksForRefs[feature.get('refName')];
|
|
1297
|
-
|
|
1298
|
-
if (!startBlock) {
|
|
1299
|
-
return null;
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
var svType;
|
|
1303
|
-
|
|
1304
|
-
if (feature.get('INFO')) {
|
|
1305
|
-
|
|
1306
|
-
var _ref2 = feature.get('INFO').SVTYPE || [];
|
|
1307
|
-
|
|
1308
|
-
var _ref3 = _slicedToArray(_ref2, 1);
|
|
1309
|
-
|
|
1310
|
-
svType = _ref3[0];
|
|
1311
|
-
} else if (feature.get('mate')) {
|
|
1312
|
-
svType = 'mate';
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
var endPosition;
|
|
1316
|
-
var endBlock;
|
|
1317
|
-
var alt = (_feature$get = feature.get('ALT')) === null || _feature$get === void 0 ? void 0 : _feature$get[0];
|
|
1318
|
-
var bnd = alt && parseBreakend(alt);
|
|
1319
|
-
|
|
1320
|
-
if (bnd) {
|
|
1321
|
-
// VCF BND
|
|
1322
|
-
var matePosition = bnd.MatePosition.split(':');
|
|
1323
|
-
endPosition = +matePosition[1];
|
|
1324
|
-
endBlock = blocksForRefs[matePosition[0]];
|
|
1325
|
-
} else if (alt === '<TRA>') {
|
|
1326
|
-
var _feature$get2, _feature$get2$CHR, _feature$get3, _feature$get3$END;
|
|
1327
|
-
|
|
1328
|
-
// VCF TRA
|
|
1329
|
-
var chr2 = (_feature$get2 = feature.get('INFO')) === null || _feature$get2 === void 0 ? void 0 : (_feature$get2$CHR = _feature$get2.CHR2) === null || _feature$get2$CHR === void 0 ? void 0 : _feature$get2$CHR[0];
|
|
1330
|
-
var end = (_feature$get3 = feature.get('INFO')) === null || _feature$get3 === void 0 ? void 0 : (_feature$get3$END = _feature$get3.END) === null || _feature$get3$END === void 0 ? void 0 : _feature$get3$END[0];
|
|
1331
|
-
endPosition = parseInt(end, 10);
|
|
1332
|
-
endBlock = blocksForRefs[chr2];
|
|
1333
|
-
} else if (svType === 'mate') {
|
|
1334
|
-
// generic simplefeatures arcs
|
|
1335
|
-
var mate = feature.get('mate');
|
|
1336
|
-
var _chr = mate.refName;
|
|
1337
|
-
endPosition = mate.start;
|
|
1338
|
-
endBlock = blocksForRefs[_chr];
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
if (endBlock) {
|
|
1342
|
-
var startPos = feature.get('start');
|
|
1343
|
-
var startRadians = bpToRadians(startBlock, startPos);
|
|
1344
|
-
var endRadians = bpToRadians(endBlock, endPosition);
|
|
1345
|
-
var startXY = polarToCartesian(radius, startRadians);
|
|
1346
|
-
var endXY = polarToCartesian(radius, endRadians);
|
|
1347
|
-
var controlXY = polarToCartesian(bezierRadius, (endRadians + startRadians) / 2);
|
|
1348
|
-
var strokeColor = selected ? readConfObject(config, 'strokeColorSelected', {
|
|
1349
|
-
feature: feature
|
|
1350
|
-
}) : readConfObject(config, 'strokeColor', {
|
|
1351
|
-
feature: feature
|
|
1352
|
-
});
|
|
1353
|
-
var hoverStrokeColor = readConfObject(config, 'strokeColorHover', {
|
|
1354
|
-
feature: feature
|
|
1355
|
-
});
|
|
1356
|
-
return /*#__PURE__*/React.createElement("path", {
|
|
1357
|
-
"data-testid": "chord-".concat(feature.id()),
|
|
1358
|
-
d: ['M'].concat(_toConsumableArray(startXY), ['Q'], _toConsumableArray(controlXY), _toConsumableArray(endXY)).join(' '),
|
|
1359
|
-
style: {
|
|
1360
|
-
stroke: strokeColor
|
|
1361
|
-
},
|
|
1362
|
-
onClick: function onClick(evt) {
|
|
1363
|
-
return _onClick(feature, startBlock.region, endBlock.region, evt);
|
|
1364
|
-
},
|
|
1365
|
-
onMouseOver: function onMouseOver(evt) {
|
|
1366
|
-
if (!selected) {
|
|
1367
|
-
evt.target.style.stroke = hoverStrokeColor;
|
|
1368
|
-
evt.target.style.strokeWidth = 3;
|
|
1369
|
-
}
|
|
1370
|
-
},
|
|
1371
|
-
onMouseOut: function onMouseOut(evt) {
|
|
1372
|
-
if (!selected) {
|
|
1373
|
-
evt.target.style.stroke = strokeColor;
|
|
1374
|
-
evt.target.style.strokeWidth = 1;
|
|
1375
|
-
}
|
|
1376
|
-
}
|
|
1377
|
-
});
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
return null;
|
|
1381
|
-
});
|
|
1382
|
-
|
|
1383
|
-
function StructuralVariantChords(props) {
|
|
1384
|
-
var features = props.features,
|
|
1385
|
-
config = props.config,
|
|
1386
|
-
displayModel = props.displayModel,
|
|
1387
|
-
blockDefinitions = props.blockDefinitions,
|
|
1388
|
-
radius = props.radius,
|
|
1389
|
-
bezierRadius = props.bezierRadius,
|
|
1390
|
-
selectedFeatureId = props.displayModel.selectedFeatureId,
|
|
1391
|
-
onChordClick = props.onChordClick; // make a map of refName -> blockDefinition
|
|
1392
|
-
|
|
1393
|
-
var blocksForRefsMemo = useMemo(function () {
|
|
1394
|
-
var blocksForRefs = {};
|
|
1395
|
-
blockDefinitions.forEach(function (block) {
|
|
1396
|
-
var regions = block.region.elided ? block.region.regions : [block.region];
|
|
1397
|
-
regions.forEach(function (region) {
|
|
1398
|
-
blocksForRefs[region.refName] = block;
|
|
1399
|
-
});
|
|
1400
|
-
});
|
|
1401
|
-
return blocksForRefs;
|
|
1402
|
-
}, [blockDefinitions]); // console.log(blocksForRefs)
|
|
1403
|
-
|
|
1404
|
-
var chords = [];
|
|
1405
|
-
|
|
1406
|
-
var _iterator = _createForOfIteratorHelper(features),
|
|
1407
|
-
_step;
|
|
1408
|
-
|
|
1409
|
-
try {
|
|
1410
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1411
|
-
var _step$value = _slicedToArray(_step.value, 2),
|
|
1412
|
-
id = _step$value[0],
|
|
1413
|
-
feature = _step$value[1];
|
|
1414
|
-
|
|
1415
|
-
var selected = String(selectedFeatureId) === String(feature.id());
|
|
1416
|
-
chords.push( /*#__PURE__*/React.createElement(Chord, {
|
|
1417
|
-
key: id,
|
|
1418
|
-
feature: feature,
|
|
1419
|
-
config: config,
|
|
1420
|
-
displayModel: displayModel,
|
|
1421
|
-
radius: radius,
|
|
1422
|
-
bezierRadius: bezierRadius,
|
|
1423
|
-
blocksForRefs: blocksForRefsMemo,
|
|
1424
|
-
selected: selected,
|
|
1425
|
-
onClick: onChordClick
|
|
1426
|
-
}));
|
|
1427
|
-
}
|
|
1428
|
-
} catch (err) {
|
|
1429
|
-
_iterator.e(err);
|
|
1430
|
-
} finally {
|
|
1431
|
-
_iterator.f();
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
var trackStyleId = "chords-".concat(displayModel.id);
|
|
1435
|
-
return /*#__PURE__*/React.createElement("g", {
|
|
1436
|
-
id: trackStyleId,
|
|
1437
|
-
"data-testid": "structuralVariantChordRenderer"
|
|
1438
|
-
}, /*#__PURE__*/React.createElement("style", {
|
|
1439
|
-
// eslint-disable-next-line react/no-danger
|
|
1440
|
-
dangerouslySetInnerHTML: {
|
|
1441
|
-
__html: "\n #".concat(trackStyleId, " > path {\n cursor: crosshair;\n fill: none;\n }\n")
|
|
1442
|
-
}
|
|
1443
|
-
}), chords);
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
StructuralVariantChords.propTypes = {
|
|
1447
|
-
features: /*#__PURE__*/PropTypes.instanceOf(Map).isRequired,
|
|
1448
|
-
config: PropTypes$1.ConfigSchema.isRequired,
|
|
1449
|
-
displayModel: PropTypes$2.objectOrObservableObject,
|
|
1450
|
-
blockDefinitions: /*#__PURE__*/PropTypes.arrayOf(PropTypes$2.objectOrObservableObject).isRequired,
|
|
1451
|
-
radius: PropTypes.number.isRequired,
|
|
1452
|
-
bezierRadius: PropTypes.number.isRequired,
|
|
1453
|
-
selectedFeatureId: PropTypes.string,
|
|
1454
|
-
onChordClick: /*#__PURE__*/PropTypes.oneOfType([PropTypes.func, PropTypes.string])
|
|
1455
|
-
};
|
|
1456
|
-
StructuralVariantChords.defaultProps = {
|
|
1457
|
-
displayModel: undefined,
|
|
1458
|
-
selectedFeatureId: '',
|
|
1459
|
-
onChordClick: undefined
|
|
1460
|
-
};
|
|
1461
|
-
var ReactComponent = /*#__PURE__*/observer(StructuralVariantChords);
|
|
1462
|
-
|
|
1463
|
-
var ChordRendererConfigF = function ChordRendererConfigF(pluginManager) {
|
|
1464
|
-
var configSchema = ConfigurationSchema('StructuralVariantChordRenderer', {
|
|
1465
|
-
strokeColor: {
|
|
1466
|
-
type: 'color',
|
|
1467
|
-
description: 'the line color of each arc',
|
|
1468
|
-
defaultValue: 'rgba(255,133,0,0.32)',
|
|
1469
|
-
contextVariable: ['feature']
|
|
1470
|
-
},
|
|
1471
|
-
strokeColorSelected: {
|
|
1472
|
-
type: 'color',
|
|
1473
|
-
description: 'the line color of an arc that has been selected',
|
|
1474
|
-
defaultValue: 'black',
|
|
1475
|
-
contextVariable: ['feature']
|
|
1476
|
-
},
|
|
1477
|
-
strokeColorHover: {
|
|
1478
|
-
type: 'color',
|
|
1479
|
-
description: 'the line color of an arc that is being hovered over with the mouse',
|
|
1480
|
-
defaultValue: '#555',
|
|
1481
|
-
contextVariable: ['feature']
|
|
1482
|
-
}
|
|
1483
|
-
}, {
|
|
1484
|
-
explicitlyTyped: true
|
|
1485
|
-
});
|
|
1486
|
-
return new ChordRendererType({
|
|
1487
|
-
name: 'StructuralVariantChordRenderer',
|
|
1488
|
-
ReactComponent: ReactComponent,
|
|
1489
|
-
configSchema: configSchema,
|
|
1490
|
-
pluginManager: pluginManager
|
|
1491
|
-
});
|
|
1492
|
-
};
|
|
1493
|
-
|
|
1494
|
-
var configSchema = /*#__PURE__*/ConfigurationSchema('VariantFeatureWidget', {});
|
|
1495
|
-
function stateModelFactory(pluginManager) {
|
|
1496
|
-
return types.model('VariantFeatureWidget', {
|
|
1497
|
-
id: ElementId,
|
|
1498
|
-
type: types.literal('VariantFeatureWidget'),
|
|
1499
|
-
view: types.safeReference(pluginManager.pluggableMstType('view', 'stateModel')),
|
|
1500
|
-
featureData: types.frozen(),
|
|
1501
|
-
descriptions: types.frozen()
|
|
1502
|
-
}).actions(function (self) {
|
|
1503
|
-
return {
|
|
1504
|
-
setFeatureData: function setFeatureData(data) {
|
|
1505
|
-
self.featureData = data;
|
|
1506
|
-
},
|
|
1507
|
-
clearFeatureData: function clearFeatureData() {
|
|
1508
|
-
self.featureData = undefined;
|
|
1509
|
-
}
|
|
1510
|
-
};
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
|
|
1514
|
-
var vcfTabixAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('VcfTabixAdapter', {
|
|
1515
|
-
vcfGzLocation: {
|
|
1516
|
-
type: 'fileLocation',
|
|
1517
|
-
defaultValue: {
|
|
1518
|
-
uri: '/path/to/my.vcf.gz',
|
|
1519
|
-
locationType: 'UriLocation'
|
|
1520
|
-
}
|
|
1521
|
-
},
|
|
1522
|
-
index: /*#__PURE__*/ConfigurationSchema('VcfIndex', {
|
|
1523
|
-
indexType: {
|
|
1524
|
-
model: /*#__PURE__*/types.enumeration('IndexType', ['TBI', 'CSI']),
|
|
1525
|
-
type: 'stringEnum',
|
|
1526
|
-
defaultValue: 'TBI'
|
|
1527
|
-
},
|
|
1528
|
-
location: {
|
|
1529
|
-
type: 'fileLocation',
|
|
1530
|
-
defaultValue: {
|
|
1531
|
-
uri: '/path/to/my.vcf.gz.tbi',
|
|
1532
|
-
locationType: 'UriLocation'
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
})
|
|
1536
|
-
}, {
|
|
1537
|
-
explicitlyTyped: true
|
|
1538
|
-
});
|
|
1539
|
-
|
|
1540
|
-
var vcfAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('VcfAdapter', {
|
|
1541
|
-
vcfLocation: {
|
|
1542
|
-
type: 'fileLocation',
|
|
1543
|
-
defaultValue: {
|
|
1544
|
-
uri: '/path/to/my.vcf',
|
|
1545
|
-
locationType: 'UriLocation'
|
|
1546
|
-
}
|
|
1547
|
-
}
|
|
1548
|
-
}, {
|
|
1549
|
-
explicitlyTyped: true
|
|
1550
|
-
});
|
|
1551
|
-
|
|
1552
|
-
var VCFFeature = /*#__PURE__*/function () {
|
|
1553
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1554
|
-
function VCFFeature(args) {
|
|
1555
|
-
_classCallCheck(this, VCFFeature);
|
|
1556
|
-
|
|
1557
|
-
this.variant = args.variant;
|
|
1558
|
-
this.parser = args.parser;
|
|
1559
|
-
this.data = this.dataFromVariant(this.variant);
|
|
1560
|
-
this._id = args.id;
|
|
1561
|
-
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
_createClass(VCFFeature, [{
|
|
1565
|
-
key: "get",
|
|
1566
|
-
value: function get(field) {
|
|
1567
|
-
return field === 'samples' ? this.variant.SAMPLES : this.data[field] || this.variant[field];
|
|
1568
|
-
}
|
|
1569
|
-
}, {
|
|
1570
|
-
key: "set",
|
|
1571
|
-
value: function set() {}
|
|
1572
|
-
}, {
|
|
1573
|
-
key: "parent",
|
|
1574
|
-
value: function parent() {
|
|
1575
|
-
return undefined;
|
|
1576
|
-
}
|
|
1577
|
-
}, {
|
|
1578
|
-
key: "children",
|
|
1579
|
-
value: function children() {
|
|
1580
|
-
return undefined;
|
|
1581
|
-
}
|
|
1582
|
-
}, {
|
|
1583
|
-
key: "tags",
|
|
1584
|
-
value: function tags() {
|
|
1585
|
-
var t = [].concat(_toConsumableArray(Object.keys(this.data)), _toConsumableArray(Object.keys(this.variant)), ['samples']);
|
|
1586
|
-
return t;
|
|
1587
|
-
}
|
|
1588
|
-
}, {
|
|
1589
|
-
key: "id",
|
|
1590
|
-
value: function id() {
|
|
1591
|
-
return this._id;
|
|
1592
|
-
}
|
|
1593
|
-
}, {
|
|
1594
|
-
key: "dataFromVariant",
|
|
1595
|
-
value: function dataFromVariant(variant) {
|
|
1596
|
-
var REF = variant.REF,
|
|
1597
|
-
ALT = variant.ALT,
|
|
1598
|
-
POS = variant.POS,
|
|
1599
|
-
CHROM = variant.CHROM,
|
|
1600
|
-
INFO = variant.INFO,
|
|
1601
|
-
ID = variant.ID;
|
|
1602
|
-
var start = POS - 1;
|
|
1603
|
-
|
|
1604
|
-
var _this$_getSOTermAndDe = this._getSOTermAndDescription(REF, ALT),
|
|
1605
|
-
_this$_getSOTermAndDe2 = _slicedToArray(_this$_getSOTermAndDe, 2),
|
|
1606
|
-
SO_term = _this$_getSOTermAndDe2[0],
|
|
1607
|
-
description = _this$_getSOTermAndDe2[1];
|
|
1608
|
-
|
|
1609
|
-
var isTRA = ALT === null || ALT === void 0 ? void 0 : ALT.some(function (f) {
|
|
1610
|
-
return f === '<TRA>';
|
|
1611
|
-
});
|
|
1612
|
-
var isSymbolic = ALT === null || ALT === void 0 ? void 0 : ALT.some(function (f) {
|
|
1613
|
-
return f.indexOf('<') !== -1;
|
|
1614
|
-
});
|
|
1615
|
-
return {
|
|
1616
|
-
refName: CHROM,
|
|
1617
|
-
start: start,
|
|
1618
|
-
end: isSymbolic && INFO.END && !isTRA ? +INFO.END[0] : start + REF.length,
|
|
1619
|
-
description: description,
|
|
1620
|
-
type: SO_term,
|
|
1621
|
-
name: ID === null || ID === void 0 ? void 0 : ID.join(','),
|
|
1622
|
-
aliases: ID && ID.length > 1 ? variant.ID.slice(1) : undefined
|
|
1623
|
-
};
|
|
1624
|
-
}
|
|
1625
|
-
/**
|
|
1626
|
-
* Get a sequence ontology (SO) term that describes the variant type
|
|
1627
|
-
*/
|
|
1628
|
-
|
|
1629
|
-
}, {
|
|
1630
|
-
key: "_getSOTermAndDescription",
|
|
1631
|
-
value: function _getSOTermAndDescription(ref, alt) {
|
|
1632
|
-
var _this = this;
|
|
1633
|
-
|
|
1634
|
-
// it's just a remark if there are no alternate alleles
|
|
1635
|
-
if (!alt || alt === []) {
|
|
1636
|
-
return ['remark', 'no alternative alleles'];
|
|
1637
|
-
}
|
|
1638
|
-
|
|
1639
|
-
var soTerms = new Set();
|
|
1640
|
-
var descriptions = new Set();
|
|
1641
|
-
alt.forEach(function (a) {
|
|
1642
|
-
var _this$_getSOAndDescFr = _this._getSOAndDescFromAltDefs(ref, a),
|
|
1643
|
-
_this$_getSOAndDescFr2 = _slicedToArray(_this$_getSOAndDescFr, 2),
|
|
1644
|
-
soTerm = _this$_getSOAndDescFr2[0],
|
|
1645
|
-
description = _this$_getSOAndDescFr2[1];
|
|
1646
|
-
|
|
1647
|
-
if (!soTerm) {
|
|
1648
|
-
|
|
1649
|
-
var _this$_getSOAndDescBy = _this._getSOAndDescByExamination(ref, a);
|
|
1650
|
-
|
|
1651
|
-
var _this$_getSOAndDescBy2 = _slicedToArray(_this$_getSOAndDescBy, 2);
|
|
1652
|
-
|
|
1653
|
-
soTerm = _this$_getSOAndDescBy2[0];
|
|
1654
|
-
description = _this$_getSOAndDescBy2[1];
|
|
1655
|
-
}
|
|
1656
|
-
|
|
1657
|
-
if (soTerm && description) {
|
|
1658
|
-
soTerms.add(soTerm);
|
|
1659
|
-
descriptions.add(description);
|
|
1660
|
-
}
|
|
1661
|
-
}); // Combine descriptions like ["SNV G -> A", "SNV G -> T"] to ["SNV G -> A,T"]
|
|
1662
|
-
|
|
1663
|
-
if (descriptions.size > 1) {
|
|
1664
|
-
var prefixes = new Set(_toConsumableArray(descriptions).map(function (desc) {
|
|
1665
|
-
var prefix = desc.split('->');
|
|
1666
|
-
return prefix[1] ? prefix[0] : desc;
|
|
1667
|
-
}));
|
|
1668
|
-
|
|
1669
|
-
var new_descs = _toConsumableArray(prefixes).map(function (prefix) {
|
|
1670
|
-
var suffixes = _toConsumableArray(descriptions).map(function (desc) {
|
|
1671
|
-
var pref = desc.split('-> ');
|
|
1672
|
-
return pref[1] && pref[0] === prefix ? pref[1] : '';
|
|
1673
|
-
}).filter(function (f) {
|
|
1674
|
-
return !!f;
|
|
1675
|
-
});
|
|
1676
|
-
|
|
1677
|
-
return suffixes.length ? prefix + '-> ' + suffixes.join(',') : _toConsumableArray(descriptions).join(',');
|
|
1678
|
-
});
|
|
1679
|
-
|
|
1680
|
-
descriptions = new Set(new_descs);
|
|
1681
|
-
}
|
|
1682
|
-
|
|
1683
|
-
if (soTerms.size) {
|
|
1684
|
-
return [_toConsumableArray(soTerms).join(','), _toConsumableArray(descriptions).join(',')];
|
|
1685
|
-
}
|
|
1686
|
-
|
|
1687
|
-
return [undefined, undefined];
|
|
1688
|
-
}
|
|
1689
|
-
}, {
|
|
1690
|
-
key: "_getSOAndDescFromAltDefs",
|
|
1691
|
-
value: function _getSOAndDescFromAltDefs(ref, alt) {
|
|
1692
|
-
if (typeof alt === 'string' && !alt.startsWith('<')) {
|
|
1693
|
-
return [undefined, undefined];
|
|
1694
|
-
} // look for a definition with an SO type for this
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
var soTerm = VCFFeature._altTypeToSO[alt]; // if no SO term but ALT is in metadata, assume sequence_variant
|
|
1698
|
-
|
|
1699
|
-
if (!soTerm && this.parser.getMetadata('ALT', alt)) {
|
|
1700
|
-
soTerm = 'sequence_variant';
|
|
1701
|
-
}
|
|
1702
|
-
|
|
1703
|
-
if (soTerm) {
|
|
1704
|
-
return [soTerm, alt];
|
|
1705
|
-
} // try to look for a definition for a parent term if we can
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
var modAlt = alt.split(':');
|
|
1709
|
-
|
|
1710
|
-
if (modAlt.length > 1) {
|
|
1711
|
-
return this._getSOAndDescFromAltDefs(ref, "<".concat(modAlt.slice(0, modAlt.length - 1).join(':'), ">"));
|
|
1712
|
-
} // no parent
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
return [undefined, undefined];
|
|
1716
|
-
} // note: term SNV is used instead of SNP because SO definition of SNP says
|
|
1717
|
-
// abundance must be at least 1% in population, and can't be sure we meet
|
|
1718
|
-
// that
|
|
1719
|
-
|
|
1720
|
-
}, {
|
|
1721
|
-
key: "_getSOAndDescByExamination",
|
|
1722
|
-
value: function _getSOAndDescByExamination(ref, alt) {
|
|
1723
|
-
var bnd = parseBreakend(alt);
|
|
1724
|
-
|
|
1725
|
-
if (bnd) {
|
|
1726
|
-
return ['breakend', alt];
|
|
1727
|
-
} else if (ref.length === 1 && alt.length === 1) {
|
|
1728
|
-
return ['SNV', this._makeDescriptionString('SNV', ref, alt)];
|
|
1729
|
-
} else if (alt === '<INS>') {
|
|
1730
|
-
return ['insertion', alt];
|
|
1731
|
-
} else if (alt === '<DEL>') {
|
|
1732
|
-
return ['deletion', alt];
|
|
1733
|
-
} else if (alt === '<INV>') {
|
|
1734
|
-
return ['deletion', alt];
|
|
1735
|
-
} else if (alt === '<TRA>') {
|
|
1736
|
-
return ['translocation', alt];
|
|
1737
|
-
} else if (alt.includes('<')) {
|
|
1738
|
-
return ['sv', alt];
|
|
1739
|
-
} else if (ref.length === alt.length) {
|
|
1740
|
-
if (ref.split('').reverse().join('') === alt) {
|
|
1741
|
-
return ['inversion', this._makeDescriptionString('inversion', ref, alt)];
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
return ['substitution', this._makeDescriptionString('substitution', ref, alt)];
|
|
1745
|
-
} else if (ref.length <= alt.length) {
|
|
1746
|
-
return ['insertion', this._makeDescriptionString('insertion', ref, alt)];
|
|
1747
|
-
} else if (ref.length > alt.length) {
|
|
1748
|
-
return ['deletion', this._makeDescriptionString('deletion', ref, alt)];
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
return ['indel', this._makeDescriptionString('indel', ref, alt)];
|
|
1752
|
-
}
|
|
1753
|
-
}, {
|
|
1754
|
-
key: "_makeDescriptionString",
|
|
1755
|
-
value: function _makeDescriptionString(soTerm, ref, alt) {
|
|
1756
|
-
return "".concat(soTerm, " ").concat(ref, " -> ").concat(alt);
|
|
1757
|
-
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1758
|
-
|
|
1759
|
-
}, {
|
|
1760
|
-
key: "toJSON",
|
|
1761
|
-
value: function toJSON() {
|
|
1762
|
-
return _objectSpread2(_objectSpread2(_objectSpread2({
|
|
1763
|
-
uniqueId: this._id
|
|
1764
|
-
}, this.variant), this.data), {}, {
|
|
1765
|
-
samples: this.variant.SAMPLES
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
|
-
}]);
|
|
1769
|
-
|
|
1770
|
-
return VCFFeature;
|
|
1771
|
-
}();
|
|
1772
|
-
VCFFeature._altTypeToSO = {
|
|
1773
|
-
DEL: 'deletion',
|
|
1774
|
-
INS: 'insertion',
|
|
1775
|
-
DUP: 'duplication',
|
|
1776
|
-
INV: 'inversion',
|
|
1777
|
-
INVDUP: 'inverted duplication',
|
|
1778
|
-
CNV: 'copy_number_variation',
|
|
1779
|
-
TRA: 'translocation',
|
|
1780
|
-
'DUP:TANDEM': 'tandem_duplication',
|
|
1781
|
-
NON_REF: 'sequence_variant',
|
|
1782
|
-
'*': 'sequence_variant'
|
|
1783
|
-
};
|
|
1784
|
-
|
|
1785
|
-
var VariantsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
1786
|
-
_inherits(VariantsPlugin, _Plugin);
|
|
1787
|
-
|
|
1788
|
-
var _super = /*#__PURE__*/_createSuper(VariantsPlugin);
|
|
1789
|
-
|
|
1790
|
-
function VariantsPlugin() {
|
|
1791
|
-
var _this;
|
|
1792
|
-
|
|
1793
|
-
_classCallCheck(this, VariantsPlugin);
|
|
1794
|
-
|
|
1795
|
-
_this = _super.apply(this, arguments);
|
|
1796
|
-
_this.name = 'VariantsPlugin';
|
|
1797
|
-
return _this;
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
_createClass(VariantsPlugin, [{
|
|
1801
|
-
key: "install",
|
|
1802
|
-
value: function install(pluginManager) {
|
|
1803
|
-
pluginManager.addAdapterType(function () {
|
|
1804
|
-
return new AdapterType({
|
|
1805
|
-
name: 'VcfTabixAdapter',
|
|
1806
|
-
configSchema: vcfTabixAdapterConfigSchema,
|
|
1807
|
-
getAdapterClass: function getAdapterClass() {
|
|
1808
|
-
return Promise.resolve().then(function () { return VcfTabixAdapter; }).then(function (r) {
|
|
1809
|
-
return r["default"];
|
|
1810
|
-
});
|
|
1811
|
-
}
|
|
1812
|
-
});
|
|
1813
|
-
});
|
|
1814
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
1815
|
-
return function (file, index, adapterHint) {
|
|
1816
|
-
var regexGuess = /\.vcf\.b?gz$/i;
|
|
1817
|
-
var adapterName = 'VcfTabixAdapter';
|
|
1818
|
-
var fileName = getFileName(file);
|
|
1819
|
-
var indexName = index && getFileName(index);
|
|
1820
|
-
var obj = {
|
|
1821
|
-
type: adapterName,
|
|
1822
|
-
vcfGzLocation: file,
|
|
1823
|
-
index: {
|
|
1824
|
-
location: index || makeIndex(file, '.tbi'),
|
|
1825
|
-
indexType: makeIndexType(indexName, 'CSI', 'TBI')
|
|
1826
|
-
}
|
|
1827
|
-
};
|
|
1828
|
-
|
|
1829
|
-
if (regexGuess.test(fileName) && !adapterHint) {
|
|
1830
|
-
return obj;
|
|
1831
|
-
} else if (adapterHint === adapterName) {
|
|
1832
|
-
return obj;
|
|
1833
|
-
}
|
|
1834
|
-
|
|
1835
|
-
return adapterGuesser(file, index, adapterHint);
|
|
1836
|
-
};
|
|
1837
|
-
});
|
|
1838
|
-
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', function (trackTypeGuesser) {
|
|
1839
|
-
return function (adapterName) {
|
|
1840
|
-
if (adapterName === 'VcfTabixAdapter' || adapterName === 'VcfAdapter') {
|
|
1841
|
-
return 'VariantTrack';
|
|
1842
|
-
}
|
|
1843
|
-
|
|
1844
|
-
return trackTypeGuesser(adapterName);
|
|
1845
|
-
};
|
|
1846
|
-
});
|
|
1847
|
-
pluginManager.addAdapterType(function () {
|
|
1848
|
-
return new AdapterType({
|
|
1849
|
-
name: 'VcfAdapter',
|
|
1850
|
-
configSchema: vcfAdapterConfigSchema,
|
|
1851
|
-
getAdapterClass: function getAdapterClass() {
|
|
1852
|
-
return Promise.resolve().then(function () { return VcfAdapter$1; }).then(function (r) {
|
|
1853
|
-
return r["default"];
|
|
1854
|
-
});
|
|
1855
|
-
}
|
|
1856
|
-
});
|
|
1857
|
-
});
|
|
1858
|
-
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
1859
|
-
return function (file, index, adapterHint) {
|
|
1860
|
-
var regexGuess = /\.vcf$/i;
|
|
1861
|
-
var adapterName = 'VcfAdapter';
|
|
1862
|
-
var fileName = getFileName(file);
|
|
1863
|
-
|
|
1864
|
-
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
1865
|
-
return {
|
|
1866
|
-
type: adapterName,
|
|
1867
|
-
vcfLocation: file
|
|
1868
|
-
};
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
return adapterGuesser(file, index, adapterHint);
|
|
1872
|
-
};
|
|
1873
|
-
});
|
|
1874
|
-
pluginManager.addRendererType(function () {
|
|
1875
|
-
return pluginManager.jbrequire(ChordRendererConfigF);
|
|
1876
|
-
});
|
|
1877
|
-
pluginManager.addTrackType(function () {
|
|
1878
|
-
var configSchema = ConfigurationSchema('VariantTrack', {}, {
|
|
1879
|
-
baseConfiguration: createBaseTrackConfig(pluginManager)
|
|
1880
|
-
});
|
|
1881
|
-
return new TrackType({
|
|
1882
|
-
name: 'VariantTrack',
|
|
1883
|
-
configSchema: configSchema,
|
|
1884
|
-
stateModel: createBaseTrackModel(pluginManager, 'VariantTrack', configSchema)
|
|
1885
|
-
});
|
|
1886
|
-
});
|
|
1887
|
-
pluginManager.addDisplayType(function () {
|
|
1888
|
-
return pluginManager.jbrequire(ChordVariantDisplay);
|
|
1889
|
-
});
|
|
1890
|
-
pluginManager.addDisplayType(function () {
|
|
1891
|
-
var configSchema = LinearVariantDisplayConfigFactory(pluginManager);
|
|
1892
|
-
return new DisplayType({
|
|
1893
|
-
name: 'LinearVariantDisplay',
|
|
1894
|
-
configSchema: configSchema,
|
|
1895
|
-
stateModel: linearVariantDisplayModelFactory(configSchema),
|
|
1896
|
-
trackType: 'VariantTrack',
|
|
1897
|
-
viewType: 'LinearGenomeView',
|
|
1898
|
-
ReactComponent: BaseLinearDisplayComponent
|
|
1899
|
-
});
|
|
1900
|
-
});
|
|
1901
|
-
pluginManager.addWidgetType(function () {
|
|
1902
|
-
return new WidgetType({
|
|
1903
|
-
name: 'VariantFeatureWidget',
|
|
1904
|
-
heading: 'Feature details',
|
|
1905
|
-
configSchema: configSchema,
|
|
1906
|
-
stateModel: stateModelFactory(pluginManager),
|
|
1907
|
-
ReactComponent: /*#__PURE__*/lazy(function () {
|
|
1908
|
-
return Promise.resolve().then(function () { return VariantFeatureWidget$1; });
|
|
1909
|
-
})
|
|
1910
|
-
});
|
|
1911
|
-
});
|
|
1912
|
-
}
|
|
1913
|
-
}]);
|
|
1914
|
-
|
|
1915
|
-
return VariantsPlugin;
|
|
1916
|
-
}(Plugin);
|
|
1917
|
-
|
|
1918
|
-
var _default = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
1919
|
-
_inherits(_default, _BaseFeatureDataAdapt);
|
|
1920
|
-
|
|
1921
|
-
var _super = /*#__PURE__*/_createSuper(_default);
|
|
1922
|
-
|
|
1923
|
-
function _default() {
|
|
1924
|
-
_classCallCheck(this, _default);
|
|
1925
|
-
|
|
1926
|
-
return _super.apply(this, arguments);
|
|
1927
|
-
}
|
|
1928
|
-
|
|
1929
|
-
_createClass(_default, [{
|
|
1930
|
-
key: "configurePre",
|
|
1931
|
-
value: function () {
|
|
1932
|
-
var _configurePre = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1933
|
-
var vcfGzLocation, location, indexType, filehandle, isCSI, vcf, header;
|
|
1934
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
1935
|
-
while (1) {
|
|
1936
|
-
switch (_context.prev = _context.next) {
|
|
1937
|
-
case 0:
|
|
1938
|
-
vcfGzLocation = readConfObject(this.config, 'vcfGzLocation');
|
|
1939
|
-
location = readConfObject(this.config, ['index', 'location']);
|
|
1940
|
-
indexType = readConfObject(this.config, ['index', 'indexType']);
|
|
1941
|
-
filehandle = openLocation(vcfGzLocation, this.pluginManager);
|
|
1942
|
-
isCSI = indexType === 'CSI';
|
|
1943
|
-
vcf = new TabixIndexedFile({
|
|
1944
|
-
filehandle: filehandle,
|
|
1945
|
-
csiFilehandle: isCSI ? openLocation(location, this.pluginManager) : undefined,
|
|
1946
|
-
tbiFilehandle: !isCSI ? openLocation(location, this.pluginManager) : undefined,
|
|
1947
|
-
chunkCacheSize: 50 * Math.pow(2, 20),
|
|
1948
|
-
chunkSizeLimit: 1000000000
|
|
1949
|
-
});
|
|
1950
|
-
_context.next = 8;
|
|
1951
|
-
return vcf.getHeader();
|
|
1952
|
-
|
|
1953
|
-
case 8:
|
|
1954
|
-
header = _context.sent;
|
|
1955
|
-
return _context.abrupt("return", {
|
|
1956
|
-
filehandle: filehandle,
|
|
1957
|
-
vcf: vcf,
|
|
1958
|
-
parser: new VCF({
|
|
1959
|
-
header: header
|
|
1960
|
-
})
|
|
1961
|
-
});
|
|
1962
|
-
|
|
1963
|
-
case 10:
|
|
1964
|
-
case "end":
|
|
1965
|
-
return _context.stop();
|
|
1966
|
-
}
|
|
1967
|
-
}
|
|
1968
|
-
}, _callee, this);
|
|
1969
|
-
}));
|
|
1970
|
-
|
|
1971
|
-
function configurePre() {
|
|
1972
|
-
return _configurePre.apply(this, arguments);
|
|
1973
|
-
}
|
|
1974
|
-
|
|
1975
|
-
return configurePre;
|
|
1976
|
-
}()
|
|
1977
|
-
}, {
|
|
1978
|
-
key: "configure",
|
|
1979
|
-
value: function () {
|
|
1980
|
-
var _configure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1981
|
-
var _this = this;
|
|
1982
|
-
|
|
1983
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1984
|
-
while (1) {
|
|
1985
|
-
switch (_context2.prev = _context2.next) {
|
|
1986
|
-
case 0:
|
|
1987
|
-
if (!this.configured) {
|
|
1988
|
-
this.configured = this.configurePre()["catch"](function (e) {
|
|
1989
|
-
_this.configured = undefined;
|
|
1990
|
-
throw e;
|
|
1991
|
-
});
|
|
1992
|
-
}
|
|
1993
|
-
|
|
1994
|
-
return _context2.abrupt("return", this.configured);
|
|
1995
|
-
|
|
1996
|
-
case 2:
|
|
1997
|
-
case "end":
|
|
1998
|
-
return _context2.stop();
|
|
1999
|
-
}
|
|
2000
|
-
}
|
|
2001
|
-
}, _callee2, this);
|
|
2002
|
-
}));
|
|
2003
|
-
|
|
2004
|
-
function configure() {
|
|
2005
|
-
return _configure.apply(this, arguments);
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
return configure;
|
|
2009
|
-
}()
|
|
2010
|
-
}, {
|
|
2011
|
-
key: "getRefNames",
|
|
2012
|
-
value: function () {
|
|
2013
|
-
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
2014
|
-
var opts,
|
|
2015
|
-
_yield$this$configure,
|
|
2016
|
-
vcf,
|
|
2017
|
-
_args3 = arguments;
|
|
2018
|
-
|
|
2019
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2020
|
-
while (1) {
|
|
2021
|
-
switch (_context3.prev = _context3.next) {
|
|
2022
|
-
case 0:
|
|
2023
|
-
opts = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : {};
|
|
2024
|
-
_context3.next = 3;
|
|
2025
|
-
return this.configure();
|
|
2026
|
-
|
|
2027
|
-
case 3:
|
|
2028
|
-
_yield$this$configure = _context3.sent;
|
|
2029
|
-
vcf = _yield$this$configure.vcf;
|
|
2030
|
-
return _context3.abrupt("return", vcf.getReferenceSequenceNames(opts));
|
|
2031
|
-
|
|
2032
|
-
case 6:
|
|
2033
|
-
case "end":
|
|
2034
|
-
return _context3.stop();
|
|
2035
|
-
}
|
|
2036
|
-
}
|
|
2037
|
-
}, _callee3, this);
|
|
2038
|
-
}));
|
|
2039
|
-
|
|
2040
|
-
function getRefNames() {
|
|
2041
|
-
return _getRefNames.apply(this, arguments);
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
return getRefNames;
|
|
2045
|
-
}()
|
|
2046
|
-
}, {
|
|
2047
|
-
key: "getHeader",
|
|
2048
|
-
value: function () {
|
|
2049
|
-
var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
2050
|
-
var _yield$this$configure2, vcf;
|
|
2051
|
-
|
|
2052
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2053
|
-
while (1) {
|
|
2054
|
-
switch (_context4.prev = _context4.next) {
|
|
2055
|
-
case 0:
|
|
2056
|
-
_context4.next = 2;
|
|
2057
|
-
return this.configure();
|
|
2058
|
-
|
|
2059
|
-
case 2:
|
|
2060
|
-
_yield$this$configure2 = _context4.sent;
|
|
2061
|
-
vcf = _yield$this$configure2.vcf;
|
|
2062
|
-
return _context4.abrupt("return", vcf.getHeader());
|
|
2063
|
-
|
|
2064
|
-
case 5:
|
|
2065
|
-
case "end":
|
|
2066
|
-
return _context4.stop();
|
|
2067
|
-
}
|
|
2068
|
-
}
|
|
2069
|
-
}, _callee4, this);
|
|
2070
|
-
}));
|
|
2071
|
-
|
|
2072
|
-
function getHeader() {
|
|
2073
|
-
return _getHeader.apply(this, arguments);
|
|
2074
|
-
}
|
|
2075
|
-
|
|
2076
|
-
return getHeader;
|
|
2077
|
-
}()
|
|
2078
|
-
}, {
|
|
2079
|
-
key: "getMetadata",
|
|
2080
|
-
value: function () {
|
|
2081
|
-
var _getMetadata = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
2082
|
-
var _yield$this$configure3, parser;
|
|
2083
|
-
|
|
2084
|
-
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2085
|
-
while (1) {
|
|
2086
|
-
switch (_context5.prev = _context5.next) {
|
|
2087
|
-
case 0:
|
|
2088
|
-
_context5.next = 2;
|
|
2089
|
-
return this.configure();
|
|
2090
|
-
|
|
2091
|
-
case 2:
|
|
2092
|
-
_yield$this$configure3 = _context5.sent;
|
|
2093
|
-
parser = _yield$this$configure3.parser;
|
|
2094
|
-
return _context5.abrupt("return", parser.getMetadata());
|
|
2095
|
-
|
|
2096
|
-
case 5:
|
|
2097
|
-
case "end":
|
|
2098
|
-
return _context5.stop();
|
|
2099
|
-
}
|
|
2100
|
-
}
|
|
2101
|
-
}, _callee5, this);
|
|
2102
|
-
}));
|
|
2103
|
-
|
|
2104
|
-
function getMetadata() {
|
|
2105
|
-
return _getMetadata.apply(this, arguments);
|
|
2106
|
-
}
|
|
2107
|
-
|
|
2108
|
-
return getMetadata;
|
|
2109
|
-
}()
|
|
2110
|
-
}, {
|
|
2111
|
-
key: "getFeatures",
|
|
2112
|
-
value: function getFeatures(query) {
|
|
2113
|
-
var _this2 = this;
|
|
2114
|
-
|
|
2115
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2116
|
-
return ObservableCreate( /*#__PURE__*/function () {
|
|
2117
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(observer) {
|
|
2118
|
-
var refName, start, end, _yield$_this2$configu, vcf, parser;
|
|
2119
|
-
|
|
2120
|
-
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2121
|
-
while (1) {
|
|
2122
|
-
switch (_context6.prev = _context6.next) {
|
|
2123
|
-
case 0:
|
|
2124
|
-
refName = query.refName, start = query.start, end = query.end;
|
|
2125
|
-
_context6.next = 3;
|
|
2126
|
-
return _this2.configure();
|
|
2127
|
-
|
|
2128
|
-
case 3:
|
|
2129
|
-
_yield$_this2$configu = _context6.sent;
|
|
2130
|
-
vcf = _yield$_this2$configu.vcf;
|
|
2131
|
-
parser = _yield$_this2$configu.parser;
|
|
2132
|
-
_context6.next = 8;
|
|
2133
|
-
return vcf.getLines(refName, start, end, _objectSpread2({
|
|
2134
|
-
lineCallback: function lineCallback(line, fileOffset) {
|
|
2135
|
-
observer.next(new VCFFeature({
|
|
2136
|
-
variant: parser.parseLine(line),
|
|
2137
|
-
parser: parser,
|
|
2138
|
-
id: "".concat(_this2.id, "-vcf-").concat(fileOffset)
|
|
2139
|
-
}));
|
|
2140
|
-
}
|
|
2141
|
-
}, opts));
|
|
2142
|
-
|
|
2143
|
-
case 8:
|
|
2144
|
-
observer.complete();
|
|
2145
|
-
|
|
2146
|
-
case 9:
|
|
2147
|
-
case "end":
|
|
2148
|
-
return _context6.stop();
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
}, _callee6);
|
|
2152
|
-
}));
|
|
2153
|
-
|
|
2154
|
-
return function (_x) {
|
|
2155
|
-
return _ref.apply(this, arguments);
|
|
2156
|
-
};
|
|
2157
|
-
}(), opts.signal);
|
|
2158
|
-
}
|
|
2159
|
-
/**
|
|
2160
|
-
* Checks if the data source has data for the given reference sequence,
|
|
2161
|
-
* and then gets the features in the region if it does
|
|
2162
|
-
*
|
|
2163
|
-
* Currently this just calls getFeatureInRegion for each region. Adapters that
|
|
2164
|
-
* are frequently called on multiple regions simultaneously may want to
|
|
2165
|
-
* implement a more efficient custom version of this method.
|
|
2166
|
-
*
|
|
2167
|
-
* Also includes a bit of extra logging to warn when fetching a large portion
|
|
2168
|
-
* of a VCF
|
|
2169
|
-
* @param regions - Regions
|
|
2170
|
-
* @param opts - Feature adapter options
|
|
2171
|
-
* @returns Observable of Feature objects in the regions
|
|
2172
|
-
*/
|
|
2173
|
-
|
|
2174
|
-
}, {
|
|
2175
|
-
key: "getFeaturesInMultipleRegions",
|
|
2176
|
-
value: function getFeaturesInMultipleRegions(regions) {
|
|
2177
|
-
var _this3 = this;
|
|
2178
|
-
|
|
2179
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2180
|
-
|
|
2181
|
-
// TODO: restore commented version below once TSDX supports Rollup v2
|
|
2182
|
-
// xref: https://github.com/rollup/rollup/blob/master/CHANGELOG.md#bug-fixes-45
|
|
2183
|
-
var superGetFeaturesInMultipleRegions = _get(_getPrototypeOf(_default.prototype), "getFeaturesInMultipleRegions", this);
|
|
2184
|
-
|
|
2185
|
-
return ObservableCreate( /*#__PURE__*/function () {
|
|
2186
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(observer) {
|
|
2187
|
-
var _yield$_this3$configu, vcf, bytes, _yield$_this3$configu2, filehandle, stat, pct;
|
|
2188
|
-
|
|
2189
|
-
return runtime_1.wrap(function _callee7$(_context7) {
|
|
2190
|
-
while (1) {
|
|
2191
|
-
switch (_context7.prev = _context7.next) {
|
|
2192
|
-
case 0:
|
|
2193
|
-
_context7.next = 2;
|
|
2194
|
-
return _this3.configure();
|
|
2195
|
-
|
|
2196
|
-
case 2:
|
|
2197
|
-
_yield$_this3$configu = _context7.sent;
|
|
2198
|
-
vcf = _yield$_this3$configu.vcf;
|
|
2199
|
-
_context7.next = 6;
|
|
2200
|
-
return bytesForRegions(regions, vcf.index);
|
|
2201
|
-
|
|
2202
|
-
case 6:
|
|
2203
|
-
bytes = _context7.sent;
|
|
2204
|
-
_context7.next = 9;
|
|
2205
|
-
return _this3.configure();
|
|
2206
|
-
|
|
2207
|
-
case 9:
|
|
2208
|
-
_yield$_this3$configu2 = _context7.sent;
|
|
2209
|
-
filehandle = _yield$_this3$configu2.filehandle;
|
|
2210
|
-
_context7.next = 13;
|
|
2211
|
-
return filehandle.stat();
|
|
2212
|
-
|
|
2213
|
-
case 13:
|
|
2214
|
-
stat = _context7.sent;
|
|
2215
|
-
pct = Math.round(bytes / stat.size * 100);
|
|
2216
|
-
|
|
2217
|
-
if (pct > 100) {
|
|
2218
|
-
// this is just a bad estimate, make 100% if it goes over
|
|
2219
|
-
pct = 100;
|
|
2220
|
-
}
|
|
2221
|
-
|
|
2222
|
-
if (pct > 60) {
|
|
2223
|
-
console.warn("getFeaturesInMultipleRegions fetching ".concat(pct, "% of VCF file, but whole-file streaming not yet implemented"));
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
|
-
superGetFeaturesInMultipleRegions.call(_this3, regions, opts).subscribe(observer); // super.getFeaturesInMultipleRegions(regions, opts).subscribe(observer)
|
|
2227
|
-
|
|
2228
|
-
case 18:
|
|
2229
|
-
case "end":
|
|
2230
|
-
return _context7.stop();
|
|
2231
|
-
}
|
|
2232
|
-
}
|
|
2233
|
-
}, _callee7);
|
|
2234
|
-
}));
|
|
2235
|
-
|
|
2236
|
-
return function (_x2) {
|
|
2237
|
-
return _ref2.apply(this, arguments);
|
|
2238
|
-
};
|
|
2239
|
-
}());
|
|
2240
|
-
}
|
|
2241
|
-
}, {
|
|
2242
|
-
key: "freeResources",
|
|
2243
|
-
value: function
|
|
2244
|
-
/* { region } */
|
|
2245
|
-
freeResources() {}
|
|
2246
|
-
}]);
|
|
2247
|
-
|
|
2248
|
-
return _default;
|
|
2249
|
-
}(BaseFeatureDataAdapter);
|
|
2250
|
-
|
|
2251
|
-
var VcfTabixAdapter = {
|
|
2252
|
-
__proto__: null,
|
|
2253
|
-
'default': _default
|
|
2254
|
-
};
|
|
2255
|
-
|
|
2256
|
-
var readVcf = function readVcf(f) {
|
|
2257
|
-
var lines = f.split('\n');
|
|
2258
|
-
var header = [];
|
|
2259
|
-
var rest = [];
|
|
2260
|
-
lines.forEach(function (line) {
|
|
2261
|
-
if (line.startsWith('#')) {
|
|
2262
|
-
header.push(line);
|
|
2263
|
-
} else if (line) {
|
|
2264
|
-
rest.push(line);
|
|
2265
|
-
}
|
|
2266
|
-
});
|
|
2267
|
-
return {
|
|
2268
|
-
header: header.join('\n'),
|
|
2269
|
-
lines: rest
|
|
2270
|
-
};
|
|
2271
|
-
};
|
|
2272
|
-
|
|
2273
|
-
function isGzip(buf) {
|
|
2274
|
-
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
2278
|
-
_inherits(VcfAdapter, _BaseFeatureDataAdapt);
|
|
2279
|
-
|
|
2280
|
-
var _super = /*#__PURE__*/_createSuper(VcfAdapter);
|
|
2281
|
-
|
|
2282
|
-
function VcfAdapter() {
|
|
2283
|
-
_classCallCheck(this, VcfAdapter);
|
|
2284
|
-
|
|
2285
|
-
return _super.apply(this, arguments);
|
|
2286
|
-
}
|
|
2287
|
-
|
|
2288
|
-
_createClass(VcfAdapter, [{
|
|
2289
|
-
key: "getHeader",
|
|
2290
|
-
value: function () {
|
|
2291
|
-
var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
2292
|
-
var _yield$this$setup, header;
|
|
2293
|
-
|
|
2294
|
-
return runtime_1.wrap(function _callee$(_context) {
|
|
2295
|
-
while (1) {
|
|
2296
|
-
switch (_context.prev = _context.next) {
|
|
2297
|
-
case 0:
|
|
2298
|
-
_context.next = 2;
|
|
2299
|
-
return this.setup();
|
|
2300
|
-
|
|
2301
|
-
case 2:
|
|
2302
|
-
_yield$this$setup = _context.sent;
|
|
2303
|
-
header = _yield$this$setup.header;
|
|
2304
|
-
return _context.abrupt("return", header);
|
|
2305
|
-
|
|
2306
|
-
case 5:
|
|
2307
|
-
case "end":
|
|
2308
|
-
return _context.stop();
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
}, _callee, this);
|
|
2312
|
-
}));
|
|
2313
|
-
|
|
2314
|
-
function getHeader() {
|
|
2315
|
-
return _getHeader.apply(this, arguments);
|
|
2316
|
-
}
|
|
2317
|
-
|
|
2318
|
-
return getHeader;
|
|
2319
|
-
}()
|
|
2320
|
-
}, {
|
|
2321
|
-
key: "getMetadata",
|
|
2322
|
-
value: function () {
|
|
2323
|
-
var _getMetadata = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
2324
|
-
var _yield$this$setup2, header, parser;
|
|
2325
|
-
|
|
2326
|
-
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2327
|
-
while (1) {
|
|
2328
|
-
switch (_context2.prev = _context2.next) {
|
|
2329
|
-
case 0:
|
|
2330
|
-
_context2.next = 2;
|
|
2331
|
-
return this.setup();
|
|
2332
|
-
|
|
2333
|
-
case 2:
|
|
2334
|
-
_yield$this$setup2 = _context2.sent;
|
|
2335
|
-
header = _yield$this$setup2.header;
|
|
2336
|
-
parser = new VCF({
|
|
2337
|
-
header: header
|
|
2338
|
-
});
|
|
2339
|
-
return _context2.abrupt("return", parser.getMetadata());
|
|
2340
|
-
|
|
2341
|
-
case 6:
|
|
2342
|
-
case "end":
|
|
2343
|
-
return _context2.stop();
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
}, _callee2, this);
|
|
2347
|
-
}));
|
|
2348
|
-
|
|
2349
|
-
function getMetadata() {
|
|
2350
|
-
return _getMetadata.apply(this, arguments);
|
|
2351
|
-
}
|
|
2352
|
-
|
|
2353
|
-
return getMetadata;
|
|
2354
|
-
}() // converts lines into an interval tree
|
|
2355
|
-
|
|
2356
|
-
}, {
|
|
2357
|
-
key: "setupP",
|
|
2358
|
-
value: function () {
|
|
2359
|
-
var _setupP = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
2360
|
-
var buffer, buf, str, _readVcf, header, lines, intervalTree;
|
|
2361
|
-
|
|
2362
|
-
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2363
|
-
while (1) {
|
|
2364
|
-
switch (_context3.prev = _context3.next) {
|
|
2365
|
-
case 0:
|
|
2366
|
-
_context3.next = 2;
|
|
2367
|
-
return openLocation(readConfObject(this.config, 'vcfLocation'), this.pluginManager).readFile();
|
|
2368
|
-
|
|
2369
|
-
case 2:
|
|
2370
|
-
buffer = _context3.sent;
|
|
2371
|
-
|
|
2372
|
-
if (!isGzip(buffer)) {
|
|
2373
|
-
_context3.next = 9;
|
|
2374
|
-
break;
|
|
2375
|
-
}
|
|
2376
|
-
|
|
2377
|
-
_context3.next = 6;
|
|
2378
|
-
return unzip(buffer);
|
|
2379
|
-
|
|
2380
|
-
case 6:
|
|
2381
|
-
_context3.t0 = _context3.sent;
|
|
2382
|
-
_context3.next = 10;
|
|
2383
|
-
break;
|
|
2384
|
-
|
|
2385
|
-
case 9:
|
|
2386
|
-
_context3.t0 = buffer;
|
|
2387
|
-
|
|
2388
|
-
case 10:
|
|
2389
|
-
buf = _context3.t0;
|
|
2390
|
-
|
|
2391
|
-
if (!(buf.length > 536870888)) {
|
|
2392
|
-
_context3.next = 13;
|
|
2393
|
-
break;
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
throw new Error('Data exceeds maximum string length (512MB)');
|
|
2397
|
-
|
|
2398
|
-
case 13:
|
|
2399
|
-
str = new TextDecoder().decode(buf);
|
|
2400
|
-
_readVcf = readVcf(str), header = _readVcf.header, lines = _readVcf.lines;
|
|
2401
|
-
intervalTree = lines.map(function (line, id) {
|
|
2402
|
-
var _info$match;
|
|
2403
|
-
|
|
2404
|
-
var _line$split = line.split('\t'),
|
|
2405
|
-
_line$split2 = _slicedToArray(_line$split, 8),
|
|
2406
|
-
refName = _line$split2[0],
|
|
2407
|
-
startP = _line$split2[1],
|
|
2408
|
-
ref = _line$split2[3],
|
|
2409
|
-
info = _line$split2[7];
|
|
2410
|
-
|
|
2411
|
-
var start = +startP - 1;
|
|
2412
|
-
var end = +(((_info$match = info.match(/END=(\d+)/)) === null || _info$match === void 0 ? void 0 : _info$match[1].trim()) || start + ref.length);
|
|
2413
|
-
return {
|
|
2414
|
-
line: line,
|
|
2415
|
-
refName: refName,
|
|
2416
|
-
start: start,
|
|
2417
|
-
end: end,
|
|
2418
|
-
id: id
|
|
2419
|
-
};
|
|
2420
|
-
}).reduce(function (acc, obj) {
|
|
2421
|
-
var key = obj.refName;
|
|
2422
|
-
|
|
2423
|
-
if (!acc[key]) {
|
|
2424
|
-
acc[key] = new IntervalTree();
|
|
2425
|
-
}
|
|
2426
|
-
|
|
2427
|
-
acc[key].insert([obj.start, obj.end], obj);
|
|
2428
|
-
return acc;
|
|
2429
|
-
}, {});
|
|
2430
|
-
return _context3.abrupt("return", {
|
|
2431
|
-
header: header,
|
|
2432
|
-
intervalTree: intervalTree
|
|
2433
|
-
});
|
|
2434
|
-
|
|
2435
|
-
case 17:
|
|
2436
|
-
case "end":
|
|
2437
|
-
return _context3.stop();
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
}, _callee3, this);
|
|
2441
|
-
}));
|
|
2442
|
-
|
|
2443
|
-
function setupP() {
|
|
2444
|
-
return _setupP.apply(this, arguments);
|
|
2445
|
-
}
|
|
2446
|
-
|
|
2447
|
-
return setupP;
|
|
2448
|
-
}()
|
|
2449
|
-
}, {
|
|
2450
|
-
key: "setup",
|
|
2451
|
-
value: function () {
|
|
2452
|
-
var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
2453
|
-
var _this = this;
|
|
2454
|
-
|
|
2455
|
-
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2456
|
-
while (1) {
|
|
2457
|
-
switch (_context4.prev = _context4.next) {
|
|
2458
|
-
case 0:
|
|
2459
|
-
if (!this.vcfFeatures) {
|
|
2460
|
-
this.vcfFeatures = this.setupP()["catch"](function (e) {
|
|
2461
|
-
_this.vcfFeatures = undefined;
|
|
2462
|
-
throw e;
|
|
2463
|
-
});
|
|
2464
|
-
}
|
|
2465
|
-
|
|
2466
|
-
return _context4.abrupt("return", this.vcfFeatures);
|
|
2467
|
-
|
|
2468
|
-
case 2:
|
|
2469
|
-
case "end":
|
|
2470
|
-
return _context4.stop();
|
|
2471
|
-
}
|
|
2472
|
-
}
|
|
2473
|
-
}, _callee4, this);
|
|
2474
|
-
}));
|
|
2475
|
-
|
|
2476
|
-
function setup() {
|
|
2477
|
-
return _setup.apply(this, arguments);
|
|
2478
|
-
}
|
|
2479
|
-
|
|
2480
|
-
return setup;
|
|
2481
|
-
}()
|
|
2482
|
-
}, {
|
|
2483
|
-
key: "getRefNames",
|
|
2484
|
-
value: function () {
|
|
2485
|
-
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
2486
|
-
var _yield$this$setup3,
|
|
2487
|
-
intervalTree;
|
|
2488
|
-
|
|
2489
|
-
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2490
|
-
while (1) {
|
|
2491
|
-
switch (_context5.prev = _context5.next) {
|
|
2492
|
-
case 0:
|
|
2493
|
-
_context5.next = 3;
|
|
2494
|
-
return this.setup();
|
|
2495
|
-
|
|
2496
|
-
case 3:
|
|
2497
|
-
_yield$this$setup3 = _context5.sent;
|
|
2498
|
-
intervalTree = _yield$this$setup3.intervalTree;
|
|
2499
|
-
return _context5.abrupt("return", Object.keys(intervalTree));
|
|
2500
|
-
|
|
2501
|
-
case 6:
|
|
2502
|
-
case "end":
|
|
2503
|
-
return _context5.stop();
|
|
2504
|
-
}
|
|
2505
|
-
}
|
|
2506
|
-
}, _callee5, this);
|
|
2507
|
-
}));
|
|
2508
|
-
|
|
2509
|
-
function getRefNames() {
|
|
2510
|
-
return _getRefNames.apply(this, arguments);
|
|
2511
|
-
}
|
|
2512
|
-
|
|
2513
|
-
return getRefNames;
|
|
2514
|
-
}()
|
|
2515
|
-
}, {
|
|
2516
|
-
key: "getFeatures",
|
|
2517
|
-
value: function getFeatures(region) {
|
|
2518
|
-
var _this2 = this;
|
|
2519
|
-
|
|
2520
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2521
|
-
return ObservableCreate( /*#__PURE__*/function () {
|
|
2522
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(observer) {
|
|
2523
|
-
var _intervalTree$refName, start, end, refName, _yield$_this2$setup, header, intervalTree, parser;
|
|
2524
|
-
|
|
2525
|
-
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2526
|
-
while (1) {
|
|
2527
|
-
switch (_context6.prev = _context6.next) {
|
|
2528
|
-
case 0:
|
|
2529
|
-
_context6.prev = 0;
|
|
2530
|
-
start = region.start, end = region.end, refName = region.refName;
|
|
2531
|
-
_context6.next = 4;
|
|
2532
|
-
return _this2.setup();
|
|
2533
|
-
|
|
2534
|
-
case 4:
|
|
2535
|
-
_yield$_this2$setup = _context6.sent;
|
|
2536
|
-
header = _yield$_this2$setup.header;
|
|
2537
|
-
intervalTree = _yield$_this2$setup.intervalTree;
|
|
2538
|
-
parser = new VCF({
|
|
2539
|
-
header: header
|
|
2540
|
-
});
|
|
2541
|
-
(_intervalTree$refName = intervalTree[refName]) === null || _intervalTree$refName === void 0 ? void 0 : _intervalTree$refName.search([start, end]).forEach(function (f) {
|
|
2542
|
-
return observer.next(new VCFFeature({
|
|
2543
|
-
variant: parser.parseLine(f.line),
|
|
2544
|
-
parser: parser,
|
|
2545
|
-
id: "".concat(_this2.id, "-").concat(f.id)
|
|
2546
|
-
}));
|
|
2547
|
-
});
|
|
2548
|
-
observer.complete();
|
|
2549
|
-
_context6.next = 15;
|
|
2550
|
-
break;
|
|
2551
|
-
|
|
2552
|
-
case 12:
|
|
2553
|
-
_context6.prev = 12;
|
|
2554
|
-
_context6.t0 = _context6["catch"](0);
|
|
2555
|
-
observer.error(_context6.t0);
|
|
2556
|
-
|
|
2557
|
-
case 15:
|
|
2558
|
-
case "end":
|
|
2559
|
-
return _context6.stop();
|
|
2560
|
-
}
|
|
2561
|
-
}
|
|
2562
|
-
}, _callee6, null, [[0, 12]]);
|
|
2563
|
-
}));
|
|
2564
|
-
|
|
2565
|
-
return function (_x) {
|
|
2566
|
-
return _ref.apply(this, arguments);
|
|
2567
|
-
};
|
|
2568
|
-
}(), opts.signal);
|
|
2569
|
-
}
|
|
2570
|
-
}, {
|
|
2571
|
-
key: "freeResources",
|
|
2572
|
-
value: function freeResources() {}
|
|
2573
|
-
}]);
|
|
2574
|
-
|
|
2575
|
-
return VcfAdapter;
|
|
2576
|
-
}(BaseFeatureDataAdapter);
|
|
2577
|
-
VcfAdapter.capabilities = ['getFeatures', 'getRefNames'];
|
|
2578
|
-
|
|
2579
|
-
var VcfAdapter$1 = {
|
|
2580
|
-
__proto__: null,
|
|
2581
|
-
'default': VcfAdapter
|
|
2582
|
-
};
|
|
2583
|
-
|
|
2584
|
-
var useStyles = /*#__PURE__*/makeStyles(function (theme) {
|
|
2585
|
-
return {
|
|
2586
|
-
closeButton: {
|
|
2587
|
-
position: 'absolute',
|
|
2588
|
-
right: theme.spacing(1),
|
|
2589
|
-
top: theme.spacing(1),
|
|
2590
|
-
color: theme.palette.grey[500]
|
|
2591
|
-
},
|
|
2592
|
-
block: {
|
|
2593
|
-
display: 'block'
|
|
2594
|
-
}
|
|
2595
|
-
};
|
|
2596
|
-
});
|
|
2597
|
-
|
|
2598
|
-
function BreakendOptionDialog(_ref) {
|
|
2599
|
-
var model = _ref.model,
|
|
2600
|
-
handleClose = _ref.handleClose,
|
|
2601
|
-
feature = _ref.feature,
|
|
2602
|
-
viewType = _ref.viewType;
|
|
2603
|
-
var classes = useStyles();
|
|
2604
|
-
|
|
2605
|
-
var _useState = useState(true),
|
|
2606
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2607
|
-
copyTracks = _useState2[0],
|
|
2608
|
-
setCopyTracks = _useState2[1];
|
|
2609
|
-
|
|
2610
|
-
var _useState3 = useState(true),
|
|
2611
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
2612
|
-
mirrorTracks = _useState4[0],
|
|
2613
|
-
setMirrorTracks = _useState4[1];
|
|
2614
|
-
|
|
2615
|
-
return /*#__PURE__*/React.createElement(Dialog, {
|
|
2616
|
-
open: true,
|
|
2617
|
-
onClose: handleClose
|
|
2618
|
-
}, /*#__PURE__*/React.createElement(DialogTitle, null, "Breakpoint split view options", handleClose ? /*#__PURE__*/React.createElement(IconButton, {
|
|
2619
|
-
className: classes.closeButton,
|
|
2620
|
-
onClick: function onClick() {
|
|
2621
|
-
return handleClose();
|
|
2622
|
-
}
|
|
2623
|
-
}, /*#__PURE__*/React.createElement(CloseIcon, null)) : null), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
2624
|
-
className: classes.block,
|
|
2625
|
-
control: /*#__PURE__*/React.createElement(Checkbox, {
|
|
2626
|
-
checked: copyTracks,
|
|
2627
|
-
onChange: function onChange() {
|
|
2628
|
-
return setCopyTracks(function (val) {
|
|
2629
|
-
return !val;
|
|
2630
|
-
});
|
|
2631
|
-
}
|
|
2632
|
-
}),
|
|
2633
|
-
label: "Copy tracks into the new view"
|
|
2634
|
-
}), /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
2635
|
-
className: classes.block,
|
|
2636
|
-
control: /*#__PURE__*/React.createElement(Checkbox, {
|
|
2637
|
-
checked: mirrorTracks,
|
|
2638
|
-
onChange: function onChange() {
|
|
2639
|
-
return setMirrorTracks(function (val) {
|
|
2640
|
-
return !val;
|
|
2641
|
-
});
|
|
2642
|
-
}
|
|
2643
|
-
}),
|
|
2644
|
-
label: "Mirror tracks vertically in vertically stacked view"
|
|
2645
|
-
})), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(Button, {
|
|
2646
|
-
onClick: function onClick() {
|
|
2647
|
-
var view = model.view;
|
|
2648
|
-
var session = getSession(model);
|
|
2649
|
-
|
|
2650
|
-
try {
|
|
2651
|
-
var viewSnapshot = viewType.snapshotFromBreakendFeature(feature, view);
|
|
2652
|
-
viewSnapshot.views[0].offsetPx -= view.width / 2 + 100;
|
|
2653
|
-
viewSnapshot.views[1].offsetPx -= view.width / 2 + 100;
|
|
2654
|
-
viewSnapshot.featureData = feature;
|
|
2655
|
-
var viewTracks = getSnapshot(view.tracks);
|
|
2656
|
-
viewSnapshot.views[0].tracks = viewTracks;
|
|
2657
|
-
viewSnapshot.views[1].tracks = mirrorTracks ? viewTracks.slice().reverse() : viewTracks;
|
|
2658
|
-
session.addView('BreakpointSplitView', viewSnapshot);
|
|
2659
|
-
} catch (e) {
|
|
2660
|
-
console.error(e);
|
|
2661
|
-
session.notify("".concat(e));
|
|
2662
|
-
}
|
|
2663
|
-
|
|
2664
|
-
handleClose();
|
|
2665
|
-
},
|
|
2666
|
-
variant: "contained",
|
|
2667
|
-
color: "primary",
|
|
2668
|
-
autoFocus: true
|
|
2669
|
-
}, "OK"), /*#__PURE__*/React.createElement(Button, {
|
|
2670
|
-
onClick: function onClick() {
|
|
2671
|
-
return handleClose();
|
|
2672
|
-
},
|
|
2673
|
-
color: "secondary",
|
|
2674
|
-
variant: "contained"
|
|
2675
|
-
}, "Cancel")));
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
var BreakendOptionDialog$1 = /*#__PURE__*/observer(BreakendOptionDialog);
|
|
2679
|
-
|
|
2680
|
-
var _excluded = ["samples"];
|
|
2681
|
-
|
|
2682
|
-
function VariantSamples(props) {
|
|
2683
|
-
var _useState = useState({}),
|
|
2684
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2685
|
-
filter = _useState2[0],
|
|
2686
|
-
setFilter = _useState2[1];
|
|
2687
|
-
|
|
2688
|
-
var _useState3 = useState(false),
|
|
2689
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
2690
|
-
showFilters = _useState4[0],
|
|
2691
|
-
setShowFilters = _useState4[1];
|
|
2692
|
-
|
|
2693
|
-
var feature = props.feature;
|
|
2694
|
-
var _feature$samples = feature.samples,
|
|
2695
|
-
samples = _feature$samples === void 0 ? {} : _feature$samples;
|
|
2696
|
-
var preFilteredRows = Object.entries(samples);
|
|
2697
|
-
|
|
2698
|
-
if (!preFilteredRows.length) {
|
|
2699
|
-
return null;
|
|
2700
|
-
}
|
|
2701
|
-
|
|
2702
|
-
var infoFields = ['sample'].concat(_toConsumableArray(Object.keys(preFilteredRows[0][1]))).map(function (field) {
|
|
2703
|
-
return {
|
|
2704
|
-
field: field
|
|
2705
|
-
};
|
|
2706
|
-
});
|
|
2707
|
-
var error;
|
|
2708
|
-
var rows = [];
|
|
2709
|
-
var filters = Object.keys(filter); // catch some error thrown from regex
|
|
2710
|
-
// note: maps all values into a string, if this is not done rows are not
|
|
2711
|
-
// sortable by the data-grid
|
|
2712
|
-
|
|
2713
|
-
try {
|
|
2714
|
-
rows = preFilteredRows.map(function (row) {
|
|
2715
|
-
return _objectSpread2(_objectSpread2({}, Object.fromEntries(Object.entries(row[1]).map(function (entry) {
|
|
2716
|
-
return [entry[0], String(entry[1])];
|
|
2717
|
-
}))), {}, {
|
|
2718
|
-
sample: row[0],
|
|
2719
|
-
id: row[0]
|
|
2720
|
-
});
|
|
2721
|
-
}).filter(function (row) {
|
|
2722
|
-
return filters.length ? filters.every(function (key) {
|
|
2723
|
-
var val = row[key];
|
|
2724
|
-
var currFilter = filter[key];
|
|
2725
|
-
return currFilter ? val.match(new RegExp(currFilter, 'i')) : true;
|
|
2726
|
-
}) : true;
|
|
2727
|
-
});
|
|
2728
|
-
} catch (e) {
|
|
2729
|
-
error = e;
|
|
2730
|
-
} // disableSelectionOnClick helps avoid
|
|
2731
|
-
// https://github.com/mui-org/material-ui-x/issues/1197
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
return /*#__PURE__*/React.createElement(BaseCard, Object.assign({}, props, {
|
|
2735
|
-
title: "Samples"
|
|
2736
|
-
}), error ? /*#__PURE__*/React.createElement(Typography, {
|
|
2737
|
-
color: "error"
|
|
2738
|
-
}, "".concat(error)) : null, /*#__PURE__*/React.createElement(FormControlLabel, {
|
|
2739
|
-
control: /*#__PURE__*/React.createElement(Checkbox, {
|
|
2740
|
-
checked: showFilters,
|
|
2741
|
-
onChange: function onChange() {
|
|
2742
|
-
return setShowFilters(function (f) {
|
|
2743
|
-
return !f;
|
|
2744
|
-
});
|
|
2745
|
-
}
|
|
2746
|
-
}),
|
|
2747
|
-
label: "Show sample filters"
|
|
2748
|
-
}), showFilters ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Typography, null, "These filters can use a plain text search or regex style query, e.g. in the genotype field, entering 1 will query for all genotypes that include the first alternate allele e.g. 0|1 or 1|1, entering [1-9]\\d* will find any non-zero allele e.g. 0|2 or 2/33"), infoFields.map(function (_ref) {
|
|
2749
|
-
var field = _ref.field;
|
|
2750
|
-
return /*#__PURE__*/React.createElement(TextField, {
|
|
2751
|
-
key: "filter-".concat(field),
|
|
2752
|
-
placeholder: "Filter ".concat(field),
|
|
2753
|
-
value: filter[field] || '',
|
|
2754
|
-
onChange: function onChange(event) {
|
|
2755
|
-
return setFilter(_objectSpread2(_objectSpread2({}, filter), {}, _defineProperty({}, field, event.target.value)));
|
|
2756
|
-
}
|
|
2757
|
-
});
|
|
2758
|
-
})) : null, /*#__PURE__*/React.createElement("div", {
|
|
2759
|
-
style: {
|
|
2760
|
-
height: 600,
|
|
2761
|
-
width: '100%',
|
|
2762
|
-
overflow: 'auto'
|
|
2763
|
-
}
|
|
2764
|
-
}, /*#__PURE__*/React.createElement(DataGrid, {
|
|
2765
|
-
rows: rows,
|
|
2766
|
-
columns: infoFields,
|
|
2767
|
-
rowHeight: 20,
|
|
2768
|
-
headerHeight: 25,
|
|
2769
|
-
disableSelectionOnClick: true,
|
|
2770
|
-
disableColumnMenu: true
|
|
2771
|
-
})));
|
|
2772
|
-
}
|
|
2773
|
-
|
|
2774
|
-
function BreakendPanel(props) {
|
|
2775
|
-
var model = props.model,
|
|
2776
|
-
locStrings = props.locStrings,
|
|
2777
|
-
feature = props.feature;
|
|
2778
|
-
var session = getSession(model);
|
|
2779
|
-
|
|
2780
|
-
var _getEnv = getEnv(session),
|
|
2781
|
-
pluginManager = _getEnv.pluginManager;
|
|
2782
|
-
|
|
2783
|
-
var _useState5 = useState(false),
|
|
2784
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
2785
|
-
breakpointDialog = _useState6[0],
|
|
2786
|
-
setBreakpointDialog = _useState6[1];
|
|
2787
|
-
|
|
2788
|
-
var viewType;
|
|
2789
|
-
|
|
2790
|
-
try {
|
|
2791
|
-
viewType = pluginManager.getViewType('BreakpointSplitView');
|
|
2792
|
-
} catch (e) {// ignore
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
var simpleFeature = new SimpleFeature(feature);
|
|
2796
|
-
return /*#__PURE__*/React.createElement(BaseCard, Object.assign({}, props, {
|
|
2797
|
-
title: "Breakends"
|
|
2798
|
-
}), /*#__PURE__*/React.createElement(Typography, null, "Link to linear view of breakend endpoints"), /*#__PURE__*/React.createElement("ul", null, locStrings.map(function (locString) {
|
|
2799
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
2800
|
-
key: "".concat(JSON.stringify(locString))
|
|
2801
|
-
}, /*#__PURE__*/React.createElement(Link, {
|
|
2802
|
-
href: "#",
|
|
2803
|
-
onClick: function onClick(event) {
|
|
2804
|
-
event.preventDefault();
|
|
2805
|
-
var view = model.view;
|
|
2806
|
-
|
|
2807
|
-
try {
|
|
2808
|
-
if (view) {
|
|
2809
|
-
var _view$navToLocString;
|
|
2810
|
-
|
|
2811
|
-
(_view$navToLocString = view.navToLocString) === null || _view$navToLocString === void 0 ? void 0 : _view$navToLocString.call(view, locString);
|
|
2812
|
-
} else {
|
|
2813
|
-
throw new Error('No view associated with this feature detail panel anymore');
|
|
2814
|
-
}
|
|
2815
|
-
} catch (e) {
|
|
2816
|
-
console.error(e);
|
|
2817
|
-
session.notify("".concat(e));
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
}, "LGV - ".concat(locString)));
|
|
2821
|
-
})), viewType ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Typography, null, "Launch split views with breakend source and target"), /*#__PURE__*/React.createElement("ul", null, locStrings.map(function (locString) {
|
|
2822
|
-
return /*#__PURE__*/React.createElement("li", {
|
|
2823
|
-
key: "".concat(JSON.stringify(locString))
|
|
2824
|
-
}, /*#__PURE__*/React.createElement(Link, {
|
|
2825
|
-
href: "#",
|
|
2826
|
-
onClick: function onClick(event) {
|
|
2827
|
-
event.preventDefault();
|
|
2828
|
-
setBreakpointDialog(true);
|
|
2829
|
-
}
|
|
2830
|
-
}, "".concat(feature.refName, ":").concat(feature.start, " // ").concat(locString, " (split view)")));
|
|
2831
|
-
})), breakpointDialog ? /*#__PURE__*/React.createElement(BreakendOptionDialog$1, {
|
|
2832
|
-
model: model,
|
|
2833
|
-
feature: simpleFeature,
|
|
2834
|
-
viewType: viewType,
|
|
2835
|
-
handleClose: function handleClose() {
|
|
2836
|
-
setBreakpointDialog(false);
|
|
2837
|
-
}
|
|
2838
|
-
}) : null) : null);
|
|
2839
|
-
}
|
|
2840
|
-
|
|
2841
|
-
function VariantFeatureDetails(props) {
|
|
2842
|
-
var model = props.model;
|
|
2843
|
-
var featureData = model.featureData,
|
|
2844
|
-
descriptions = model.descriptions;
|
|
2845
|
-
var feat = JSON.parse(JSON.stringify(featureData));
|
|
2846
|
-
|
|
2847
|
-
var rest = _objectWithoutProperties(feat, _excluded);
|
|
2848
|
-
|
|
2849
|
-
var basicDescriptions = {
|
|
2850
|
-
CHROM: 'chromosome: An identifier from the reference genome',
|
|
2851
|
-
POS: 'position: The reference position, with the 1st base having position 1',
|
|
2852
|
-
ID: 'identifier: Semi-colon separated list of unique identifiers where available',
|
|
2853
|
-
REF: 'reference base(s): Each base must be one of A,C,G,T,N (case insensitive).',
|
|
2854
|
-
ALT: 'alternate base(s): Comma-separated list of alternate non-reference alleles',
|
|
2855
|
-
QUAL: 'quality: Phred-scaled quality score for the assertion made in ALT',
|
|
2856
|
-
FILTER: 'filter status: PASS if this position has passed all filters, otherwise a semicolon-separated list of codes for filters that fail'
|
|
2857
|
-
};
|
|
2858
|
-
return /*#__PURE__*/React.createElement(Paper, {
|
|
2859
|
-
"data-testid": "variant-side-drawer"
|
|
2860
|
-
}, /*#__PURE__*/React.createElement(FeatureDetails, Object.assign({
|
|
2861
|
-
feature: rest,
|
|
2862
|
-
descriptions: _objectSpread2(_objectSpread2({}, basicDescriptions), descriptions)
|
|
2863
|
-
}, props)), /*#__PURE__*/React.createElement(Divider, null), feat.type === 'breakend' ? /*#__PURE__*/React.createElement(BreakendPanel, {
|
|
2864
|
-
feature: feat,
|
|
2865
|
-
locStrings: feat.ALT.map(function (alt) {
|
|
2866
|
-
var _parseBreakend;
|
|
2867
|
-
|
|
2868
|
-
return ((_parseBreakend = parseBreakend(alt)) === null || _parseBreakend === void 0 ? void 0 : _parseBreakend.MatePosition) || '';
|
|
2869
|
-
}),
|
|
2870
|
-
model: model
|
|
2871
|
-
}) : null, feat.type === 'translocation' ? /*#__PURE__*/React.createElement(BreakendPanel, {
|
|
2872
|
-
feature: feat,
|
|
2873
|
-
model: model,
|
|
2874
|
-
locStrings: ["".concat(feat.INFO.CHR2[0], ":").concat(feat.INFO.END)]
|
|
2875
|
-
}) : null, /*#__PURE__*/React.createElement(VariantSamples, Object.assign({
|
|
2876
|
-
feature: feat
|
|
2877
|
-
}, props)));
|
|
2878
|
-
}
|
|
2879
|
-
|
|
2880
|
-
var VariantFeatureWidget = /*#__PURE__*/observer(VariantFeatureDetails);
|
|
2881
|
-
|
|
2882
|
-
var VariantFeatureWidget$1 = {
|
|
2883
|
-
__proto__: null,
|
|
2884
|
-
'default': VariantFeatureWidget
|
|
2885
|
-
};
|
|
2886
|
-
|
|
2887
|
-
export default VariantsPlugin;
|
|
2888
|
-
export { VCFFeature as VcfFeature };
|
|
2889
|
-
//# sourceMappingURL=plugin-variants.esm.js.map
|