@jbrowse/plugin-gff3 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.
- package/dist/Gff3Adapter/Gff3Adapter.d.ts +17 -0
- package/dist/Gff3Adapter/configSchema.d.ts +2 -0
- package/dist/Gff3Adapter/index.d.ts +1 -0
- package/dist/Gff3TabixAdapter/Gff3TabixAdapter.d.ts +3 -1
- package/dist/plugin-gff3.cjs.development.js +435 -31
- 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 +435 -31
- package/dist/plugin-gff3.esm.js.map +1 -1
- package/dist/util.d.ts +14 -0
- package/package.json +6 -4
- package/src/Gff3Adapter/Gff3Adapter.test.ts +33 -0
- package/src/Gff3Adapter/Gff3Adapter.ts +164 -0
- package/src/Gff3Adapter/__snapshots__/Gff3Adapter.test.ts.snap +53 -0
- package/src/Gff3Adapter/configSchema.ts +12 -0
- package/src/Gff3Adapter/index.ts +1 -0
- package/src/Gff3TabixAdapter/Gff3TabixAdapter.test.ts +35 -0
- package/src/Gff3TabixAdapter/Gff3TabixAdapter.ts +18 -22
- package/src/Gff3TabixAdapter/__snapshots__/Gff3TabixAdapter.test.ts.snap +53 -0
- package/src/Gff3TabixAdapter/configSchema.ts +5 -2
- package/src/declare.d.ts +1 -0
- package/src/index.ts +66 -1
- package/src/test_data/volvox.sort.gff3 +246 -0
- package/src/test_data/volvox.sort.gff3.gz +0 -0
- package/src/test_data/volvox.sort.gff3.gz.tbi +0 -0
- package/src/util.ts +12 -0
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';
|
|
@@ -9,6 +10,8 @@ import { ObservableCreate } from '@jbrowse/core/util/rxjs';
|
|
|
9
10
|
import SimpleFeature from '@jbrowse/core/util/simpleFeature';
|
|
10
11
|
import { TabixIndexedFile } from '@gmod/tabix';
|
|
11
12
|
import gff from '@gmod/gff';
|
|
13
|
+
import IntervalTree from '@flatten-js/interval-tree';
|
|
14
|
+
import { unzip } from '@gmod/bgzf-filehandle';
|
|
12
15
|
|
|
13
16
|
function ownKeys(object, enumerableOnly) {
|
|
14
17
|
var keys = Object.keys(object);
|
|
@@ -176,6 +179,8 @@ function _assertThisInitialized(self) {
|
|
|
176
179
|
function _possibleConstructorReturn(self, call) {
|
|
177
180
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
178
181
|
return call;
|
|
182
|
+
} else if (call !== void 0) {
|
|
183
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
return _assertThisInitialized(self);
|
|
@@ -263,7 +268,8 @@ var gff3TabixAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('Gff3TabixAd
|
|
|
263
268
|
gffGzLocation: {
|
|
264
269
|
type: 'fileLocation',
|
|
265
270
|
defaultValue: {
|
|
266
|
-
uri: '/path/to/my.gff.gz'
|
|
271
|
+
uri: '/path/to/my.gff.gz',
|
|
272
|
+
locationType: 'UriLocation'
|
|
267
273
|
}
|
|
268
274
|
},
|
|
269
275
|
index: /*#__PURE__*/ConfigurationSchema('Gff3TabixIndex', {
|
|
@@ -275,7 +281,8 @@ var gff3TabixAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('Gff3TabixAd
|
|
|
275
281
|
location: {
|
|
276
282
|
type: 'fileLocation',
|
|
277
283
|
defaultValue: {
|
|
278
|
-
uri: '/path/to/my.gff.gz.tbi'
|
|
284
|
+
uri: '/path/to/my.gff.gz.tbi',
|
|
285
|
+
locationType: 'UriLocation'
|
|
279
286
|
}
|
|
280
287
|
}
|
|
281
288
|
}),
|
|
@@ -287,6 +294,18 @@ var gff3TabixAdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('Gff3TabixAd
|
|
|
287
294
|
explicitlyTyped: true
|
|
288
295
|
});
|
|
289
296
|
|
|
297
|
+
var gff3AdapterConfigSchema = /*#__PURE__*/ConfigurationSchema('Gff3Adapter', {
|
|
298
|
+
gffLocation: {
|
|
299
|
+
type: 'fileLocation',
|
|
300
|
+
defaultValue: {
|
|
301
|
+
uri: '/path/to/my.gff',
|
|
302
|
+
locationType: 'UriLocation'
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
}, {
|
|
306
|
+
explicitlyTyped: true
|
|
307
|
+
});
|
|
308
|
+
|
|
290
309
|
var _default = /*#__PURE__*/function (_Plugin) {
|
|
291
310
|
_inherits(_default, _Plugin);
|
|
292
311
|
|
|
@@ -298,7 +317,7 @@ var _default = /*#__PURE__*/function (_Plugin) {
|
|
|
298
317
|
_classCallCheck(this, _default);
|
|
299
318
|
|
|
300
319
|
_this = _super.apply(this, arguments);
|
|
301
|
-
_this.name = '
|
|
320
|
+
_this.name = 'GFF3Plugin';
|
|
302
321
|
return _this;
|
|
303
322
|
}
|
|
304
323
|
|
|
@@ -316,6 +335,55 @@ var _default = /*#__PURE__*/function (_Plugin) {
|
|
|
316
335
|
}
|
|
317
336
|
});
|
|
318
337
|
});
|
|
338
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
339
|
+
return function (file, index, adapterHint) {
|
|
340
|
+
var regexGuess = /\.gff3?\.b?gz$/i;
|
|
341
|
+
var adapterName = 'Gff3TabixAdapter';
|
|
342
|
+
var fileName = getFileName(file);
|
|
343
|
+
var indexName = index && getFileName(index);
|
|
344
|
+
|
|
345
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
346
|
+
return {
|
|
347
|
+
type: adapterName,
|
|
348
|
+
bamLocation: file,
|
|
349
|
+
gffGzLocation: file,
|
|
350
|
+
index: {
|
|
351
|
+
location: index || makeIndex(file, '.tbi'),
|
|
352
|
+
indexType: makeIndexType(indexName, 'CSI', 'TBI')
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return adapterGuesser(file, index, adapterHint);
|
|
358
|
+
};
|
|
359
|
+
});
|
|
360
|
+
pluginManager.addAdapterType(function () {
|
|
361
|
+
return new AdapterType({
|
|
362
|
+
name: 'Gff3Adapter',
|
|
363
|
+
configSchema: gff3AdapterConfigSchema,
|
|
364
|
+
getAdapterClass: function getAdapterClass() {
|
|
365
|
+
return Promise.resolve().then(function () { return Gff3Adapter; }).then(function (r) {
|
|
366
|
+
return r["default"];
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
});
|
|
371
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
372
|
+
return function (file, index, adapterHint) {
|
|
373
|
+
var regexGuess = /\.gff3?$/i;
|
|
374
|
+
var adapterName = 'Gff3Adapter';
|
|
375
|
+
var fileName = getFileName(file);
|
|
376
|
+
|
|
377
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
378
|
+
return {
|
|
379
|
+
type: adapterName,
|
|
380
|
+
gffLocation: file
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
return adapterGuesser(file, index, adapterHint);
|
|
385
|
+
};
|
|
386
|
+
});
|
|
319
387
|
}
|
|
320
388
|
}]);
|
|
321
389
|
|
|
@@ -419,11 +487,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
419
487
|
|
|
420
488
|
|
|
421
489
|
var IteratorPrototype = {};
|
|
422
|
-
|
|
423
|
-
IteratorPrototype[iteratorSymbol] = function () {
|
|
490
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
424
491
|
return this;
|
|
425
|
-
};
|
|
426
|
-
|
|
492
|
+
});
|
|
427
493
|
var getProto = Object.getPrototypeOf;
|
|
428
494
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
429
495
|
|
|
@@ -434,8 +500,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
434
500
|
}
|
|
435
501
|
|
|
436
502
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
437
|
-
GeneratorFunction.prototype =
|
|
438
|
-
|
|
503
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
504
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
505
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
439
506
|
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
440
507
|
// Iterator interface in terms of a single ._invoke method.
|
|
441
508
|
|
|
@@ -540,11 +607,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
540
607
|
}
|
|
541
608
|
|
|
542
609
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
543
|
-
|
|
544
|
-
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
610
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
545
611
|
return this;
|
|
546
|
-
};
|
|
547
|
-
|
|
612
|
+
});
|
|
548
613
|
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
549
614
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
550
615
|
// the final result produced by the iterator.
|
|
@@ -721,13 +786,12 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
721
786
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
722
787
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
723
788
|
|
|
724
|
-
Gp
|
|
789
|
+
define(Gp, iteratorSymbol, function () {
|
|
725
790
|
return this;
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
Gp.toString = function () {
|
|
791
|
+
});
|
|
792
|
+
define(Gp, "toString", function () {
|
|
729
793
|
return "[object Generator]";
|
|
730
|
-
};
|
|
794
|
+
});
|
|
731
795
|
|
|
732
796
|
function pushTryEntry(locs) {
|
|
733
797
|
var entry = {
|
|
@@ -1039,14 +1103,19 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1039
1103
|
} catch (accidentalStrictMode) {
|
|
1040
1104
|
// This module should not be running in strict mode, so the above
|
|
1041
1105
|
// assignment should always work unless something is misconfigured. Just
|
|
1042
|
-
// in case runtime.js accidentally runs in strict mode,
|
|
1106
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1107
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
1043
1108
|
// strict mode using a global Function call. This could conceivably fail
|
|
1044
1109
|
// if a Content Security Policy forbids using Function, but in that case
|
|
1045
1110
|
// the proper solution is to fix the accidental strict mode problem. If
|
|
1046
1111
|
// you've misconfigured your bundler to force strict mode and applied a
|
|
1047
1112
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1048
1113
|
// problems, please detail your unique predicament in a GitHub issue.
|
|
1049
|
-
|
|
1114
|
+
if (typeof globalThis === "object") {
|
|
1115
|
+
globalThis.regeneratorRuntime = runtime;
|
|
1116
|
+
} else {
|
|
1117
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1118
|
+
}
|
|
1050
1119
|
}
|
|
1051
1120
|
});
|
|
1052
1121
|
|
|
@@ -1055,21 +1124,21 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1055
1124
|
|
|
1056
1125
|
var _super = /*#__PURE__*/_createSuper(_default);
|
|
1057
1126
|
|
|
1058
|
-
function _default(config) {
|
|
1127
|
+
function _default(config, getSubAdapter, pluginManager) {
|
|
1059
1128
|
var _this;
|
|
1060
1129
|
|
|
1061
1130
|
_classCallCheck(this, _default);
|
|
1062
1131
|
|
|
1063
|
-
_this = _super.call(this, config);
|
|
1132
|
+
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
1064
1133
|
var gffGzLocation = readConfObject(config, 'gffGzLocation');
|
|
1065
1134
|
var indexType = readConfObject(config, ['index', 'indexType']);
|
|
1066
1135
|
var location = readConfObject(config, ['index', 'location']);
|
|
1067
1136
|
var dontRedispatch = readConfObject(config, 'dontRedispatch');
|
|
1068
1137
|
_this.dontRedispatch = dontRedispatch || ['chromosome', 'contig', 'region'];
|
|
1069
1138
|
_this.gff = new TabixIndexedFile({
|
|
1070
|
-
filehandle: openLocation(gffGzLocation),
|
|
1071
|
-
csiFilehandle: indexType === 'CSI' ? openLocation(location) : undefined,
|
|
1072
|
-
tbiFilehandle: indexType !== 'CSI' ? openLocation(location) : undefined,
|
|
1139
|
+
filehandle: openLocation(gffGzLocation, _this.pluginManager),
|
|
1140
|
+
csiFilehandle: indexType === 'CSI' ? openLocation(location, _this.pluginManager) : undefined,
|
|
1141
|
+
tbiFilehandle: indexType !== 'CSI' ? openLocation(location, _this.pluginManager) : undefined,
|
|
1073
1142
|
chunkCacheSize: 50 * Math.pow(2, 20),
|
|
1074
1143
|
renameRefSeqs: function renameRefSeqs(n) {
|
|
1075
1144
|
return n;
|
|
@@ -1226,9 +1295,6 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1226
1295
|
break;
|
|
1227
1296
|
}
|
|
1228
1297
|
|
|
1229
|
-
// console.log(
|
|
1230
|
-
// `redispatching ${query.start}-${query.end} => ${minStart}-${maxEnd}`,
|
|
1231
|
-
// )
|
|
1232
1298
|
// make a new feature callback to only return top-level features
|
|
1233
1299
|
// in the original query range
|
|
1234
1300
|
this.getFeaturesHelper(_objectSpread2(_objectSpread2({}, query), {}, {
|
|
@@ -1380,9 +1446,9 @@ var _default$1 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1380
1446
|
}
|
|
1381
1447
|
}, {
|
|
1382
1448
|
key: "freeResources",
|
|
1383
|
-
value: function
|
|
1384
|
-
|
|
1385
|
-
{}
|
|
1449
|
+
value: function
|
|
1450
|
+
/* { region } */
|
|
1451
|
+
freeResources() {}
|
|
1386
1452
|
}]);
|
|
1387
1453
|
|
|
1388
1454
|
return _default;
|
|
@@ -1393,5 +1459,343 @@ var Gff3TabixAdapter = {
|
|
|
1393
1459
|
'default': _default$1
|
|
1394
1460
|
};
|
|
1395
1461
|
|
|
1462
|
+
function isGzip(buf) {
|
|
1463
|
+
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
var _default$2 = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
1467
|
+
_inherits(_default, _BaseFeatureDataAdapt);
|
|
1468
|
+
|
|
1469
|
+
var _super = /*#__PURE__*/_createSuper(_default);
|
|
1470
|
+
|
|
1471
|
+
function _default() {
|
|
1472
|
+
_classCallCheck(this, _default);
|
|
1473
|
+
|
|
1474
|
+
return _super.apply(this, arguments);
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
_createClass(_default, [{
|
|
1478
|
+
key: "loadDataP",
|
|
1479
|
+
value: function () {
|
|
1480
|
+
var _loadDataP = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee() {
|
|
1481
|
+
var _this = this;
|
|
1482
|
+
|
|
1483
|
+
var buffer, buf, data, lines, headerLines, i, header, feats, intervalTree;
|
|
1484
|
+
return runtime_1.wrap(function _callee$(_context) {
|
|
1485
|
+
while (1) {
|
|
1486
|
+
switch (_context.prev = _context.next) {
|
|
1487
|
+
case 0:
|
|
1488
|
+
_context.next = 2;
|
|
1489
|
+
return openLocation(readConfObject(this.config, 'gffLocation'), this.pluginManager).readFile();
|
|
1490
|
+
|
|
1491
|
+
case 2:
|
|
1492
|
+
buffer = _context.sent;
|
|
1493
|
+
|
|
1494
|
+
if (!isGzip(buffer)) {
|
|
1495
|
+
_context.next = 9;
|
|
1496
|
+
break;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
_context.next = 6;
|
|
1500
|
+
return unzip(buffer);
|
|
1501
|
+
|
|
1502
|
+
case 6:
|
|
1503
|
+
_context.t0 = _context.sent;
|
|
1504
|
+
_context.next = 10;
|
|
1505
|
+
break;
|
|
1506
|
+
|
|
1507
|
+
case 9:
|
|
1508
|
+
_context.t0 = buffer;
|
|
1509
|
+
|
|
1510
|
+
case 10:
|
|
1511
|
+
buf = _context.t0;
|
|
1512
|
+
|
|
1513
|
+
if (!(buf.length > 536870888)) {
|
|
1514
|
+
_context.next = 13;
|
|
1515
|
+
break;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
throw new Error('Data exceeds maximum string length (512MB)');
|
|
1519
|
+
|
|
1520
|
+
case 13:
|
|
1521
|
+
data = new TextDecoder('utf8', {
|
|
1522
|
+
fatal: true
|
|
1523
|
+
}).decode(buf);
|
|
1524
|
+
lines = data.split('\n');
|
|
1525
|
+
headerLines = [];
|
|
1526
|
+
|
|
1527
|
+
for (i = 0; i < lines.length && lines[i].startsWith('#'); i++) {
|
|
1528
|
+
headerLines.push(lines[i]);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
header = headerLines.join('\n');
|
|
1532
|
+
feats = gff.parseStringSync(data, {
|
|
1533
|
+
parseFeatures: true,
|
|
1534
|
+
parseComments: false,
|
|
1535
|
+
parseDirectives: false,
|
|
1536
|
+
parseSequences: false
|
|
1537
|
+
});
|
|
1538
|
+
intervalTree = feats.flat().map(function (f, i) {
|
|
1539
|
+
return new SimpleFeature({
|
|
1540
|
+
data: _this.featureData(f),
|
|
1541
|
+
id: "".concat(_this.id, "-offset-").concat(i)
|
|
1542
|
+
});
|
|
1543
|
+
}).reduce(function (acc, obj) {
|
|
1544
|
+
var key = obj.get('refName');
|
|
1545
|
+
|
|
1546
|
+
if (!acc[key]) {
|
|
1547
|
+
acc[key] = new IntervalTree();
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
acc[key].insert([obj.get('start'), obj.get('end')], obj);
|
|
1551
|
+
return acc;
|
|
1552
|
+
}, {});
|
|
1553
|
+
return _context.abrupt("return", {
|
|
1554
|
+
header: header,
|
|
1555
|
+
intervalTree: intervalTree
|
|
1556
|
+
});
|
|
1557
|
+
|
|
1558
|
+
case 21:
|
|
1559
|
+
case "end":
|
|
1560
|
+
return _context.stop();
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
}, _callee, this);
|
|
1564
|
+
}));
|
|
1565
|
+
|
|
1566
|
+
function loadDataP() {
|
|
1567
|
+
return _loadDataP.apply(this, arguments);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
return loadDataP;
|
|
1571
|
+
}()
|
|
1572
|
+
}, {
|
|
1573
|
+
key: "loadData",
|
|
1574
|
+
value: function () {
|
|
1575
|
+
var _loadData = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
|
|
1576
|
+
var _this2 = this;
|
|
1577
|
+
|
|
1578
|
+
return runtime_1.wrap(function _callee2$(_context2) {
|
|
1579
|
+
while (1) {
|
|
1580
|
+
switch (_context2.prev = _context2.next) {
|
|
1581
|
+
case 0:
|
|
1582
|
+
if (!this.gffFeatures) {
|
|
1583
|
+
this.gffFeatures = this.loadDataP()["catch"](function (e) {
|
|
1584
|
+
_this2.gffFeatures = undefined;
|
|
1585
|
+
throw e;
|
|
1586
|
+
});
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
return _context2.abrupt("return", this.gffFeatures);
|
|
1590
|
+
|
|
1591
|
+
case 2:
|
|
1592
|
+
case "end":
|
|
1593
|
+
return _context2.stop();
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
}, _callee2, this);
|
|
1597
|
+
}));
|
|
1598
|
+
|
|
1599
|
+
function loadData() {
|
|
1600
|
+
return _loadData.apply(this, arguments);
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
return loadData;
|
|
1604
|
+
}()
|
|
1605
|
+
}, {
|
|
1606
|
+
key: "getRefNames",
|
|
1607
|
+
value: function () {
|
|
1608
|
+
var _getRefNames = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee3() {
|
|
1609
|
+
var _yield$this$loadData,
|
|
1610
|
+
intervalTree;
|
|
1611
|
+
|
|
1612
|
+
return runtime_1.wrap(function _callee3$(_context3) {
|
|
1613
|
+
while (1) {
|
|
1614
|
+
switch (_context3.prev = _context3.next) {
|
|
1615
|
+
case 0:
|
|
1616
|
+
_context3.next = 3;
|
|
1617
|
+
return this.loadData();
|
|
1618
|
+
|
|
1619
|
+
case 3:
|
|
1620
|
+
_yield$this$loadData = _context3.sent;
|
|
1621
|
+
intervalTree = _yield$this$loadData.intervalTree;
|
|
1622
|
+
return _context3.abrupt("return", Object.keys(intervalTree));
|
|
1623
|
+
|
|
1624
|
+
case 6:
|
|
1625
|
+
case "end":
|
|
1626
|
+
return _context3.stop();
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
}, _callee3, this);
|
|
1630
|
+
}));
|
|
1631
|
+
|
|
1632
|
+
function getRefNames() {
|
|
1633
|
+
return _getRefNames.apply(this, arguments);
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
return getRefNames;
|
|
1637
|
+
}()
|
|
1638
|
+
}, {
|
|
1639
|
+
key: "getHeader",
|
|
1640
|
+
value: function () {
|
|
1641
|
+
var _getHeader = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee4() {
|
|
1642
|
+
var _yield$this$loadData2, header;
|
|
1643
|
+
|
|
1644
|
+
return runtime_1.wrap(function _callee4$(_context4) {
|
|
1645
|
+
while (1) {
|
|
1646
|
+
switch (_context4.prev = _context4.next) {
|
|
1647
|
+
case 0:
|
|
1648
|
+
_context4.next = 2;
|
|
1649
|
+
return this.loadData();
|
|
1650
|
+
|
|
1651
|
+
case 2:
|
|
1652
|
+
_yield$this$loadData2 = _context4.sent;
|
|
1653
|
+
header = _yield$this$loadData2.header;
|
|
1654
|
+
return _context4.abrupt("return", header);
|
|
1655
|
+
|
|
1656
|
+
case 5:
|
|
1657
|
+
case "end":
|
|
1658
|
+
return _context4.stop();
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
}, _callee4, this);
|
|
1662
|
+
}));
|
|
1663
|
+
|
|
1664
|
+
function getHeader() {
|
|
1665
|
+
return _getHeader.apply(this, arguments);
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
return getHeader;
|
|
1669
|
+
}()
|
|
1670
|
+
}, {
|
|
1671
|
+
key: "getFeatures",
|
|
1672
|
+
value: function getFeatures(query) {
|
|
1673
|
+
var _this3 = this;
|
|
1674
|
+
|
|
1675
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1676
|
+
return ObservableCreate( /*#__PURE__*/function () {
|
|
1677
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee5(observer) {
|
|
1678
|
+
var _intervalTree$refName, start, end, refName, _yield$_this3$loadDat, intervalTree;
|
|
1679
|
+
|
|
1680
|
+
return runtime_1.wrap(function _callee5$(_context5) {
|
|
1681
|
+
while (1) {
|
|
1682
|
+
switch (_context5.prev = _context5.next) {
|
|
1683
|
+
case 0:
|
|
1684
|
+
_context5.prev = 0;
|
|
1685
|
+
start = query.start, end = query.end, refName = query.refName;
|
|
1686
|
+
_context5.next = 4;
|
|
1687
|
+
return _this3.loadData();
|
|
1688
|
+
|
|
1689
|
+
case 4:
|
|
1690
|
+
_yield$_this3$loadDat = _context5.sent;
|
|
1691
|
+
intervalTree = _yield$_this3$loadDat.intervalTree;
|
|
1692
|
+
(_intervalTree$refName = intervalTree[refName]) === null || _intervalTree$refName === void 0 ? void 0 : _intervalTree$refName.search([start, end]).forEach(function (f) {
|
|
1693
|
+
return observer.next(f);
|
|
1694
|
+
});
|
|
1695
|
+
observer.complete();
|
|
1696
|
+
_context5.next = 13;
|
|
1697
|
+
break;
|
|
1698
|
+
|
|
1699
|
+
case 10:
|
|
1700
|
+
_context5.prev = 10;
|
|
1701
|
+
_context5.t0 = _context5["catch"](0);
|
|
1702
|
+
observer.error(_context5.t0);
|
|
1703
|
+
|
|
1704
|
+
case 13:
|
|
1705
|
+
case "end":
|
|
1706
|
+
return _context5.stop();
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
}, _callee5, null, [[0, 10]]);
|
|
1710
|
+
}));
|
|
1711
|
+
|
|
1712
|
+
return function (_x) {
|
|
1713
|
+
return _ref.apply(this, arguments);
|
|
1714
|
+
};
|
|
1715
|
+
}(), opts.signal);
|
|
1716
|
+
}
|
|
1717
|
+
}, {
|
|
1718
|
+
key: "featureData",
|
|
1719
|
+
value: function featureData(data) {
|
|
1720
|
+
var _this4 = this;
|
|
1721
|
+
|
|
1722
|
+
var f = _objectSpread2({}, data);
|
|
1723
|
+
|
|
1724
|
+
f.start -= 1; // convert to interbase
|
|
1725
|
+
|
|
1726
|
+
f.strand = {
|
|
1727
|
+
'+': 1,
|
|
1728
|
+
'-': -1,
|
|
1729
|
+
'.': 0,
|
|
1730
|
+
'?': undefined
|
|
1731
|
+
}[data.strand]; // convert strand
|
|
1732
|
+
|
|
1733
|
+
f.phase = Number(data.phase);
|
|
1734
|
+
f.refName = data.seq_id;
|
|
1735
|
+
|
|
1736
|
+
if (data.score === null) {
|
|
1737
|
+
delete f.score;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
if (data.phase === null) {
|
|
1741
|
+
delete f.score;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
var defaultFields = ['start', 'end', 'seq_id', 'score', 'type', 'source', 'phase', 'strand'];
|
|
1745
|
+
Object.keys(data.attributes).forEach(function (a) {
|
|
1746
|
+
var b = a.toLowerCase();
|
|
1747
|
+
|
|
1748
|
+
if (defaultFields.includes(b)) {
|
|
1749
|
+
// add "suffix" to tag name if it already exists
|
|
1750
|
+
// reproduces behavior of NCList
|
|
1751
|
+
b += '2';
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
if (data.attributes[a] !== null) {
|
|
1755
|
+
var attr = data.attributes[a];
|
|
1756
|
+
|
|
1757
|
+
if (Array.isArray(attr) && attr.length === 1) {
|
|
1758
|
+
var _attr = attr;
|
|
1759
|
+
|
|
1760
|
+
var _attr2 = _slicedToArray(_attr, 1);
|
|
1761
|
+
|
|
1762
|
+
attr = _attr2[0];
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
f[b] = attr;
|
|
1766
|
+
}
|
|
1767
|
+
});
|
|
1768
|
+
f.refName = f.seq_id; // the SimpleFeature constructor takes care of recursively inflating subfeatures
|
|
1769
|
+
|
|
1770
|
+
if (data.child_features && data.child_features.length) {
|
|
1771
|
+
f.subfeatures = data.child_features.map(function (childLocs) {
|
|
1772
|
+
return childLocs.map(function (childLoc) {
|
|
1773
|
+
return _this4.featureData(childLoc);
|
|
1774
|
+
});
|
|
1775
|
+
}).flat();
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
delete f.child_features;
|
|
1779
|
+
delete f.data;
|
|
1780
|
+
delete f.derived_features;
|
|
1781
|
+
delete f.attributes;
|
|
1782
|
+
delete f.seq_id;
|
|
1783
|
+
return f;
|
|
1784
|
+
}
|
|
1785
|
+
}, {
|
|
1786
|
+
key: "freeResources",
|
|
1787
|
+
value: function
|
|
1788
|
+
/* { region } */
|
|
1789
|
+
freeResources() {}
|
|
1790
|
+
}]);
|
|
1791
|
+
|
|
1792
|
+
return _default;
|
|
1793
|
+
}(BaseFeatureDataAdapter);
|
|
1794
|
+
|
|
1795
|
+
var Gff3Adapter = {
|
|
1796
|
+
__proto__: null,
|
|
1797
|
+
'default': _default$2
|
|
1798
|
+
};
|
|
1799
|
+
|
|
1396
1800
|
export default _default;
|
|
1397
1801
|
//# sourceMappingURL=plugin-gff3.esm.js.map
|