@jbrowse/plugin-variants 1.4.3 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,10 +28,11 @@ var BaseAdapter = require('@jbrowse/core/data_adapters/BaseAdapter');
28
28
  var io = require('@jbrowse/core/util/io');
29
29
  var rxjs = require('@jbrowse/core/util/rxjs');
30
30
  var tabix = require('@gmod/tabix');
31
+ var IntervalTree = _interopDefault(require('@flatten-js/interval-tree'));
31
32
  var bgzfFilehandle = require('@gmod/bgzf-filehandle');
32
33
  var core = require('@material-ui/core');
33
34
  var SimpleFeature = _interopDefault(require('@jbrowse/core/util/simpleFeature'));
34
- var dataGrid = require('@material-ui/data-grid');
35
+ var xDataGrid = require('@mui/x-data-grid');
35
36
  var BaseFeatureDetail = require('@jbrowse/core/BaseFeatureWidget/BaseFeatureDetail');
36
37
  var styles = require('@material-ui/core/styles');
37
38
  var CloseIcon = _interopDefault(require('@material-ui/icons/Close'));
@@ -238,6 +239,8 @@ function _assertThisInitialized(self) {
238
239
  function _possibleConstructorReturn(self, call) {
239
240
  if (call && (typeof call === "object" || typeof call === "function")) {
240
241
  return call;
242
+ } else if (call !== void 0) {
243
+ throw new TypeError("Derived constructors may only return object or undefined");
241
244
  }
242
245
 
243
246
  return _assertThisInitialized(self);
@@ -601,11 +604,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
601
604
 
602
605
 
603
606
  var IteratorPrototype = {};
604
-
605
- IteratorPrototype[iteratorSymbol] = function () {
607
+ define(IteratorPrototype, iteratorSymbol, function () {
606
608
  return this;
607
- };
608
-
609
+ });
609
610
  var getProto = Object.getPrototypeOf;
610
611
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
611
612
 
@@ -616,8 +617,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
616
617
  }
617
618
 
618
619
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
619
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
620
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
620
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
621
+ define(Gp, "constructor", GeneratorFunctionPrototype);
622
+ define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
621
623
  GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
622
624
  // Iterator interface in terms of a single ._invoke method.
623
625
 
@@ -722,11 +724,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
722
724
  }
723
725
 
724
726
  defineIteratorMethods(AsyncIterator.prototype);
725
-
726
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
727
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
727
728
  return this;
728
- };
729
-
729
+ });
730
730
  exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
731
731
  // AsyncIterator objects; they just return a Promise for the value of
732
732
  // the final result produced by the iterator.
@@ -903,13 +903,12 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
903
903
  // object to not be returned from this call. This ensures that doesn't happen.
904
904
  // See https://github.com/facebook/regenerator/issues/274 for more details.
905
905
 
906
- Gp[iteratorSymbol] = function () {
906
+ define(Gp, iteratorSymbol, function () {
907
907
  return this;
908
- };
909
-
910
- Gp.toString = function () {
908
+ });
909
+ define(Gp, "toString", function () {
911
910
  return "[object Generator]";
912
- };
911
+ });
913
912
 
914
913
  function pushTryEntry(locs) {
915
914
  var entry = {
@@ -1221,14 +1220,19 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
1221
1220
  } catch (accidentalStrictMode) {
1222
1221
  // This module should not be running in strict mode, so the above
1223
1222
  // assignment should always work unless something is misconfigured. Just
1224
- // in case runtime.js accidentally runs in strict mode, we can escape
1223
+ // in case runtime.js accidentally runs in strict mode, in modern engines
1224
+ // we can explicitly access globalThis. In older engines we can escape
1225
1225
  // strict mode using a global Function call. This could conceivably fail
1226
1226
  // if a Content Security Policy forbids using Function, but in that case
1227
1227
  // the proper solution is to fix the accidental strict mode problem. If
1228
1228
  // you've misconfigured your bundler to force strict mode and applied a
1229
1229
  // CSP to forbid Function, and you're not willing to fix either of those
1230
1230
  // problems, please detail your unique predicament in a GitHub issue.
1231
- Function("r", "regeneratorRuntime = r")(runtime);
1231
+ if (typeof globalThis === "object") {
1232
+ globalThis.regeneratorRuntime = runtime;
1233
+ } else {
1234
+ Function("r", "regeneratorRuntime = r")(runtime);
1235
+ }
1232
1236
  }
1233
1237
  });
