@jbrowse/plugin-bed 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/BedTabixAdapter/BedTabixAdapter.d.ts +3 -1
- package/dist/BigBedAdapter/BigBedAdapter.d.ts +3 -1
- package/dist/plugin-bed.cjs.development.js +77 -33
- 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 +77 -33
- package/dist/plugin-bed.esm.js.map +1 -1
- package/package.json +4 -4
- package/src/BedTabixAdapter/BedTabixAdapter.test.ts +10 -0
- package/src/BedTabixAdapter/BedTabixAdapter.ts +17 -5
- package/src/BedTabixAdapter/configSchema.ts +5 -2
- package/src/BigBedAdapter/BigBedAdapter.test.ts +4 -1
- package/src/BigBedAdapter/BigBedAdapter.ts +11 -7
- package/src/BigBedAdapter/configSchema.ts +1 -1
- package/src/index.ts +55 -0
|
@@ -4,13 +4,15 @@ import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
|
4
4
|
import { TabixIndexedFile } from '@gmod/tabix';
|
|
5
5
|
import { Instance } from 'mobx-state-tree';
|
|
6
6
|
import MyConfigSchema from './configSchema';
|
|
7
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
8
|
+
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
7
9
|
export default class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
8
10
|
private parser;
|
|
9
11
|
protected bed: TabixIndexedFile;
|
|
10
12
|
protected columnNames: string[];
|
|
11
13
|
protected scoreColumn: string;
|
|
12
14
|
static capabilities: string[];
|
|
13
|
-
constructor(config: Instance<typeof MyConfigSchema
|
|
15
|
+
constructor(config: Instance<typeof MyConfigSchema>, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
14
16
|
getRefNames(opts?: BaseOptions): Promise<any>;
|
|
15
17
|
getHeader(): Promise<string>;
|
|
16
18
|
defaultParser(fields: string[], line: string): {
|
|
@@ -3,10 +3,12 @@ import { Region } from '@jbrowse/core/util/types';
|
|
|
3
3
|
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
4
4
|
import { Instance } from 'mobx-state-tree';
|
|
5
5
|
import configSchema from './configSchema';
|
|
6
|
+
import PluginManager from '@jbrowse/core/PluginManager';
|
|
7
|
+
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache';
|
|
6
8
|
export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
7
9
|
private bigbed;
|
|
8
10
|
private parser;
|
|
9
|
-
constructor(config: Instance<typeof configSchema
|
|
11
|
+
constructor(config: Instance<typeof configSchema>, getSubAdapter?: getSubAdapterType, pluginManager?: PluginManager);
|
|
10
12
|
getRefNames(): Promise<string[]>;
|
|
11
13
|
getHeader(opts?: BaseOptions): Promise<{
|
|
12
14
|
version: any;
|
|
@@ -8,6 +8,7 @@ var AdapterType = _interopDefault(require('@jbrowse/core/pluggableElementTypes/A
|
|
|
8
8
|
var Plugin = _interopDefault(require('@jbrowse/core/Plugin'));
|
|
9
9
|
var configuration = require('@jbrowse/core/configuration');
|
|
10
10
|
var mobxStateTree = require('mobx-state-tree');
|
|
11
|
+
var tracks = require('@jbrowse/core/util/tracks');
|
|
11
12
|
var bbi = require('@gmod/bbi');
|
|
12
13
|
var BED = _interopDefault(require('@gmod/bed'));
|
|
13
14
|
var BaseAdapter = require('@jbrowse/core/data_adapters/BaseAdapter');
|
|
@@ -219,6 +220,8 @@ function _assertThisInitialized(self) {
|
|
|
219
220
|
function _possibleConstructorReturn(self, call) {
|
|
220
221
|
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
221
222
|
return call;
|
|
223
|
+
} else if (call !== void 0) {
|
|
224
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
222
225
|
}
|
|
223
226
|
|
|
224
227
|
return _assertThisInitialized(self);
|
|
@@ -247,7 +250,8 @@ var bigBedAdapterConfigSchema = /*#__PURE__*/configuration.ConfigurationSchema('
|
|
|
247
250
|
bigBedLocation: {
|
|
248
251
|
type: 'fileLocation',
|
|
249
252
|
defaultValue: {
|
|
250
|
-
uri: '/path/to/my.bb'
|
|
253
|
+
uri: '/path/to/my.bb',
|
|
254
|
+
locationType: 'UriLocation'
|
|
251
255
|
}
|
|
252
256
|
}
|
|
253
257
|
}, {
|
|
@@ -258,7 +262,8 @@ var bedTabixAdapterConfigSchema = /*#__PURE__*/configuration.ConfigurationSchema
|
|
|
258
262
|
bedGzLocation: {
|
|
259
263
|
type: 'fileLocation',
|
|
260
264
|
defaultValue: {
|
|
261
|
-
uri: '/path/to/my.bed.gz'
|
|
265
|
+
uri: '/path/to/my.bed.gz',
|
|
266
|
+
locationType: 'UriLocation'
|
|
262
267
|
}
|
|
263
268
|
},
|
|
264
269
|
index: /*#__PURE__*/configuration.ConfigurationSchema('TabixIndex', {
|
|
@@ -270,7 +275,8 @@ var bedTabixAdapterConfigSchema = /*#__PURE__*/configuration.ConfigurationSchema
|
|
|
270
275
|
location: {
|
|
271
276
|
type: 'fileLocation',
|
|
272
277
|
defaultValue: {
|
|
273
|
-
uri: '/path/to/my.bed.gz.tbi'
|
|
278
|
+
uri: '/path/to/my.bed.gz.tbi',
|
|
279
|
+
locationType: 'UriLocation'
|
|
274
280
|
}
|
|
275
281
|
}
|
|
276
282
|
}),
|
|
@@ -322,6 +328,22 @@ var BedPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
322
328
|
}
|
|
323
329
|
});
|
|
324
330
|
});
|
|
331
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
332
|
+
return function (file, index, adapterHint) {
|
|
333
|
+
var regexGuess = /\.(bb|bigbed)$/i;
|
|
334
|
+
var adapterName = 'BigBedAdapter';
|
|
335
|
+
var fileName = tracks.getFileName(file);
|
|
336
|
+
|
|
337
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
338
|
+
return {
|
|
339
|
+
type: adapterName,
|
|
340
|
+
bigBedLocation: file
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return adapterGuesser(file, index, adapterHint);
|
|
345
|
+
};
|
|
346
|
+
});
|
|
325
347
|
pluginManager.addAdapterType(function () {
|
|
326
348
|
return new AdapterType({
|
|
327
349
|
name: 'BedTabixAdapter',
|
|
@@ -333,6 +355,27 @@ var BedPlugin = /*#__PURE__*/function (_Plugin) {
|
|
|
333
355
|
}
|
|
334
356
|
});
|
|
335
357
|
});
|
|
358
|
+
pluginManager.addToExtensionPoint('Core-guessAdapterForLocation', function (adapterGuesser) {
|
|
359
|
+
return function (file, index, adapterHint) {
|
|
360
|
+
var regexGuess = /\.bed\.b?gz$/i;
|
|
361
|
+
var adapterName = 'BedTabixAdapter';
|
|
362
|
+
var fileName = tracks.getFileName(file);
|
|
363
|
+
var indexName = index && tracks.getFileName(index);
|
|
364
|
+
|
|
365
|
+
if (regexGuess.test(fileName) || adapterHint === adapterName) {
|
|
366
|
+
return {
|
|
367
|
+
type: adapterName,
|
|
368
|
+
bedGzLocation: file,
|
|
369
|
+
index: {
|
|
370
|
+
location: index || tracks.makeIndex(file, '.tbi'),
|
|
371
|
+
indexType: tracks.makeIndexType(indexName, 'CSI', 'TBI')
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return adapterGuesser(file, index, adapterHint);
|
|
377
|
+
};
|
|
378
|
+
});
|
|
336
379
|
}
|
|
337
380
|
}]);
|
|
338
381
|
|
|
@@ -436,11 +479,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
436
479
|
|
|
437
480
|
|
|
438
481
|
var IteratorPrototype = {};
|
|
439
|
-
|
|
440
|
-
IteratorPrototype[iteratorSymbol] = function () {
|
|
482
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
441
483
|
return this;
|
|
442
|
-
};
|
|
443
|
-
|
|
484
|
+
});
|
|
444
485
|
var getProto = Object.getPrototypeOf;
|
|
445
486
|
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
446
487
|
|
|
@@ -451,8 +492,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
451
492
|
}
|
|
452
493
|
|
|
453
494
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
454
|
-
GeneratorFunction.prototype =
|
|
455
|
-
|
|
495
|
+
GeneratorFunction.prototype = GeneratorFunctionPrototype;
|
|
496
|
+
define(Gp, "constructor", GeneratorFunctionPrototype);
|
|
497
|
+
define(GeneratorFunctionPrototype, "constructor", GeneratorFunction);
|
|
456
498
|
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
457
499
|
// Iterator interface in terms of a single ._invoke method.
|
|
458
500
|
|
|
@@ -557,11 +599,9 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
557
599
|
}
|
|
558
600
|
|
|
559
601
|
defineIteratorMethods(AsyncIterator.prototype);
|
|
560
|
-
|
|
561
|
-
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
602
|
+
define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
562
603
|
return this;
|
|
563
|
-
};
|
|
564
|
-
|
|
604
|
+
});
|
|
565
605
|
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
566
606
|
// AsyncIterator objects; they just return a Promise for the value of
|
|
567
607
|
// the final result produced by the iterator.
|
|
@@ -738,13 +778,12 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
738
778
|
// object to not be returned from this call. This ensures that doesn't happen.
|
|
739
779
|
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
740
780
|
|
|
741
|
-
Gp
|
|
781
|
+
define(Gp, iteratorSymbol, function () {
|
|
742
782
|
return this;
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
Gp.toString = function () {
|
|
783
|
+
});
|
|
784
|
+
define(Gp, "toString", function () {
|
|
746
785
|
return "[object Generator]";
|
|
747
|
-
};
|
|
786
|
+
});
|
|
748
787
|
|
|
749
788
|
function pushTryEntry(locs) {
|
|
750
789
|
var entry = {
|
|
@@ -1056,14 +1095,19 @@ var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
|
1056
1095
|
} catch (accidentalStrictMode) {
|
|
1057
1096
|
// This module should not be running in strict mode, so the above
|
|
1058
1097
|
// assignment should always work unless something is misconfigured. Just
|
|
1059
|
-
// in case runtime.js accidentally runs in strict mode,
|
|
1098
|
+
// in case runtime.js accidentally runs in strict mode, in modern engines
|
|
1099
|
+
// we can explicitly access globalThis. In older engines we can escape
|
|
1060
1100
|
// strict mode using a global Function call. This could conceivably fail
|
|
1061
1101
|
// if a Content Security Policy forbids using Function, but in that case
|
|
1062
1102
|
// the proper solution is to fix the accidental strict mode problem. If
|
|
1063
1103
|
// you've misconfigured your bundler to force strict mode and applied a
|
|
1064
1104
|
// CSP to forbid Function, and you're not willing to fix either of those
|
|
1065
1105
|
// problems, please detail your unique predicament in a GitHub issue.
|
|
1066
|
-
|
|
1106
|
+
if (typeof globalThis === "object") {
|
|
1107
|
+
globalThis.regeneratorRuntime = runtime;
|
|
1108
|
+
} else {
|
|
1109
|
+
Function("r", "regeneratorRuntime = r")(runtime);
|
|
1110
|
+
}
|
|
1067
1111
|
}
|
|
1068
1112
|
});
|
|
1069
1113
|
|
|
@@ -1181,22 +1225,23 @@ function ucscProcessedTranscript(feature) {
|
|
|
1181
1225
|
return newFeature;
|
|
1182
1226
|
}
|
|
1183
1227
|
|
|
1184
|
-
var _excluded = ["fields"]
|
|
1228
|
+
var _excluded = ["fields"],
|
|
1229
|
+
_excluded2 = ["chromStart", "chromEnd", "chrom"];
|
|
1185
1230
|
|
|
1186
1231
|
var BigBedAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
1187
1232
|
_inherits(BigBedAdapter, _BaseFeatureDataAdapt);
|
|
1188
1233
|
|
|
1189
1234
|
var _super = /*#__PURE__*/_createSuper(BigBedAdapter);
|
|
1190
1235
|
|
|
1191
|
-
function BigBedAdapter(config) {
|
|
1236
|
+
function BigBedAdapter(config, getSubAdapter, pluginManager) {
|
|
1192
1237
|
var _this;
|
|
1193
1238
|
|
|
1194
1239
|
_classCallCheck(this, BigBedAdapter);
|
|
1195
1240
|
|
|
1196
|
-
_this = _super.call(this, config);
|
|
1241
|
+
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
1197
1242
|
var bigBedLocation = configuration.readConfObject(config, 'bigBedLocation');
|
|
1198
1243
|
_this.bigbed = new bbi.BigBed({
|
|
1199
|
-
filehandle: io.openLocation(bigBedLocation)
|
|
1244
|
+
filehandle: io.openLocation(bigBedLocation, _this.pluginManager)
|
|
1200
1245
|
});
|
|
1201
1246
|
_this.parser = _this.bigbed.getHeader().then(function (_ref) {
|
|
1202
1247
|
var autoSql = _ref.autoSql;
|
|
@@ -1389,12 +1434,11 @@ var BigBedAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1389
1434
|
throw new Error('invalid bbi feature');
|
|
1390
1435
|
}
|
|
1391
1436
|
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
delete data.chrom;
|
|
1437
|
+
var rest = _objectWithoutProperties(data, _excluded2);
|
|
1438
|
+
|
|
1395
1439
|
var f = new SimpleFeature({
|
|
1396
1440
|
id: "".concat(_this2.id, "-").concat(r.uniqueId),
|
|
1397
|
-
data: _objectSpread2(_objectSpread2({},
|
|
1441
|
+
data: _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
1398
1442
|
start: r.start,
|
|
1399
1443
|
end: r.end,
|
|
1400
1444
|
refName: refName
|
|
@@ -1444,21 +1488,21 @@ var BedTabixAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
1444
1488
|
|
|
1445
1489
|
var _super = /*#__PURE__*/_createSuper(BedTabixAdapter);
|
|
1446
1490
|
|
|
1447
|
-
function BedTabixAdapter(config) {
|
|
1491
|
+
function BedTabixAdapter(config, getSubAdapter, pluginManager) {
|
|
1448
1492
|
var _this;
|
|
1449
1493
|
|
|
1450
1494
|
_classCallCheck(this, BedTabixAdapter);
|
|
1451
1495
|
|
|
1452
|
-
_this = _super.call(this, config);
|
|
1496
|
+
_this = _super.call(this, config, getSubAdapter, pluginManager);
|
|
1453
1497
|
var bedGzLocation = configuration.readConfObject(config, 'bedGzLocation');
|
|
1454
1498
|
var index = configuration.readConfObject(config, 'index');
|
|
1455
1499
|
var autoSql = configuration.readConfObject(config, 'autoSql');
|
|
1456
1500
|
var location = index.location,
|
|
1457
1501
|
indexType = index.indexType;
|
|
1458
1502
|
_this.bed = new tabix.TabixIndexedFile({
|
|
1459
|
-
filehandle: io.openLocation(bedGzLocation),
|
|
1460
|
-
csiFilehandle: indexType === 'CSI' ? io.openLocation(location) : undefined,
|
|
1461
|
-
tbiFilehandle: indexType !== 'CSI' ? io.openLocation(location) : undefined,
|
|
1503
|
+
filehandle: io.openLocation(bedGzLocation, _this.pluginManager),
|
|
1504
|
+
csiFilehandle: indexType === 'CSI' ? io.openLocation(location, _this.pluginManager) : undefined,
|
|
1505
|
+
tbiFilehandle: indexType !== 'CSI' ? io.openLocation(location, _this.pluginManager) : undefined,
|
|
1462
1506
|
chunkCacheSize: 50 * Math.pow(2, 20)
|
|
1463
1507
|
});
|
|
1464
1508
|
_this.columnNames = configuration.readConfObject(config, 'columnNames');
|