@jbrowse/plugin-wiggle 1.4.1 → 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.
@@ -9,18 +9,11 @@ import { renderToAbstractCanvas } from '@jbrowse/core/util/offscreenCanvasUtils'
9
9
  import { observer } from 'mobx-react';
10
10
  import React, { useRef, useState, useMemo, lazy } from 'react';
11
11
  import { PrerenderedCanvas } from '@jbrowse/core/ui';
12
- import { BigWig } from '@gmod/bbi';
13
- import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
14
- import { openLocation } from '@jbrowse/core/util/io';
15
- import { ObservableCreate } from '@jbrowse/core/util/rxjs';
16
- import SimpleFeature from '@jbrowse/core/util/simpleFeature';
17
- import { mergeAll, map } from 'rxjs/operators';
18
- import { rectifyStats } from '@jbrowse/core/util/stats';
19
12
  import { featureSpanPx, getSession, isSelectionContainer, isAbortException, getContainingView, renameRegionsIfNeeded } from '@jbrowse/core/util';
20
13
  import { scaleLinear, scaleLog, scaleQuantize } from 'd3-scale';
21
14
  import { types, getEnv, addDisposer, isAlive } from 'mobx-state-tree';
22
15
  import { baseLinearDisplayConfigSchema, BaseLinearDisplayComponent, BaseLinearDisplay } from '@jbrowse/plugin-linear-genome-view';
23
- import { getRpcSessionId } from '@jbrowse/core/util/tracks';
16
+ import { getRpcSessionId, getFileName } from '@jbrowse/core/util/tracks';
24
17
  import { observable, autorun, when } from 'mobx';
25
18
  import { Axis, LEFT, RIGHT, axisPropsFromTickScale } from 'react-d3-axis';
26
19
  import { Portal, makeStyles, alpha, Dialog as Dialog$1, DialogTitle as DialogTitle$1, IconButton as IconButton$1, DialogContent as DialogContent$1, Button as Button$1 } from '@material-ui/core';
@@ -28,6 +21,7 @@ import { usePopper } from 'react-popper';
28
21
  import Color from 'color';
29
22
  import { getAdapter } from '@jbrowse/core/data_adapters/dataAdapterCache';
30
23
  import RpcMethodType from '@jbrowse/core/pluggableElementTypes/RpcMethodType';
24
+ import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
31
25
  import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/renderers/util/serializableFilterChain';
32
26
  import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
33
27
  import Button from '@material-ui/core/Button';
@@ -39,6 +33,12 @@ import DialogTitle from '@material-ui/core/DialogTitle';
39
33
  import IconButton from '@material-ui/core/IconButton';
40
34
  import CloseIcon from '@material-ui/icons/Close';
41
35
  import { CompactPicker } from 'react-color';
36
+ import { BigWig } from '@gmod/bbi';
37
+ import { openLocation } from '@jbrowse/core/util/io';
38
+ import { ObservableCreate } from '@jbrowse/core/util/rxjs';
39
+ import SimpleFeature from '@jbrowse/core/util/simpleFeature';
40
+ import { mergeAll, map } from 'rxjs/operators';
41
+ import { rectifyStats } from '@jbrowse/core/util/stats';
42
42
 
43
43
  function ownKeys(object, enumerableOnly) {
44
44
  var keys = Object.keys(object);
@@ -206,6 +206,8 @@ function _assertThisInitialized(self) {
206
206
  function _possibleConstructorReturn(self, call) {
207
207
  if (call && (typeof call === "object" || typeof call === "function")) {
208
208
  return call;
209
+ } else if (call !== void 0) {
210
+ throw new TypeError("Derived constructors may only return object or undefined");
209
211
  }
210
212
 
211
213
  return _assertThisInitialized(self);
@@ -489,11 +491,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
489
491
 
490
492
 
491
493
  var IteratorPrototype = {};
492
-
493
- IteratorPrototype[iteratorSymbol] = function () {
494
+ define(IteratorPrototype, iteratorSymbol, function () {
494
495
  return this;
495
- };
496
-
496
+ });
497
497
  var getProto = Object.getPrototypeOf;
498
498
  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
499
499
 
@@ -504,8 +504,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
504
504
  }
505
505
 
506
506
  var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
507
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
508
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
507
+ GeneratorFunction.prototype = GeneratorFunctionPrototype;
508
+ define(Gp, "constructor", GeneratorFunctionPrototype);
509
+ define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
509
510
  GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
510
511
  // Iterator interface in terms of a single ._invoke method.
511
512
 
@@ -610,11 +611,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
610
611
  }
611
612
 
612
613
  defineIteratorMethods(AsyncIterator.prototype);
613
-
614
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
614
+ define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
615
615
  return this;
616
- };
617
-
616
+ });
618
617
  exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