1234
1238
 
@@ -1326,7 +1330,7 @@ var Chord = /*#__PURE__*/mobxReact.observer(function Chord(_ref) {
1326
1330
  var endPosition;
1327
1331
  var endBlock;
1328
1332
  var alt = (_feature$get = feature.get('ALT')) === null || _feature$get === void 0 ? void 0 : _feature$get[0];
1329
- var bnd = VCF.parseBreakend(alt);
1333
+ var bnd = alt && VCF.parseBreakend(alt);
1330
1334
 
1331
1335
  if (bnd) {
1332
1336
  // VCF BND
@@ -1382,6 +1386,7 @@ var Chord = /*#__PURE__*/mobxReact.observer(function Chord(_ref) {
1382
1386
  onMouseOut: function onMouseOut(evt) {
1383
1387
  if (!selected) {
1384
1388
  evt.target.style.stroke = strokeColor;
1389
+ evt.target.style.strokeWidth = 1;
1385
1390
  }
1386
1391
  }
1387
1392
  });
@@ -1525,7 +1530,8 @@ var vcfTabixAdapterConfigSchema = /*#__PURE__*/configuration.ConfigurationSchema
1525
1530
  vcfGzLocation: {
1526
1531
  type: 'fileLocation',
1527
1532
  defaultValue: {
1528
- uri: '/path/to/my.vcf.gz'
1533
+ uri: '/path/to/my.vcf.gz',
1534
+ locationType: 'UriLocation'
1529
1535
  }
1530
1536
  },
1531
1537
  index: /*#__PURE__*/configuration.ConfigurationSchema('VcfIndex', {
@@ -1537,7 +1543,8 @@ var vcfTabixAdapterConfigSchema = /*#__PURE__*/configuration.ConfigurationSchema
1537
1543
  location: {
1538
1544
  type: 'fileLocation',
1539
1545
  defaultValue: {
1540
- uri: '/path/to/my.vcf.gz.tbi'
1546
+ uri: '/path/to/my.vcf.gz.tbi',
1547
+ locationType: 'UriLocation'
1541
1548
  }
1542
1549
  }
1543
1550
  })
@@ -1549,7 +1556,8 @@ var vcfAdapterConfigSchema = /*#__PURE__*/configuration.ConfigurationSchema('Vcf
1549
1556
  vcfLocation: {
1550
1557
  type: 'fileLocation',
1551
1558
  defaultValue: {
1552
- uri: '/path/to/my.vcf'
1559
+ uri: '/path/to/my.vcf',
1560
+ locationType: 'UriLocation'
1553
1561
  }
1554
1562
  }
1555
1563
  }, {
@@ -1818,6 +1826,36 @@ var VariantsPlugin = /*#__PURE__*/function (_Plugin) {
1818
1826
  }
1819
1827
  });
1820
1828
  });
1829
+ pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
1830
+ return function (file, index, adapterHint) {
1831
+ var regexGuess = /\.vcf\.b?gz$/i;
1832
+ var adapterName = 'VcfTabixAdapter';
1833
+ var fileName = tracks.getFileName(file);
1834
+ var indexName = index && tracks.getFileName(index);
1835
+
1836
+ if (regexGuess.test(fileName) || adapterHint === adapterName) {
1837
+ return {
1838
+ type: adapterName,
1839
+ vcfGzLocation: file,
1840
+ index: {
1841
+ location: index || tracks.makeIndex(file, '.tbi'),
1842
+ indexType: tracks.makeIndexType(indexName, 'CSI', 'TBI')
1843
+ }
1844
+ };
1845
+ }
1846
+
1847
+ return adapterGuesser(file, index, adapterHint);
1848
+ };
1849
+ });
1850
+ pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', function (trackTypeGuesser) {
1851
+ return function (adapterName) {
1852
+ if (adapterName === 'VcfTabixAdapter') {
1853
+ return 'VariantTrack';
1854
+ }
1855
+
1856
+ return trackTypeGuesser(adapterName);
1857
+ };
1858
+ });
1821
1859
  pluginManager.addAdapterType(function () {
1822
1860
  return new AdapterType({
1823
1861
  name: 'VcfAdapter',
@@ -1829,6 +1867,22 @@ var VariantsPlugin = /*#__PURE__*/function (_Plugin) {
1829
1867
  }
1830
1868
  });
1831
1869
  });
