@jbrowse/plugin-variants 1.6.8 → 1.7.1
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,261 @@
|
|
|
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
16
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
18
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
+
|
|
20
|
+
var _vcf = require("@gmod/vcf");
|
|
21
|
+
|
|
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
|
+
|
|
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
|
+
|
|
26
|
+
var VCFFeature = /*#__PURE__*/function () {
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
function VCFFeature(args) {
|
|
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
|
+
this.variant = args.variant;
|
|
37
|
+
this.parser = args.parser;
|
|
38
|
+
this.data = this.dataFromVariant(this.variant);
|
|
39
|
+
this._id = args.id;
|
|
40
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
(0, _createClass2["default"])(VCFFeature, [{
|
|
44
|
+
key: "get",
|
|
45
|
+
value: function get(field) {
|
|
46
|
+
return field === 'samples' ? this.variant.SAMPLES : this.data[field] || this.variant[field];
|
|
47
|
+
}
|
|
48
|
+
}, {
|
|
49
|
+
key: "set",
|
|
50
|
+
value: function set() {}
|
|
51
|
+
}, {
|
|
52
|
+
key: "parent",
|
|
53
|
+
value: function parent() {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "children",
|
|
58
|
+
value: function children() {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
}, {
|
|
62
|
+
key: "tags",
|
|
63
|
+
value: function tags() {
|
|
64
|
+
var t = [].concat((0, _toConsumableArray2["default"])(Object.keys(this.data)), (0, _toConsumableArray2["default"])(Object.keys(this.variant)), ['samples']);
|
|
65
|
+
return t;
|
|
66
|
+
}
|
|
67
|
+
}, {
|
|
68
|
+
key: "id",
|
|
69
|
+
value: function id() {
|
|
70
|
+
return this._id;
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "dataFromVariant",
|
|
74
|
+
value: function dataFromVariant(variant) {
|
|
75
|
+
var REF = variant.REF,
|
|
76
|
+
ALT = variant.ALT,
|
|
77
|
+
POS = variant.POS,
|
|
78
|
+
CHROM = variant.CHROM,
|
|
79
|
+
INFO = variant.INFO,
|
|
80
|
+
ID = variant.ID;
|
|
81
|
+
var start = POS - 1;
|
|
82
|
+
|
|
83
|
+
var _this$_getSOTermAndDe = this._getSOTermAndDescription(REF, ALT),
|
|
84
|
+
_this$_getSOTermAndDe2 = (0, _slicedToArray2["default"])(_this$_getSOTermAndDe, 2),
|
|
85
|
+
SO_term = _this$_getSOTermAndDe2[0],
|
|
86
|
+
description = _this$_getSOTermAndDe2[1];
|
|
87
|
+
|
|
88
|
+
var isTRA = ALT === null || ALT === void 0 ? void 0 : ALT.some(function (f) {
|
|
89
|
+
return f === '<TRA>';
|
|
90
|
+
});
|
|
91
|
+
var isSymbolic = ALT === null || ALT === void 0 ? void 0 : ALT.some(function (f) {
|
|
92
|
+
return f.indexOf('<') !== -1;
|
|
93
|
+
});
|
|
94
|
+
return {
|
|
95
|
+
refName: CHROM,
|
|
96
|
+
start: start,
|
|
97
|
+
end: isSymbolic && INFO.END && !isTRA ? +INFO.END[0] : start + REF.length,
|
|
98
|
+
description: description,
|
|
99
|
+
type: SO_term,
|
|
100
|
+
name: ID === null || ID === void 0 ? void 0 : ID.join(','),
|
|
101
|
+
aliases: ID && ID.length > 1 ? variant.ID.slice(1) : undefined
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Get a sequence ontology (SO) term that describes the variant type
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
}, {
|
|
109
|
+
key: "_getSOTermAndDescription",
|
|
110
|
+
value: function _getSOTermAndDescription(ref, alt) {
|
|
111
|
+
var _this = this;
|
|
112
|
+
|
|
113
|
+
// it's just a remark if there are no alternate alleles
|
|
114
|
+
if (!alt || alt === []) {
|
|
115
|
+
return ['remark', 'no alternative alleles'];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var soTerms = new Set();
|
|
119
|
+
var descriptions = new Set();
|
|
120
|
+
alt.forEach(function (a) {
|
|
121
|
+
var _this$_getSOAndDescFr = _this._getSOAndDescFromAltDefs(ref, a),
|
|
122
|
+
_this$_getSOAndDescFr2 = (0, _slicedToArray2["default"])(_this$_getSOAndDescFr, 2),
|
|
123
|
+
soTerm = _this$_getSOAndDescFr2[0],
|
|
124
|
+
description = _this$_getSOAndDescFr2[1];
|
|
125
|
+
|
|
126
|
+
if (!soTerm) {
|
|
127
|
+
;
|
|
128
|
+
|
|
129
|
+
var _this$_getSOAndDescBy = _this._getSOAndDescByExamination(ref, a);
|
|
130
|
+
|
|
131
|
+
var _this$_getSOAndDescBy2 = (0, _slicedToArray2["default"])(_this$_getSOAndDescBy, 2);
|
|
132
|
+
|
|
133
|
+
soTerm = _this$_getSOAndDescBy2[0];
|
|
134
|
+
description = _this$_getSOAndDescBy2[1];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (soTerm && description) {
|
|
138
|
+
soTerms.add(soTerm);
|
|
139
|
+
descriptions.add(description);
|
|
140
|
+
}
|
|
141
|
+
}); // Combine descriptions like ["SNV G -> A", "SNV G -> T"] to ["SNV G -> A,T"]
|
|
142
|
+
|
|
143
|
+
if (descriptions.size > 1) {
|
|
144
|
+
var prefixes = new Set((0, _toConsumableArray2["default"])(descriptions).map(function (desc) {
|
|
145
|
+
var prefix = desc.split('->');
|
|
146
|
+
return prefix[1] ? prefix[0] : desc;
|
|
147
|
+
}));
|
|
148
|
+
var new_descs = (0, _toConsumableArray2["default"])(prefixes).map(function (prefix) {
|
|
149
|
+
var suffixes = (0, _toConsumableArray2["default"])(descriptions).map(function (desc) {
|
|
150
|
+
var pref = desc.split('-> ');
|
|
151
|
+
return pref[1] && pref[0] === prefix ? pref[1] : '';
|
|
152
|
+
}).filter(function (f) {
|
|
153
|
+
return !!f;
|
|
154
|
+
});
|
|
155
|
+
return suffixes.length ? prefix + '-> ' + suffixes.join(',') : (0, _toConsumableArray2["default"])(descriptions).join(',');
|
|
156
|
+
});
|
|
157
|
+
descriptions = new Set(new_descs);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (soTerms.size) {
|
|
161
|
+
return [(0, _toConsumableArray2["default"])(soTerms).join(','), (0, _toConsumableArray2["default"])(descriptions).join(',')];
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return [undefined, undefined];
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
key: "_getSOAndDescFromAltDefs",
|
|
168
|
+
value: function _getSOAndDescFromAltDefs(ref, alt) {
|
|
169
|
+
if (typeof alt === 'string' && !alt.startsWith('<')) {
|
|
170
|
+
return [undefined, undefined];
|
|
171
|
+
} // look for a definition with an SO type for this
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
var soTerm = VCFFeature._altTypeToSO[alt]; // if no SO term but ALT is in metadata, assume sequence_variant
|
|
175
|
+
|
|
176
|
+
if (!soTerm && this.parser.getMetadata('ALT', alt)) {
|
|
177
|
+
soTerm = 'sequence_variant';
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (soTerm) {
|
|
181
|
+
return [soTerm, alt];
|
|
182
|
+
} // try to look for a definition for a parent term if we can
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
var modAlt = alt.split(':');
|
|
186
|
+
|
|
187
|
+
if (modAlt.length > 1) {
|
|
188
|
+
return this._getSOAndDescFromAltDefs(ref, "<".concat(modAlt.slice(0, modAlt.length - 1).join(':'), ">"));
|
|
189
|
+
} // no parent
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
return [undefined, undefined];
|
|
193
|
+
} // note: term SNV is used instead of SNP because SO definition of SNP says
|
|
194
|
+
// abundance must be at least 1% in population, and can't be sure we meet
|
|
195
|
+
// that
|
|
196
|
+
|
|
197
|
+
}, {
|
|
198
|
+
key: "_getSOAndDescByExamination",
|
|
199
|
+
value: function _getSOAndDescByExamination(ref, alt) {
|
|
200
|
+
var bnd = (0, _vcf.parseBreakend)(alt);
|
|
201
|
+
|
|
202
|
+
if (bnd) {
|
|
203
|
+
return ['breakend', alt];
|
|
204
|
+
} else if (ref.length === 1 && alt.length === 1) {
|
|
205
|
+
return ['SNV', this._makeDescriptionString('SNV', ref, alt)];
|
|
206
|
+
} else if (alt === '<INS>') {
|
|
207
|
+
return ['insertion', alt];
|
|
208
|
+
} else if (alt === '<DEL>') {
|
|
209
|
+
return ['deletion', alt];
|
|
210
|
+
} else if (alt === '<INV>') {
|
|
211
|
+
return ['deletion', alt];
|
|
212
|
+
} else if (alt === '<TRA>') {
|
|
213
|
+
return ['translocation', alt];
|
|
214
|
+
} else if (alt.includes('<')) {
|
|
215
|
+
return ['sv', alt];
|
|
216
|
+
} else if (ref.length === alt.length) {
|
|
217
|
+
if (ref.split('').reverse().join('') === alt) {
|
|
218
|
+
return ['inversion', this._makeDescriptionString('inversion', ref, alt)];
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return ['substitution', this._makeDescriptionString('substitution', ref, alt)];
|
|
222
|
+
} else if (ref.length <= alt.length) {
|
|
223
|
+
return ['insertion', this._makeDescriptionString('insertion', ref, alt)];
|
|
224
|
+
} else if (ref.length > alt.length) {
|
|
225
|
+
return ['deletion', this._makeDescriptionString('deletion', ref, alt)];
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
return ['indel', this._makeDescriptionString('indel', ref, alt)];
|
|
229
|
+
}
|
|
230
|
+
}, {
|
|
231
|
+
key: "_makeDescriptionString",
|
|
232
|
+
value: function _makeDescriptionString(soTerm, ref, alt) {
|
|
233
|
+
return "".concat(soTerm, " ").concat(ref, " -> ").concat(alt);
|
|
234
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
235
|
+
|
|
236
|
+
}, {
|
|
237
|
+
key: "toJSON",
|
|
238
|
+
value: function toJSON() {
|
|
239
|
+
return _objectSpread(_objectSpread(_objectSpread({
|
|
240
|
+
uniqueId: this._id
|
|
241
|
+
}, this.variant), this.data), {}, {
|
|
242
|
+
samples: this.variant.SAMPLES
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
}]);
|
|
246
|
+
return VCFFeature;
|
|
247
|
+
}();
|
|
248
|
+
|
|
249
|
+
exports["default"] = VCFFeature;
|
|
250
|
+
(0, _defineProperty2["default"])(VCFFeature, "_altTypeToSO", {
|
|
251
|
+
DEL: 'deletion',
|
|
252
|
+
INS: 'insertion',
|
|
253
|
+
DUP: 'duplication',
|
|
254
|
+
INV: 'inversion',
|
|
255
|
+
INVDUP: 'inverted duplication',
|
|
256
|
+
CNV: 'copy_number_variation',
|
|
257
|
+
TRA: 'translocation',
|
|
258
|
+
'DUP:TANDEM': 'tandem_duplication',
|
|
259
|
+
NON_REF: 'sequence_variant',
|
|
260
|
+
'*': 'sequence_variant'
|
|
261
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _vcf = _interopRequireDefault(require("@gmod/vcf"));
|
|
6
|
+
|
|
7
|
+
var _VcfFeature = _interopRequireDefault(require("./VcfFeature"));
|
|
8
|
+
|
|
9
|
+
test('test usage of the VcfFeature', function () {
|
|
10
|
+
var parser = new _vcf["default"]({
|
|
11
|
+
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
12
|
+
});
|
|
13
|
+
var line = "lcl|Scaffald_1\t80465\trs118266897\tR\tA\t29\tPASS\tNS=3;0,14;AF=0.5;DB;112;PG2.1";
|
|
14
|
+
var variant = parser.parseLine(line);
|
|
15
|
+
var f = new _VcfFeature["default"]({
|
|
16
|
+
parser: parser,
|
|
17
|
+
variant: variant,
|
|
18
|
+
id: 'myuniqueid'
|
|
19
|
+
});
|
|
20
|
+
expect(f.id()).toEqual('myuniqueid');
|
|
21
|
+
expect(f.get('name')).toEqual('rs118266897');
|
|
22
|
+
});
|
|
23
|
+
test('try INS feature with END less than start', function () {
|
|
24
|
+
var parser = new _vcf["default"]({
|
|
25
|
+
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
26
|
+
});
|
|
27
|
+
var line = "chr1\t100\trs123\tR\tA\t29\tPASS\tEND=1;SVTYPE=INS";
|
|
28
|
+
var variant = parser.parseLine(line);
|
|
29
|
+
var f = new _VcfFeature["default"]({
|
|
30
|
+
parser: parser,
|
|
31
|
+
variant: variant,
|
|
32
|
+
id: 'myuniqueid'
|
|
33
|
+
});
|
|
34
|
+
expect(f.id()).toEqual('myuniqueid');
|
|
35
|
+
expect(f.get('start')).toEqual(99);
|
|
36
|
+
expect(f.get('end')).toEqual(100);
|
|
37
|
+
});
|
|
38
|
+
test('try DEL feature with END info field valid', function () {
|
|
39
|
+
var parser = new _vcf["default"]({
|
|
40
|
+
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
41
|
+
});
|
|
42
|
+
var line = "chr1\t100\trs123\tR\t<DEL>\t29\tPASS\tEND=1000;SVTYPE=DEL";
|
|
43
|
+
var variant = parser.parseLine(line);
|
|
44
|
+
var f = new _VcfFeature["default"]({
|
|
45
|
+
parser: parser,
|
|
46
|
+
variant: variant,
|
|
47
|
+
id: 'myuniqueid'
|
|
48
|
+
});
|
|
49
|
+
expect(f.id()).toEqual('myuniqueid');
|
|
50
|
+
expect(f.get('start')).toEqual(99);
|
|
51
|
+
expect(f.get('end')).toEqual(1000);
|
|
52
|
+
});
|
|
53
|
+
describe('test SV description', function () {
|
|
54
|
+
it('multiple SVs', function () {
|
|
55
|
+
var parser = new _vcf["default"]({
|
|
56
|
+
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
57
|
+
});
|
|
58
|
+
var line = "chr1\t100\trs123\tR\t<INVDUP>,<INV>\t29\tPASS\tEND=1000;SVTYPE=DEL";
|
|
59
|
+
var variant = parser.parseLine(line);
|
|
60
|
+
var f = new _VcfFeature["default"]({
|
|
61
|
+
parser: parser,
|
|
62
|
+
variant: variant,
|
|
63
|
+
id: 'myuniqueid'
|
|
64
|
+
});
|
|
65
|
+
expect(f.get('description')).toEqual('<INVDUP>,<INV>');
|
|
66
|
+
});
|
|
67
|
+
it('BND', function () {
|
|
68
|
+
var parser = new _vcf["default"]({
|
|
69
|
+
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
70
|
+
});
|
|
71
|
+
var line = "chr1\t100\trs123\tR\tG[ctgA:34200[\t29\tPASS\tEND=1000;SVTYPE=BND";
|
|
72
|
+
var variant = parser.parseLine(line);
|
|
73
|
+
var f = new _VcfFeature["default"]({
|
|
74
|
+
parser: parser,
|
|
75
|
+
variant: variant,
|
|
76
|
+
id: 'myuniqueid'
|
|
77
|
+
});
|
|
78
|
+
expect(f.get('description')).toEqual('G[ctgA:34200[');
|
|
79
|
+
});
|
|
80
|
+
it('multiple BND', function () {
|
|
81
|
+
var parser = new _vcf["default"]({
|
|
82
|
+
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
83
|
+
});
|
|
84
|
+
var line = "chr1\t100\trs123\tR\tG[ctgA:34200[,G[ctgA:44200[\t29\tPASS\tEND=1000;SVTYPE=BND";
|
|
85
|
+
var variant = parser.parseLine(line);
|
|
86
|
+
var f = new _VcfFeature["default"]({
|
|
87
|
+
parser: parser,
|
|
88
|
+
variant: variant,
|
|
89
|
+
id: 'myuniqueid'
|
|
90
|
+
});
|
|
91
|
+
expect(f.get('description')).toEqual('G[ctgA:34200[,G[ctgA:44200[');
|
|
92
|
+
});
|
|
93
|
+
it('multiple SNV', function () {
|
|
94
|
+
var parser = new _vcf["default"]({
|
|
95
|
+
header: "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tBAMs/caudaus.sorted.sam"
|
|
96
|
+
});
|
|
97
|
+
var line = "chr1\t100\trs123\tG\tA,C\t29\tPASS\tHELLO=world";
|
|
98
|
+
var variant = parser.parseLine(line);
|
|
99
|
+
var f = new _VcfFeature["default"]({
|
|
100
|
+
parser: parser,
|
|
101
|
+
variant: variant,
|
|
102
|
+
id: 'myuniqueid'
|
|
103
|
+
});
|
|
104
|
+
expect(f.get('description')).toEqual('SNV G -> A,C');
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -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
|
+
}
|