619
618
  // AsyncIterator objects; they just return a Promise for the value of
620
619
  // the final result produced by the iterator.
@@ -791,13 +790,12 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
791
790
  // object to not be returned from this call. This ensures that doesn't happen.
792
791
  // See https://github.com/facebook/regenerator/issues/274 for more details.
793
792
 
794
- Gp[iteratorSymbol] = function () {
793
+ define(Gp, iteratorSymbol, function () {
795
794
  return this;
796
- };
797
-
798
- Gp.toString = function () {
795
+ });
796
+ define(Gp, "toString", function () {
799
797
  return "[object Generator]";
800
- };
798
+ });
801
799
 
802
800
  function pushTryEntry(locs) {
803
801
  var entry = {
@@ -1109,14 +1107,19 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
1109
1107
  } catch (accidentalStrictMode) {
1110
1108
  // This module should not be running in strict mode, so the above
1111
1109
  // assignment should always work unless something is misconfigured. Just
1112
- // in case runtime.js accidentally runs in strict mode, we can escape
1110
+ // in case runtime.js accidentally runs in strict mode, in modern engines
1111
+ // we can explicitly access globalThis. In older engines we can escape
1113
1112
  // strict mode using a global Function call. This could conceivably fail
1114
1113
  // if a Content Security Policy forbids using Function, but in that case
1115
1114
  // the proper solution is to fix the accidental strict mode problem. If
1116
1115
  // you've misconfigured your bundler to force strict mode and applied a
1117
1116
  // CSP to forbid Function, and you're not willing to fix either of those
1118
1117
  // problems, please detail your unique predicament in a GitHub issue.
1119
- Function("r", "regeneratorRuntime = r")(runtime);
1118
+ if (typeof globalThis === "object") {
1119
+ globalThis.regeneratorRuntime = runtime;
1120
+ } else {
1121
+ Function("r", "regeneratorRuntime = r")(runtime);
1122
+ }
1120
1123
  }
1121
1124
  });
1122
1125
 
@@ -1281,225 +1284,14 @@ var bigWigAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('BigWigAdapter'
1281
1284
  bigWigLocation: {
1282
1285
  type: 'fileLocation',
1283
1286
  defaultValue: {
1284
- uri: '/path/to/my.bw'
1287
+ uri: '/path/to/my.bw',
1288
+ locationType: 'UriLocation'
1285
1289
  }
1286
1290
  }
1287
1291
  }, {
1288
1292
  explicitlyTyped: true
1289
1293
  });
1290
1294
 