1870
+ pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
1871
+ return function (file, index, adapterHint) {
1872
+ var regexGuess = /\.vcf$/i;
1873
+ var adapterName = 'VcfAdapter';
1874
+ var fileName = tracks.getFileName(file);
1875
+
1876
+ if (regexGuess.test(fileName) || adapterHint === adapterName) {
1877
+ return {
1878
+ type: adapterName,
1879
+ vcfLocation: file
1880
+ };
1881
+ }
1882
+
1883
+ return adapterGuesser(file, index, adapterHint);
1884
+ };
1885
+ });
1832
1886
  pluginManager.addRendererType(function () {
1833
1887
  return pluginManager.jbrequire(ChordRendererConfigF);
1834
1888
  });
@@ -1899,12 +1953,12 @@ var _default = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
1899
1953
  vcfGzLocation = configuration.readConfObject(this.config, 'vcfGzLocation');
1900
1954
  location = configuration.readConfObject(this.config, ['index', 'location']);
1901
1955
  indexType = configuration.readConfObject(this.config, ['index', 'indexType']);
1902
- filehandle = io.openLocation(vcfGzLocation);
1956
+ filehandle = io.openLocation(vcfGzLocation, this.pluginManager);
1903
1957
  isCSI = indexType === 'CSI';
1904
1958
  vcf = new tabix.TabixIndexedFile({
1905
1959
  filehandle: filehandle,
1906
- csiFilehandle: isCSI ? io.openLocation(location) : undefined,
1907
- tbiFilehandle: !isCSI ? io.openLocation(location) : undefined,
1960
+ csiFilehandle: isCSI ? io.openLocation(location, this.pluginManager) : undefined,
1961
+ tbiFilehandle: !isCSI ? io.openLocation(location, this.pluginManager) : undefined,
1908
1962
  chunkCacheSize: 50 * Math.pow(2, 20),
1909
1963
  chunkSizeLimit: 1000000000
1910
1964
  });
@@ -2236,9 +2290,9 @@ var _default = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2236
2290
  }()
2237
2291
  }, {
2238
2292
  key: "freeResources",
2239
- value: function freeResources()
2240
- /* { region } */
2241
- {}
2293
+ value: function
2294
+ /* { region } */
2295
+ freeResources() {}
2242
2296
  }]);
2243
2297
 
2244
2298
  return _default;
