@jbrowse/plugin-bed 1.5.9 → 1.6.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/BedTabixAdapter/BedTabixAdapter.d.ts +2 -3
- package/dist/BigBedAdapter/BigBedAdapter.d.ts +33 -11
- package/dist/plugin-bed.cjs.development.js +136 -110
- package/dist/plugin-bed.cjs.development.js.map +1 -1
- package/dist/plugin-bed.cjs.production.min.js +1 -1
- package/dist/plugin-bed.cjs.production.min.js.map +1 -1
- package/dist/plugin-bed.esm.js +136 -110
- package/dist/plugin-bed.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/BedTabixAdapter/BedTabixAdapter.ts +2 -3
- package/src/BigBedAdapter/BigBedAdapter.test.ts +0 -2
- package/src/BigBedAdapter/BigBedAdapter.ts +82 -92
- package/src/index.ts +9 -5
package/dist/plugin-bed.esm.js
CHANGED
|
@@ -119,14 +119,14 @@ function _inherits(subClass, superClass) {
|
|
|
119
119
|
throw new TypeError("Super expression must either be null or a function");
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
123
|
+
constructor: {
|
|
124
|
+
value: subClass,
|
|
125
|
+
writable: true,
|
|
126
|
+
configurable: true
|
|
127
|
+
}
|
|
128
|
+
});
|
|
122
129
|
Object.defineProperty(subClass, "prototype", {
|
|
123
|
-
value: Object.create(superClass && superClass.prototype, {
|
|
124
|
-
constructor: {
|
|
125
|
-
value: subClass,
|
|
126
|
-
writable: true,
|
|
127
|
-
configurable: true
|
|
128
|
-
}
|
|
129
|
-
}),
|
|
130
130
|
writable: false
|
|
131
131
|
});
|
|
132
132
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
@@ -321,12 +321,15 @@ var BedPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
321
321
|
var regexGuess = /\.(bb|bigbed)$/i;
|
|
322
322
|
var adapterName = 'BigBedAdapter';
|
|
323
323
|
var fileName = getFileName(file);
|
|
324
|
+
var obj = {
|
|
325
|
+
type: adapterName,
|
|
326
|
+
bigBedLocation: file
|
|
327
|
+
};
|
|
324
328
|
|
|
325
|
-
if (regexGuess.test(fileName)
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
};
|
|
329
|
+
if (regexGuess.test(fileName) && !adapterHint) {
|
|
330
|
+
return obj;
|
|
331
|
+
} else if (adapterHint === adapterName) {
|
|
332
|
+
return obj;
|
|
330
333
|
}
|
|
331
334
|
|
|
332
335
|
return adapterGuesser(file, index, adapterHint);
|
|
@@ -1216,47 +1219,48 @@ function ucscProcessedTranscript(feature) {
|
|
|
1216
1219
|
var _excluded = ["fields"],
|
|
1217
1220
|
_excluded2 = ["chromStart", "chromEnd", "chrom"];
|
|
1218
1221
|
|
|
1222
|
+
function isUCSC(f) {
|
|
1223
|
+
return f.get('thickStart') && f.get('blockCount') && f.get('strand') !== 0;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1219
1226
|
var BigBedAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
1220
1227
|
_inherits(BigBedAdapter, _BaseFeatureDataAdapt);
|
|
1221
1228
|
|
|
1222
1229
|
var _super = /*#__PURE__*/_createSuper(BigBedAdapter);
|
|
1223
1230
|
|
|
1224
|
-
function BigBedAdapter(
|
|
1225
|
-
var _this;
|
|
1226
|
-
|
|
1231
|
+
function BigBedAdapter() {
|
|
1227
1232
|
_classCallCheck(this, BigBedAdapter);
|
|
1228
1233
|
|
|
1229
|
-
|
|
1230
|
-
var bigBedLocation = readConfObject(config, 'bigBedLocation');
|
|
1231
|
-
_this.bigbed = new BigBed({
|
|
1232
|
-
filehandle: openLocation(bigBedLocation, _this.pluginManager)
|
|
1233
|
-
});
|
|
1234
|
-
_this.parser = _this.bigbed.getHeader().then(function (_ref) {
|
|
1235
|
-
var autoSql = _ref.autoSql;
|
|
1236
|
-
return new BED({
|
|
1237
|
-
autoSql: autoSql
|
|
1238
|
-
});
|
|
1239
|
-
});
|
|
1240
|
-
return _this;
|
|
1234
|
+
return _super.apply(this, arguments);
|
|
1241
1235
|
}
|
|
1242
1236
|
|
|
1243
1237
|
_createClass(BigBedAdapter, [{
|
|
1244
|
-
key: "
|
|
1238
|
+
key: "configurePre",
|
|
1245
1239
|
value: function () {
|
|
1246
|
-
var
|
|
1240
|
+
var _configurePre = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee(opts) {
|
|
1241
|
+
var bigbed, header, parser;
|
|
1247
1242
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1248
1243
|
while (1) {
|
|
1249
1244
|
switch (_context.prev = _context.next) {
|
|
1250
1245
|
case 0:
|
|
1251
|
-
|
|
1246
|
+
bigbed = new BigBed({
|
|
1247
|
+
filehandle: openLocation(readConfObject(this.config, 'bigBedLocation'), this.pluginManager)
|
|
1248
|
+
});
|
|
1252
1249
|
_context.next = 3;
|
|
1253
|
-
return
|
|
1250
|
+
return bigbed.getHeader(opts);
|
|
1254
1251
|
|
|
1255
1252
|
case 3:
|
|
1256
|
-
|
|
1257
|
-
|
|
1253
|
+
header = _context.sent;
|
|
1254
|
+
parser = new BED({
|
|
1255
|
+
autoSql: header.autoSql
|
|
1256
|
+
});
|
|
1257
|
+
return _context.abrupt("return", {
|
|
1258
|
+
bigbed: bigbed,
|
|
1259
|
+
header: header,
|
|
1260
|
+
parser: parser
|
|
1261
|
+
});
|
|
1258
1262
|
|
|
1259
|
-
case
|
|
1263
|
+
case 6:
|
|
1260
1264
|
case "end":
|
|
1261
1265
|
return _context.stop();
|
|
1262
1266
|
}
|
|
@@ -1264,50 +1268,32 @@ var BigBedAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1264
1268
|
}, _callee, this);
|
|
1265
1269
|
}));
|
|
1266
1270
|
|
|
1267
|
-
function
|
|
1268
|
-
return
|
|
1271
|
+
function configurePre(_x) {
|
|
1272
|
+
return _configurePre.apply(this, arguments);
|
|
1269
1273
|
}
|
|
1270
1274
|
|
|
1271
|
-
return
|
|
1275
|
+
return configurePre;
|
|
1272
1276
|
}()
|
|
1273
1277
|
}, {
|
|
1274
|
-
key: "
|
|
1278
|
+
key: "configure",
|
|
1275
1279
|
value: function () {
|
|
1276
|
-
var
|
|
1277
|
-
var
|
|
1280
|
+
var _configure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2(opts) {
|
|
1281
|
+
var _this = this;
|
|
1278
1282
|
|
|
1279
1283
|
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1280
1284
|
while (1) {
|
|
1281
1285
|
switch (_context2.prev = _context2.next) {
|
|
1282
1286
|
case 0:
|
|
1283
|
-
|
|
1284
|
-
|
|
1287
|
+
if (!this.cached) {
|
|
1288
|
+
this.cached = this.configurePre(opts)["catch"](function (e) {
|
|
1289
|
+
_this.cached = undefined;
|
|
1290
|
+
throw e;
|
|
1291
|
+
});
|
|
1292
|
+
}
|
|
1285
1293
|
|
|
1286
|
-
|
|
1287
|
-
_yield$this$bigbed$ge = _context2.sent;
|
|
1288
|
-
version = _yield$this$bigbed$ge.version;
|
|
1289
|
-
fileType = _yield$this$bigbed$ge.fileType;
|
|
1290
|
-
_context2.next = 7;
|
|
1291
|
-
return this.parser;
|
|
1292
|
-
|
|
1293
|
-
case 7:
|
|
1294
|
-
_yield$this$parser = _context2.sent;
|
|
1295
|
-
autoSql = _yield$this$parser.autoSql;
|
|
1296
|
-
fields = autoSql.fields, rest = _objectWithoutProperties(autoSql, _excluded);
|
|
1297
|
-
f = Object.fromEntries( // @ts-ignore
|
|
1298
|
-
fields.map(function (_ref2) {
|
|
1299
|
-
var name = _ref2.name,
|
|
1300
|
-
comment = _ref2.comment;
|
|
1301
|
-
return [name, comment];
|
|
1302
|
-
}));
|
|
1303
|
-
return _context2.abrupt("return", {
|
|
1304
|
-
version: version,
|
|
1305
|
-
fileType: fileType,
|
|
1306
|
-
autoSql: _objectSpread2({}, rest),
|
|
1307
|
-
fields: f
|
|
1308
|
-
});
|
|
1294
|
+
return _context2.abrupt("return", this.cached);
|
|
1309
1295
|
|
|
1310
|
-
case
|
|
1296
|
+
case 2:
|
|
1311
1297
|
case "end":
|
|
1312
1298
|
return _context2.stop();
|
|
1313
1299
|
}
|
|
@@ -1315,50 +1301,87 @@ var BigBedAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1315
1301
|
}, _callee2, this);
|
|
1316
1302
|
}));
|
|
1317
1303
|
|
|
1318
|
-
function
|
|
1319
|
-
return
|
|
1304
|
+
function configure(_x2) {
|
|
1305
|
+
return _configure.apply(this, arguments);
|
|
1320
1306
|
}
|
|
1321
1307
|
|
|
1322
|
-
return
|
|
1308
|
+
return configure;
|
|
1323
1309
|
}()
|
|
1324
1310
|
}, {
|
|
1325
|
-
key: "
|
|
1311
|
+
key: "getRefNames",
|
|
1326
1312
|
value: function () {
|
|
1327
|
-
var
|
|
1313
|
+
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3(opts) {
|
|
1314
|
+
var _yield$this$configure, header;
|
|
1315
|
+
|
|
1328
1316
|
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1329
1317
|
while (1) {
|
|
1330
1318
|
switch (_context3.prev = _context3.next) {
|
|
1331
1319
|
case 0:
|
|
1332
1320
|
_context3.next = 2;
|
|
1333
|
-
return this.
|
|
1321
|
+
return this.configure(opts);
|
|
1334
1322
|
|
|
1335
1323
|
case 2:
|
|
1336
|
-
|
|
1337
|
-
|
|
1324
|
+
_yield$this$configure = _context3.sent;
|
|
1325
|
+
header = _yield$this$configure.header;
|
|
1326
|
+
return _context3.abrupt("return", Object.keys(header.refsByName));
|
|
1338
1327
|
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1328
|
+
case 5:
|
|
1329
|
+
case "end":
|
|
1330
|
+
return _context3.stop();
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
}, _callee3, this);
|
|
1334
|
+
}));
|
|
1343
1335
|
|
|
1344
|
-
|
|
1336
|
+
function getRefNames(_x3) {
|
|
1337
|
+
return _getRefNames.apply(this, arguments);
|
|
1338
|
+
}
|
|
1345
1339
|
|
|
1346
|
-
|
|
1347
|
-
|
|
1340
|
+
return getRefNames;
|
|
1341
|
+
}()
|
|
1342
|
+
}, {
|
|
1343
|
+
key: "getHeader",
|
|
1344
|
+
value: function () {
|
|
1345
|
+
var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4(opts) {
|
|
1346
|
+
var _yield$this$configure2, parser, header, version, fileType, _parser$autoSql, fields, rest;
|
|
1348
1347
|
|
|
1349
|
-
|
|
1348
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1349
|
+
while (1) {
|
|
1350
|
+
switch (_context4.prev = _context4.next) {
|
|
1351
|
+
case 0:
|
|
1352
|
+
_context4.next = 2;
|
|
1353
|
+
return this.configure(opts);
|
|
1354
|
+
|
|
1355
|
+
case 2:
|
|
1356
|
+
_yield$this$configure2 = _context4.sent;
|
|
1357
|
+
parser = _yield$this$configure2.parser;
|
|
1358
|
+
header = _yield$this$configure2.header;
|
|
1359
|
+
version = header.version, fileType = header.fileType;
|
|
1360
|
+
_parser$autoSql = parser.autoSql, fields = _parser$autoSql.fields, rest = _objectWithoutProperties(_parser$autoSql, _excluded);
|
|
1361
|
+
return _context4.abrupt("return", {
|
|
1362
|
+
version: version,
|
|
1363
|
+
fileType: fileType,
|
|
1364
|
+
autoSql: _objectSpread2({}, rest),
|
|
1365
|
+
fields: Object.fromEntries(fields.map(function (_ref) {
|
|
1366
|
+
var name = _ref.name,
|
|
1367
|
+
comment = _ref.comment;
|
|
1368
|
+
return [name, comment];
|
|
1369
|
+
}))
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
case 8:
|
|
1350
1373
|
case "end":
|
|
1351
|
-
return
|
|
1374
|
+
return _context4.stop();
|
|
1352
1375
|
}
|
|
1353
1376
|
}
|
|
1354
|
-
},
|
|
1377
|
+
}, _callee4, this);
|
|
1355
1378
|
}));
|
|
1356
1379
|
|
|
1357
|
-
function
|
|
1358
|
-
return
|
|
1380
|
+
function getHeader(_x4) {
|
|
1381
|
+
return _getHeader.apply(this, arguments);
|
|
1359
1382
|
}
|
|
1360
1383
|
|
|
1361
|
-
return
|
|
1384
|
+
return getHeader;
|
|
1362
1385
|
}()
|
|
1363
1386
|
}, {
|
|
1364
1387
|
key: "getFeatures",
|
|
@@ -1371,26 +1394,29 @@ var BigBedAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1371
1394
|
end = region.end;
|
|
1372
1395
|
var signal = opts.signal;
|
|
1373
1396
|
return ObservableCreate( /*#__PURE__*/function () {
|
|
1374
|
-
var
|
|
1375
|
-
var parser, ob;
|
|
1376
|
-
|
|
1397
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(observer) {
|
|
1398
|
+
var _yield$_this2$configu, parser, bigbed, ob;
|
|
1399
|
+
|
|
1400
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1377
1401
|
while (1) {
|
|
1378
|
-
switch (
|
|
1402
|
+
switch (_context5.prev = _context5.next) {
|
|
1379
1403
|
case 0:
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
return _this2.
|
|
1404
|
+
_context5.prev = 0;
|
|
1405
|
+
_context5.next = 3;
|
|
1406
|
+
return _this2.configure(opts);
|
|
1383
1407
|
|
|
1384
1408
|
case 3:
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1409
|
+
_yield$_this2$configu = _context5.sent;
|
|
1410
|
+
parser = _yield$_this2$configu.parser;
|
|
1411
|
+
bigbed = _yield$_this2$configu.bigbed;
|
|
1412
|
+
_context5.next = 8;
|
|
1413
|
+
return bigbed.getFeatureStream(refName, start, end, {
|
|
1388
1414
|
signal: signal,
|
|
1389
1415
|
basesPerSpan: end - start
|
|
1390
1416
|
});
|
|
1391
1417
|
|
|
1392
|
-
case
|
|
1393
|
-
ob =
|
|
1418
|
+
case 8:
|
|
1419
|
+
ob = _context5.sent;
|
|
1394
1420
|
ob.pipe(mergeAll(), map(function (r) {
|
|
1395
1421
|
var data = parser.parseLine("".concat(refName, "\t").concat(r.start, "\t").concat(r.end, "\t").concat(r.rest), {
|
|
1396
1422
|
uniqueId: r.uniqueId
|
|
@@ -1435,26 +1461,26 @@ var BigBedAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1435
1461
|
// should be converted to a gene, CNV bigbed has many gene like
|
|
1436
1462
|
// features including thickStart and blockCount but no strand
|
|
1437
1463
|
|
|
1438
|
-
return
|
|
1464
|
+
return isUCSC(f) ? ucscProcessedTranscript(f) : f;
|
|
1439
1465
|
})).subscribe(observer);
|
|
1440
|
-
|
|
1466
|
+
_context5.next = 15;
|
|
1441
1467
|
break;
|
|
1442
1468
|
|
|
1443
|
-
case
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
observer.error(
|
|
1469
|
+
case 12:
|
|
1470
|
+
_context5.prev = 12;
|
|
1471
|
+
_context5.t0 = _context5["catch"](0);
|
|
1472
|
+
observer.error(_context5.t0);
|
|
1447
1473
|
|
|
1448
|
-
case
|
|
1474
|
+
case 15:
|
|
1449
1475
|
case "end":
|
|
1450
|
-
return
|
|
1476
|
+
return _context5.stop();
|
|
1451
1477
|
}
|
|
1452
1478
|
}
|
|
1453
|
-
},
|
|
1479
|
+
}, _callee5, null, [[0, 12]]);
|
|
1454
1480
|
}));
|
|
1455
1481
|
|
|
1456
|
-
return function (
|
|
1457
|
-
return
|
|
1482
|
+
return function (_x5) {
|
|
1483
|
+
return _ref2.apply(this, arguments);
|
|
1458
1484
|
};
|
|
1459
1485
|
}(), opts.signal);
|
|
1460
1486
|
}
|