1291
- var BigWigAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
1292
- _inherits(BigWigAdapter, _BaseFeatureDataAdapt);
1293
-
1294
- var _super = /*#__PURE__*/_createSuper(BigWigAdapter);
1295
-
1296
- function BigWigAdapter(config) {
1297
- var _this;
1298
-
1299
- _classCallCheck(this, BigWigAdapter);
1300
-
1301
- _this = _super.call(this, config);
1302
- _this.bigwig = new BigWig({
1303
- filehandle: openLocation(readConfObject(config, 'bigWigLocation'))
1304
- });
1305
- return _this;
1306
- }
1307
-
1308
- _createClass(BigWigAdapter, [{
1309
- key: "setup",
1310
- value: function () {
1311
- var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(opts) {
1312
- var _ref, _ref$statusCallback, statusCallback, result;
1313
-
1314
- return runtime_1.wrap(function _callee$(_context) {
1315
- while (1) {
1316
- switch (_context.prev = _context.next) {
1317
- case 0:
1318
- _ref = opts || {}, _ref$statusCallback = _ref.statusCallback, statusCallback = _ref$statusCallback === void 0 ? function () {} : _ref$statusCallback;
1319
- statusCallback('Downloading bigwig header');
1320
- _context.next = 4;
1321
- return this.bigwig.getHeader(opts);
1322
-
1323
- case 4:
1324
- result = _context.sent;
1325
- statusCallback('');
1326
- return _context.abrupt("return", result);
1327
-
1328
- case 7:
1329
- case "end":
1330
- return _context.stop();
1331
- }
1332
- }
1333
- }, _callee, this);
1334
- }));
1335
-
1336
- function setup(_x) {
1337
- return _setup.apply(this, arguments);
1338
- }
1339
-
1340
- return setup;
1341
- }()
1342
- }, {
1343
- key: "getRefNames",
1344
- value: function () {
1345
- var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(opts) {
1346
- var header;
1347
- return runtime_1.wrap(function _callee2$(_context2) {
1348
- while (1) {
1349
- switch (_context2.prev = _context2.next) {
1350
- case 0:
1351
- _context2.next = 2;
1352
- return this.setup(opts);
1353
-
1354
- case 2:
1355
- header = _context2.sent;
1356
- return _context2.abrupt("return", Object.keys(header.refsByName));
1357
-
1358
- case 4:
1359
- case "end":
1360
- return _context2.stop();
1361
- }
1362
- }
1363
- }, _callee2, this);
1364
- }));
1365
-
1366
- function getRefNames(_x2) {
1367
- return _getRefNames.apply(this, arguments);
1368
- }
1369
-
1370
- return getRefNames;
1371
- }()
1372
- }, {
1373
- key: "refIdToName",
1374
- value: function () {
1375
- var _refIdToName = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(refId) {
1376
- var h;
1377
- return runtime_1.wrap(function _callee3$(_context3) {
1378
- while (1) {
1379
- switch (_context3.prev = _context3.next) {
1380
- case 0:
1381
- _context3.next = 2;
1382
- return this.setup();
1383
-
1384
- case 2:
1385
- h = _context3.sent;
1386
- return _context3.abrupt("return", (h.refsByNumber[refId] || {
1387
- name: undefined
1388
- }).name);
1389
-
1390
- case 4:
1391
- case "end":
1392
- return _context3.stop();
1393
- }
1394
- }
1395
- }, _callee3, this);
1396
- }));
1397
-
1398
- function refIdToName(_x3) {
1399
- return _refIdToName.apply(this, arguments);
1400
- }
1401
-
1402
- return refIdToName;
1403
- }()
1404
- }, {
1405
- key: "getGlobalStats",
1406
- value: function () {
1407
- var _getGlobalStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(opts) {
1408
- var header;
1409
- return runtime_1.wrap(function _callee4$(_context4) {
1410
- while (1) {
1411
- switch (_context4.prev = _context4.next) {
1412
- case 0:
1413
- _context4.next = 2;
1414
- return this.setup(opts);
1415
-
1416
- case 2:
1417
- header = _context4.sent;
1418
- return _context4.abrupt("return", rectifyStats(header.totalSummary));
1419
-
1420
- case 4:
1421
- case "end":
1422
- return _context4.stop();
1423
- }
1424
- }
1425
- }, _callee4, this);
1426
- }));
1427
-
1428
- function getGlobalStats(_x4) {
1429
- return _getGlobalStats.apply(this, arguments);
1430
- }
1431
-
1432
- return getGlobalStats;
1433
- }()
1434
- }, {
1435
- key: "getFeatures",
1436
- value: function getFeatures(region) {
1437
- var _this2 = this;
1438
-
1439
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1440
- var refName = region.refName,
1441
- start = region.start,
1442
- end = region.end;
1443
- var _opts$bpPerPx = opts.bpPerPx,
1444
- bpPerPx = _opts$bpPerPx === void 0 ? 0 : _opts$bpPerPx,
1445
- signal = opts.signal,
1446
- _opts$resolution = opts.resolution,
1447
- resolution = _opts$resolution === void 0 ? 1 : _opts$resolution,
1448
- _opts$statusCallback = opts.statusCallback,
1449
- statusCallback = _opts$statusCallback === void 0 ? function () {} : _opts$statusCallback;
1450
- return ObservableCreate( /*#__PURE__*/function () {
1451
- var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(observer) {
1452
- var ob;
1453
- return runtime_1.wrap(function _callee5$(_context5) {
1454
- while (1) {
1455
- switch (_context5.prev = _context5.next) {
1456
- case 0:
1457
- statusCallback('Downloading bigwig data');
1458
- _context5.next = 3;
1459
- return _this2.bigwig.getFeatureStream(refName, start, end, _objectSpread2(_objectSpread2({}, opts), {}, {
1460
- basesPerSpan: bpPerPx / resolution
1461
- }));
1462
-
1463
- case 3:
1464
- ob = _context5.sent;
1465
- ob.pipe(mergeAll(), map(function (record) {
1466
- return new SimpleFeature({
1467
- id: "".concat(refName, ":").concat(record.start, "-").concat(record.end),
1468
- data: _objectSpread2(_objectSpread2({}, record), {}, {
1469
- refName: refName
1470
- })
1471
- });
1472
- })).subscribe(observer);
1473
-
1474
- case 5:
1475
- case "end":
1476
- return _context5.stop();
1477
- }
1478
- }
1479
- }, _callee5);
1480
- }));
1481
-
1482
- return function (_x5) {
1483
- return _ref2.apply(this, arguments);
1484
- };
1485
- }(), signal);
1486
- }
1487
- }, {
1488
- key: "freeResources",
1489
- value: function freeResources() {}
1490
- }]);
1491
-
1492
- return BigWigAdapter;
1493
- }(BaseFeatureDataAdapter);
1494
- BigWigAdapter.capabilities = ['hasResolution', 'hasLocalStats', 'hasGlobalStats'];
1495
- var adapterCapabilities = BigWigAdapter.capabilities;
1496
-
1497
- var BigWigAdapter$1 = {
1498
- __proto__: null,
1499
- 'default': BigWigAdapter,
1500
- adapterCapabilities: adapterCapabilities
1501
- };
1502
-
1503
1295
  /**
1504
1296
  * produces a d3-scale from arguments. applies a "nice domain" adjustment
1505
1297
  *
@@ -1938,7 +1730,6 @@ var Tooltip = /*#__PURE__*/observer(function (_ref2) {
1938
1730
  clientRect = _ref2.clientRect,
1939
1731
  TooltipContents = _ref2.TooltipContents;
1940
1732
  var featureUnderMouse = model.featureUnderMouse;
1941
- var classes = useStyles();
1942
1733
 
1943
1734
  var _useState = useState(0),
1944
1735
  _useState2 = _slicedToArray(_useState, 2),
@@ -1947,9 +1738,10 @@ var Tooltip = /*#__PURE__*/observer(function (_ref2) {
1947
1738
 
1948
1739
  var _useState3 = useState(null),
1949
1740
  _useState4 = _slicedToArray(_useState3, 2),
1950
- popperElement = _useState4[0],
1951
- setPopperElement = _useState4[1]; // must be memoized a la https://github.com/popperjs/react-popper/issues/391
1741
+ anchorEl = _useState4[0],
1742
+ setAnchorEl = _useState4[1];
1952
1743
 
1744
+ var classes = useStyles(); // must be memoized a la https://github.com/popperjs/react-popper/issues/391
1953
1745
 
1954
1746
  var virtElement = useMemo(function () {
1955
1747
  return {
@@ -1962,18 +1754,21 @@ var Tooltip = /*#__PURE__*/observer(function (_ref2) {
1962
1754
  bottom: y,
1963
1755
  right: x,
1964
1756
  width: 0,
1965
- height: 0
1757
+ height: 0,
1758
+ x: x,
1759
+ y: y,
1760
+ toJSON: function toJSON() {}
1966
1761
  };
1967
1762
  }
1968
1763
  };
1969
1764
  }, [clientRect === null || clientRect === void 0 ? void 0 : clientRect.top, clientMouseCoord, width]);
1970
1765
 
1971
- var _usePopper = usePopper(virtElement, popperElement),
1766
+ var _usePopper = usePopper(virtElement, anchorEl),
1972
1767
  styles = _usePopper.styles,
1973
1768
  attributes = _usePopper.attributes;
1974
1769
 
1975
1770
  return featureUnderMouse ? React.createElement(React.Fragment, null, React.createElement(Portal, null, React.createElement("div", Object.assign({
1976
- ref: setPopperElement,
1771
+ ref: setAnchorEl,
1977
1772
  className: classes.tooltip,
1978
1773
  // zIndex needed to go over widget drawer
1979
1774
  style: _objectSpread2(_objectSpread2({}, styles.popper), {}, {
@@ -2389,15 +2184,21 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
2389
2184
  }, {
2390
2185
  label: 'Set min/max score',
2391
2186
  onClick: function onClick() {
2392
- getSession(self).setDialogComponent(SetMinMaxDlg, {
2393
- model: self
2187
+ getSession(self).queueDialog(function (doneCallback) {
2188
+ return [SetMinMaxDlg, {
2189
+ model: self,
2190
+ handleClose: doneCallback
2191
+ }];
2394
2192
  });
2395
2193
  }
2396
2194
  }, {
2397
2195
  label: 'Set color',
2398
2196
  onClick: function onClick() {
2399
- getSession(self).setDialogComponent(SetColorDlg, {
2400
- model: self
2197
+ getSession(self).queueDialog(function (doneCallback) {
2198
+ return [SetColorDlg, {
2199
+ model: self,
2200
+ handleClose: doneCallback
2201
+ }];
2401
2202
  });
2402
2203
  }
2403
2204
  }]);
@@ -2464,7 +2265,7 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
2464
2265
  regions: dynamicBlocks.contentBlocks.map(function (region) {
2465
2266
  var start = region.start,
2466
2267
  end = region.end;
2467
- return _objectSpread2(_objectSpread2({}, region), {}, {
2268
+ return _objectSpread2(_objectSpread2({}, JSON.parse(JSON.stringify(region))), {}, {
2468
2269
  start: Math.floor(start),
2469
2270
  end: Math.ceil(end)
2470
2271
  });
@@ -2515,13 +2316,14 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
2515
2316
  case 0:
2516
2317
  self.setError();
2517
2318
  aborter = new AbortController();
2518
- _context.next = 4;
2319
+ _context.prev = 2;
2320
+ _context.next = 5;
2519
2321
  return getStats({
2520
2322
  signal: aborter.signal,
2521
2323
  filters: self.filters
2522
2324
  });
2523
2325
 
2524
- case 4:
2326
+ case 5:
2525
2327
  stats = _context.sent;
2526
2328
 
2527
2329
  if (isAlive(self)) {
@@ -2529,12 +2331,20 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
2529
2331
  superReload();
2530
2332
  }
2531
2333
 
2532
- case 6:
2334
+ _context.next = 12;
2335
+ break;
2336
+
2337
+ case 9:
2338
+ _context.prev = 9;
2339
+ _context.t0 = _context["catch"](2);
2340
+ self.setError(_context.t0);
2341
+
2342
+ case 12:
2533
2343
  case "end":
2534
2344
  return _context.stop();
2535
2345
  }
2536
2346
  }
2537
- }, _callee);
2347
+ }, _callee, null, [[2, 9]]);
2538
2348
  }))();
2539
2349
  },
2540
2350
  afterAttach: function afterAttach() {
@@ -2586,6 +2396,7 @@ var stateModelFactory = function stateModelFactory(pluginManager, configSchema)
2586
2396
  _context2.t0 = _context2["catch"](0);
2587
2397
 
2588
2398
  if (!isAbortException(_context2.t0) && isAlive(self)) {
2399
+ console.error(_context2.t0);
2589
2400
  self.setError(_context2.t0);
2590
2401
  }
2591
2402
 
@@ -2697,7 +2508,7 @@ var XYPlotRenderer = /*#__PURE__*/function (_WiggleBaseRenderer) {
2697
2508
  niceMax = _scale$domain2[1];
2698
2509
 
2699
2510
  var toY = function toY(n) {
2700
- return height - scale(n) + offset;
2511
+ return height - (scale(n) || 0) + offset;
2701
2512
  };
2702
2513
 
2703
2514
  var toHeight = function toHeight(n) {
@@ -3103,10 +2914,10 @@ var WiggleGetMultiRegionStats = /*#__PURE__*/function (_RpcMethodType2) {
3103
2914
  }, {
3104
2915
  key: "serializeArguments",
3105
2916
  value: function () {
3106
- var _serializeArguments = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(args) {
2917
+ var _serializeArguments = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(args, rpcDriverClassName) {
3107
2918
  var _this$pluginManager$r, _this$pluginManager$r2;
3108
2919
 
3109
- var assemblyManager;
2920
+ var assemblyManager, renamedArgs;
3110
2921
  return runtime_1.wrap(function _callee4$(_context4) {
3111
2922
  while (1) {
3112
2923
  switch (_context4.prev = _context4.next) {
@@ -3121,11 +2932,16 @@ var WiggleGetMultiRegionStats = /*#__PURE__*/function (_RpcMethodType2) {
3121
2932
  return _context4.abrupt("return", args);
3122
2933
 
3123
2934
  case 3:
3124
- return _context4.abrupt("return", renameRegionsIfNeeded(assemblyManager, _objectSpread2(_objectSpread2({}, args), {}, {
2935
+ _context4.next = 5;
2936
+ return renameRegionsIfNeeded(assemblyManager, _objectSpread2(_objectSpread2({}, args), {}, {
3125
2937
  filters: args.filters && args.filters.toJSON().filters
3126
- })));
2938
+ }));
3127
2939
 
3128
- case 4:
2940
+ case 5:
2941
+ renamedArgs = _context4.sent;
2942
+ return _context4.abrupt("return", _get(_getPrototypeOf(WiggleGetMultiRegionStats.prototype), "serializeArguments", this).call(this, renamedArgs, rpcDriverClassName));
2943
+
2944
+ case 7:
3129
2945
  case "end":
3130
2946
  return _context4.stop();
3131
2947
  }
@@ -3133,7 +2949,7 @@ var WiggleGetMultiRegionStats = /*#__PURE__*/function (_RpcMethodType2) {
3133
2949
  }, _callee4, this);
3134
2950
  }));
3135
2951
 
3136
- function serializeArguments(_x7) {
2952
+ function serializeArguments(_x7, _x8) {
3137
2953
  return _serializeArguments.apply(this, arguments);
3138
2954
  }
3139
2955
 
@@ -3180,7 +2996,7 @@ var WiggleGetMultiRegionStats = /*#__PURE__*/function (_RpcMethodType2) {
3180
2996
  }, _callee5, this);
3181
2997
  }));
3182
2998
 
3183
- function execute(_x8, _x9) {
2999
+ function execute(_x9, _x10) {
3184
3000
  return _execute2.apply(this, arguments);
3185
3001
  }
3186
3002
 
@@ -3243,7 +3059,7 @@ var WigglePlugin = /*#__PURE__*/function (_Plugin) {
3243
3059
  return new AdapterType({
3244
3060
  name: 'BigWigAdapter',
3245
3061
  configSchema: bigWigAdapterConfigSchema,
3246
- adapterCapabilities: adapterCapabilities,
3062
+ adapterCapabilities: ['hasResolution', 'hasLocalStats', 'hasGlobalStats'],
3247
3063
  getAdapterClass: function getAdapterClass() {
3248
3064
  return Promise.resolve().then(function () { return BigWigAdapter$1; }).then(function (r) {
3249
3065
  return r["default"];
@@ -3251,6 +3067,31 @@ var WigglePlugin = /*#__PURE__*/function (_Plugin) {
3251
3067
  }
3252
3068
  });
3253
3069
  });
3070
+ pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
3071
+ return function (file, index, adapterHint) {
3072
+ var regexGuess = /\.(bw|bigwig)$/i;
3073
+ var adapterName = 'BigWigAdapter';
3074
+ var fileName = getFileName(file);
3075
+
3076
+ if (regexGuess.test(fileName) || adapterHint === adapterName) {
3077
+ return {
3078
+ type: adapterName,
3079
+ bigWigLocation: file
3080
+ };
3081
+ }
3082
+
3083
+ return adapterGuesser(file, index, adapterHint);
3084
+ };
3085
+ });
3086
+ pluginManager.addToExtensionPoint('Core-guessTrackTypeForLocation', function (trackTypeGuesser) {
3087
+ return function (adapterName) {
3088
+ if (adapterName === 'BigWigAdapter') {
3089
+ return 'QuantitativeTrack';
3090
+ }
3091
+
3092
+ return trackTypeGuesser(adapterName);
3093
+ };
3094
+ });
3254
3095
  pluginManager.addRendererType(function () {
3255
3096
  return new DensityRenderer({
3256
3097
  name: 'DensityRenderer',
@@ -3442,6 +3283,216 @@ var SetColorDialog$1 = {
3442
3283
  'default': SetColorDialog
3443
3284
  };
3444
3285
 
3286
+ var BigWigAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
3287
+ _inherits(BigWigAdapter, _BaseFeatureDataAdapt);
3288
+
3289
+ var _super = /*#__PURE__*/_createSuper(BigWigAdapter);
3290
+
3291
+ function BigWigAdapter(config, getSubAdapter, pluginManager) {
3292
+ var _this;
3293
+
3294
+ _classCallCheck(this, BigWigAdapter);
3295
+
3296
+ _this = _super.call(this, config, getSubAdapter, pluginManager);
3297
+ _this.bigwig = new BigWig({
3298
+ filehandle: openLocation(readConfObject(config, 'bigWigLocation'), _this.pluginManager)
3299
+ });
3300
+ return _this;
3301
+ }
3302
+
3303
+ _createClass(BigWigAdapter, [{
3304
+ key: "setup",
3305
+ value: function () {
3306
+ var _setup = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(opts) {
3307
+ var _ref, _ref$statusCallback, statusCallback, result;
3308
+
3309
+ return runtime_1.wrap(function _callee$(_context) {
3310
+ while (1) {
3311
+ switch (_context.prev = _context.next) {
3312
+ case 0:
3313
+ _ref = opts || {}, _ref$statusCallback = _ref.statusCallback, statusCallback = _ref$statusCallback === void 0 ? function () {} : _ref$statusCallback;
3314
+ statusCallback('Downloading bigwig header');
3315
+ _context.next = 4;
3316
+ return this.bigwig.getHeader(opts);
3317
+
3318
+ case 4:
3319
+ result = _context.sent;
3320
+ statusCallback('');
3321
+ return _context.abrupt("return", result);
3322
+
3323
+ case 7:
3324
+ case "end":
3325
+ return _context.stop();
3326
+ }
3327
+ }
3328
+ }, _callee, this);
3329
+ }));
3330
+
3331
+ function setup(_x) {
3332
+ return _setup.apply(this, arguments);
3333
+ }
3334
+
3335
+ return setup;
3336
+ }()
3337
+ }, {
3338
+ key: "getRefNames",
3339
+ value: function () {
3340
+ var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(opts) {
3341
+ var header;
3342
+ return runtime_1.wrap(function _callee2$(_context2) {
3343
+ while (1) {
3344
+ switch (_context2.prev = _context2.next) {
3345
+ case 0:
3346
+ _context2.next = 2;
3347
+ return this.setup(opts);
3348
+
3349
+ case 2:
3350
+ header = _context2.sent;
3351
+ return _context2.abrupt("return", Object.keys(header.refsByName));
3352
+
3353
+ case 4:
3354
+ case "end":
3355
+ return _context2.stop();
3356
+ }
3357
+ }
3358
+ }, _callee2, this);
3359
+ }));
3360
+
3361
+ function getRefNames(_x2) {
3362
+ return _getRefNames.apply(this, arguments);
3363
+ }
3364
+
3365
+ return getRefNames;
3366
+ }()
3367
+ }, {
3368
+ key: "refIdToName",
3369
+ value: function () {
3370
+ var _refIdToName = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(refId) {
3371
+ var h;
3372
+ return runtime_1.wrap(function _callee3$(_context3) {
3373
+ while (1) {
3374
+ switch (_context3.prev = _context3.next) {
3375
+ case 0:
3376
+ _context3.next = 2;
3377
+ return this.setup();
3378
+
3379
+ case 2:
3380
+ h = _context3.sent;
3381
+ return _context3.abrupt("return", (h.refsByNumber[refId] || {
3382
+ name: undefined
3383
+ }).name);
3384
+
3385
+ case 4:
3386
+ case "end":
3387
+ return _context3.stop();
3388
+ }
3389
+ }
3390
+ }, _callee3, this);
3391
+ }));
3392
+
3393
+ function refIdToName(_x3) {
3394
+ return _refIdToName.apply(this, arguments);
3395
+ }
3396
+
3397
+ return refIdToName;
3398
+ }()
3399
+ }, {
3400
+ key: "getGlobalStats",
3401
+ value: function () {
3402
+ var _getGlobalStats = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(opts) {
3403
+ var header;
3404
+ return runtime_1.wrap(function _callee4$(_context4) {
3405
+ while (1) {
3406
+ switch (_context4.prev = _context4.next) {
3407
+ case 0:
3408
+ _context4.next = 2;
3409
+ return this.setup(opts);
3410
+
3411
+ case 2:
3412
+ header = _context4.sent;
3413
+ return _context4.abrupt("return", rectifyStats(header.totalSummary));
3414
+
3415
+ case 4:
3416
+ case "end":
3417
+ return _context4.stop();
3418
+ }
3419
+ }
3420
+ }, _callee4, this);
3421
+ }));
3422
+
3423
+ function getGlobalStats(_x4) {
3424
+ return _getGlobalStats.apply(this, arguments);
3425
+ }
3426
+
3427
+ return getGlobalStats;
3428
+ }()
3429
+ }, {
3430
+ key: "getFeatures",
3431
+ value: function getFeatures(region) {
3432
+ var _this2 = this;
3433
+
3434
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
3435
+ var refName = region.refName,
3436
+ start = region.start,
3437
+ end = region.end;
3438
+ var _opts$bpPerPx = opts.bpPerPx,
3439
+ bpPerPx = _opts$bpPerPx === void 0 ? 0 : _opts$bpPerPx,
3440
+ signal = opts.signal,
3441
+ _opts$resolution = opts.resolution,
3442
+ resolution = _opts$resolution === void 0 ? 1 : _opts$resolution,
3443
+ _opts$statusCallback = opts.statusCallback,
3444
+ statusCallback = _opts$statusCallback === void 0 ? function () {} : _opts$statusCallback;
3445
+ return ObservableCreate( /*#__PURE__*/function () {
3446
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(observer) {
3447
+ var ob;
3448
+ return runtime_1.wrap(function _callee5$(_context5) {
3449
+ while (1) {
3450
+ switch (_context5.prev = _context5.next) {
3451
+ case 0:
3452
+ statusCallback('Downloading bigwig data');
3453
+ _context5.next = 3;
3454
+ return _this2.bigwig.getFeatureStream(refName, start, end, _objectSpread2(_objectSpread2({}, opts), {}, {
3455
+ basesPerSpan: bpPerPx / resolution
3456
+ }));
3457
+
3458
+ case 3:
3459
+ ob = _context5.sent;
3460
+ ob.pipe(mergeAll(), map(function (record) {
3461
+ return new SimpleFeature({
3462
+ id: "".concat(refName, ":").concat(record.start, "-").concat(record.end),
3463
+ data: _objectSpread2(_objectSpread2({}, record), {}, {
3464
+ refName: refName
3465
+ })
3466
+ });
3467
+ })).subscribe(observer);
3468
+
3469
+ case 5:
3470
+ case "end":
3471
+ return _context5.stop();
3472
+ }
3473
+ }
3474
+ }, _callee5);
3475
+ }));
3476
+
3477
+ return function (_x5) {
3478
+ return _ref2.apply(this, arguments);
3479
+ };
3480
+ }(), signal);
3481
+ }
3482
+ }, {
3483
+ key: "freeResources",
3484
+ value: function freeResources() {}
3485
+ }]);
3486
+
3487
+ return BigWigAdapter;
3488
+ }(BaseFeatureDataAdapter);
3489
+ BigWigAdapter.capabilities = ['hasResolution', 'hasLocalStats', 'hasGlobalStats'];
3490
+
3491
+ var BigWigAdapter$1 = {
3492
+ __proto__: null,
3493
+ 'default': BigWigAdapter
3494
+ };
3495
+
3445
3496
  export default WigglePlugin;
3446
3497
  export { LinearWiggleDisplay as LinearWiggleDisplayReactComponent, Tooltip, WiggleBaseRenderer, XYPlotRendererReactComponent as WiggleRendering, YSCALEBAR_LABEL_OFFSET, getNiceDomain, getOrigin, getScale, stateModelFactory as linearWiggleDisplayModelFactory };
3447
3498
  //# sourceMappingURL=plugin-wiggle.esm.js.map