@jbrowse/plugin-variants 1.5.0 → 1.5.4
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 +1 -1
- package/dist/VcfAdapter/VcfAdapter.d.ts +12 -9
- package/dist/VcfTabixAdapter/VcfTabixAdapter.d.ts +2 -2
- package/dist/plugin-variants.cjs.development.js +230 -186
- package/dist/plugin-variants.cjs.development.js.map +1 -1
- package/dist/plugin-variants.cjs.production.min.js +1 -1
- package/dist/plugin-variants.cjs.production.min.js.map +1 -1
- package/dist/plugin-variants.esm.js +231 -187
- package/dist/plugin-variants.esm.js.map +1 -1
- package/package.json +7 -7
- package/src/LinearVariantDisplay/configSchema.test.js +2 -13
- package/src/VariantFeatureWidget/VariantFeatureWidget.tsx +1 -1
- package/src/VariantFeatureWidget/__snapshots__/VariantFeatureWidget.test.js.snap +1 -0
- package/src/VcfAdapter/VcfAdapter.ts +62 -78
- package/src/VcfAdapter/__snapshots__/VcfAdapter.test.ts.snap +5 -5
- package/src/VcfTabixAdapter/VcfTabixAdapter.ts +1 -1
- package/src/index.ts +67 -0
- package/src/declare.d.ts +0 -2
|
@@ -8,7 +8,7 @@ import WidgetType from '@jbrowse/core/pluggableElementTypes/WidgetType';
|
|
|
8
8
|
import Plugin from '@jbrowse/core/Plugin';
|
|
9
9
|
import { linearBasicDisplayConfigSchemaFactory, linearBasicDisplayModelFactory, BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
10
10
|
import { baseChordDisplayConfig, BaseChordDisplayModel, BaseChordDisplayComponentFactory } from '@jbrowse/plugin-circular-view';
|
|
11
|
-
import { getRpcSessionId } from '@jbrowse/core/util/tracks';
|
|
11
|
+
import { getRpcSessionId, getFileName, makeIndex, makeIndexType } from '@jbrowse/core/util/tracks';
|
|
12
12
|
import { getContainingView, getSession, isSessionModelWithWidgets, getContainingTrack, polarToCartesian } from '@jbrowse/core/util';
|
|
13
13
|
import { types, getSnapshot, getEnv } from 'mobx-state-tree';
|
|
14
14
|
import ChordRendererType from '@jbrowse/core/pluggableElementTypes/renderers/CircularChordRendererType';
|
|
@@ -34,14 +34,9 @@ function ownKeys(object, enumerableOnly) {
|
|
|
34
34
|
|
|
35
35
|
if (Object.getOwnPropertySymbols) {
|
|
36
36
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
keys.push.apply(keys, symbols);
|
|
37
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
38
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
39
|
+
})), keys.push.apply(keys, symbols);
|
|
45
40
|
}
|
|
46
41
|
|
|
47
42
|
return keys;
|
|
@@ -49,19 +44,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
49
44
|
|
|
50
45
|
function _objectSpread2(target) {
|
|
51
46
|
for (var i = 1; i < arguments.length; i++) {
|
|
52
|
-
var source = arguments[i]
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
59
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
60
|
-
} else {
|
|
61
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
62
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
63
|
-
});
|
|
64
|
-
}
|
|
47
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
48
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
49
|
+
_defineProperty(target, key, source[key]);
|
|
50
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
51
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
52
|
+
});
|
|
65
53
|
}
|
|
66
54
|
|
|
67
55
|
return target;
|
|
@@ -122,6 +110,9 @@ function _defineProperties(target, props) {
|
|
|
122
110
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
123
111
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
124
112
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
113
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
114
|
+
writable: false
|
|
115
|
+
});
|
|
125
116
|
return Constructor;
|
|
126
117
|
}
|
|
127
118
|
|
|
@@ -145,12 +136,15 @@ function _inherits(subClass, superClass) {
|
|
|
145
136
|
throw new TypeError("Super expression must either be null or a function");
|
|
146
137
|
}
|
|
147
138
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
139
|
+
Object.defineProperty(subClass, "prototype", {
|
|
140
|
+
value: Object.create(superClass && superClass.prototype, {
|
|
141
|
+
constructor: {
|
|
142
|
+
value: subClass,
|
|
143
|
+
writable: true,
|
|
144
|
+
configurable: true
|
|
145
|
+
}
|
|
146
|
+
}),
|
|
147
|
+
writable: false
|
|
154
148
|
});
|
|
155
149
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
156
150
|
}
|
|
@@ -266,7 +260,7 @@ function _superPropBase(object, property) {
|
|
|
266
260
|
return object;
|
|
267
261
|
}
|
|
268
262
|
|
|
269
|
-
function _get(
|
|
263
|
+
function _get() {
|
|
270
264
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
271
265
|
_get = Reflect.get;
|
|
272
266
|
} else {
|
|
@@ -277,14 +271,14 @@ function _get(target, property, receiver) {
|
|
|
277
271
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
278
272
|
|
|
279
273
|
if (desc.get) {
|
|
280
|
-
return desc.get.call(receiver);
|
|
274
|
+
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
281
275
|
}
|
|
282
276
|
|
|
283
277
|
return desc.value;
|
|
284
278
|
};
|
|
285
279
|
}
|
|
286
280
|
|
|
287
|
-
return _get(
|
|
281
|
+
return _get.apply(this, arguments);
|
|
288
282
|
}
|
|
289
283
|
|
|
290
284
|
function _slicedToArray(arr, i) {
|
|
@@ -1818,6 +1812,36 @@ var VariantsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
1818
1812
|
}
|
|
1819
1813
|
});
|
|
1820
1814
|
});
|
|
1815
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
1816
|
+
return function (file, index, adapterHint) {
|
|
1817
|
+
var regexGuess = /\.vcf\.b?gz$/i;
|
|
1818
|
+
var adapterName = 'VcfTabixAdapter';
|
|
1819
|
+
var fileName = getFileName(file);
|
|
1820
|
+
var indexName = index && getFileName(index);
|
|
1821
|
+
|
|
1822
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
1823
|
+
return {
|
|
1824
|
+
type: adapterName,
|
|
1825
|
+
vcfGzLocation: file,
|
|
1826
|
+
index: {
|
|
1827
|
+
location: index || makeIndex(file, '.tbi'),
|
|
1828
|
+
indexType: makeIndexType(indexName, 'CSI', 'TBI')
|
|
1829
|
+
}
|
|
1830
|
+
};
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
return adapterGuesser(file, index, adapterHint);
|
|
1834
|
+
};
|
|
1835
|
+
});
|
|
1836
|
+
pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', function (trackTypeGuesser) {
|
|
1837
|
+
return function (adapterName) {
|
|
1838
|
+
if (adapterName === 'VcfTabixAdapter') {
|
|
1839
|
+
return 'VariantTrack';
|
|
1840
|
+
}
|
|
1841
|
+
|
|
1842
|
+
return trackTypeGuesser(adapterName);
|
|
1843
|
+
};
|
|
1844
|
+
});
|
|
1821
1845
|
pluginManager.addAdapterType(function () {
|
|
1822
1846
|
return new AdapterType({
|
|
1823
1847
|
name: 'VcfAdapter',
|
|
@@ -1829,6 +1853,22 @@ var VariantsPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
1829
1853
|
}
|
|
1830
1854
|
});
|
|
1831
1855
|
});
|
|
1856
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
1857
|
+
return function (file, index, adapterHint) {
|
|
1858
|
+
var regexGuess = /\.vcf$/i;
|
|
1859
|
+
var adapterName = 'VcfAdapter';
|
|
1860
|
+
var fileName = getFileName(file);
|
|
1861
|
+
|
|
1862
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
1863
|
+
return {
|
|
1864
|
+
type: adapterName,
|
|
1865
|
+
vcfLocation: file
|
|
1866
|
+
};
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
return adapterGuesser(file, index, adapterHint);
|
|
1870
|
+
};
|
|
1871
|
+
});
|
|
1832
1872
|
pluginManager.addRendererType(function () {
|
|
1833
1873
|
return pluginManager.jbrequire(ChordRendererConfigF);
|
|
1834
1874
|
});
|
|
@@ -2236,7 +2276,9 @@ var _default = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2236
2276
|
}()
|
|
2237
2277
|
}, {
|
|
2238
2278
|
key: "freeResources",
|
|
2239
|
-
value: function
|
|
2279
|
+
value: function
|
|
2280
|
+
/* { region } */
|
|
2281
|
+
freeResources() {}
|
|
2240
2282
|
}]);
|
|
2241
2283
|
|
|
2242
2284
|
return _default;
|
|
@@ -2250,12 +2292,9 @@ var VcfTabixAdapter = {
|
|
|
2250
2292
|
var readVcf = function readVcf(f) {
|
|
2251
2293
|
var lines = f.split('\n');
|
|
2252
2294
|
var header = [];
|
|
2253
|
-
var refNames = [];
|
|
2254
2295
|
var rest = [];
|
|
2255
2296
|
lines.forEach(function (line) {
|
|
2256
|
-
if (line.startsWith('
|
|
2257
|
-
refNames.push(line.split('##contig=<ID=')[1].split(',')[0]);
|
|
2258
|
-
} else if (line.startsWith('#')) {
|
|
2297
|
+
if (line.startsWith('#')) {
|
|
2259
2298
|
header.push(line);
|
|
2260
2299
|
} else if (line) {
|
|
2261
2300
|
rest.push(line);
|
|
@@ -2263,60 +2302,44 @@ var readVcf = function readVcf(f) {
|
|
|
2263
2302
|
});
|
|
2264
2303
|
return {
|
|
2265
2304
|
header: header.join('\n'),
|
|
2266
|
-
lines: rest
|
|
2267
|
-
refNames: refNames
|
|
2305
|
+
lines: rest
|
|
2268
2306
|
};
|
|
2269
2307
|
};
|
|
2270
2308
|
|
|
2309
|
+
function isGzip(buf) {
|
|
2310
|
+
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2271
2313
|
var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
2272
2314
|
_inherits(VcfAdapter, _BaseFeatureDataAdapt);
|
|
2273
2315
|
|
|
2274
2316
|
var _super = /*#__PURE__*/_createSuper(VcfAdapter);
|
|
2275
2317
|
|
|
2276
|
-
function VcfAdapter(
|
|
2318
|
+
function VcfAdapter() {
|
|
2277
2319
|
_classCallCheck(this, VcfAdapter);
|
|
2278
2320
|
|
|
2279
|
-
return _super.
|
|
2321
|
+
return _super.apply(this, arguments);
|
|
2280
2322
|
}
|
|
2281
2323
|
|
|
2282
2324
|
_createClass(VcfAdapter, [{
|
|
2283
|
-
key: "
|
|
2325
|
+
key: "getHeader",
|
|
2284
2326
|
value: function () {
|
|
2285
|
-
var
|
|
2286
|
-
var
|
|
2327
|
+
var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
2328
|
+
var _yield$this$setup, header;
|
|
2329
|
+
|
|
2287
2330
|
return runtime_1.wrap(function _callee$(_context) {
|
|
2288
2331
|
while (1) {
|
|
2289
2332
|
switch (_context.prev = _context.next) {
|
|
2290
2333
|
case 0:
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
return openLocation(vcfLocation, this.pluginManager).readFile();
|
|
2294
|
-
|
|
2295
|
-
case 3:
|
|
2296
|
-
fileContents = _context.sent;
|
|
2297
|
-
|
|
2298
|
-
if (!(typeof fileContents[0] === 'number' && fileContents[0] === 31 && typeof fileContents[1] === 'number' && fileContents[1] === 139 && typeof fileContents[2] === 'number' && fileContents[2] === 8)) {
|
|
2299
|
-
_context.next = 12;
|
|
2300
|
-
break;
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
_context.t0 = new TextDecoder();
|
|
2304
|
-
_context.next = 8;
|
|
2305
|
-
return unzip(fileContents);
|
|
2334
|
+
_context.next = 2;
|
|
2335
|
+
return this.setup();
|
|
2306
2336
|
|
|
2307
|
-
case
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
_context.
|
|
2311
|
-
break;
|
|
2312
|
-
|
|
2313
|
-
case 12:
|
|
2314
|
-
fileContents = fileContents.toString();
|
|
2315
|
-
|
|
2316
|
-
case 13:
|
|
2317
|
-
return _context.abrupt("return", readVcf(fileContents));
|
|
2337
|
+
case 2:
|
|
2338
|
+
_yield$this$setup = _context.sent;
|
|
2339
|
+
header = _yield$this$setup.header;
|
|
2340
|
+
return _context.abrupt("return", header);
|
|
2318
2341
|
|
|
2319
|
-
case
|
|
2342
|
+
case 5:
|
|
2320
2343
|
case "end":
|
|
2321
2344
|
return _context.stop();
|
|
2322
2345
|
}
|
|
@@ -2324,31 +2347,34 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2324
2347
|
}, _callee, this);
|
|
2325
2348
|
}));
|
|
2326
2349
|
|
|
2327
|
-
function
|
|
2328
|
-
return
|
|
2350
|
+
function getHeader() {
|
|
2351
|
+
return _getHeader.apply(this, arguments);
|
|
2329
2352
|
}
|
|
2330
2353
|
|
|
2331
|
-
return
|
|
2354
|
+
return getHeader;
|
|
2332
2355
|
}()
|
|
2333
2356
|
}, {
|
|
2334
|
-
key: "
|
|
2357
|
+
key: "getMetadata",
|
|
2335
2358
|
value: function () {
|
|
2336
|
-
var
|
|
2337
|
-
var _yield$this$
|
|
2359
|
+
var _getMetadata = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
2360
|
+
var _yield$this$setup2, header, parser;
|
|
2338
2361
|
|
|
2339
2362
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
2340
2363
|
while (1) {
|
|
2341
2364
|
switch (_context2.prev = _context2.next) {
|
|
2342
2365
|
case 0:
|
|
2343
2366
|
_context2.next = 2;
|
|
2344
|
-
return this.
|
|
2367
|
+
return this.setup();
|
|
2345
2368
|
|
|
2346
2369
|
case 2:
|
|
2347
|
-
_yield$this$
|
|
2348
|
-
header = _yield$this$
|
|
2349
|
-
|
|
2370
|
+
_yield$this$setup2 = _context2.sent;
|
|
2371
|
+
header = _yield$this$setup2.header;
|
|
2372
|
+
parser = new VCF({
|
|
2373
|
+
header: header
|
|
2374
|
+
});
|
|
2375
|
+
return _context2.abrupt("return", parser.getMetadata());
|
|
2350
2376
|
|
|
2351
|
-
case
|
|
2377
|
+
case 6:
|
|
2352
2378
|
case "end":
|
|
2353
2379
|
return _context2.stop();
|
|
2354
2380
|
}
|
|
@@ -2356,122 +2382,131 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2356
2382
|
}, _callee2, this);
|
|
2357
2383
|
}));
|
|
2358
2384
|
|
|
2359
|
-
function
|
|
2360
|
-
return
|
|
2385
|
+
function getMetadata() {
|
|
2386
|
+
return _getMetadata.apply(this, arguments);
|
|
2361
2387
|
}
|
|
2362
2388
|
|
|
2363
|
-
return
|
|
2364
|
-
}()
|
|
2389
|
+
return getMetadata;
|
|
2390
|
+
}() // converts lines into an interval tree
|
|
2391
|
+
|
|
2365
2392
|
}, {
|
|
2366
|
-
key: "
|
|
2393
|
+
key: "setupP",
|
|
2367
2394
|
value: function () {
|
|
2368
|
-
var
|
|
2369
|
-
var
|
|
2395
|
+
var _setupP = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
2396
|
+
var buffer, buf, str, _readVcf, header, lines, intervalTree;
|
|
2370
2397
|
|
|
2371
2398
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
2372
2399
|
while (1) {
|
|
2373
2400
|
switch (_context3.prev = _context3.next) {
|
|
2374
2401
|
case 0:
|
|
2375
2402
|
_context3.next = 2;
|
|
2376
|
-
return this.
|
|
2403
|
+
return openLocation(readConfObject(this.config, 'vcfLocation'), this.pluginManager).readFile();
|
|
2377
2404
|
|
|
2378
2405
|
case 2:
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2406
|
+
buffer = _context3.sent;
|
|
2407
|
+
|
|
2408
|
+
if (!isGzip(buffer)) {
|
|
2409
|
+
_context3.next = 9;
|
|
2410
|
+
break;
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
_context3.next = 6;
|
|
2414
|
+
return unzip(buffer);
|
|
2385
2415
|
|
|
2386
2416
|
case 6:
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
}
|
|
2391
|
-
}, _callee3, this);
|
|
2392
|
-
}));
|
|
2417
|
+
_context3.t0 = _context3.sent;
|
|
2418
|
+
_context3.next = 10;
|
|
2419
|
+
break;
|
|
2393
2420
|
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
}
|
|
2421
|
+
case 9:
|
|
2422
|
+
_context3.t0 = buffer;
|
|
2397
2423
|
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
}, {
|
|
2401
|
-
key: "getLines",
|
|
2402
|
-
value: function () {
|
|
2403
|
-
var _getLines = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
2404
|
-
var _this = this;
|
|
2424
|
+
case 10:
|
|
2425
|
+
buf = _context3.t0;
|
|
2405
2426
|
|
|
2406
|
-
|
|
2427
|
+
if (!(buf.length > 536870888)) {
|
|
2428
|
+
_context3.next = 13;
|
|
2429
|
+
break;
|
|
2430
|
+
}
|
|
2407
2431
|
|
|
2408
|
-
|
|
2409
|
-
while (1) {
|
|
2410
|
-
switch (_context4.prev = _context4.next) {
|
|
2411
|
-
case 0:
|
|
2412
|
-
_context4.next = 2;
|
|
2413
|
-
return this.decodeFileContents();
|
|
2432
|
+
throw new Error('Data exceeds maximum string length (512MB)');
|
|
2414
2433
|
|
|
2415
|
-
case
|
|
2416
|
-
|
|
2417
|
-
header =
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2434
|
+
case 13:
|
|
2435
|
+
str = new TextDecoder().decode(buf);
|
|
2436
|
+
_readVcf = readVcf(str), header = _readVcf.header, lines = _readVcf.lines;
|
|
2437
|
+
intervalTree = lines.map(function (line, id) {
|
|
2438
|
+
var _info$match;
|
|
2439
|
+
|
|
2440
|
+
var _line$split = line.split('\t'),
|
|
2441
|
+
_line$split2 = _slicedToArray(_line$split, 8),
|
|
2442
|
+
refName = _line$split2[0],
|
|
2443
|
+
startP = _line$split2[1],
|
|
2444
|
+
ref = _line$split2[3],
|
|
2445
|
+
info = _line$split2[7];
|
|
2446
|
+
|
|
2447
|
+
var start = +startP - 1;
|
|
2448
|
+
var end = +(((_info$match = info.match(/END=(\d+)/)) === null || _info$match === void 0 ? void 0 : _info$match[1].trim()) || start + ref.length);
|
|
2449
|
+
return {
|
|
2450
|
+
line: line,
|
|
2451
|
+
refName: refName,
|
|
2452
|
+
start: start,
|
|
2453
|
+
end: end,
|
|
2454
|
+
id: id
|
|
2455
|
+
};
|
|
2456
|
+
}).reduce(function (acc, obj) {
|
|
2457
|
+
var key = obj.refName;
|
|
2458
|
+
|
|
2459
|
+
if (!acc[key]) {
|
|
2460
|
+
acc[key] = new IntervalTree();
|
|
2461
|
+
}
|
|
2462
|
+
|
|
2463
|
+
acc[key].insert([obj.start, obj.end], obj);
|
|
2464
|
+
return acc;
|
|
2465
|
+
}, {});
|
|
2466
|
+
return _context3.abrupt("return", {
|
|
2467
|
+
header: header,
|
|
2468
|
+
intervalTree: intervalTree
|
|
2421
2469
|
});
|
|
2422
|
-
return _context4.abrupt("return", lines.map(function (line, index) {
|
|
2423
|
-
return new VCFFeature({
|
|
2424
|
-
variant: parser.parseLine(line),
|
|
2425
|
-
parser: parser,
|
|
2426
|
-
id: "".concat(_this.id, "-vcf-").concat(index)
|
|
2427
|
-
});
|
|
2428
|
-
}));
|
|
2429
2470
|
|
|
2430
|
-
case
|
|
2471
|
+
case 17:
|
|
2431
2472
|
case "end":
|
|
2432
|
-
return
|
|
2473
|
+
return _context3.stop();
|
|
2433
2474
|
}
|
|
2434
2475
|
}
|
|
2435
|
-
},
|
|
2476
|
+
}, _callee3, this);
|
|
2436
2477
|
}));
|
|
2437
2478
|
|
|
2438
|
-
function
|
|
2439
|
-
return
|
|
2479
|
+
function setupP() {
|
|
2480
|
+
return _setupP.apply(this, arguments);
|
|
2440
2481
|
}
|
|
2441
2482
|
|
|
2442
|
-
return
|
|
2483
|
+
return setupP;
|
|
2443
2484
|
}()
|
|
2444
2485
|
}, {
|
|
2445
2486
|
key: "setup",
|
|
2446
2487
|
value: function () {
|
|
2447
|
-
var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2448
|
-
|
|
2488
|
+
var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
2489
|
+
var _this = this;
|
|
2490
|
+
|
|
2491
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
2449
2492
|
while (1) {
|
|
2450
|
-
switch (
|
|
2493
|
+
switch (_context4.prev = _context4.next) {
|
|
2451
2494
|
case 0:
|
|
2452
2495
|
if (!this.vcfFeatures) {
|
|
2453
|
-
this.vcfFeatures = this.
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
if (!acc[key]) {
|
|
2458
|
-
acc[key] = new IntervalTree();
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
acc[key].insert([obj.get('start'), obj.get('end')], obj);
|
|
2462
|
-
return acc;
|
|
2463
|
-
}, {});
|
|
2496
|
+
this.vcfFeatures = this.setupP()["catch"](function (e) {
|
|
2497
|
+
_this.vcfFeatures = undefined;
|
|
2498
|
+
throw e;
|
|
2464
2499
|
});
|
|
2465
2500
|
}
|
|
2466
2501
|
|
|
2467
|
-
return
|
|
2502
|
+
return _context4.abrupt("return", this.vcfFeatures);
|
|
2468
2503
|
|
|
2469
2504
|
case 2:
|
|
2470
2505
|
case "end":
|
|
2471
|
-
return
|
|
2506
|
+
return _context4.stop();
|
|
2472
2507
|
}
|
|
2473
2508
|
}
|
|
2474
|
-
},
|
|
2509
|
+
}, _callee4, this);
|
|
2475
2510
|
}));
|
|
2476
2511
|
|
|
2477
2512
|
function setup() {
|
|
@@ -2483,28 +2518,28 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2483
2518
|
}, {
|
|
2484
2519
|
key: "getRefNames",
|
|
2485
2520
|
value: function () {
|
|
2486
|
-
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2487
|
-
var _yield$this$
|
|
2488
|
-
|
|
2521
|
+
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
|
|
2522
|
+
var _yield$this$setup3,
|
|
2523
|
+
intervalTree;
|
|
2489
2524
|
|
|
2490
|
-
return runtime_1.wrap(function
|
|
2525
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
2491
2526
|
while (1) {
|
|
2492
|
-
switch (
|
|
2527
|
+
switch (_context5.prev = _context5.next) {
|
|
2493
2528
|
case 0:
|
|
2494
|
-
|
|
2495
|
-
return this.
|
|
2529
|
+
_context5.next = 3;
|
|
2530
|
+
return this.setup();
|
|
2496
2531
|
|
|
2497
2532
|
case 3:
|
|
2498
|
-
_yield$this$
|
|
2499
|
-
|
|
2500
|
-
return
|
|
2533
|
+
_yield$this$setup3 = _context5.sent;
|
|
2534
|
+
intervalTree = _yield$this$setup3.intervalTree;
|
|
2535
|
+
return _context5.abrupt("return", Object.keys(intervalTree));
|
|
2501
2536
|
|
|
2502
2537
|
case 6:
|
|
2503
2538
|
case "end":
|
|
2504
|
-
return
|
|
2539
|
+
return _context5.stop();
|
|
2505
2540
|
}
|
|
2506
2541
|
}
|
|
2507
|
-
},
|
|
2542
|
+
}, _callee5, this);
|
|
2508
2543
|
}));
|
|
2509
2544
|
|
|
2510
2545
|
function getRefNames() {
|
|
@@ -2520,40 +2555,47 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
2520
2555
|
|
|
2521
2556
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
2522
2557
|
return ObservableCreate( /*#__PURE__*/function () {
|
|
2523
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
2524
|
-
var start, end, refName,
|
|
2525
|
-
|
|
2558
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(observer) {
|
|
2559
|
+
var _intervalTree$refName, start, end, refName, _yield$_this2$setup, header, intervalTree, parser;
|
|
2560
|
+
|
|
2561
|
+
return runtime_1.wrap(function _callee6$(_context6) {
|
|
2526
2562
|
while (1) {
|
|
2527
|
-
switch (
|
|
2563
|
+
switch (_context6.prev = _context6.next) {
|
|
2528
2564
|
case 0:
|
|
2529
|
-
|
|
2565
|
+
_context6.prev = 0;
|
|
2530
2566
|
start = region.start, end = region.end, refName = region.refName;
|
|
2531
|
-
|
|
2567
|
+
_context6.next = 4;
|
|
2532
2568
|
return _this2.setup();
|
|
2533
2569
|
|
|
2534
2570
|
case 4:
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2571
|
+
_yield$_this2$setup = _context6.sent;
|
|
2572
|
+
header = _yield$_this2$setup.header;
|
|
2573
|
+
intervalTree = _yield$_this2$setup.intervalTree;
|
|
2574
|
+
parser = new VCF({
|
|
2575
|
+
header: header
|
|
2576
|
+
});
|
|
2577
|
+
(_intervalTree$refName = intervalTree[refName]) === null || _intervalTree$refName === void 0 ? void 0 : _intervalTree$refName.search([start, end]).forEach(function (f) {
|
|
2578
|
+
return observer.next(new VCFFeature({
|
|
2579
|
+
variant: parser.parseLine(f.line),
|
|
2580
|
+
parser: parser,
|
|
2581
|
+
id: "".concat(_this2.id, "-").concat(f.id)
|
|
2582
|
+
}));
|
|
2541
2583
|
});
|
|
2542
2584
|
observer.complete();
|
|
2543
|
-
|
|
2585
|
+
_context6.next = 15;
|
|
2544
2586
|
break;
|
|
2545
2587
|
|
|
2546
|
-
case
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
observer.error(
|
|
2588
|
+
case 12:
|
|
2589
|
+
_context6.prev = 12;
|
|
2590
|
+
_context6.t0 = _context6["catch"](0);
|
|
2591
|
+
observer.error(_context6.t0);
|
|
2550
2592
|
|
|
2551
|
-
case
|
|
2593
|
+
case 15:
|
|
2552
2594
|
case "end":
|
|
2553
|
-
return
|
|
2595
|
+
return _context6.stop();
|
|
2554
2596
|
}
|
|
2555
2597
|
}
|
|
2556
|
-
},
|
|
2598
|
+
}, _callee6, null, [[0, 12]]);
|
|
2557
2599
|
}));
|
|
2558
2600
|
|
|
2559
2601
|
return function (_x) {
|
|
@@ -2846,7 +2888,9 @@ function VariantFeatureDetails(props) {
|
|
|
2846
2888
|
}, props)), /*#__PURE__*/React.createElement(Divider, null), feat.type === 'breakend' ? /*#__PURE__*/React.createElement(BreakendPanel, {
|
|
2847
2889
|
feature: feat,
|
|
2848
2890
|
locStrings: feat.ALT.map(function (alt) {
|
|
2849
|
-
|
|
2891
|
+
var _parseBreakend;
|
|
2892
|
+
|
|
2893
|
+
return ((_parseBreakend = parseBreakend(alt)) === null || _parseBreakend === void 0 ? void 0 : _parseBreakend.MatePosition) || '';
|
|
2850
2894
|
}),
|
|
2851
2895
|
model: model
|
|
2852
2896
|
}) : null, feat.type === 'translocation' ? /*#__PURE__*/React.createElement(BreakendPanel, {
|