@jbrowse/plugin-gff3 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/Gff3Adapter/Gff3Adapter.d.ts +6 -9
- package/dist/plugin-gff3.cjs.development.js +258 -126
- package/dist/plugin-gff3.cjs.development.js.map +1 -1
- package/dist/plugin-gff3.cjs.production.min.js +1 -1
- package/dist/plugin-gff3.cjs.production.min.js.map +1 -1
- package/dist/plugin-gff3.esm.js +258 -126
- package/dist/plugin-gff3.esm.js.map +1 -1
- package/package.json +7 -6
- package/src/Gff3Adapter/Gff3Adapter.test.ts +3 -0
- package/src/Gff3Adapter/Gff3Adapter.ts +85 -74
- package/src/Gff3TabixAdapter/Gff3TabixAdapter.ts +19 -14
- package/src/index.ts +55 -1
- package/dist/util.d.ts +0 -14
- package/src/declare.d.ts +0 -1
- package/src/util.ts +0 -12
package/dist/plugin-gff3.esm.js
CHANGED
|
@@ -2,6 +2,7 @@ import AdapterType from '@jbrowse/core/pluggableElementTypes/AdapterType';
|
|
|
2
2
|
import Plugin from '@jbrowse/core/Plugin';
|
|
3
3
|
import { types } from 'mobx-state-tree';
|
|
4
4
|
import { ConfigurationSchema, readConfObject } from '@jbrowse/core/configuration';
|
|
5
|
+
import { getFileName, makeIndex, makeIndexType } from '@jbrowse/core/util/tracks';
|
|
5
6
|
import { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
6
7
|
import { doesIntersect2 } from '@jbrowse/core/util/range';
|
|
7
8
|
import { openLocation } from '@jbrowse/core/util/io';
|
|
@@ -10,20 +11,16 @@ import SimpleFeature from '@jbrowse/core/util/simpleFeature';
|
|
|
10
11
|
import { TabixIndexedFile } from '@gmod/tabix';
|
|
11
12
|
import gff from '@gmod/gff';
|
|
12
13
|
import IntervalTree from '@flatten-js/interval-tree';
|
|
14
|
+
import { unzip } from '@gmod/bgzf-filehandle';
|
|
13
15
|
|
|
14
16
|
function ownKeys(object, enumerableOnly) {
|
|
15
17
|
var keys = Object.keys(object);
|
|
16
18
|
|
|
17
19
|
if (Object.getOwnPropertySymbols) {
|
|
18
20
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
keys.push.apply(keys, symbols);
|
|
21
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
22
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
23
|
+
})), keys.push.apply(keys, symbols);
|
|
27
24
|
}
|
|
28
25
|
|
|
29
26
|
return keys;
|
|
@@ -31,19 +28,12 @@ function ownKeys(object, enumerableOnly) {
|
|
|
31
28
|
|
|
32
29
|
function _objectSpread2(target) {
|
|
33
30
|
for (var i = 1; i < arguments.length; i++) {
|
|
34
|
-
var source = arguments[i]
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} else if (Object.getOwnPropertyDescriptors) {
|
|
41
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
42
|
-
} else {
|
|
43
|
-
ownKeys(Object(source)).forEach(function (key) {
|
|
44
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
45
|
-
});
|
|
46
|
-
}
|
|
31
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
32
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
33
|
+
_defineProperty(target, key, source[key]);
|
|
34
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
35
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
36
|
+
});
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
return target;
|
|
@@ -104,6 +94,9 @@ function _defineProperties(target, props) {
|
|
|
104
94
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
105
95
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
106
96
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
97
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
98
|
+
writable: false
|
|
99
|
+
});
|
|
107
100
|
return Constructor;
|
|
108
101
|
}
|
|
109
102
|
|
|
@@ -127,12 +120,15 @@ function _inherits(subClass, superClass) {
|
|
|
127
120
|
throw new TypeError("Super expression must either be null or a function");
|
|
128
121
|
}
|
|
129
122
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
123
|
+
Object.defineProperty(subClass, "prototype", {
|
|
124
|
+
value: Object.create(superClass && superClass.prototype, {
|
|
125
|
+
constructor: {
|
|
126
|
+
value: subClass,
|
|
127
|
+
writable: true,
|
|
128
|
+
configurable: true
|
|
129
|
+
}
|
|
130
|
+
}),
|
|
131
|
+
writable: false
|
|
136
132
|
});
|
|
137
133
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
138
134
|
}
|
|
@@ -333,6 +329,28 @@ var _default = /*#__PURE__*/function (_Plugin) {
|
|
|
333
329
|
}
|
|
334
330
|
});
|
|
335
331
|
});
|
|
332
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
333
|
+
return function (file, index, adapterHint) {
|
|
334
|
+
var regexGuess = /\.gff3?\.b?gz$/i;
|
|
335
|
+
var adapterName = 'Gff3TabixAdapter';
|
|
336
|
+
var fileName = getFileName(file);
|
|
337
|
+
var indexName = index && getFileName(index);
|
|
338
|
+
|
|
339
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
340
|
+
return {
|
|
341
|
+
type: adapterName,
|
|
342
|
+
bamLocation: file,
|
|
343
|
+
gffGzLocation: file,
|
|
344
|
+
index: {
|
|
345
|
+
location: index || makeIndex(file, '.tbi'),
|
|
346
|
+
indexType: makeIndexType(indexName, 'CSI', 'TBI')
|
|
347
|
+
}
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return adapterGuesser(file, index, adapterHint);
|
|
352
|
+
};
|
|
353
|
+
});
|
|
336
354
|
pluginManager.addAdapterType(function () {
|
|
337
355
|
return new AdapterType({
|
|
338
356
|
name: 'Gff3Adapter',
|
|
@@ -344,6 +362,22 @@ var _default = /*#__PURE__*/function (_Plugin) {
|
|
|
344
362
|
}
|
|
345
363
|
});
|
|
346
364
|
});
|
|
365
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
366
|
+
return function (file, index, adapterHint) {
|
|
367
|
+
var regexGuess = /\.gff3?$/i;
|
|
368
|
+
var adapterName = 'Gff3Adapter';
|
|
369
|
+
var fileName = getFileName(file);
|
|
370
|
+
|
|
371
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
372
|
+
return {
|
|
373
|
+
type: adapterName,
|
|
374
|
+
gffLocation: file
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return adapterGuesser(file, index, adapterHint);
|
|
379
|
+
};
|
|
380
|
+
});
|
|
347
381
|
}
|
|
348
382
|
}]);
|
|
349
383
|
|
|
@@ -1255,9 +1289,6 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1255
1289
|
break;
|
|
1256
1290
|
}
|
|
1257
1291
|
|
|
1258
|
-
// console.log(
|
|
1259
|
-
// `redispatching ${query.start}-${query.end} => ${minStart}-${maxEnd}`,
|
|
1260
|
-
// )
|
|
1261
1292
|
// make a new feature callback to only return top-level features
|
|
1262
1293
|
// in the original query range
|
|
1263
1294
|
this.getFeaturesHelper(_objectSpread2(_objectSpread2({}, query), {}, {
|
|
@@ -1334,6 +1365,7 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1334
1365
|
return featureLocs.map(function (featureLoc) {
|
|
1335
1366
|
return new SimpleFeature({
|
|
1336
1367
|
data: _this4.featureData(featureLoc),
|
|
1368
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1337
1369
|
id: "".concat(_this4.id, "-offset-").concat(featureLoc.attributes._lineHash[0])
|
|
1338
1370
|
});
|
|
1339
1371
|
});
|
|
@@ -1347,12 +1379,15 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1347
1379
|
|
|
1348
1380
|
f.start -= 1; // convert to interbase
|
|
1349
1381
|
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1382
|
+
if (data.strand === '+') {
|
|
1383
|
+
f.strand = 1;
|
|
1384
|
+
} else if (data.strand === '-') {
|
|
1385
|
+
f.strand = -1;
|
|
1386
|
+
} else if (data.strand === '.') {
|
|
1387
|
+
f.strand = 0;
|
|
1388
|
+
} else {
|
|
1389
|
+
f.strand = undefined;
|
|
1390
|
+
}
|
|
1356
1391
|
|
|
1357
1392
|
f.phase = Number(data.phase);
|
|
1358
1393
|
f.refName = data.seq_id;
|
|
@@ -1366,7 +1401,8 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1366
1401
|
}
|
|
1367
1402
|
|
|
1368
1403
|
var defaultFields = ['start', 'end', 'seq_id', 'score', 'type', 'source', 'phase', 'strand'];
|
|
1369
|
-
|
|
1404
|
+
var dataAttributes = data.attributes || {};
|
|
1405
|
+
Object.keys(dataAttributes).forEach(function (a) {
|
|
1370
1406
|
var b = a.toLowerCase();
|
|
1371
1407
|
|
|
1372
1408
|
if (defaultFields.includes(b)) {
|
|
@@ -1375,8 +1411,8 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1375
1411
|
b += '2';
|
|
1376
1412
|
}
|
|
1377
1413
|
|
|
1378
|
-
if (
|
|
1379
|
-
var attr =
|
|
1414
|
+
if (dataAttributes[a] !== null) {
|
|
1415
|
+
var attr = dataAttributes[a];
|
|
1380
1416
|
|
|
1381
1417
|
if (Array.isArray(attr) && attr.length === 1) {
|
|
1382
1418
|
var _attr = attr;
|
|
@@ -1409,7 +1445,9 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1409
1445
|
}
|
|
1410
1446
|
}, {
|
|
1411
1447
|
key: "freeResources",
|
|
1412
|
-
value: function
|
|
1448
|
+
value: function
|
|
1449
|
+
/* { region } */
|
|
1450
|
+
freeResources() {}
|
|
1413
1451
|
}]);
|
|
1414
1452
|
|
|
1415
1453
|
return _default;
|
|
@@ -1420,88 +1458,141 @@ var Gff3TabixAdapter = {
|
|
|
1420
1458
|
'default': _default$1
|
|
1421
1459
|
};
|
|
1422
1460
|
|
|
1461
|
+
function isGzip(buf) {
|
|
1462
|
+
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1423
1465
|
var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
1424
1466
|
_inherits(_default, _BaseFeatureDataAdapt);
|
|
1425
1467
|
|
|
1426
1468
|
var _super = /*#__PURE__*/_createSuper(_default);
|
|
1427
1469
|
|
|
1428
|
-
function _default(
|
|
1429
|
-
var _this;
|
|
1430
|
-
|
|
1470
|
+
function _default() {
|
|
1431
1471
|
_classCallCheck(this, _default);
|
|
1432
1472
|
|
|
1433
|
-
|
|
1434
|
-
var gffLocation = readConfObject(config, 'gffLocation');
|
|
1435
|
-
var uri = gffLocation.uri;
|
|
1436
|
-
_this.uri = uri;
|
|
1437
|
-
_this.filehandle = openLocation(gffLocation, _this.pluginManager);
|
|
1438
|
-
return _this;
|
|
1473
|
+
return _super.apply(this, arguments);
|
|
1439
1474
|
}
|
|
1440
1475
|
|
|
1441
1476
|
_createClass(_default, [{
|
|
1442
|
-
key: "
|
|
1477
|
+
key: "loadDataP",
|
|
1443
1478
|
value: function () {
|
|
1444
|
-
var
|
|
1445
|
-
var
|
|
1446
|
-
|
|
1447
|
-
var _yield$this$filehandl, size;
|
|
1479
|
+
var _loadDataP = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1480
|
+
var _this = this;
|
|
1448
1481
|
|
|
1482
|
+
var buffer, buf, data, lines, headerLines, i, header, feats, intervalTree;
|
|
1449
1483
|
return runtime_1.wrap(function _callee$(_context) {
|
|
1450
1484
|
while (1) {
|
|
1451
1485
|
switch (_context.prev = _context.next) {
|
|
1452
1486
|
case 0:
|
|
1453
1487
|
_context.next = 2;
|
|
1454
|
-
return this.
|
|
1488
|
+
return openLocation(readConfObject(this.config, 'gffLocation'), this.pluginManager).readFile();
|
|
1455
1489
|
|
|
1456
1490
|
case 2:
|
|
1457
|
-
|
|
1458
|
-
size = _yield$this$filehandl.size;
|
|
1491
|
+
buffer = _context.sent;
|
|
1459
1492
|
|
|
1460
|
-
if (!(
|
|
1461
|
-
_context.next =
|
|
1493
|
+
if (!isGzip(buffer)) {
|
|
1494
|
+
_context.next = 9;
|
|
1462
1495
|
break;
|
|
1463
1496
|
}
|
|
1464
1497
|
|
|
1465
|
-
|
|
1498
|
+
_context.next = 6;
|
|
1499
|
+
return unzip(buffer);
|
|
1466
1500
|
|
|
1467
1501
|
case 6:
|
|
1502
|
+
_context.t0 = _context.sent;
|
|
1503
|
+
_context.next = 10;
|
|
1504
|
+
break;
|
|
1505
|
+
|
|
1506
|
+
case 9:
|
|
1507
|
+
_context.t0 = buffer;
|
|
1508
|
+
|
|
1509
|
+
case 10:
|
|
1510
|
+
buf = _context.t0;
|
|
1511
|
+
|
|
1512
|
+
if (!(buf.length > 536870888)) {
|
|
1513
|
+
_context.next = 13;
|
|
1514
|
+
break;
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
throw new Error('Data exceeds maximum string length (512MB)');
|
|
1518
|
+
|
|
1519
|
+
case 13:
|
|
1520
|
+
data = new TextDecoder('utf8', {
|
|
1521
|
+
fatal: true
|
|
1522
|
+
}).decode(buf);
|
|
1523
|
+
lines = data.split('\n');
|
|
1524
|
+
headerLines = [];
|
|
1525
|
+
|
|
1526
|
+
for (i = 0; i < lines.length && lines[i].startsWith('#'); i++) {
|
|
1527
|
+
headerLines.push(lines[i]);
|
|
1528
|
+
}
|
|
1529
|
+
|
|
1530
|
+
header = headerLines.join('\n');
|
|
1531
|
+
feats = gff.parseStringSync(data, {
|
|
1532
|
+
parseFeatures: true,
|
|
1533
|
+
parseComments: false,
|
|
1534
|
+
parseDirectives: false,
|
|
1535
|
+
parseSequences: false
|
|
1536
|
+
});
|
|
1537
|
+
intervalTree = feats.flat().map(function (f, i) {
|
|
1538
|
+
return new SimpleFeature({
|
|
1539
|
+
data: _this.featureData(f),
|
|
1540
|
+
id: "".concat(_this.id, "-offset-").concat(i)
|
|
1541
|
+
});
|
|
1542
|
+
}).reduce(function (acc, obj) {
|
|
1543
|
+
var key = obj.get('refName');
|
|
1544
|
+
|
|
1545
|
+
if (!acc[key]) {
|
|
1546
|
+
acc[key] = new IntervalTree();
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
acc[key].insert([obj.get('start'), obj.get('end')], obj);
|
|
1550
|
+
return acc;
|
|
1551
|
+
}, {});
|
|
1552
|
+
return _context.abrupt("return", {
|
|
1553
|
+
header: header,
|
|
1554
|
+
intervalTree: intervalTree
|
|
1555
|
+
});
|
|
1556
|
+
|
|
1557
|
+
case 21:
|
|
1558
|
+
case "end":
|
|
1559
|
+
return _context.stop();
|
|
1560
|
+
}
|
|
1561
|
+
}
|
|
1562
|
+
}, _callee, this);
|
|
1563
|
+
}));
|
|
1564
|
+
|
|
1565
|
+
function loadDataP() {
|
|
1566
|
+
return _loadDataP.apply(this, arguments);
|
|
1567
|
+
}
|
|
1568
|
+
|
|
1569
|
+
return loadDataP;
|
|
1570
|
+
}()
|
|
1571
|
+
}, {
|
|
1572
|
+
key: "loadData",
|
|
1573
|
+
value: function () {
|
|
1574
|
+
var _loadData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1575
|
+
var _this2 = this;
|
|
1576
|
+
|
|
1577
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1578
|
+
while (1) {
|
|
1579
|
+
switch (_context2.prev = _context2.next) {
|
|
1580
|
+
case 0:
|
|
1468
1581
|
if (!this.gffFeatures) {
|
|
1469
|
-
this.gffFeatures = this.
|
|
1470
|
-
var gffFeatures = gff.parseStringSync(data, {
|
|
1471
|
-
parseFeatures: true,
|
|
1472
|
-
parseComments: false,
|
|
1473
|
-
parseDirectives: false,
|
|
1474
|
-
parseSequences: false
|
|
1475
|
-
});
|
|
1476
|
-
return gffFeatures.flat().map(function (f, i) {
|
|
1477
|
-
return new SimpleFeature({
|
|
1478
|
-
data: _this2.featureData(f),
|
|
1479
|
-
id: "".concat(_this2.id, "-offset-").concat(i)
|
|
1480
|
-
});
|
|
1481
|
-
}).reduce(function (acc, obj) {
|
|
1482
|
-
var key = obj.get('refName');
|
|
1483
|
-
|
|
1484
|
-
if (!acc[key]) {
|
|
1485
|
-
acc[key] = new IntervalTree();
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
acc[key].insert([obj.get('start'), obj.get('end')], obj);
|
|
1489
|
-
return acc;
|
|
1490
|
-
}, {});
|
|
1491
|
-
})["catch"](function (e) {
|
|
1582
|
+
this.gffFeatures = this.loadDataP()["catch"](function (e) {
|
|
1492
1583
|
_this2.gffFeatures = undefined;
|
|
1493
1584
|
throw e;
|
|
1494
1585
|
});
|
|
1495
1586
|
}
|
|
1496
1587
|
|
|
1497
|
-
return
|
|
1588
|
+
return _context2.abrupt("return", this.gffFeatures);
|
|
1498
1589
|
|
|
1499
|
-
case
|
|
1590
|
+
case 2:
|
|
1500
1591
|
case "end":
|
|
1501
|
-
return
|
|
1592
|
+
return _context2.stop();
|
|
1502
1593
|
}
|
|
1503
1594
|
}
|
|
1504
|
-
},
|
|
1595
|
+
}, _callee2, this);
|
|
1505
1596
|
}));
|
|
1506
1597
|
|
|
1507
1598
|
function loadData() {
|
|
@@ -1513,25 +1604,28 @@ var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1513
1604
|
}, {
|
|
1514
1605
|
key: "getRefNames",
|
|
1515
1606
|
value: function () {
|
|
1516
|
-
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1517
|
-
var
|
|
1518
|
-
|
|
1607
|
+
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1608
|
+
var _yield$this$loadData,
|
|
1609
|
+
intervalTree;
|
|
1610
|
+
|
|
1611
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1519
1612
|
while (1) {
|
|
1520
|
-
switch (
|
|
1613
|
+
switch (_context3.prev = _context3.next) {
|
|
1521
1614
|
case 0:
|
|
1522
|
-
|
|
1615
|
+
_context3.next = 3;
|
|
1523
1616
|
return this.loadData();
|
|
1524
1617
|
|
|
1525
1618
|
case 3:
|
|
1526
|
-
|
|
1527
|
-
|
|
1619
|
+
_yield$this$loadData = _context3.sent;
|
|
1620
|
+
intervalTree = _yield$this$loadData.intervalTree;
|
|
1621
|
+
return _context3.abrupt("return", Object.keys(intervalTree));
|
|
1528
1622
|
|
|
1529
|
-
case
|
|
1623
|
+
case 6:
|
|
1530
1624
|
case "end":
|
|
1531
|
-
return
|
|
1625
|
+
return _context3.stop();
|
|
1532
1626
|
}
|
|
1533
1627
|
}
|
|
1534
|
-
},
|
|
1628
|
+
}, _callee3, this);
|
|
1535
1629
|
}));
|
|
1536
1630
|
|
|
1537
1631
|
function getRefNames() {
|
|
@@ -1540,6 +1634,38 @@ var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1540
1634
|
|
|
1541
1635
|
return getRefNames;
|
|
1542
1636
|
}()
|
|
1637
|
+
}, {
|
|
1638
|
+
key: "getHeader",
|
|
1639
|
+
value: function () {
|
|
1640
|
+
var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
1641
|
+
var _yield$this$loadData2, header;
|
|
1642
|
+
|
|
1643
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1644
|
+
while (1) {
|
|
1645
|
+
switch (_context4.prev = _context4.next) {
|
|
1646
|
+
case 0:
|
|
1647
|
+
_context4.next = 2;
|
|
1648
|
+
return this.loadData();
|
|
1649
|
+
|
|
1650
|
+
case 2:
|
|
1651
|
+
_yield$this$loadData2 = _context4.sent;
|
|
1652
|
+
header = _yield$this$loadData2.header;
|
|
1653
|
+
return _context4.abrupt("return", header);
|
|
1654
|
+
|
|
1655
|
+
case 5:
|
|
1656
|
+
case "end":
|
|
1657
|
+
return _context4.stop();
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}, _callee4, this);
|
|
1661
|
+
}));
|
|
1662
|
+
|
|
1663
|
+
function getHeader() {
|
|
1664
|
+
return _getHeader.apply(this, arguments);
|
|
1665
|
+
}
|
|
1666
|
+
|
|
1667
|
+
return getHeader;
|
|
1668
|
+
}()
|
|
1543
1669
|
}, {
|
|
1544
1670
|
key: "getFeatures",
|
|
1545
1671
|
value: function getFeatures(query) {
|
|
@@ -1547,39 +1673,39 @@ var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1547
1673
|
|
|
1548
1674
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1549
1675
|
return ObservableCreate( /*#__PURE__*/function () {
|
|
1550
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function
|
|
1551
|
-
var start, end, refName,
|
|
1552
|
-
|
|
1676
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(observer) {
|
|
1677
|
+
var _intervalTree$refName, start, end, refName, _yield$_this3$loadDat, intervalTree;
|
|
1678
|
+
|
|
1679
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1553
1680
|
while (1) {
|
|
1554
|
-
switch (
|
|
1681
|
+
switch (_context5.prev = _context5.next) {
|
|
1555
1682
|
case 0:
|
|
1556
|
-
|
|
1683
|
+
_context5.prev = 0;
|
|
1557
1684
|
start = query.start, end = query.end, refName = query.refName;
|
|
1558
|
-
|
|
1685
|
+
_context5.next = 4;
|
|
1559
1686
|
return _this3.loadData();
|
|
1560
1687
|
|
|
1561
1688
|
case 4:
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
observer.next(f);
|
|
1689
|
+
_yield$_this3$loadDat = _context5.sent;
|
|
1690
|
+
intervalTree = _yield$_this3$loadDat.intervalTree;
|
|
1691
|
+
(_intervalTree$refName = intervalTree[refName]) === null || _intervalTree$refName === void 0 ? void 0 : _intervalTree$refName.search([start, end]).forEach(function (f) {
|
|
1692
|
+
return observer.next(f);
|
|
1567
1693
|
});
|
|
1568
1694
|
observer.complete();
|
|
1569
|
-
|
|
1695
|
+
_context5.next = 13;
|
|
1570
1696
|
break;
|
|
1571
1697
|
|
|
1572
|
-
case
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
observer.error(
|
|
1698
|
+
case 10:
|
|
1699
|
+
_context5.prev = 10;
|
|
1700
|
+
_context5.t0 = _context5["catch"](0);
|
|
1701
|
+
observer.error(_context5.t0);
|
|
1576
1702
|
|
|
1577
|
-
case
|
|
1703
|
+
case 13:
|
|
1578
1704
|
case "end":
|
|
1579
|
-
return
|
|
1705
|
+
return _context5.stop();
|
|
1580
1706
|
}
|
|
1581
1707
|
}
|
|
1582
|
-
},
|
|
1708
|
+
}, _callee5, null, [[0, 10]]);
|
|
1583
1709
|
}));
|
|
1584
1710
|
|
|
1585
1711
|
return function (_x) {
|
|
@@ -1596,12 +1722,15 @@ var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1596
1722
|
|
|
1597
1723
|
f.start -= 1; // convert to interbase
|
|
1598
1724
|
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1725
|
+
if (data.strand === '+') {
|
|
1726
|
+
f.strand = 1;
|
|
1727
|
+
} else if (data.strand === '-') {
|
|
1728
|
+
f.strand = -1;
|
|
1729
|
+
} else if (data.strand === '.') {
|
|
1730
|
+
f.strand = 0;
|
|
1731
|
+
} else {
|
|
1732
|
+
f.strand = undefined;
|
|
1733
|
+
}
|
|
1605
1734
|
|
|
1606
1735
|
f.phase = Number(data.phase);
|
|
1607
1736
|
f.refName = data.seq_id;
|
|
@@ -1615,7 +1744,8 @@ var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1615
1744
|
}
|
|
1616
1745
|
|
|
1617
1746
|
var defaultFields = ['start', 'end', 'seq_id', 'score', 'type', 'source', 'phase', 'strand'];
|
|
1618
|
-
|
|
1747
|
+
var dataAttributes = data.attributes || {};
|
|
1748
|
+
Object.keys(dataAttributes).forEach(function (a) {
|
|
1619
1749
|
var b = a.toLowerCase();
|
|
1620
1750
|
|
|
1621
1751
|
if (defaultFields.includes(b)) {
|
|
@@ -1624,8 +1754,8 @@ var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1624
1754
|
b += '2';
|
|
1625
1755
|
}
|
|
1626
1756
|
|
|
1627
|
-
if (
|
|
1628
|
-
var attr =
|
|
1757
|
+
if (dataAttributes[a] !== null) {
|
|
1758
|
+
var attr = dataAttributes[a];
|
|
1629
1759
|
|
|
1630
1760
|
if (Array.isArray(attr) && attr.length === 1) {
|
|
1631
1761
|
var _attr = attr;
|
|
@@ -1657,7 +1787,9 @@ var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1657
1787
|
}
|
|
1658
1788
|
}, {
|
|
1659
1789
|
key: "freeResources",
|
|
1660
|
-
value: function
|
|
1790
|
+
value: function
|
|
1791
|
+
/* { region } */
|
|
1792
|
+
freeResources() {}
|
|
1661
1793
|
}]);
|
|
1662
1794
|
|
|
1663
1795
|
return _default;
|