@jbrowse/plugin-variants 1.6.9 → 1.7.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/ChordVariantDisplay/index.d.ts +3 -3
- package/dist/ChordVariantDisplay/index.js +33 -0
- package/dist/ChordVariantDisplay/models/ChordVariantDisplay.d.ts +5 -5
- package/dist/ChordVariantDisplay/models/ChordVariantDisplay.js +76 -0
- package/dist/LinearVariantDisplay/configSchema.d.ts +5 -5
- package/dist/LinearVariantDisplay/configSchema.js +18 -0
- package/dist/LinearVariantDisplay/configSchema.test.js +92 -0
- package/dist/LinearVariantDisplay/index.d.ts +2 -2
- package/dist/LinearVariantDisplay/index.js +23 -0
- package/dist/LinearVariantDisplay/model.d.ts +207 -207
- package/dist/LinearVariantDisplay/model.js +75 -0
- package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +24 -24
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +228 -0
- package/dist/StructuralVariantChordRenderer/index.d.ts +3 -3
- package/dist/StructuralVariantChordRenderer/index.js +48 -0
- package/dist/VariantFeatureWidget/BreakendOptionDialog.d.ts +10 -10
- package/dist/VariantFeatureWidget/BreakendOptionDialog.js +127 -0
- package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +4 -4
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +251 -0
- package/dist/VariantFeatureWidget/VariantFeatureWidget.test.js +56 -0
- package/dist/VariantFeatureWidget/index.d.ts +11 -11
- package/dist/VariantFeatureWidget/index.js +35 -0
- package/dist/VcfAdapter/VcfAdapter.d.ts +24 -24
- package/dist/VcfAdapter/VcfAdapter.js +383 -0
- package/dist/VcfAdapter/VcfAdapter.test.js +55 -0
- package/dist/VcfAdapter/configSchema.d.ts +2 -2
- package/dist/VcfAdapter/configSchema.js +22 -0
- package/dist/VcfAdapter/index.d.ts +1 -1
- package/dist/VcfAdapter/index.js +15 -0
- package/dist/VcfTabixAdapter/VcfFeature.d.ts +59 -59
- package/dist/VcfTabixAdapter/VcfFeature.js +261 -0
- package/dist/VcfTabixAdapter/VcfFeature.test.js +106 -0
- package/dist/VcfTabixAdapter/VcfTabixAdapter.d.ts +35 -35
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +392 -0
- package/dist/VcfTabixAdapter/VcfTabixAdapter.test.js +99 -0
- package/dist/VcfTabixAdapter/configSchema.d.ts +2 -2
- package/dist/VcfTabixAdapter/configSchema.js +38 -0
- package/dist/VcfTabixAdapter/index.d.ts +1 -1
- package/dist/VcfTabixAdapter/index.js +15 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +214 -6
- package/dist/index.test.js +37 -0
- package/package.json +5 -7
- package/dist/LinearVariantDisplay/configSchema.test.d.ts +0 -1
- package/dist/VariantFeatureWidget/VariantFeatureWidget.test.d.ts +0 -1
- package/dist/index.test.d.ts +0 -1
- package/dist/plugin-variants.cjs.development.js +0 -2897
- package/dist/plugin-variants.cjs.development.js.map +0 -1
- package/dist/plugin-variants.cjs.production.min.js +0 -2
- package/dist/plugin-variants.cjs.production.min.js.map +0 -1
- package/dist/plugin-variants.esm.js +0 -2889
- package/dist/plugin-variants.esm.js.map +0 -1
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
21
|
+
|
|
22
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
28
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
30
|
+
var _BaseAdapter = require("@jbrowse/core/data_adapters/BaseAdapter");
|
|
31
|
+
|
|
32
|
+
var _io = require("@jbrowse/core/util/io");
|
|
33
|
+
|
|
34
|
+
var _rxjs = require("@jbrowse/core/util/rxjs");
|
|
35
|
+
|
|
36
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
37
|
+
|
|
38
|
+
var _intervalTree = _interopRequireDefault(require("@flatten-js/interval-tree"));
|
|
39
|
+
|
|
40
|
+
var _bgzfFilehandle = require("@gmod/bgzf-filehandle");
|
|
41
|
+
|
|
42
|
+
var _vcf = _interopRequireDefault(require("@gmod/vcf"));
|
|
43
|
+
|
|
44
|
+
var _VcfFeature = _interopRequireDefault(require("../VcfTabixAdapter/VcfFeature"));
|
|
45
|
+
|
|
46
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
47
|
+
|
|
48
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
49
|
+
|
|
50
|
+
var readVcf = function readVcf(f) {
|
|
51
|
+
var lines = f.split('\n');
|
|
52
|
+
var header = [];
|
|
53
|
+
var rest = [];
|
|
54
|
+
lines.forEach(function (line) {
|
|
55
|
+
if (line.startsWith('#')) {
|
|
56
|
+
header.push(line);
|
|
57
|
+
} else if (line) {
|
|
58
|
+
rest.push(line);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
header: header.join('\n'),
|
|
63
|
+
lines: rest
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
function isGzip(buf) {
|
|
68
|
+
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
72
|
+
(0, _inherits2["default"])(VcfAdapter, _BaseFeatureDataAdapt);
|
|
73
|
+
|
|
74
|
+
var _super = _createSuper(VcfAdapter);
|
|
75
|
+
|
|
76
|
+
function VcfAdapter() {
|
|
77
|
+
var _this;
|
|
78
|
+
|
|
79
|
+
(0, _classCallCheck2["default"])(this, VcfAdapter);
|
|
80
|
+
|
|
81
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
82
|
+
args[_key] = arguments[_key];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
86
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "vcfFeatures", void 0);
|
|
87
|
+
return _this;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
(0, _createClass2["default"])(VcfAdapter, [{
|
|
91
|
+
key: "getHeader",
|
|
92
|
+
value: function () {
|
|
93
|
+
var _getHeader = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
94
|
+
var _yield$this$setup, header;
|
|
95
|
+
|
|
96
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
97
|
+
while (1) {
|
|
98
|
+
switch (_context.prev = _context.next) {
|
|
99
|
+
case 0:
|
|
100
|
+
_context.next = 2;
|
|
101
|
+
return this.setup();
|
|
102
|
+
|
|
103
|
+
case 2:
|
|
104
|
+
_yield$this$setup = _context.sent;
|
|
105
|
+
header = _yield$this$setup.header;
|
|
106
|
+
return _context.abrupt("return", header);
|
|
107
|
+
|
|
108
|
+
case 5:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context.stop();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}, _callee, this);
|
|
114
|
+
}));
|
|
115
|
+
|
|
116
|
+
function getHeader() {
|
|
117
|
+
return _getHeader.apply(this, arguments);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return getHeader;
|
|
121
|
+
}()
|
|
122
|
+
}, {
|
|
123
|
+
key: "getMetadata",
|
|
124
|
+
value: function () {
|
|
125
|
+
var _getMetadata = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
126
|
+
var _yield$this$setup2, header, parser;
|
|
127
|
+
|
|
128
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
129
|
+
while (1) {
|
|
130
|
+
switch (_context2.prev = _context2.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
_context2.next = 2;
|
|
133
|
+
return this.setup();
|
|
134
|
+
|
|
135
|
+
case 2:
|
|
136
|
+
_yield$this$setup2 = _context2.sent;
|
|
137
|
+
header = _yield$this$setup2.header;
|
|
138
|
+
parser = new _vcf["default"]({
|
|
139
|
+
header: header
|
|
140
|
+
});
|
|
141
|
+
return _context2.abrupt("return", parser.getMetadata());
|
|
142
|
+
|
|
143
|
+
case 6:
|
|
144
|
+
case "end":
|
|
145
|
+
return _context2.stop();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, _callee2, this);
|
|
149
|
+
}));
|
|
150
|
+
|
|
151
|
+
function getMetadata() {
|
|
152
|
+
return _getMetadata.apply(this, arguments);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return getMetadata;
|
|
156
|
+
}() // converts lines into an interval tree
|
|
157
|
+
|
|
158
|
+
}, {
|
|
159
|
+
key: "setupP",
|
|
160
|
+
value: function () {
|
|
161
|
+
var _setupP = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
162
|
+
var buffer, buf, str, _readVcf, header, lines, intervalTree;
|
|
163
|
+
|
|
164
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
165
|
+
while (1) {
|
|
166
|
+
switch (_context3.prev = _context3.next) {
|
|
167
|
+
case 0:
|
|
168
|
+
_context3.next = 2;
|
|
169
|
+
return (0, _io.openLocation)((0, _configuration.readConfObject)(this.config, 'vcfLocation'), this.pluginManager).readFile();
|
|
170
|
+
|
|
171
|
+
case 2:
|
|
172
|
+
buffer = _context3.sent;
|
|
173
|
+
|
|
174
|
+
if (!isGzip(buffer)) {
|
|
175
|
+
_context3.next = 9;
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
_context3.next = 6;
|
|
180
|
+
return (0, _bgzfFilehandle.unzip)(buffer);
|
|
181
|
+
|
|
182
|
+
case 6:
|
|
183
|
+
_context3.t0 = _context3.sent;
|
|
184
|
+
_context3.next = 10;
|
|
185
|
+
break;
|
|
186
|
+
|
|
187
|
+
case 9:
|
|
188
|
+
_context3.t0 = buffer;
|
|
189
|
+
|
|
190
|
+
case 10:
|
|
191
|
+
buf = _context3.t0;
|
|
192
|
+
|
|
193
|
+
if (!(buf.length > 536870888)) {
|
|
194
|
+
_context3.next = 13;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
throw new Error('Data exceeds maximum string length (512MB)');
|
|
199
|
+
|
|
200
|
+
case 13:
|
|
201
|
+
str = new TextDecoder().decode(buf);
|
|
202
|
+
_readVcf = readVcf(str), header = _readVcf.header, lines = _readVcf.lines;
|
|
203
|
+
intervalTree = lines.map(function (line, id) {
|
|
204
|
+
var _info$match;
|
|
205
|
+
|
|
206
|
+
var _line$split = line.split('\t'),
|
|
207
|
+
_line$split2 = (0, _slicedToArray2["default"])(_line$split, 8),
|
|
208
|
+
refName = _line$split2[0],
|
|
209
|
+
startP = _line$split2[1],
|
|
210
|
+
ref = _line$split2[3],
|
|
211
|
+
info = _line$split2[7];
|
|
212
|
+
|
|
213
|
+
var start = +startP - 1;
|
|
214
|
+
var end = +(((_info$match = info.match(/END=(\d+)/)) === null || _info$match === void 0 ? void 0 : _info$match[1].trim()) || start + ref.length);
|
|
215
|
+
return {
|
|
216
|
+
line: line,
|
|
217
|
+
refName: refName,
|
|
218
|
+
start: start,
|
|
219
|
+
end: end,
|
|
220
|
+
id: id
|
|
221
|
+
};
|
|
222
|
+
}).reduce(function (acc, obj) {
|
|
223
|
+
var key = obj.refName;
|
|
224
|
+
|
|
225
|
+
if (!acc[key]) {
|
|
226
|
+
acc[key] = new _intervalTree["default"]();
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
acc[key].insert([obj.start, obj.end], obj);
|
|
230
|
+
return acc;
|
|
231
|
+
}, {});
|
|
232
|
+
return _context3.abrupt("return", {
|
|
233
|
+
header: header,
|
|
234
|
+
intervalTree: intervalTree
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
case 17:
|
|
238
|
+
case "end":
|
|
239
|
+
return _context3.stop();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}, _callee3, this);
|
|
243
|
+
}));
|
|
244
|
+
|
|
245
|
+
function setupP() {
|
|
246
|
+
return _setupP.apply(this, arguments);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return setupP;
|
|
250
|
+
}()
|
|
251
|
+
}, {
|
|
252
|
+
key: "setup",
|
|
253
|
+
value: function () {
|
|
254
|
+
var _setup = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
255
|
+
var _this2 = this;
|
|
256
|
+
|
|
257
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
258
|
+
while (1) {
|
|
259
|
+
switch (_context4.prev = _context4.next) {
|
|
260
|
+
case 0:
|
|
261
|
+
if (!this.vcfFeatures) {
|
|
262
|
+
this.vcfFeatures = this.setupP()["catch"](function (e) {
|
|
263
|
+
_this2.vcfFeatures = undefined;
|
|
264
|
+
throw e;
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return _context4.abrupt("return", this.vcfFeatures);
|
|
269
|
+
|
|
270
|
+
case 2:
|
|
271
|
+
case "end":
|
|
272
|
+
return _context4.stop();
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}, _callee4, this);
|
|
276
|
+
}));
|
|
277
|
+
|
|
278
|
+
function setup() {
|
|
279
|
+
return _setup.apply(this, arguments);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return setup;
|
|
283
|
+
}()
|
|
284
|
+
}, {
|
|
285
|
+
key: "getRefNames",
|
|
286
|
+
value: function () {
|
|
287
|
+
var _getRefNames = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
288
|
+
var _,
|
|
289
|
+
_yield$this$setup3,
|
|
290
|
+
intervalTree,
|
|
291
|
+
_args5 = arguments;
|
|
292
|
+
|
|
293
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
294
|
+
while (1) {
|
|
295
|
+
switch (_context5.prev = _context5.next) {
|
|
296
|
+
case 0:
|
|
297
|
+
_ = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
|
|
298
|
+
_context5.next = 3;
|
|
299
|
+
return this.setup();
|
|
300
|
+
|
|
301
|
+
case 3:
|
|
302
|
+
_yield$this$setup3 = _context5.sent;
|
|
303
|
+
intervalTree = _yield$this$setup3.intervalTree;
|
|
304
|
+
return _context5.abrupt("return", Object.keys(intervalTree));
|
|
305
|
+
|
|
306
|
+
case 6:
|
|
307
|
+
case "end":
|
|
308
|
+
return _context5.stop();
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}, _callee5, this);
|
|
312
|
+
}));
|
|
313
|
+
|
|
314
|
+
function getRefNames() {
|
|
315
|
+
return _getRefNames.apply(this, arguments);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return getRefNames;
|
|
319
|
+
}()
|
|
320
|
+
}, {
|
|
321
|
+
key: "getFeatures",
|
|
322
|
+
value: function getFeatures(region) {
|
|
323
|
+
var _this3 = this;
|
|
324
|
+
|
|
325
|
+
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
326
|
+
return (0, _rxjs.ObservableCreate)( /*#__PURE__*/function () {
|
|
327
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(observer) {
|
|
328
|
+
var _intervalTree$refName, start, end, refName, _yield$_this3$setup, header, intervalTree, parser;
|
|
329
|
+
|
|
330
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
331
|
+
while (1) {
|
|
332
|
+
switch (_context6.prev = _context6.next) {
|
|
333
|
+
case 0:
|
|
334
|
+
_context6.prev = 0;
|
|
335
|
+
start = region.start, end = region.end, refName = region.refName;
|
|
336
|
+
_context6.next = 4;
|
|
337
|
+
return _this3.setup();
|
|
338
|
+
|
|
339
|
+
case 4:
|
|
340
|
+
_yield$_this3$setup = _context6.sent;
|
|
341
|
+
header = _yield$_this3$setup.header;
|
|
342
|
+
intervalTree = _yield$_this3$setup.intervalTree;
|
|
343
|
+
parser = new _vcf["default"]({
|
|
344
|
+
header: header
|
|
345
|
+
});
|
|
346
|
+
(_intervalTree$refName = intervalTree[refName]) === null || _intervalTree$refName === void 0 ? void 0 : _intervalTree$refName.search([start, end]).forEach(function (f) {
|
|
347
|
+
return observer.next(new _VcfFeature["default"]({
|
|
348
|
+
variant: parser.parseLine(f.line),
|
|
349
|
+
parser: parser,
|
|
350
|
+
id: "".concat(_this3.id, "-").concat(f.id)
|
|
351
|
+
}));
|
|
352
|
+
});
|
|
353
|
+
observer.complete();
|
|
354
|
+
_context6.next = 15;
|
|
355
|
+
break;
|
|
356
|
+
|
|
357
|
+
case 12:
|
|
358
|
+
_context6.prev = 12;
|
|
359
|
+
_context6.t0 = _context6["catch"](0);
|
|
360
|
+
observer.error(_context6.t0);
|
|
361
|
+
|
|
362
|
+
case 15:
|
|
363
|
+
case "end":
|
|
364
|
+
return _context6.stop();
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
}, _callee6, null, [[0, 12]]);
|
|
368
|
+
}));
|
|
369
|
+
|
|
370
|
+
return function (_x) {
|
|
371
|
+
return _ref.apply(this, arguments);
|
|
372
|
+
};
|
|
373
|
+
}(), opts.signal);
|
|
374
|
+
}
|
|
375
|
+
}, {
|
|
376
|
+
key: "freeResources",
|
|
377
|
+
value: function freeResources() {}
|
|
378
|
+
}]);
|
|
379
|
+
return VcfAdapter;
|
|
380
|
+
}(_BaseAdapter.BaseFeatureDataAdapter);
|
|
381
|
+
|
|
382
|
+
exports["default"] = VcfAdapter;
|
|
383
|
+
(0, _defineProperty2["default"])(VcfAdapter, "capabilities", ['getFeatures', 'getRefNames']);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
|
+
|
|
7
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
+
|
|
9
|
+
var _operators = require("rxjs/operators");
|
|
10
|
+
|
|
11
|
+
var _VcfAdapter = _interopRequireDefault(require("./VcfAdapter"));
|
|
12
|
+
|
|
13
|
+
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
14
|
+
|
|
15
|
+
var _webEncoding = require("web-encoding");
|
|
16
|
+
|
|
17
|
+
window.TextDecoder = _webEncoding.TextDecoder;
|
|
18
|
+
test('adapter can fetch variants from volvox.vcf', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
19
|
+
var adapter, features, names, featuresArray;
|
|
20
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
21
|
+
while (1) {
|
|
22
|
+
switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
adapter = new _VcfAdapter["default"](_configSchema["default"].create({
|
|
25
|
+
vcfLocation: {
|
|
26
|
+
localPath: require.resolve('./test_data/volvox.filtered.vcf'),
|
|
27
|
+
locationType: 'LocalPathLocation'
|
|
28
|
+
}
|
|
29
|
+
}));
|
|
30
|
+
features = adapter.getFeatures({
|
|
31
|
+
assemblyName: 'volvox',
|
|
32
|
+
refName: 'ctgA',
|
|
33
|
+
start: 0,
|
|
34
|
+
end: 20000
|
|
35
|
+
});
|
|
36
|
+
_context.next = 4;
|
|
37
|
+
return adapter.getRefNames();
|
|
38
|
+
|
|
39
|
+
case 4:
|
|
40
|
+
names = _context.sent;
|
|
41
|
+
expect(names).toMatchSnapshot();
|
|
42
|
+
_context.next = 8;
|
|
43
|
+
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
44
|
+
|
|
45
|
+
case 8:
|
|
46
|
+
featuresArray = _context.sent;
|
|
47
|
+
expect(featuresArray.slice(0, 5)).toMatchSnapshot();
|
|
48
|
+
|
|
49
|
+
case 10:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, _callee);
|
|
55
|
+
})));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
2
|
-
export default _default;
|
|
1
|
+
declare const _default: import("@jbrowse/core/configuration").AnyConfigurationSchemaType;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _configuration = require("@jbrowse/core/configuration");
|
|
9
|
+
|
|
10
|
+
var _default = (0, _configuration.ConfigurationSchema)('VcfAdapter', {
|
|
11
|
+
vcfLocation: {
|
|
12
|
+
type: 'fileLocation',
|
|
13
|
+
defaultValue: {
|
|
14
|
+
uri: '/path/to/my.vcf',
|
|
15
|
+
locationType: 'UriLocation'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}, {
|
|
19
|
+
explicitlyTyped: true
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
exports["default"] = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as configSchema } from './configSchema';
|
|
1
|
+
export { default as configSchema } from './configSchema';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
Object.defineProperty(exports, "configSchema", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _configSchema["default"];
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
-
/**
|
|
3
|
-
* VCF Feature creation with lazy genotype evaluation.
|
|
4
|
-
*/
|
|
5
|
-
interface Samples {
|
|
6
|
-
[key: string]: {
|
|
7
|
-
[key: string]: {
|
|
8
|
-
values: string[] | number[] | null;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
interface FeatureData {
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
refName: string;
|
|
15
|
-
start: number;
|
|
16
|
-
end: number;
|
|
17
|
-
description?: string;
|
|
18
|
-
type?: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
aliases?: string[];
|
|
21
|
-
samples?: Samples;
|
|
22
|
-
}
|
|
23
|
-
export default class VCFFeature implements Feature {
|
|
24
|
-
private variant;
|
|
25
|
-
private parser;
|
|
26
|
-
private data;
|
|
27
|
-
private _id;
|
|
28
|
-
constructor(args: {
|
|
29
|
-
variant: any;
|
|
30
|
-
parser: any;
|
|
31
|
-
id: string;
|
|
32
|
-
});
|
|
33
|
-
get(field: string): any;
|
|
34
|
-
set(): void;
|
|
35
|
-
parent(): undefined;
|
|
36
|
-
children(): undefined;
|
|
37
|
-
tags(): string[];
|
|
38
|
-
id(): string;
|
|
39
|
-
dataFromVariant(variant: {
|
|
40
|
-
REF: string;
|
|
41
|
-
POS: number;
|
|
42
|
-
ALT: string[];
|
|
43
|
-
CHROM: string;
|
|
44
|
-
INFO: any;
|
|
45
|
-
ID: string[];
|
|
46
|
-
}): FeatureData;
|
|
47
|
-
/**
|
|
48
|
-
* Get a sequence ontology (SO) term that describes the variant type
|
|
49
|
-
*/
|
|
50
|
-
_getSOTermAndDescription(ref: string, alt: string[]): [string, string] | [undefined, undefined];
|
|
51
|
-
static _altTypeToSO: {
|
|
52
|
-
[key: string]: string | undefined;
|
|
53
|
-
};
|
|
54
|
-
_getSOAndDescFromAltDefs(ref: string, alt: string): [string, string] | [undefined, undefined];
|
|
55
|
-
_getSOAndDescByExamination(ref: string, alt: string): [string, string];
|
|
56
|
-
_makeDescriptionString(soTerm: string, ref: string, alt: string): string;
|
|
57
|
-
toJSON(): any;
|
|
58
|
-
}
|
|
59
|
-
export {};
|
|
1
|
+
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
2
|
+
/**
|
|
3
|
+
* VCF Feature creation with lazy genotype evaluation.
|
|
4
|
+
*/
|
|
5
|
+
interface Samples {
|
|
6
|
+
[key: string]: {
|
|
7
|
+
[key: string]: {
|
|
8
|
+
values: string[] | number[] | null;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
interface FeatureData {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
refName: string;
|
|
15
|
+
start: number;
|
|
16
|
+
end: number;
|
|
17
|
+
description?: string;
|
|
18
|
+
type?: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
aliases?: string[];
|
|
21
|
+
samples?: Samples;
|
|
22
|
+
}
|
|
23
|
+
export default class VCFFeature implements Feature {
|
|
24
|
+
private variant;
|
|
25
|
+
private parser;
|
|
26
|
+
private data;
|
|
27
|
+
private _id;
|
|
28
|
+
constructor(args: {
|
|
29
|
+
variant: any;
|
|
30
|
+
parser: any;
|
|
31
|
+
id: string;
|
|
32
|
+
});
|
|
33
|
+
get(field: string): any;
|
|
34
|
+
set(): void;
|
|
35
|
+
parent(): undefined;
|
|
36
|
+
children(): undefined;
|
|
37
|
+
tags(): string[];
|
|
38
|
+
id(): string;
|
|
39
|
+
dataFromVariant(variant: {
|
|
40
|
+
REF: string;
|
|
41
|
+
POS: number;
|
|
42
|
+
ALT: string[];
|
|
43
|
+
CHROM: string;
|
|
44
|
+
INFO: any;
|
|
45
|
+
ID: string[];
|
|
46
|
+
}): FeatureData;
|
|
47
|
+
/**
|
|
48
|
+
* Get a sequence ontology (SO) term that describes the variant type
|
|
49
|
+
*/
|
|
50
|
+
_getSOTermAndDescription(ref: string, alt: string[]): [string, string] | [undefined, undefined];
|
|
51
|
+
static _altTypeToSO: {
|
|
52
|
+
[key: string]: string | undefined;
|
|
53
|
+
};
|
|
54
|
+
_getSOAndDescFromAltDefs(ref: string, alt: string): [string, string] | [undefined, undefined];
|
|
55
|
+
_getSOAndDescByExamination(ref: string, alt: string): [string, string];
|
|
56
|
+
_makeDescriptionString(soTerm: string, ref: string, alt: string): string;
|
|
57
|
+
toJSON(): any;
|
|
58
|
+
}
|
|
59
|
+
export {};
|