@@ -2252,12 +2306,9 @@ var VcfTabixAdapter = {
2252
2306
  var readVcf = function readVcf(f) {
2253
2307
  var lines = f.split('\n');
2254
2308
  var header = [];
2255
- var refNames = [];
2256
2309
  var rest = [];
2257
2310
  lines.forEach(function (line) {
2258
- if (line.startsWith('##contig')) {
2259
- refNames.push(line.split('##contig=<ID=')[1].split(',')[0]);
2260
- } else if (line.startsWith('#')) {
2311
+ if (line.startsWith('#')) {
2261
2312
  header.push(line);
2262
2313
  } else if (line) {
2263
2314
  rest.push(line);
@@ -2265,60 +2316,44 @@ var readVcf = function readVcf(f) {
2265
2316
  });
2266
2317
  return {
2267
2318
  header: header.join('\n'),
2268
- lines: rest,
2269
- refNames: refNames
2319
+ lines: rest
2270
2320
  };
2271
2321
  };
2272
2322
 
2323
+ function isGzip(buf) {
2324
+ return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
2325
+ }
2326
+
2273
2327
  var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2274
2328
  _inherits(VcfAdapter, _BaseFeatureDataAdapt);
2275
2329
 
2276
2330
  var _super = /*#__PURE__*/_createSuper(VcfAdapter);
2277
2331
 
2278
- function VcfAdapter(config) {
2332
+ function VcfAdapter() {
2279
2333
  _classCallCheck(this, VcfAdapter);
2280
2334
 
2281
- return _super.call(this, config);
2335
+ return _super.apply(this, arguments);
2282
2336
  }
2283
2337
 
2284
2338
  _createClass(VcfAdapter, [{
2285
- key: "decodeFileContents",
2339
+ key: "getHeader",
2286
2340
  value: function () {
2287
- var _decodeFileContents = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2288
- var vcfLocation, fileContents;
2341
+ var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
2342
+ var _yield$this$setup, header;
2343
+
2289
2344
  return runtime_1.wrap(function _callee$(_context) {
2290
2345
  while (1) {
2291
2346
  switch (_context.prev = _context.next) {
2292
2347
  case 0:
2293
- vcfLocation = configuration.readConfObject(this.config, 'vcfLocation');
2294
- _context.next = 3;
2295
- return io.openLocation(vcfLocation).readFile();
2296
-
2297
- case 3:
2298
- fileContents = _context.sent;
2299
-
2300
- if (!(typeof fileContents[0] === 'number' && fileContents[0] === 31 && typeof fileContents[1] === 'number' && fileContents[1] === 139 && typeof fileContents[2] === 'number' && fileContents[2] === 8)) {
2301
- _context.next = 12;
2302
- break;
2303
- }
2304
-
2305
- _context.t0 = new TextDecoder();
2306
- _context.next = 8;
2307
- return bgzfFilehandle.unzip(fileContents);
2348
+ _context.next = 2;
2349
+ return this.setup();
2308
2350
 
2309
- case 8:
2310
- _context.t1 = _context.sent;
2311
- fileContents = _context.t0.decode.call(_context.t0, _context.t1);
2312
- _context.next = 13;
2313
- break;
2314
-
2315
- case 12:
2316
- fileContents = fileContents.toString();
2317
-
2318
- case 13:
2319
- return _context.abrupt("return", readVcf(fileContents));
2351
+ case 2:
2352
+ _yield$this$setup = _context.sent;
2353
+ header = _yield$this$setup.header;
2354
+ return _context.abrupt("return", header);
2320
2355
 
2321
- case 14:
2356
+ case 5:
2322
2357
  case "end":
2323
2358
  return _context.stop();
2324
2359
  }
@@ -2326,31 +2361,34 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2326
2361
  }, _callee, this);
2327
2362
  }));
2328
2363
 
2329
- function decodeFileContents() {
2330
- return _decodeFileContents.apply(this, arguments);
2364
+ function getHeader() {
2365
+ return _getHeader.apply(this, arguments);
2331
2366
  }
2332
2367
 
2333
- return decodeFileContents;
2368
+ return getHeader;
2334
2369
  }()
2335
2370
  }, {
2336
- key: "getHeader",
2371
+ key: "getMetadata",
2337
2372
  value: function () {
2338
- var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
2339
- var _yield$this$decodeFil, header;
2373
+ var _getMetadata = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
2374
+ var _yield$this$setup2, header, parser;
2340
2375
 
2341
2376
  return runtime_1.wrap(function _callee2$(_context2) {
2342
2377
  while (1) {
2343
2378
  switch (_context2.prev = _context2.next) {
2344
2379
  case 0:
2345
2380
  _context2.next = 2;
2346
- return this.decodeFileContents();
2381
+ return this.setup();
2347
2382
 
2348
2383
  case 2:
2349
- _yield$this$decodeFil = _context2.sent;
2350
- header = _yield$this$decodeFil.header;
2351
- return _context2.abrupt("return", header);
2384
+ _yield$this$setup2 = _context2.sent;
2385
+ header = _yield$this$setup2.header;
2386
+ parser = new VCF__default({
2387
+ header: header
2388
+ });
2389
+ return _context2.abrupt("return", parser.getMetadata());
2352
2390
 
2353
- case 5:
2391
+ case 6:
2354
2392
  case "end":
2355
2393
  return _context2.stop();
2356
2394
  }
@@ -2358,111 +2396,131 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2358
2396
  }, _callee2, this);
2359
2397
  }));
2360
2398
 
2361
- function getHeader() {
2362
- return _getHeader.apply(this, arguments);
2399
+ function getMetadata() {
2400
+ return _getMetadata.apply(this, arguments);
2363
2401
  }
2364
2402
 
2365
- return getHeader;
2366
- }()
2403
+ return getMetadata;
2404
+ }() // converts lines into an interval tree
2405
+
2367
2406
  }, {
2368
- key: "getMetadata",
2407
+ key: "setupP",
2369
2408
  value: function () {
2370
- var _getMetadata = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2371
- var _yield$this$decodeFil2, header, parser;
2409
+ var _setupP = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
2410
+ var buffer, buf, str, _readVcf, header, lines, intervalTree;
2372
2411
 
2373
2412
  return runtime_1.wrap(function _callee3$(_context3) {
2374
2413
  while (1) {
2375
2414
  switch (_context3.prev = _context3.next) {
2376
2415
  case 0:
2377
2416
  _context3.next = 2;
2378
- return this.decodeFileContents();
2417
+ return io.openLocation(configuration.readConfObject(this.config, 'vcfLocation'), this.pluginManager).readFile();
2379
2418
 
2380
2419
  case 2:
2381
- _yield$this$decodeFil2 = _context3.sent;
2382
- header = _yield$this$decodeFil2.header;
2383
- parser = new VCF__default({
2384
- header: header
2385
- });
2386
- return _context3.abrupt("return", parser.getMetadata());
2420
+ buffer = _context3.sent;
2421
+
2422
+ if (!isGzip(buffer)) {
2423
+ _context3.next = 9;
2424
+ break;
2425
+ }
2426
+
2427
+ _context3.next = 6;
2428
+ return bgzfFilehandle.unzip(buffer);
2387
2429
 
2388
2430
  case 6:
2389
- case "end":
2390
- return _context3.stop();
2391
- }
2392
- }
2393
- }, _callee3, this);
2394
- }));
2431
+ _context3.t0 = _context3.sent;
2432
+ _context3.next = 10;
2433
+ break;
2395
2434
 
2396
- function getMetadata() {
2397
- return _getMetadata.apply(this, arguments);
2398
- }
2435
+ case 9:
2436
+ _context3.t0 = buffer;
2399
2437
 
2400
- return getMetadata;
2401
- }()
2402
- }, {
2403
- key: "getLines",
2404
- value: function () {
2405
- var _getLines = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2406
- var _this = this;
2438
+ case 10:
2439
+ buf = _context3.t0;
2407
2440
 
2408
- var _yield$this$decodeFil3, header, lines, parser;
2441
+ if (!(buf.length > 536870888)) {
2442
+ _context3.next = 13;
2443
+ break;
2444
+ }
2409
2445
 
2410
- return runtime_1.wrap(function _callee4$(_context4) {
2411
- while (1) {
2412
- switch (_context4.prev = _context4.next) {
2413
- case 0:
2414
- _context4.next = 2;
2415
- return this.decodeFileContents();
2446
+ throw new Error('Data exceeds maximum string length (512MB)');
2416
2447
 
2417
- case 2:
2418
- _yield$this$decodeFil3 = _context4.sent;
2419
- header = _yield$this$decodeFil3.header;
2420
- lines = _yield$this$decodeFil3.lines;
2421
- parser = new VCF__default({
2422
- header: header
2448
+ case 13:
2449
+ str = new TextDecoder().decode(buf);
2450
+ _readVcf = readVcf(str), header = _readVcf.header, lines = _readVcf.lines;
2451
+ intervalTree = lines.map(function (line, id) {
2452
+ var _info$match;
2453
+
2454
+ var _line$split = line.split('\t'),
2455
+ _line$split2 = _slicedToArray(_line$split, 8),
2456
+ refName = _line$split2[0],
2457
+ startP = _line$split2[1],
2458
+ ref = _line$split2[3],
2459
+ info = _line$split2[7];
2460
+
2461
+ var start = +startP - 1;
2462
+ var end = +(((_info$match = info.match(/END=(\d+)/)) === null || _info$match === void 0 ? void 0 : _info$match[1].trim()) || start + ref.length);
2463
+ return {
2464
+ line: line,
2465
+ refName: refName,
2466
+ start: start,
2467
+ end: end,
2468
+ id: id
2469
+ };
2470
+ }).reduce(function (acc, obj) {
2471
+ var key = obj.refName;
2472
+
2473
+ if (!acc[key]) {
2474
+ acc[key] = new IntervalTree();
2475
+ }
2476
+
2477
+ acc[key].insert([obj.start, obj.end], obj);
2478
+ return acc;
2479
+ }, {});
2480
+ return _context3.abrupt("return", {
2481
+ header: header,
2482
+ intervalTree: intervalTree
2423
2483
  });
2424
- return _context4.abrupt("return", lines.map(function (line, index) {
2425
- return new VCFFeature({
2426
- variant: parser.parseLine(line),
2427
- parser: parser,
2428
- id: "".concat(_this.id, "-vcf-").concat(index)
2429
- });
2430
- }));
2431
2484
 
2432
- case 7:
2485
+ case 17:
2433
2486
  case "end":
2434
- return _context4.stop();
2487
+ return _context3.stop();
2435
2488
  }
2436
2489
  }
2437
- }, _callee4, this);
2490
+ }, _callee3, this);
2438
2491
  }));
