@jbrowse/plugin-variants 1.7.0 → 1.7.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/ChordVariantDisplay/index.d.ts +3 -3
- package/dist/ChordVariantDisplay/index.js +3 -3
- package/dist/ChordVariantDisplay/models/ChordVariantDisplay.d.ts +5 -5
- package/dist/ChordVariantDisplay/models/ChordVariantDisplay.js +3 -3
- package/dist/LinearVariantDisplay/configSchema.d.ts +5 -5
- package/dist/LinearVariantDisplay/configSchema.test.js +12 -12
- package/dist/LinearVariantDisplay/index.d.ts +2 -2
- package/dist/LinearVariantDisplay/index.js +1 -1
- package/dist/LinearVariantDisplay/model.d.ts +207 -207
- package/dist/LinearVariantDisplay/model.js +3 -3
- package/dist/StructuralVariantChordRenderer/ReactComponent.d.ts +24 -24
- package/dist/StructuralVariantChordRenderer/ReactComponent.js +17 -17
- package/dist/StructuralVariantChordRenderer/index.d.ts +3 -3
- package/dist/StructuralVariantChordRenderer/index.js +4 -4
- package/dist/VariantFeatureWidget/BreakendOptionDialog.d.ts +10 -10
- package/dist/VariantFeatureWidget/BreakendOptionDialog.js +13 -13
- package/dist/VariantFeatureWidget/VariantFeatureWidget.d.ts +4 -4
- package/dist/VariantFeatureWidget/VariantFeatureWidget.js +32 -32
- package/dist/VariantFeatureWidget/VariantFeatureWidget.test.js +2 -2
- package/dist/VariantFeatureWidget/index.d.ts +11 -11
- package/dist/VcfAdapter/VcfAdapter.d.ts +24 -24
- package/dist/VcfAdapter/VcfAdapter.js +26 -26
- package/dist/VcfAdapter/VcfAdapter.test.js +3 -3
- package/dist/VcfAdapter/configSchema.d.ts +2 -2
- package/dist/VcfAdapter/configSchema.js +2 -2
- package/dist/VcfAdapter/index.d.ts +1 -1
- package/dist/VcfAdapter/index.js +1 -1
- package/dist/VcfTabixAdapter/VcfFeature.d.ts +59 -59
- package/dist/VcfTabixAdapter/VcfFeature.js +19 -19
- package/dist/VcfTabixAdapter/VcfFeature.test.js +14 -14
- package/dist/VcfTabixAdapter/VcfTabixAdapter.d.ts +35 -35
- package/dist/VcfTabixAdapter/VcfTabixAdapter.js +26 -26
- package/dist/VcfTabixAdapter/VcfTabixAdapter.test.js +4 -4
- package/dist/VcfTabixAdapter/configSchema.d.ts +2 -2
- package/dist/VcfTabixAdapter/configSchema.js +2 -2
- package/dist/VcfTabixAdapter/index.d.ts +1 -1
- package/dist/VcfTabixAdapter/index.js +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.js +19 -19
- package/dist/index.test.js +2 -2
- package/package.json +5 -3
- 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
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
@@ -43,7 +43,7 @@ var _vcf = _interopRequireDefault(require("@gmod/vcf"));
|
|
|
43
43
|
|
|
44
44
|
var _VcfFeature = _interopRequireDefault(require("../VcfTabixAdapter/VcfFeature"));
|
|
45
45
|
|
|
46
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2
|
|
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
47
|
|
|
48
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
49
|
|
|
@@ -69,31 +69,31 @@ function isGzip(buf) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
72
|
-
(0, _inherits2
|
|
72
|
+
(0, _inherits2.default)(VcfAdapter, _BaseFeatureDataAdapt);
|
|
73
73
|
|
|
74
74
|
var _super = _createSuper(VcfAdapter);
|
|
75
75
|
|
|
76
76
|
function VcfAdapter() {
|
|
77
77
|
var _this;
|
|
78
78
|
|
|
79
|
-
(0, _classCallCheck2
|
|
79
|
+
(0, _classCallCheck2.default)(this, VcfAdapter);
|
|
80
80
|
|
|
81
81
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
82
82
|
args[_key] = arguments[_key];
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
86
|
-
(0, _defineProperty2
|
|
86
|
+
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "vcfFeatures", void 0);
|
|
87
87
|
return _this;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
(0, _createClass2
|
|
90
|
+
(0, _createClass2.default)(VcfAdapter, [{
|
|
91
91
|
key: "getHeader",
|
|
92
92
|
value: function () {
|
|
93
|
-
var _getHeader = (0, _asyncToGenerator2
|
|
93
|
+
var _getHeader = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
94
94
|
var _yield$this$setup, header;
|
|
95
95
|
|
|
96
|
-
return _regenerator
|
|
96
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
97
97
|
while (1) {
|
|
98
98
|
switch (_context.prev = _context.next) {
|
|
99
99
|
case 0:
|
|
@@ -122,10 +122,10 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
122
122
|
}, {
|
|
123
123
|
key: "getMetadata",
|
|
124
124
|
value: function () {
|
|
125
|
-
var _getMetadata = (0, _asyncToGenerator2
|
|
125
|
+
var _getMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
126
126
|
var _yield$this$setup2, header, parser;
|
|
127
127
|
|
|
128
|
-
return _regenerator
|
|
128
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
129
129
|
while (1) {
|
|
130
130
|
switch (_context2.prev = _context2.next) {
|
|
131
131
|
case 0:
|
|
@@ -135,7 +135,7 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
135
135
|
case 2:
|
|
136
136
|
_yield$this$setup2 = _context2.sent;
|
|
137
137
|
header = _yield$this$setup2.header;
|
|
138
|
-
parser = new _vcf
|
|
138
|
+
parser = new _vcf.default({
|
|
139
139
|
header: header
|
|
140
140
|
});
|
|
141
141
|
return _context2.abrupt("return", parser.getMetadata());
|
|
@@ -158,10 +158,10 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
158
158
|
}, {
|
|
159
159
|
key: "setupP",
|
|
160
160
|
value: function () {
|
|
161
|
-
var _setupP = (0, _asyncToGenerator2
|
|
161
|
+
var _setupP = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
162
162
|
var buffer, buf, str, _readVcf, header, lines, intervalTree;
|
|
163
163
|
|
|
164
|
-
return _regenerator
|
|
164
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
165
165
|
while (1) {
|
|
166
166
|
switch (_context3.prev = _context3.next) {
|
|
167
167
|
case 0:
|
|
@@ -204,7 +204,7 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
204
204
|
var _info$match;
|
|
205
205
|
|
|
206
206
|
var _line$split = line.split('\t'),
|
|
207
|
-
_line$split2 = (0, _slicedToArray2
|
|
207
|
+
_line$split2 = (0, _slicedToArray2.default)(_line$split, 8),
|
|
208
208
|
refName = _line$split2[0],
|
|
209
209
|
startP = _line$split2[1],
|
|
210
210
|
ref = _line$split2[3],
|
|
@@ -223,7 +223,7 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
223
223
|
var key = obj.refName;
|
|
224
224
|
|
|
225
225
|
if (!acc[key]) {
|
|
226
|
-
acc[key] = new _intervalTree
|
|
226
|
+
acc[key] = new _intervalTree.default();
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
acc[key].insert([obj.start, obj.end], obj);
|
|
@@ -251,15 +251,15 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
251
251
|
}, {
|
|
252
252
|
key: "setup",
|
|
253
253
|
value: function () {
|
|
254
|
-
var _setup = (0, _asyncToGenerator2
|
|
254
|
+
var _setup = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
255
255
|
var _this2 = this;
|
|
256
256
|
|
|
257
|
-
return _regenerator
|
|
257
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
258
258
|
while (1) {
|
|
259
259
|
switch (_context4.prev = _context4.next) {
|
|
260
260
|
case 0:
|
|
261
261
|
if (!this.vcfFeatures) {
|
|
262
|
-
this.vcfFeatures = this.setupP()
|
|
262
|
+
this.vcfFeatures = this.setupP().catch(function (e) {
|
|
263
263
|
_this2.vcfFeatures = undefined;
|
|
264
264
|
throw e;
|
|
265
265
|
});
|
|
@@ -284,13 +284,13 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
284
284
|
}, {
|
|
285
285
|
key: "getRefNames",
|
|
286
286
|
value: function () {
|
|
287
|
-
var _getRefNames = (0, _asyncToGenerator2
|
|
287
|
+
var _getRefNames = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
288
288
|
var _,
|
|
289
289
|
_yield$this$setup3,
|
|
290
290
|
intervalTree,
|
|
291
291
|
_args5 = arguments;
|
|
292
292
|
|
|
293
|
-
return _regenerator
|
|
293
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
294
294
|
while (1) {
|
|
295
295
|
switch (_context5.prev = _context5.next) {
|
|
296
296
|
case 0:
|
|
@@ -324,10 +324,10 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
324
324
|
|
|
325
325
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
326
326
|
return (0, _rxjs.ObservableCreate)( /*#__PURE__*/function () {
|
|
327
|
-
var _ref = (0, _asyncToGenerator2
|
|
327
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(observer) {
|
|
328
328
|
var _intervalTree$refName, start, end, refName, _yield$_this3$setup, header, intervalTree, parser;
|
|
329
329
|
|
|
330
|
-
return _regenerator
|
|
330
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
331
331
|
while (1) {
|
|
332
332
|
switch (_context6.prev = _context6.next) {
|
|
333
333
|
case 0:
|
|
@@ -340,11 +340,11 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
340
340
|
_yield$_this3$setup = _context6.sent;
|
|
341
341
|
header = _yield$_this3$setup.header;
|
|
342
342
|
intervalTree = _yield$_this3$setup.intervalTree;
|
|
343
|
-
parser = new _vcf
|
|
343
|
+
parser = new _vcf.default({
|
|
344
344
|
header: header
|
|
345
345
|
});
|
|
346
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
|
|
347
|
+
return observer.next(new _VcfFeature.default({
|
|
348
348
|
variant: parser.parseLine(f.line),
|
|
349
349
|
parser: parser,
|
|
350
350
|
id: "".concat(_this3.id, "-").concat(f.id)
|
|
@@ -379,5 +379,5 @@ var VcfAdapter = /*#__PURE__*/function (_BaseFeatureDataAdapt) {
|
|
|
379
379
|
return VcfAdapter;
|
|
380
380
|
}(_BaseAdapter.BaseFeatureDataAdapter);
|
|
381
381
|
|
|
382
|
-
exports
|
|
383
|
-
(0, _defineProperty2
|
|
382
|
+
exports.default = VcfAdapter;
|
|
383
|
+
(0, _defineProperty2.default)(VcfAdapter, "capabilities", ['getFeatures', 'getRefNames']);
|
|
@@ -15,13 +15,13 @@ var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
|
15
15
|
var _webEncoding = require("web-encoding");
|
|
16
16
|
|
|
17
17
|
window.TextDecoder = _webEncoding.TextDecoder;
|
|
18
|
-
test('adapter can fetch variants from volvox.vcf', /*#__PURE__*/(0, _asyncToGenerator2
|
|
18
|
+
test('adapter can fetch variants from volvox.vcf', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
19
19
|
var adapter, features, names, featuresArray;
|
|
20
|
-
return _regenerator
|
|
20
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
21
|
while (1) {
|
|
22
22
|
switch (_context.prev = _context.next) {
|
|
23
23
|
case 0:
|
|
24
|
-
adapter = new _VcfAdapter
|
|
24
|
+
adapter = new _VcfAdapter.default(_configSchema.default.create({
|
|
25
25
|
vcfLocation: {
|
|
26
26
|
localPath: require.resolve('./test_data/volvox.filtered.vcf'),
|
|
27
27
|
locationType: 'LocalPathLocation'
|
|
@@ -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;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
|
|
8
8
|
var _configuration = require("@jbrowse/core/configuration");
|
|
9
9
|
|
|
@@ -19,4 +19,4 @@ var _default = (0, _configuration.ConfigurationSchema)('VcfAdapter', {
|
|
|
19
19
|
explicitlyTyped: true
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
exports
|
|
22
|
+
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as configSchema } from './configSchema';
|
|
1
|
+
export { default as configSchema } from './configSchema';
|
package/dist/VcfAdapter/index.js
CHANGED
|
@@ -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 {};
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports
|
|
8
|
+
exports.default = void 0;
|
|
9
9
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
|
|
@@ -21,18 +21,18 @@ var _vcf = require("@gmod/vcf");
|
|
|
21
21
|
|
|
22
22
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
23
23
|
|
|
24
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2
|
|
24
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
25
|
|
|
26
26
|
var VCFFeature = /*#__PURE__*/function () {
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
30
|
function VCFFeature(args) {
|
|
31
|
-
(0, _classCallCheck2
|
|
32
|
-
(0, _defineProperty2
|
|
33
|
-
(0, _defineProperty2
|
|
34
|
-
(0, _defineProperty2
|
|
35
|
-
(0, _defineProperty2
|
|
31
|
+
(0, _classCallCheck2.default)(this, VCFFeature);
|
|
32
|
+
(0, _defineProperty2.default)(this, "variant", void 0);
|
|
33
|
+
(0, _defineProperty2.default)(this, "parser", void 0);
|
|
34
|
+
(0, _defineProperty2.default)(this, "data", void 0);
|
|
35
|
+
(0, _defineProperty2.default)(this, "_id", void 0);
|
|
36
36
|
this.variant = args.variant;
|
|
37
37
|
this.parser = args.parser;
|
|
38
38
|
this.data = this.dataFromVariant(this.variant);
|
|
@@ -40,7 +40,7 @@ var VCFFeature = /*#__PURE__*/function () {
|
|
|
40
40
|
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
(0, _createClass2
|
|
43
|
+
(0, _createClass2.default)(VCFFeature, [{
|
|
44
44
|
key: "get",
|
|
45
45
|
value: function get(field) {
|
|
46
46
|
return field === 'samples' ? this.variant.SAMPLES : this.data[field] || this.variant[field];
|
|
@@ -61,7 +61,7 @@ var VCFFeature = /*#__PURE__*/function () {
|
|
|
61
61
|
}, {
|
|
62
62
|
key: "tags",
|
|
63
63
|
value: function tags() {
|
|
64
|
-
var t = [].concat((0, _toConsumableArray2
|
|
64
|
+
var t = [].concat((0, _toConsumableArray2.default)(Object.keys(this.data)), (0, _toConsumableArray2.default)(Object.keys(this.variant)), ['samples']);
|
|
65
65
|
return t;
|
|
66
66
|
}
|
|
67
67
|
}, {
|
|
@@ -81,7 +81,7 @@ var VCFFeature = /*#__PURE__*/function () {
|
|
|
81
81
|
var start = POS - 1;
|
|
82
82
|
|
|
83
83
|
var _this$_getSOTermAndDe = this._getSOTermAndDescription(REF, ALT),
|
|
84
|
-
_this$_getSOTermAndDe2 = (0, _slicedToArray2
|
|
84
|
+
_this$_getSOTermAndDe2 = (0, _slicedToArray2.default)(_this$_getSOTermAndDe, 2),
|
|
85
85
|
SO_term = _this$_getSOTermAndDe2[0],
|
|
86
86
|
description = _this$_getSOTermAndDe2[1];
|
|
87
87
|
|
|
@@ -119,7 +119,7 @@ var VCFFeature = /*#__PURE__*/function () {
|
|
|
119
119
|
var descriptions = new Set();
|
|
120
120
|
alt.forEach(function (a) {
|
|
121
121
|
var _this$_getSOAndDescFr = _this._getSOAndDescFromAltDefs(ref, a),
|
|
122
|
-
_this$_getSOAndDescFr2 = (0, _slicedToArray2
|
|
122
|
+
_this$_getSOAndDescFr2 = (0, _slicedToArray2.default)(_this$_getSOAndDescFr, 2),
|
|
123
123
|
soTerm = _this$_getSOAndDescFr2[0],
|
|
124
124
|
description = _this$_getSOAndDescFr2[1];
|
|
125
125
|
|
|
@@ -128,7 +128,7 @@ var VCFFeature = /*#__PURE__*/function () {
|
|
|
128
128
|
|
|
129
129
|
var _this$_getSOAndDescBy = _this._getSOAndDescByExamination(ref, a);
|
|
130
130
|
|
|
131
|
-
var _this$_getSOAndDescBy2 = (0, _slicedToArray2
|
|
131
|
+
var _this$_getSOAndDescBy2 = (0, _slicedToArray2.default)(_this$_getSOAndDescBy, 2);
|
|
132
132
|
|
|
133
133
|
soTerm = _this$_getSOAndDescBy2[0];
|
|
134
134
|
description = _this$_getSOAndDescBy2[1];
|
|
@@ -141,24 +141,24 @@ var VCFFeature = /*#__PURE__*/function () {
|
|
|
141
141
|
}); // Combine descriptions like ["SNV G -> A", "SNV G -> T"] to ["SNV G -> A,T"]
|
|
142
142
|
|
|
143
143
|
if (descriptions.size > 1) {
|
|
144
|
-
var prefixes = new Set((0, _toConsumableArray2
|
|
144
|
+
var prefixes = new Set((0, _toConsumableArray2.default)(descriptions).map(function (desc) {
|
|
145
145
|
var prefix = desc.split('->');
|
|
146
146
|
return prefix[1] ? prefix[0] : desc;
|
|
147
147
|
}));
|
|
148
|
-
var new_descs = (0, _toConsumableArray2
|
|
149
|
-
var suffixes = (0, _toConsumableArray2
|
|
148
|
+
var new_descs = (0, _toConsumableArray2.default)(prefixes).map(function (prefix) {
|
|
149
|
+
var suffixes = (0, _toConsumableArray2.default)(descriptions).map(function (desc) {
|
|
150
150
|
var pref = desc.split('-> ');
|
|
151
151
|
return pref[1] && pref[0] === prefix ? pref[1] : '';
|
|
152
152
|
}).filter(function (f) {
|
|
153
153
|
return !!f;
|
|
154
154
|
});
|
|
155
|
-
return suffixes.length ? prefix + '-> ' + suffixes.join(',') : (0, _toConsumableArray2
|
|
155
|
+
return suffixes.length ? prefix + '-> ' + suffixes.join(',') : (0, _toConsumableArray2.default)(descriptions).join(',');
|
|
156
156
|
});
|
|
157
157
|
descriptions = new Set(new_descs);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
if (soTerms.size) {
|
|
161
|
-
return [(0, _toConsumableArray2
|
|
161
|
+
return [(0, _toConsumableArray2.default)(soTerms).join(','), (0, _toConsumableArray2.default)(descriptions).join(',')];
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
return [undefined, undefined];
|
|
@@ -246,8 +246,8 @@ var VCFFeature = /*#__PURE__*/function () {
|
|
|
246
246
|
return VCFFeature;
|
|
247
247
|
}();
|
|
248
248
|
|
|
249
|
-
exports
|
|
250
|
-
(0, _defineProperty2
|
|
249
|
+
exports.default = VCFFeature;
|
|
250
|
+
(0, _defineProperty2.default)(VCFFeature, "_altTypeToSO", {
|
|
251
251
|
DEL: 'deletion',
|
|
252
252
|
INS: 'insertion',
|
|
253
253
|
DUP: 'duplication',
|
|
@@ -7,12 +7,12 @@ var _vcf = _interopRequireDefault(require("@gmod/vcf"));
|
|
|
7
7
|
var _VcfFeature = _interopRequireDefault(require("./VcfFeature"));
|
|
8
8
|
|
|
9
9
|
test('test usage of the VcfFeature', function () {
|
|
10
|
-
var parser = new _vcf
|
|
10
|
+
var parser = new _vcf.default({
|
|
11
11
|
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
12
12
|
});
|
|
13
13
|
var line = "lcl|Scaffald_1\t80465\trs118266897\tR\tA\t29\tPASS\tNS=3;0,14;AF=0.5;DB;112;PG2.1";
|
|
14
14
|
var variant = parser.parseLine(line);
|
|
15
|
-
var f = new _VcfFeature
|
|
15
|
+
var f = new _VcfFeature.default({
|
|
16
16
|
parser: parser,
|
|
17
17
|
variant: variant,
|
|
18
18
|
id: 'myuniqueid'
|
|
@@ -21,12 +21,12 @@ test('test usage of the VcfFeature', function () {
|
|
|
21
21
|
expect(f.get('name')).toEqual('rs118266897');
|
|
22
22
|
});
|
|
23
23
|
test('try INS feature with END less than start', function () {
|
|
24
|
-
var parser = new _vcf
|
|
24
|
+
var parser = new _vcf.default({
|
|
25
25
|
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
26
26
|
});
|
|
27
27
|
var line = "chr1\t100\trs123\tR\tA\t29\tPASS\tEND=1;SVTYPE=INS";
|
|
28
28
|
var variant = parser.parseLine(line);
|
|
29
|
-
var f = new _VcfFeature
|
|
29
|
+
var f = new _VcfFeature.default({
|
|
30
30
|
parser: parser,
|
|
31
31
|
variant: variant,
|
|
32
32
|
id: 'myuniqueid'
|
|
@@ -36,12 +36,12 @@ test('try INS feature with END less than start', function () {
|
|
|
36
36
|
expect(f.get('end')).toEqual(100);
|
|
37
37
|
});
|
|
38
38
|
test('try DEL feature with END info field valid', function () {
|
|
39
|
-
var parser = new _vcf
|
|
39
|
+
var parser = new _vcf.default({
|
|
40
40
|
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
41
41
|
});
|
|
42
42
|
var line = "chr1\t100\trs123\tR\t<DEL>\t29\tPASS\tEND=1000;SVTYPE=DEL";
|
|
43
43
|
var variant = parser.parseLine(line);
|
|
44
|
-
var f = new _VcfFeature
|
|
44
|
+
var f = new _VcfFeature.default({
|
|
45
45
|
parser: parser,
|
|
46
46
|
variant: variant,
|
|
47
47
|
id: 'myuniqueid'
|
|
@@ -52,12 +52,12 @@ test('try DEL feature with END info field valid', function () {
|
|
|
52
52
|
});
|
|
53
53
|
describe('test SV description', function () {
|
|
54
54
|
it('multiple SVs', function () {
|
|
55
|
-
var parser = new _vcf
|
|
55
|
+
var parser = new _vcf.default({
|
|
56
56
|
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
57
57
|
});
|
|
58
58
|
var line = "chr1\t100\trs123\tR\t<INVDUP>,<INV>\t29\tPASS\tEND=1000;SVTYPE=DEL";
|
|
59
59
|
var variant = parser.parseLine(line);
|
|
60
|
-
var f = new _VcfFeature
|
|
60
|
+
var f = new _VcfFeature.default({
|
|
61
61
|
parser: parser,
|
|
62
62
|
variant: variant,
|
|
63
63
|
id: 'myuniqueid'
|
|
@@ -65,12 +65,12 @@ describe('test SV description', function () {
|
|
|
65
65
|
expect(f.get('description')).toEqual('<INVDUP>,<INV>');
|
|
66
66
|
});
|
|
67
67
|
it('BND', function () {
|
|
68
|
-
var parser = new _vcf
|
|
68
|
+
var parser = new _vcf.default({
|
|
69
69
|
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
70
70
|
});
|
|
71
71
|
var line = "chr1\t100\trs123\tR\tG[ctgA:34200[\t29\tPASS\tEND=1000;SVTYPE=BND";
|
|
72
72
|
var variant = parser.parseLine(line);
|
|
73
|
-
var f = new _VcfFeature
|
|
73
|
+
var f = new _VcfFeature.default({
|
|
74
74
|
parser: parser,
|
|
75
75
|
variant: variant,
|
|
76
76
|
id: 'myuniqueid'
|
|
@@ -78,12 +78,12 @@ describe('test SV description', function () {
|
|
|
78
78
|
expect(f.get('description')).toEqual('G[ctgA:34200[');
|
|
79
79
|
});
|
|
80
80
|
it('multiple BND', function () {
|
|
81
|
-
var parser = new _vcf
|
|
81
|
+
var parser = new _vcf.default({
|
|
82
82
|
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
83
83
|
});
|
|
84
84
|
var line = "chr1\t100\trs123\tR\tG[ctgA:34200[,G[ctgA:44200[\t29\tPASS\tEND=1000;SVTYPE=BND";
|
|
85
85
|
var variant = parser.parseLine(line);
|
|
86
|
-
var f = new _VcfFeature
|
|
86
|
+
var f = new _VcfFeature.default({
|
|
87
87
|
parser: parser,
|
|
88
88
|
variant: variant,
|
|
89
89
|
id: 'myuniqueid'
|
|
@@ -91,12 +91,12 @@ describe('test SV description', function () {
|
|
|
91
91
|
expect(f.get('description')).toEqual('G[ctgA:34200[,G[ctgA:44200[');
|
|
92
92
|
});
|
|
93
93
|
it('multiple SNV', function () {
|
|
94
|
-
var parser = new _vcf
|
|
94
|
+
var parser = new _vcf.default({
|
|
95
95
|
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
96
96
|
});
|
|
97
97
|
var line = "chr1\t100\trs123\tG\tA,C\t29\tPASS\tHELLO=world";
|
|
98
98
|
var variant = parser.parseLine(line);
|
|
99
|
-
var f = new _VcfFeature
|
|
99
|
+
var f = new _VcfFeature.default({
|
|
100
100
|
parser: parser,
|
|
101
101
|
variant: variant,
|
|
102
102
|
id: 'myuniqueid'
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
-
import { NoAssemblyRegion, Region } from '@jbrowse/core/util/types';
|
|
3
|
-
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
4
|
-
import { TabixIndexedFile } from '@gmod/tabix';
|
|
5
|
-
import VcfParser from '@gmod/vcf';
|
|
6
|
-
import { GenericFilehandle } from 'generic-filehandle';
|
|
7
|
-
export default class extends BaseFeatureDataAdapter {
|
|
8
|
-
private configured?;
|
|
9
|
-
private configurePre;
|
|
10
|
-
protected configure(): Promise<{
|
|
11
|
-
filehandle: GenericFilehandle;
|
|
12
|
-
vcf: TabixIndexedFile;
|
|
13
|
-
parser: VcfParser;
|
|
14
|
-
}>;
|
|
15
|
-
getRefNames(opts?: BaseOptions): Promise<any>;
|
|
16
|
-
getHeader(): Promise<string>;
|
|
17
|
-
getMetadata(): Promise<any>;
|
|
18
|
-
getFeatures(query: NoAssemblyRegion, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
19
|
-
/**
|
|
20
|
-
* Checks if the data source has data for the given reference sequence,
|
|
21
|
-
* and then gets the features in the region if it does
|
|
22
|
-
*
|
|
23
|
-
* Currently this just calls getFeatureInRegion for each region. Adapters that
|
|
24
|
-
* are frequently called on multiple regions simultaneously may want to
|
|
25
|
-
* implement a more efficient custom version of this method.
|
|
26
|
-
*
|
|
27
|
-
* Also includes a bit of extra logging to warn when fetching a large portion
|
|
28
|
-
* of a VCF
|
|
29
|
-
* @param regions - Regions
|
|
30
|
-
* @param opts - Feature adapter options
|
|
31
|
-
* @returns Observable of Feature objects in the regions
|
|
32
|
-
*/
|
|
33
|
-
getFeaturesInMultipleRegions(regions: Region[], opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
34
|
-
freeResources(): void;
|
|
35
|
-
}
|
|
1
|
+
import { BaseFeatureDataAdapter, BaseOptions } from '@jbrowse/core/data_adapters/BaseAdapter';
|
|
2
|
+
import { NoAssemblyRegion, Region } from '@jbrowse/core/util/types';
|
|
3
|
+
import { Feature } from '@jbrowse/core/util/simpleFeature';
|
|
4
|
+
import { TabixIndexedFile } from '@gmod/tabix';
|
|
5
|
+
import VcfParser from '@gmod/vcf';
|
|
6
|
+
import { GenericFilehandle } from 'generic-filehandle';
|
|
7
|
+
export default class extends BaseFeatureDataAdapter {
|
|
8
|
+
private configured?;
|
|
9
|
+
private configurePre;
|
|
10
|
+
protected configure(): Promise<{
|
|
11
|
+
filehandle: GenericFilehandle;
|
|
12
|
+
vcf: TabixIndexedFile;
|
|
13
|
+
parser: VcfParser;
|
|
14
|
+
}>;
|
|
15
|
+
getRefNames(opts?: BaseOptions): Promise<any>;
|
|
16
|
+
getHeader(): Promise<string>;
|
|
17
|
+
getMetadata(): Promise<any>;
|
|
18
|
+
getFeatures(query: NoAssemblyRegion, opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the data source has data for the given reference sequence,
|
|
21
|
+
* and then gets the features in the region if it does
|
|
22
|
+
*
|
|
23
|
+
* Currently this just calls getFeatureInRegion for each region. Adapters that
|
|
24
|
+
* are frequently called on multiple regions simultaneously may want to
|
|
25
|
+
* implement a more efficient custom version of this method.
|
|
26
|
+
*
|
|
27
|
+
* Also includes a bit of extra logging to warn when fetching a large portion
|
|
28
|
+
* of a VCF
|
|
29
|
+
* @param regions - Regions
|
|
30
|
+
* @param opts - Feature adapter options
|
|
31
|
+
* @returns Observable of Feature objects in the regions
|
|
32
|
+
*/
|
|
33
|
+
getFeaturesInMultipleRegions(regions: Region[], opts?: BaseOptions): import("rxjs").Observable<Feature>;
|
|
34
|
+
freeResources(): void;
|
|
35
|
+
}
|