@jbrowse/plugin-bed 1.7.11 → 2.1.0
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/BedAdapter/BedAdapter.d.ts +1 -1
- package/dist/BedAdapter/BedAdapter.js +260 -485
- package/dist/BedAdapter/BedAdapter.js.map +1 -0
- package/dist/BedAdapter/configSchema.js +39 -51
- package/dist/BedAdapter/configSchema.js.map +1 -0
- package/dist/BedAdapter/index.js +8 -14
- package/dist/BedAdapter/index.js.map +1 -0
- package/dist/BedTabixAdapter/BedTabixAdapter.js +154 -234
- package/dist/BedTabixAdapter/BedTabixAdapter.js.map +1 -0
- package/dist/BedTabixAdapter/configSchema.js +38 -51
- package/dist/BedTabixAdapter/configSchema.js.map +1 -0
- package/dist/BedTabixAdapter/index.js +8 -14
- package/dist/BedTabixAdapter/index.js.map +1 -0
- package/dist/BigBedAdapter/BigBedAdapter.d.ts +4 -21
- package/dist/BigBedAdapter/BigBedAdapter.js +228 -335
- package/dist/BigBedAdapter/BigBedAdapter.js.map +1 -0
- package/dist/BigBedAdapter/configSchema.js +9 -21
- package/dist/BigBedAdapter/configSchema.js.map +1 -0
- package/dist/BigBedAdapter/index.js +8 -14
- package/dist/BigBedAdapter/index.js.map +1 -0
- package/dist/index.js +129 -157
- package/dist/index.js.map +1 -0
- package/dist/util.d.ts +1 -1
- package/dist/util.js +156 -175
- package/dist/util.js.map +1 -0
- package/esm/BedAdapter/BedAdapter.d.ts +29 -0
- package/esm/BedAdapter/BedAdapter.js +130 -0
- package/esm/BedAdapter/BedAdapter.js.map +1 -0
- package/esm/BedAdapter/configSchema.d.ts +2 -0
- package/esm/BedAdapter/configSchema.js +38 -0
- package/esm/BedAdapter/configSchema.js.map +1 -0
- package/esm/BedAdapter/index.d.ts +1 -0
- package/esm/BedAdapter/index.js +2 -0
- package/esm/BedAdapter/index.js.map +1 -0
- package/esm/BedTabixAdapter/BedTabixAdapter.d.ts +19 -0
- package/esm/BedTabixAdapter/BedTabixAdapter.js +68 -0
- package/esm/BedTabixAdapter/BedTabixAdapter.js.map +1 -0
- package/esm/BedTabixAdapter/configSchema.d.ts +2 -0
- package/esm/BedTabixAdapter/configSchema.js +38 -0
- package/esm/BedTabixAdapter/configSchema.js.map +1 -0
- package/esm/BedTabixAdapter/index.d.ts +1 -0
- package/esm/BedTabixAdapter/index.js +2 -0
- package/esm/BedTabixAdapter/index.js.map +1 -0
- package/esm/BigBedAdapter/BigBedAdapter.d.ts +29 -0
- package/esm/BigBedAdapter/BigBedAdapter.js +104 -0
- package/esm/BigBedAdapter/BigBedAdapter.js.map +1 -0
- package/esm/BigBedAdapter/configSchema.d.ts +2 -0
- package/esm/BigBedAdapter/configSchema.js +8 -0
- package/esm/BigBedAdapter/configSchema.js.map +1 -0
- package/esm/BigBedAdapter/index.d.ts +1 -0
- package/esm/BigBedAdapter/index.js +2 -0
- package/esm/BigBedAdapter/index.js.map +1 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.js +81 -0
- package/esm/index.js.map +1 -0
- package/esm/util.d.ts +4 -0
- package/esm/util.js +154 -0
- package/esm/util.js.map +1 -0
- package/package.json +18 -9
- package/src/BedAdapter/BedAdapter.ts +1 -1
- package/src/BedTabixAdapter/BedTabixAdapter.ts +1 -2
- package/src/BigBedAdapter/BigBedAdapter.ts +2 -14
- package/src/util.ts +1 -1
- package/dist/BedAdapter/BedAdapter.test.js +0 -255
- package/dist/BedTabixAdapter/BedTabixAdapter.test.js +0 -276
- package/dist/BigBedAdapter/BigBedAdapter.test.js +0 -63
- package/dist/declare.d.js +0 -1
- package/dist/index.test.js +0 -24
- package/src/declare.d.ts +0 -1
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "configSchema", {
|
|
9
|
-
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _configSchema.default;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.configSchema = void 0;
|
|
7
|
+
var configSchema_1 = require("./configSchema");
|
|
8
|
+
Object.defineProperty(exports, "configSchema", { enumerable: true, get: function () { return __importDefault(configSchema_1).default; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/BedTabixAdapter/index.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAwD;AAA/C,6HAAA,OAAO,OAAgB"}
|
|
@@ -1,35 +1,19 @@
|
|
|
1
1
|
import { BigBed } from '@gmod/bbi';
|
|
2
|
+
import BED from '@gmod/bed';
|
|
2
3
|
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
3
4
|
import { Region } from '@jbrowse/core/util/types';
|
|
4
5
|
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
5
|
-
interface BEDFeature {
|
|
6
|
-
chrom: string;
|
|
7
|
-
chromStart: number;
|
|
8
|
-
chromEnd: number;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
interface Parser {
|
|
12
|
-
parseLine: (line: string, opts: {
|
|
13
|
-
uniqueId: string | number;
|
|
14
|
-
}) => BEDFeature;
|
|
15
|
-
autoSql: {
|
|
16
|
-
fields: {
|
|
17
|
-
name: string;
|
|
18
|
-
comment: string;
|
|
19
|
-
}[];
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
6
|
export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
23
7
|
private cached?;
|
|
24
8
|
configurePre(opts?: BaseOptions): Promise<{
|
|
25
9
|
bigbed: BigBed;
|
|
26
|
-
header:
|
|
27
|
-
parser:
|
|
10
|
+
header: import("@gmod/bbi").Header;
|
|
11
|
+
parser: BED;
|
|
28
12
|
}>;
|
|
29
13
|
configure(opts?: BaseOptions): Promise<{
|
|
30
14
|
bigbed: BigBed;
|
|
31
15
|
header: any;
|
|
32
|
-
parser:
|
|
16
|
+
parser: BED;
|
|
33
17
|
}>;
|
|
34
18
|
getRefNames(opts?: BaseOptions): Promise<string[]>;
|
|
35
19
|
getHeader(opts?: BaseOptions): Promise<{
|
|
@@ -43,4 +27,3 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
43
27
|
getFeatures(region: Region, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
44
28
|
freeResources(): void;
|
|
45
29
|
}
|
|
46
|
-
export {};
|
|
@@ -1,341 +1,234 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __assign = (this && this.__assign) || function () {
|
|
18
|
+
__assign = Object.assign || function(t) {
|
|
19
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
+
s = arguments[i];
|
|
21
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
+
t[p] = s[p];
|
|
23
|
+
}
|
|
24
|
+
return t;
|
|
25
|
+
};
|
|
26
|
+
return __assign.apply(this, arguments);
|
|
27
|
+
};
|
|
28
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
+
function step(op) {
|
|
42
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
+
while (_) try {
|
|
44
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
+
switch (op[0]) {
|
|
47
|
+
case 0: case 1: t = op; break;
|
|
48
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
+
default:
|
|
52
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
+
if (t[2]) _.ops.pop();
|
|
57
|
+
_.trys.pop(); continue;
|
|
58
|
+
}
|
|
59
|
+
op = body.call(thisArg, _);
|
|
60
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
65
|
+
var t = {};
|
|
66
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
67
|
+
t[p] = s[p];
|
|
68
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
69
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
70
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
71
|
+
t[p[i]] = s[p[i]];
|
|
72
|
+
}
|
|
73
|
+
return t;
|
|
74
|
+
};
|
|
75
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
76
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
77
|
+
};
|
|
78
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
79
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
80
|
+
var bbi_1 = require("@gmod/bbi");
|
|
81
|
+
var bed_1 = __importDefault(require("@gmod/bed"));
|
|
82
|
+
var BaseAdapter_1 = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
83
|
+
var io_1 = require("@jbrowse/core/util/io");
|
|
84
|
+
var rxjs_1 = require("@jbrowse/core/util/rxjs");
|
|
85
|
+
var simpleFeature_1 = __importDefault(require("@jbrowse/core/util/simpleFeature"));
|
|
86
|
+
var operators_1 = require("rxjs/operators");
|
|
87
|
+
var configuration_1 = require("@jbrowse/core/configuration");
|
|
88
|
+
var util_1 = require("../util");
|
|
59
89
|
function isUCSC(f) {
|
|
60
|
-
|
|
90
|
+
return f.get('thickStart') && f.get('blockCount') && f.get('strand') !== 0;
|
|
61
91
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var _super = _createSuper(BigBedAdapter);
|
|
67
|
-
|
|
68
|
-
function BigBedAdapter() {
|
|
69
|
-
var _this;
|
|
70
|
-
|
|
71
|
-
(0, _classCallCheck2.default)(this, BigBedAdapter);
|
|
72
|
-
|
|
73
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
74
|
-
args[_key] = arguments[_key];
|
|
92
|
+
var BigBedAdapter = /** @class */ (function (_super) {
|
|
93
|
+
__extends(BigBedAdapter, _super);
|
|
94
|
+
function BigBedAdapter() {
|
|
95
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
75
96
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
case 0:
|
|
91
|
-
bigbed = new _bbi.BigBed({
|
|
92
|
-
filehandle: (0, _io.openLocation)((0, _configuration.readConfObject)(this.config, 'bigBedLocation'), this.pluginManager)
|
|
93
|
-
});
|
|
94
|
-
_context.next = 3;
|
|
95
|
-
return bigbed.getHeader(opts);
|
|
96
|
-
|
|
97
|
-
case 3:
|
|
98
|
-
header = _context.sent;
|
|
99
|
-
parser = new _bed.default({
|
|
100
|
-
autoSql: header.autoSql
|
|
101
|
-
});
|
|
102
|
-
return _context.abrupt("return", {
|
|
103
|
-
bigbed: bigbed,
|
|
104
|
-
header: header,
|
|
105
|
-
parser: parser
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
case 6:
|
|
109
|
-
case "end":
|
|
110
|
-
return _context.stop();
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}, _callee, this);
|
|
114
|
-
}));
|
|
115
|
-
|
|
116
|
-
function configurePre(_x) {
|
|
117
|
-
return _configurePre.apply(this, arguments);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return configurePre;
|
|
121
|
-
}()
|
|
122
|
-
}, {
|
|
123
|
-
key: "configure",
|
|
124
|
-
value: function () {
|
|
125
|
-
var _configure = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(opts) {
|
|
126
|
-
var _this2 = this;
|
|
127
|
-
|
|
128
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
129
|
-
while (1) {
|
|
130
|
-
switch (_context2.prev = _context2.next) {
|
|
131
|
-
case 0:
|
|
132
|
-
if (!this.cached) {
|
|
133
|
-
this.cached = this.configurePre(opts).catch(function (e) {
|
|
134
|
-
_this2.cached = undefined;
|
|
135
|
-
throw e;
|
|
136
|
-
});
|
|
97
|
+
BigBedAdapter.prototype.configurePre = function (opts) {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
99
|
+
var bigbed, header, parser;
|
|
100
|
+
return __generator(this, function (_a) {
|
|
101
|
+
switch (_a.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
bigbed = new bbi_1.BigBed({
|
|
104
|
+
filehandle: (0, io_1.openLocation)((0, configuration_1.readConfObject)(this.config, 'bigBedLocation'), this.pluginManager),
|
|
105
|
+
});
|
|
106
|
+
return [4 /*yield*/, bigbed.getHeader(opts)];
|
|
107
|
+
case 1:
|
|
108
|
+
header = _a.sent();
|
|
109
|
+
parser = new bed_1.default({ autoSql: header.autoSql });
|
|
110
|
+
return [2 /*return*/, { bigbed: bigbed, header: header, parser: parser }];
|
|
137
111
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
function configure(_x2) {
|
|
150
|
-
return _configure.apply(this, arguments);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return configure;
|
|
154
|
-
}()
|
|
155
|
-
}, {
|
|
156
|
-
key: "getRefNames",
|
|
157
|
-
value: function () {
|
|
158
|
-
var _getRefNames = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(opts) {
|
|
159
|
-
var _yield$this$configure, header;
|
|
160
|
-
|
|
161
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
162
|
-
while (1) {
|
|
163
|
-
switch (_context3.prev = _context3.next) {
|
|
164
|
-
case 0:
|
|
165
|
-
_context3.next = 2;
|
|
166
|
-
return this.configure(opts);
|
|
167
|
-
|
|
168
|
-
case 2:
|
|
169
|
-
_yield$this$configure = _context3.sent;
|
|
170
|
-
header = _yield$this$configure.header;
|
|
171
|
-
return _context3.abrupt("return", Object.keys(header.refsByName));
|
|
172
|
-
|
|
173
|
-
case 5:
|
|
174
|
-
case "end":
|
|
175
|
-
return _context3.stop();
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}, _callee3, this);
|
|
179
|
-
}));
|
|
180
|
-
|
|
181
|
-
function getRefNames(_x3) {
|
|
182
|
-
return _getRefNames.apply(this, arguments);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return getRefNames;
|
|
186
|
-
}()
|
|
187
|
-
}, {
|
|
188
|
-
key: "getHeader",
|
|
189
|
-
value: function () {
|
|
190
|
-
var _getHeader = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(opts) {
|
|
191
|
-
var _yield$this$configure2, parser, header, version, fileType, _parser$autoSql, fields, rest;
|
|
192
|
-
|
|
193
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
194
|
-
while (1) {
|
|
195
|
-
switch (_context4.prev = _context4.next) {
|
|
196
|
-
case 0:
|
|
197
|
-
_context4.next = 2;
|
|
198
|
-
return this.configure(opts);
|
|
199
|
-
|
|
200
|
-
case 2:
|
|
201
|
-
_yield$this$configure2 = _context4.sent;
|
|
202
|
-
parser = _yield$this$configure2.parser;
|
|
203
|
-
header = _yield$this$configure2.header;
|
|
204
|
-
version = header.version, fileType = header.fileType;
|
|
205
|
-
_parser$autoSql = parser.autoSql, fields = _parser$autoSql.fields, rest = (0, _objectWithoutProperties2.default)(_parser$autoSql, _excluded);
|
|
206
|
-
return _context4.abrupt("return", {
|
|
207
|
-
version: version,
|
|
208
|
-
fileType: fileType,
|
|
209
|
-
autoSql: _objectSpread({}, rest),
|
|
210
|
-
fields: Object.fromEntries(fields.map(function (_ref) {
|
|
211
|
-
var name = _ref.name,
|
|
212
|
-
comment = _ref.comment;
|
|
213
|
-
return [name, comment];
|
|
214
|
-
}))
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
case 8:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context4.stop();
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}, _callee4, this);
|
|
223
|
-
}));
|
|
224
|
-
|
|
225
|
-
function getHeader(_x4) {
|
|
226
|
-
return _getHeader.apply(this, arguments);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
return getHeader;
|
|
230
|
-
}()
|
|
231
|
-
}, {
|
|
232
|
-
key: "getFeatures",
|
|
233
|
-
value: function getFeatures(region) {
|
|
234
|
-
var _this3 = this;
|
|
235
|
-
|
|
236
|
-
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
237
|
-
var refName = region.refName,
|
|
238
|
-
start = region.start,
|
|
239
|
-
end = region.end;
|
|
240
|
-
var signal = opts.signal;
|
|
241
|
-
return (0, _rxjs.ObservableCreate)( /*#__PURE__*/function () {
|
|
242
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(observer) {
|
|
243
|
-
var _yield$_this3$configu, parser, bigbed, ob;
|
|
244
|
-
|
|
245
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
246
|
-
while (1) {
|
|
247
|
-
switch (_context5.prev = _context5.next) {
|
|
248
|
-
case 0:
|
|
249
|
-
_context5.prev = 0;
|
|
250
|
-
_context5.next = 3;
|
|
251
|
-
return _this3.configure(opts);
|
|
252
|
-
|
|
253
|
-
case 3:
|
|
254
|
-
_yield$_this3$configu = _context5.sent;
|
|
255
|
-
parser = _yield$_this3$configu.parser;
|
|
256
|
-
bigbed = _yield$_this3$configu.bigbed;
|
|
257
|
-
_context5.next = 8;
|
|
258
|
-
return bigbed.getFeatureStream(refName, start, end, {
|
|
259
|
-
signal: signal,
|
|
260
|
-
basesPerSpan: end - start
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
case 8:
|
|
264
|
-
ob = _context5.sent;
|
|
265
|
-
ob.pipe((0, _operators.mergeAll)(), (0, _operators.map)(function (r) {
|
|
266
|
-
var data = parser.parseLine("".concat(refName, "\t").concat(r.start, "\t").concat(r.end, "\t").concat(r.rest), {
|
|
267
|
-
uniqueId: r.uniqueId
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
BigBedAdapter.prototype.configure = function (opts) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
117
|
+
var _this = this;
|
|
118
|
+
return __generator(this, function (_a) {
|
|
119
|
+
if (!this.cached) {
|
|
120
|
+
this.cached = this.configurePre(opts).catch(function (e) {
|
|
121
|
+
_this.cached = undefined;
|
|
122
|
+
throw e;
|
|
268
123
|
});
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
124
|
+
}
|
|
125
|
+
return [2 /*return*/, this.cached];
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
BigBedAdapter.prototype.getRefNames = function (opts) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
131
|
+
var header;
|
|
132
|
+
return __generator(this, function (_a) {
|
|
133
|
+
switch (_a.label) {
|
|
134
|
+
case 0: return [4 /*yield*/, this.configure(opts)];
|
|
135
|
+
case 1:
|
|
136
|
+
header = (_a.sent()).header;
|
|
137
|
+
return [2 /*return*/, Object.keys(header.refsByName)];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
BigBedAdapter.prototype.getHeader = function (opts) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
+
var _a, parser, header, version, fileType, _b, fields, rest;
|
|
145
|
+
return __generator(this, function (_c) {
|
|
146
|
+
switch (_c.label) {
|
|
147
|
+
case 0: return [4 /*yield*/, this.configure(opts)];
|
|
148
|
+
case 1:
|
|
149
|
+
_a = _c.sent(), parser = _a.parser, header = _a.header;
|
|
150
|
+
version = header.version, fileType = header.fileType;
|
|
151
|
+
_b = parser.autoSql, fields = _b.fields, rest = __rest(_b, ["fields"]);
|
|
152
|
+
return [2 /*return*/, {
|
|
153
|
+
version: version,
|
|
154
|
+
fileType: fileType,
|
|
155
|
+
autoSql: __assign({}, rest),
|
|
156
|
+
fields: Object.fromEntries(fields.map(function (_a) {
|
|
157
|
+
var name = _a.name, comment = _a.comment;
|
|
158
|
+
return [name, comment];
|
|
159
|
+
})),
|
|
160
|
+
}];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
BigBedAdapter.prototype.getFeatures = function (region, opts) {
|
|
166
|
+
var _this = this;
|
|
167
|
+
if (opts === void 0) { opts = {}; }
|
|
168
|
+
var refName = region.refName, start = region.start, end = region.end;
|
|
169
|
+
var signal = opts.signal;
|
|
170
|
+
return (0, rxjs_1.ObservableCreate)(function (observer) { return __awaiter(_this, void 0, void 0, function () {
|
|
171
|
+
var _a, parser_1, bigbed, ob, e_1;
|
|
172
|
+
var _this = this;
|
|
173
|
+
return __generator(this, function (_b) {
|
|
174
|
+
switch (_b.label) {
|
|
175
|
+
case 0:
|
|
176
|
+
_b.trys.push([0, 3, , 4]);
|
|
177
|
+
return [4 /*yield*/, this.configure(opts)];
|
|
178
|
+
case 1:
|
|
179
|
+
_a = _b.sent(), parser_1 = _a.parser, bigbed = _a.bigbed;
|
|
180
|
+
return [4 /*yield*/, bigbed.getFeatureStream(refName, start, end, {
|
|
181
|
+
signal: signal,
|
|
182
|
+
basesPerSpan: end - start,
|
|
183
|
+
})];
|
|
184
|
+
case 2:
|
|
185
|
+
ob = _b.sent();
|
|
186
|
+
ob.pipe((0, operators_1.mergeAll)(), (0, operators_1.map)(function (r) {
|
|
187
|
+
var data = parser_1.parseLine("".concat(refName, "\t").concat(r.start, "\t").concat(r.end, "\t").concat(r.rest), {
|
|
188
|
+
uniqueId: r.uniqueId,
|
|
189
|
+
});
|
|
190
|
+
var blockCount = data.blockCount, blockSizes = data.blockSizes, blockStarts = data.blockStarts, chromStarts = data.chromStarts;
|
|
191
|
+
if (blockCount) {
|
|
192
|
+
var starts = chromStarts || blockStarts || [];
|
|
193
|
+
var sizes = blockSizes;
|
|
194
|
+
var blocksOffset = r.start;
|
|
195
|
+
data.subfeatures = [];
|
|
196
|
+
for (var b = 0; b < blockCount; b += 1) {
|
|
197
|
+
var bmin = (starts[b] || 0) + blocksOffset;
|
|
198
|
+
var bmax = bmin + (sizes[b] || 0);
|
|
199
|
+
data.subfeatures.push({
|
|
200
|
+
uniqueId: "".concat(r.uniqueId, "-").concat(b),
|
|
201
|
+
start: bmin,
|
|
202
|
+
end: bmax,
|
|
203
|
+
type: 'block',
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (r.uniqueId === undefined) {
|
|
208
|
+
throw new Error('invalid bbi feature');
|
|
209
|
+
}
|
|
210
|
+
var chromStart = data.chromStart, chromEnd = data.chromEnd, chrom = data.chrom, rest = __rest(data, ["chromStart", "chromEnd", "chrom"]);
|
|
211
|
+
var f = new simpleFeature_1.default({
|
|
212
|
+
id: "".concat(_this.id, "-").concat(r.uniqueId),
|
|
213
|
+
data: __assign(__assign({}, rest), { start: r.start, end: r.end, refName: refName }),
|
|
214
|
+
});
|
|
215
|
+
// collection of heuristics for suggesting that this feature
|
|
216
|
+
// should be converted to a gene, CNV bigbed has many gene like
|
|
217
|
+
// features including thickStart and blockCount but no strand
|
|
218
|
+
return isUCSC(f) ? (0, util_1.ucscProcessedTranscript)(f) : f;
|
|
219
|
+
})).subscribe(observer);
|
|
220
|
+
return [3 /*break*/, 4];
|
|
221
|
+
case 3:
|
|
222
|
+
e_1 = _b.sent();
|
|
223
|
+
observer.error(e_1);
|
|
224
|
+
return [3 /*break*/, 4];
|
|
225
|
+
case 4: return [2 /*return*/];
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}); }, opts.signal);
|
|
229
|
+
};
|
|
230
|
+
BigBedAdapter.prototype.freeResources = function () { };
|
|
231
|
+
return BigBedAdapter;
|
|
232
|
+
}(BaseAdapter_1.BaseFeatureDataAdapter));
|
|
233
|
+
exports.default = BigBedAdapter;
|
|
234
|
+
//# sourceMappingURL=BigBedAdapter.js.map
|