2439
2492
 
2440
- function getLines() {
2441
- return _getLines.apply(this, arguments);
2493
+ function setupP() {
2494
+ return _setupP.apply(this, arguments);
2442
2495
  }
2443
2496
 
2444
- return getLines;
2497
+ return setupP;
2445
2498
  }()
2446
2499
  }, {
2447
2500
  key: "setup",
2448
2501
  value: function () {
2449
- var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2450
- return runtime_1.wrap(function _callee5$(_context5) {
2502
+ var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
2503
+ var _this = this;
2504
+
2505
+ return runtime_1.wrap(function _callee4$(_context4) {
2451
2506
  while (1) {
2452
- switch (_context5.prev = _context5.next) {
2507
+ switch (_context4.prev = _context4.next) {
2453
2508
  case 0:
2454
- if (!this.setupP) {
2455
- this.setupP = this.getLines();
2509
+ if (!this.vcfFeatures) {
2510
+ this.vcfFeatures = this.setupP()["catch"](function (e) {
2511
+ _this.vcfFeatures = undefined;
2512
+ throw e;
2513
+ });
2456
2514
  }
2457
2515
 
2458
- return _context5.abrupt("return", this.setupP);
2516
+ return _context4.abrupt("return", this.vcfFeatures);
2459
2517
 
2460
2518
  case 2:
2461
2519
  case "end":
2462
- return _context5.stop();
2520
+ return _context4.stop();
2463
2521
  }
2464
2522
  }
2465
- }, _callee5, this);
2523
+ }, _callee4, this);
2466
2524
  }));
2467
2525
 
2468
2526
  function setup() {
@@ -2474,28 +2532,28 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2474
2532
  }, {
2475
2533
  key: "getRefNames",
2476
2534
  value: function () {
2477
- var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2478
- var _yield$this$decodeFil4,
2479
- refNames;
2535
+ var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5() {
2536
+ var _yield$this$setup3,
2537
+ intervalTree;
2480
2538
 
2481
- return runtime_1.wrap(function _callee6$(_context6) {
2539
+ return runtime_1.wrap(function _callee5$(_context5) {
2482
2540
  while (1) {
2483
- switch (_context6.prev = _context6.next) {
2541
+ switch (_context5.prev = _context5.next) {
2484
2542
  case 0:
2485
- _context6.next = 3;
2486
- return this.decodeFileContents();
2543
+ _context5.next = 3;
2544
+ return this.setup();
2487
2545
 
2488
2546
  case 3:
2489
- _yield$this$decodeFil4 = _context6.sent;
2490
- refNames = _yield$this$decodeFil4.refNames;
2491
- return _context6.abrupt("return", refNames);
2547
+ _yield$this$setup3 = _context5.sent;
2548
+ intervalTree = _yield$this$setup3.intervalTree;
2549
+ return _context5.abrupt("return", Object.keys(intervalTree));
2492
2550
 
2493
2551
  case 6:
2494
2552
  case "end":
2495
- return _context6.stop();
2553
+ return _context5.stop();
2496
2554
  }
2497
2555
  }
2498
- }, _callee6, this);
2556
+ }, _callee5, this);
2499
2557
  }));
2500
2558
 
2501
2559
  function getRefNames() {
@@ -2511,30 +2569,47 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
2511
2569
 
2512
2570
  var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2513
2571
  return rxjs.ObservableCreate( /*#__PURE__*/function () {
2514
- var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee7(observer) {
2515
- var feats;
2516
- return runtime_1.wrap(function _callee7$(_context7) {
2572
+ var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6(observer) {
2573
+ var _intervalTree$refName, start, end, refName, _yield$_this2$setup, header, intervalTree, parser;
2574
+
2575
+ return runtime_1.wrap(function _callee6$(_context6) {
2517
2576
  while (1) {
2518
- switch (_context7.prev = _context7.next) {
2577
+ switch (_context6.prev = _context6.next) {
2519
2578
  case 0:
2520
- _context7.next = 2;
2579
+ _context6.prev = 0;
2580
+ start = region.start, end = region.end, refName = region.refName;
2581
+ _context6.next = 4;
2521
2582
  return _this2.setup();
2522
2583
 
2523
- case 2:
2524
- feats = _context7.sent;
2525
- feats.forEach(function (f) {
2526
- if (f.get('refName') === region.refName && f.get('end') > region.start && f.get('start') < region.end) {
2527
- observer.next(f);
2528
- }
2584
+ case 4:
2585
+ _yield$_this2$setup = _context6.sent;
2586
+ header = _yield$_this2$setup.header;
2587
+ intervalTree = _yield$_this2$setup.intervalTree;
2588
+ parser = new VCF__default({
2589
+ header: header
2590
+ });
2591
+ (_intervalTree$refName = intervalTree[refName]) === null || _intervalTree$refName === void 0 ? void 0 : _intervalTree$refName.search([start, end]).forEach(function (f) {
2592
+ return observer.next(new VCFFeature({
2593
+ variant: parser.parseLine(f.line),
2594
+ parser: parser,
2595
+ id: "".concat(_this2.id, "-").concat(f.id)
2596
+ }));
2529
2597
  });
2530
2598
  observer.complete();
2599
+ _context6.next = 15;
2600
+ break;
2531
2601
 
2532
- case 5:
2602
+ case 12:
2603
+ _context6.prev = 12;
2604
+ _context6.t0 = _context6["catch"](0);
2605
+ observer.error(_context6.t0);
2606
+
2607
+ case 15:
2533
2608
  case "end":
2534
- return _context7.stop();
2609
+ return _context6.stop();
2535
2610
  }
2536
2611
  }
2537
- }, _callee7);
2612
+ }, _callee6, null, [[0, 12]]);
2538
2613
  }));
2539
2614
 
2540
2615
  return function (_x) {
@@ -2730,7 +2805,7 @@ function VariantSamples(props) {
2730
2805
  width: '100%',
2731
2806
  overflow: 'auto'
2732
2807
  }
2733
- }, /*#__PURE__*/React__default.createElement(dataGrid.DataGrid, {
2808
+ }, /*#__PURE__*/React__default.createElement(xDataGrid.DataGrid, {
2734
2809
  rows: rows,
2735
2810
  columns: infoFields,
2736
2811
  rowHeight: 20,