@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,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
1
|
import BED from '@gmod/bed'
|
|
3
2
|
import {
|
|
4
3
|
BaseFeatureDataAdapter,
|
|
@@ -14,7 +13,7 @@ import { AnyConfigurationModel } from '@jbrowse/core/configuration'
|
|
|
14
13
|
import { getSubAdapterType } from '@jbrowse/core/data_adapters/dataAdapterCache'
|
|
15
14
|
|
|
16
15
|
export default class BedTabixAdapter extends BaseFeatureDataAdapter {
|
|
17
|
-
private parser:
|
|
16
|
+
private parser: BED
|
|
18
17
|
|
|
19
18
|
protected bed: TabixIndexedFile
|
|
20
19
|
|
|
@@ -17,20 +17,8 @@ function isUCSC(f: Feature) {
|
|
|
17
17
|
return f.get('thickStart') && f.get('blockCount') && f.get('strand') !== 0
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
interface BEDFeature {
|
|
21
|
-
chrom: string
|
|
22
|
-
chromStart: number
|
|
23
|
-
chromEnd: number
|
|
24
|
-
[key: string]: any
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface Parser {
|
|
28
|
-
parseLine: (line: string, opts: { uniqueId: string | number }) => BEDFeature
|
|
29
|
-
autoSql: { fields: { name: string; comment: string }[] }
|
|
30
|
-
}
|
|
31
|
-
|
|
32
20
|
export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
33
|
-
private cached?: Promise<{ bigbed: BigBed; header: any; parser:
|
|
21
|
+
private cached?: Promise<{ bigbed: BigBed; header: any; parser: BED }>
|
|
34
22
|
|
|
35
23
|
public async configurePre(opts?: BaseOptions) {
|
|
36
24
|
const bigbed = new BigBed({
|
|
@@ -40,7 +28,7 @@ export default class BigBedAdapter extends BaseFeatureDataAdapter {
|
|
|
40
28
|
),
|
|
41
29
|
})
|
|
42
30
|
const header = await bigbed.getHeader(opts)
|
|
43
|
-
const parser = new BED({ autoSql: header.autoSql })
|
|
31
|
+
const parser = new BED({ autoSql: header.autoSql })
|
|
44
32
|
return { bigbed, header, parser }
|
|
45
33
|
}
|
|
46
34
|
|
package/src/util.ts
CHANGED
|
@@ -1,255 +0,0 @@
|
|
|
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 _BedAdapter = _interopRequireDefault(require("./BedAdapter"));
|
|
12
|
-
|
|
13
|
-
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
14
|
-
|
|
15
|
-
var _webEncoding = require("web-encoding");
|
|
16
|
-
|
|
17
|
-
if (!window.TextDecoder) {
|
|
18
|
-
window.TextDecoder = _webEncoding.TextDecoder;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
test('adapter can fetch features from volvox-bed12.bed', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
22
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
23
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
24
|
-
while (1) {
|
|
25
|
-
switch (_context.prev = _context.next) {
|
|
26
|
-
case 0:
|
|
27
|
-
adapter = new _BedAdapter.default(_configSchema.default.create({
|
|
28
|
-
bedLocation: {
|
|
29
|
-
localPath: require.resolve('./test_data/volvox-bed12.bed'),
|
|
30
|
-
locationType: 'LocalPathLocation'
|
|
31
|
-
}
|
|
32
|
-
}));
|
|
33
|
-
features = adapter.getFeatures({
|
|
34
|
-
refName: 'ctgA',
|
|
35
|
-
start: 0,
|
|
36
|
-
end: 20000,
|
|
37
|
-
assemblyName: 'volvox'
|
|
38
|
-
});
|
|
39
|
-
_context.t0 = expect;
|
|
40
|
-
_context.next = 5;
|
|
41
|
-
return adapter.hasDataForRefName('ctgA');
|
|
42
|
-
|
|
43
|
-
case 5:
|
|
44
|
-
_context.t1 = _context.sent;
|
|
45
|
-
(0, _context.t0)(_context.t1).toBe(true);
|
|
46
|
-
_context.t2 = expect;
|
|
47
|
-
_context.next = 10;
|
|
48
|
-
return adapter.hasDataForRefName('ctgB');
|
|
49
|
-
|
|
50
|
-
case 10:
|
|
51
|
-
_context.t3 = _context.sent;
|
|
52
|
-
(0, _context.t2)(_context.t3).toBe(false);
|
|
53
|
-
_context.next = 14;
|
|
54
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
55
|
-
|
|
56
|
-
case 14:
|
|
57
|
-
featuresArray = _context.sent;
|
|
58
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
59
|
-
return f.toJSON();
|
|
60
|
-
});
|
|
61
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
62
|
-
|
|
63
|
-
case 17:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, _callee);
|
|
69
|
-
})));
|
|
70
|
-
test('adapter can fetch features from volvox.sort.bed simple bed3', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
71
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
72
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
73
|
-
while (1) {
|
|
74
|
-
switch (_context2.prev = _context2.next) {
|
|
75
|
-
case 0:
|
|
76
|
-
adapter = new _BedAdapter.default(_configSchema.default.create({
|
|
77
|
-
bedLocation: {
|
|
78
|
-
localPath: require.resolve('./test_data/volvox.sort.bed'),
|
|
79
|
-
locationType: 'LocalPathLocation'
|
|
80
|
-
}
|
|
81
|
-
}));
|
|
82
|
-
features = adapter.getFeatures({
|
|
83
|
-
refName: 'contigA',
|
|
84
|
-
start: 0,
|
|
85
|
-
end: 20000,
|
|
86
|
-
assemblyName: 'volvox'
|
|
87
|
-
});
|
|
88
|
-
_context2.t0 = expect;
|
|
89
|
-
_context2.next = 5;
|
|
90
|
-
return adapter.hasDataForRefName('contigA');
|
|
91
|
-
|
|
92
|
-
case 5:
|
|
93
|
-
_context2.t1 = _context2.sent;
|
|
94
|
-
(0, _context2.t0)(_context2.t1).toBe(true);
|
|
95
|
-
_context2.t2 = expect;
|
|
96
|
-
_context2.next = 10;
|
|
97
|
-
return adapter.hasDataForRefName('ctgB');
|
|
98
|
-
|
|
99
|
-
case 10:
|
|
100
|
-
_context2.t3 = _context2.sent;
|
|
101
|
-
(0, _context2.t2)(_context2.t3).toBe(false);
|
|
102
|
-
_context2.next = 14;
|
|
103
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
104
|
-
|
|
105
|
-
case 14:
|
|
106
|
-
featuresArray = _context2.sent;
|
|
107
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
108
|
-
return f.toJSON();
|
|
109
|
-
});
|
|
110
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
111
|
-
|
|
112
|
-
case 17:
|
|
113
|
-
case "end":
|
|
114
|
-
return _context2.stop();
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}, _callee2);
|
|
118
|
-
})));
|
|
119
|
-
test('adapter can fetch features bed with autosql', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
120
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
121
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
122
|
-
while (1) {
|
|
123
|
-
switch (_context3.prev = _context3.next) {
|
|
124
|
-
case 0:
|
|
125
|
-
adapter = new _BedAdapter.default(_configSchema.default.create({
|
|
126
|
-
bedLocation: {
|
|
127
|
-
localPath: require.resolve('./test_data/volvox-autosql.bed'),
|
|
128
|
-
locationType: 'LocalPathLocation'
|
|
129
|
-
},
|
|
130
|
-
autoSql: "table gdcCancer\n\"somatic variants converted from MAF files obtained through the NCI GDC\"\n (\n string chrom; \"Chromosome (or contig, scaffold, etc.)\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name of item\"\n uint score; \"Score from 0-1000\"\n char[1] strand; \"+ or -\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"Used as itemRgb as of 2004-11-22\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n string sampleCount; \"Number of samples with this variant\"\n string freq; \"Variant frequency\"\n lstring Hugo_Symbol; \"Hugo symbol\"\n lstring Entrez_Gene_Id; \"Entrez Gene Id\"\n lstring Variant_Classification; \"Class of variant\"\n lstring Variant_Type; \"Type of variant\"\n lstring Reference_Allele; \"Reference allele\"\n lstring Tumor_Seq_Allele1; \"Tumor allele 1\"\n lstring Tumor_Seq_Allele2; \"Tumor allele 2\"\n lstring dbSNP_RS; \"dbSNP RS number\"\n lstring dbSNP_Val_Status; \"dbSNP validation status\"\n lstring days_to_death; \"Number of days till death\"\n lstring cigarettes_per_day; \"Number of cigarettes per day\"\n lstring weight; \"Weight\"\n lstring alcohol_history; \"Any alcohol consumption?\"\n lstring alcohol_intensity; \"Frequency of alcohol consumption\"\n lstring bmi; \"Body mass index\"\n lstring years_smoked; \"Number of years smoked\"\n lstring height; \"Height\"\n lstring gender; \"Gender\"\n lstring project_id; \"TCGA Project id\"\n lstring ethnicity; \"Ethnicity\"\n lstring Tumor_Sample_Barcode; \"Tumor sample barcode\"\n lstring Matched_Norm_Sample_Barcode; \"Matcheds normal sample barcode\"\n lstring case_id; \"Case ID number\"\n)"
|
|
131
|
-
}));
|
|
132
|
-
features = adapter.getFeatures({
|
|
133
|
-
refName: 'ctgA',
|
|
134
|
-
start: 0,
|
|
135
|
-
end: 20000,
|
|
136
|
-
assemblyName: 'volvox'
|
|
137
|
-
});
|
|
138
|
-
_context3.t0 = expect;
|
|
139
|
-
_context3.next = 5;
|
|
140
|
-
return adapter.hasDataForRefName('ctgA');
|
|
141
|
-
|
|
142
|
-
case 5:
|
|
143
|
-
_context3.t1 = _context3.sent;
|
|
144
|
-
(0, _context3.t0)(_context3.t1).toBe(true);
|
|
145
|
-
_context3.t2 = expect;
|
|
146
|
-
_context3.next = 10;
|
|
147
|
-
return adapter.hasDataForRefName('ctgB');
|
|
148
|
-
|
|
149
|
-
case 10:
|
|
150
|
-
_context3.t3 = _context3.sent;
|
|
151
|
-
(0, _context3.t2)(_context3.t3).toBe(false);
|
|
152
|
-
_context3.next = 14;
|
|
153
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
154
|
-
|
|
155
|
-
case 14:
|
|
156
|
-
featuresArray = _context3.sent;
|
|
157
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
158
|
-
return f.toJSON();
|
|
159
|
-
});
|
|
160
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
161
|
-
|
|
162
|
-
case 17:
|
|
163
|
-
case "end":
|
|
164
|
-
return _context3.stop();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}, _callee3);
|
|
168
|
-
})));
|
|
169
|
-
test('adapter can fetch bed with header', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
170
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
171
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
172
|
-
while (1) {
|
|
173
|
-
switch (_context4.prev = _context4.next) {
|
|
174
|
-
case 0:
|
|
175
|
-
adapter = new _BedAdapter.default(_configSchema.default.create({
|
|
176
|
-
bedLocation: {
|
|
177
|
-
localPath: require.resolve('./test_data/volvox.sort.with.header.bed'),
|
|
178
|
-
locationType: 'LocalPathLocation'
|
|
179
|
-
}
|
|
180
|
-
}));
|
|
181
|
-
features = adapter.getFeatures({
|
|
182
|
-
refName: 'contigA',
|
|
183
|
-
start: 0,
|
|
184
|
-
end: 20000,
|
|
185
|
-
assemblyName: 'volvox'
|
|
186
|
-
});
|
|
187
|
-
_context4.t0 = expect;
|
|
188
|
-
_context4.next = 5;
|
|
189
|
-
return adapter.hasDataForRefName('contigA');
|
|
190
|
-
|
|
191
|
-
case 5:
|
|
192
|
-
_context4.t1 = _context4.sent;
|
|
193
|
-
(0, _context4.t0)(_context4.t1).toBe(true);
|
|
194
|
-
_context4.t2 = expect;
|
|
195
|
-
_context4.next = 10;
|
|
196
|
-
return adapter.hasDataForRefName('ctgB');
|
|
197
|
-
|
|
198
|
-
case 10:
|
|
199
|
-
_context4.t3 = _context4.sent;
|
|
200
|
-
(0, _context4.t2)(_context4.t3).toBe(false);
|
|
201
|
-
_context4.next = 14;
|
|
202
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
203
|
-
|
|
204
|
-
case 14:
|
|
205
|
-
featuresArray = _context4.sent;
|
|
206
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
207
|
-
return f.toJSON();
|
|
208
|
-
});
|
|
209
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
210
|
-
|
|
211
|
-
case 17:
|
|
212
|
-
case "end":
|
|
213
|
-
return _context4.stop();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
}, _callee4);
|
|
217
|
-
})));
|
|
218
|
-
test('adapter can use gwas header', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
219
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
220
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
221
|
-
while (1) {
|
|
222
|
-
switch (_context5.prev = _context5.next) {
|
|
223
|
-
case 0:
|
|
224
|
-
adapter = new _BedAdapter.default(_configSchema.default.create({
|
|
225
|
-
bedLocation: {
|
|
226
|
-
localPath: require.resolve('./test_data/gwas.bed'),
|
|
227
|
-
locationType: 'LocalPathLocation'
|
|
228
|
-
},
|
|
229
|
-
colRef: 0,
|
|
230
|
-
colStart: 1,
|
|
231
|
-
colEnd: 1
|
|
232
|
-
}));
|
|
233
|
-
features = adapter.getFeatures({
|
|
234
|
-
refName: '1',
|
|
235
|
-
start: 0,
|
|
236
|
-
end: 100000,
|
|
237
|
-
assemblyName: 'hg19'
|
|
238
|
-
});
|
|
239
|
-
_context5.next = 4;
|
|
240
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
241
|
-
|
|
242
|
-
case 4:
|
|
243
|
-
featuresArray = _context5.sent;
|
|
244
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
245
|
-
return f.toJSON();
|
|
246
|
-
});
|
|
247
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
248
|
-
|
|
249
|
-
case 7:
|
|
250
|
-
case "end":
|
|
251
|
-
return _context5.stop();
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}, _callee5);
|
|
255
|
-
})));
|
|
@@ -1,276 +0,0 @@
|
|
|
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 _BedTabixAdapter = _interopRequireDefault(require("./BedTabixAdapter"));
|
|
12
|
-
|
|
13
|
-
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
14
|
-
|
|
15
|
-
test('adapter can fetch features from volvox-bed12.bed.gz', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
16
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
17
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
adapter = new _BedTabixAdapter.default(_configSchema.default.create({
|
|
22
|
-
bedGzLocation: {
|
|
23
|
-
localPath: require.resolve('./test_data/volvox-bed12.bed.gz'),
|
|
24
|
-
locationType: 'LocalPathLocation'
|
|
25
|
-
},
|
|
26
|
-
index: {
|
|
27
|
-
location: {
|
|
28
|
-
localPath: require.resolve('./test_data/volvox-bed12.bed.gz.tbi'),
|
|
29
|
-
locationType: 'LocalPathLocation'
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}));
|
|
33
|
-
features = adapter.getFeatures({
|
|
34
|
-
refName: 'ctgA',
|
|
35
|
-
start: 0,
|
|
36
|
-
end: 20000,
|
|
37
|
-
assemblyName: 'volvox'
|
|
38
|
-
});
|
|
39
|
-
_context.t0 = expect;
|
|
40
|
-
_context.next = 5;
|
|
41
|
-
return adapter.hasDataForRefName('ctgA');
|
|
42
|
-
|
|
43
|
-
case 5:
|
|
44
|
-
_context.t1 = _context.sent;
|
|
45
|
-
(0, _context.t0)(_context.t1).toBe(true);
|
|
46
|
-
_context.t2 = expect;
|
|
47
|
-
_context.next = 10;
|
|
48
|
-
return adapter.hasDataForRefName('ctgB');
|
|
49
|
-
|
|
50
|
-
case 10:
|
|
51
|
-
_context.t3 = _context.sent;
|
|
52
|
-
(0, _context.t2)(_context.t3).toBe(false);
|
|
53
|
-
_context.next = 14;
|
|
54
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
55
|
-
|
|
56
|
-
case 14:
|
|
57
|
-
featuresArray = _context.sent;
|
|
58
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
59
|
-
return f.toJSON();
|
|
60
|
-
});
|
|
61
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
62
|
-
|
|
63
|
-
case 17:
|
|
64
|
-
case "end":
|
|
65
|
-
return _context.stop();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, _callee);
|
|
69
|
-
})));
|
|
70
|
-
test('adapter can fetch features from volvox.sort.bed.gz simple bed3', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
71
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
72
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
73
|
-
while (1) {
|
|
74
|
-
switch (_context2.prev = _context2.next) {
|
|
75
|
-
case 0:
|
|
76
|
-
adapter = new _BedTabixAdapter.default(_configSchema.default.create({
|
|
77
|
-
bedGzLocation: {
|
|
78
|
-
localPath: require.resolve('./test_data/volvox.sort.bed.gz'),
|
|
79
|
-
locationType: 'LocalPathLocation'
|
|
80
|
-
},
|
|
81
|
-
index: {
|
|
82
|
-
location: {
|
|
83
|
-
localPath: require.resolve('./test_data/volvox.sort.bed.gz.tbi'),
|
|
84
|
-
locationType: 'LocalPathLocation'
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}));
|
|
88
|
-
features = adapter.getFeatures({
|
|
89
|
-
refName: 'contigA',
|
|
90
|
-
start: 0,
|
|
91
|
-
end: 20000,
|
|
92
|
-
assemblyName: 'volvox'
|
|
93
|
-
});
|
|
94
|
-
_context2.t0 = expect;
|
|
95
|
-
_context2.next = 5;
|
|
96
|
-
return adapter.hasDataForRefName('contigA');
|
|
97
|
-
|
|
98
|
-
case 5:
|
|
99
|
-
_context2.t1 = _context2.sent;
|
|
100
|
-
(0, _context2.t0)(_context2.t1).toBe(true);
|
|
101
|
-
_context2.t2 = expect;
|
|
102
|
-
_context2.next = 10;
|
|
103
|
-
return adapter.hasDataForRefName('ctgB');
|
|
104
|
-
|
|
105
|
-
case 10:
|
|
106
|
-
_context2.t3 = _context2.sent;
|
|
107
|
-
(0, _context2.t2)(_context2.t3).toBe(false);
|
|
108
|
-
_context2.next = 14;
|
|
109
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
110
|
-
|
|
111
|
-
case 14:
|
|
112
|
-
featuresArray = _context2.sent;
|
|
113
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
114
|
-
return f.toJSON();
|
|
115
|
-
});
|
|
116
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
117
|
-
|
|
118
|
-
case 17:
|
|
119
|
-
case "end":
|
|
120
|
-
return _context2.stop();
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}, _callee2);
|
|
124
|
-
})));
|
|
125
|
-
test('adapter can fetch features bed with autosql', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
126
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
127
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
128
|
-
while (1) {
|
|
129
|
-
switch (_context3.prev = _context3.next) {
|
|
130
|
-
case 0:
|
|
131
|
-
adapter = new _BedTabixAdapter.default(_configSchema.default.create({
|
|
132
|
-
bedGzLocation: {
|
|
133
|
-
localPath: require.resolve('./test_data/volvox-autosql.bed.gz'),
|
|
134
|
-
locationType: 'LocalPathLocation'
|
|
135
|
-
},
|
|
136
|
-
index: {
|
|
137
|
-
location: {
|
|
138
|
-
localPath: require.resolve('./test_data/volvox-autosql.bed.gz.tbi'),
|
|
139
|
-
locationType: 'LocalPathLocation'
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
autoSql: "table gdcCancer\n\"somatic variants converted from MAF files obtained through the NCI GDC\"\n (\n string chrom; \"Chromosome (or contig, scaffold, etc.)\"\n uint chromStart; \"Start position in chromosome\"\n uint chromEnd; \"End position in chromosome\"\n string name; \"Name of item\"\n uint score; \"Score from 0-1000\"\n char[1] strand; \"+ or -\"\n uint thickStart; \"Start of where display should be thick (start codon)\"\n uint thickEnd; \"End of where display should be thick (stop codon)\"\n uint reserved; \"Used as itemRgb as of 2004-11-22\"\n int blockCount; \"Number of blocks\"\n int[blockCount] blockSizes; \"Comma separated list of block sizes\"\n int[blockCount] chromStarts; \"Start positions relative to chromStart\"\n string sampleCount; \"Number of samples with this variant\"\n string freq; \"Variant frequency\"\n lstring Hugo_Symbol; \"Hugo symbol\"\n lstring Entrez_Gene_Id; \"Entrez Gene Id\"\n lstring Variant_Classification; \"Class of variant\"\n lstring Variant_Type; \"Type of variant\"\n lstring Reference_Allele; \"Reference allele\"\n lstring Tumor_Seq_Allele1; \"Tumor allele 1\"\n lstring Tumor_Seq_Allele2; \"Tumor allele 2\"\n lstring dbSNP_RS; \"dbSNP RS number\"\n lstring dbSNP_Val_Status; \"dbSNP validation status\"\n lstring days_to_death; \"Number of days till death\"\n lstring cigarettes_per_day; \"Number of cigarettes per day\"\n lstring weight; \"Weight\"\n lstring alcohol_history; \"Any alcohol consumption?\"\n lstring alcohol_intensity; \"Frequency of alcohol consumption\"\n lstring bmi; \"Body mass index\"\n lstring years_smoked; \"Number of years smoked\"\n lstring height; \"Height\"\n lstring gender; \"Gender\"\n lstring project_id; \"TCGA Project id\"\n lstring ethnicity; \"Ethnicity\"\n lstring Tumor_Sample_Barcode; \"Tumor sample barcode\"\n lstring Matched_Norm_Sample_Barcode; \"Matcheds normal sample barcode\"\n lstring case_id; \"Case ID number\"\n)"
|
|
143
|
-
}));
|
|
144
|
-
features = adapter.getFeatures({
|
|
145
|
-
refName: 'ctgA',
|
|
146
|
-
start: 0,
|
|
147
|
-
end: 20000,
|
|
148
|
-
assemblyName: 'volvox'
|
|
149
|
-
});
|
|
150
|
-
_context3.t0 = expect;
|
|
151
|
-
_context3.next = 5;
|
|
152
|
-
return adapter.hasDataForRefName('ctgA');
|
|
153
|
-
|
|
154
|
-
case 5:
|
|
155
|
-
_context3.t1 = _context3.sent;
|
|
156
|
-
(0, _context3.t0)(_context3.t1).toBe(true);
|
|
157
|
-
_context3.t2 = expect;
|
|
158
|
-
_context3.next = 10;
|
|
159
|
-
return adapter.hasDataForRefName('ctgB');
|
|
160
|
-
|
|
161
|
-
case 10:
|
|
162
|
-
_context3.t3 = _context3.sent;
|
|
163
|
-
(0, _context3.t2)(_context3.t3).toBe(false);
|
|
164
|
-
_context3.next = 14;
|
|
165
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
166
|
-
|
|
167
|
-
case 14:
|
|
168
|
-
featuresArray = _context3.sent;
|
|
169
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
170
|
-
return f.toJSON();
|
|
171
|
-
});
|
|
172
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
173
|
-
|
|
174
|
-
case 17:
|
|
175
|
-
case "end":
|
|
176
|
-
return _context3.stop();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}, _callee3);
|
|
180
|
-
})));
|
|
181
|
-
test('adapter can fetch bed with header', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
182
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
183
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
184
|
-
while (1) {
|
|
185
|
-
switch (_context4.prev = _context4.next) {
|
|
186
|
-
case 0:
|
|
187
|
-
adapter = new _BedTabixAdapter.default(_configSchema.default.create({
|
|
188
|
-
bedGzLocation: {
|
|
189
|
-
localPath: require.resolve('./test_data/volvox.sort.with.header.bed.gz'),
|
|
190
|
-
locationType: 'LocalPathLocation'
|
|
191
|
-
},
|
|
192
|
-
index: {
|
|
193
|
-
location: {
|
|
194
|
-
localPath: require.resolve('./test_data/volvox.sort.with.header.bed.gz.tbi'),
|
|
195
|
-
locationType: 'LocalPathLocation'
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}));
|
|
199
|
-
features = adapter.getFeatures({
|
|
200
|
-
refName: 'contigA',
|
|
201
|
-
start: 0,
|
|
202
|
-
end: 20000,
|
|
203
|
-
assemblyName: 'volvox'
|
|
204
|
-
});
|
|
205
|
-
_context4.t0 = expect;
|
|
206
|
-
_context4.next = 5;
|
|
207
|
-
return adapter.hasDataForRefName('contigA');
|
|
208
|
-
|
|
209
|
-
case 5:
|
|
210
|
-
_context4.t1 = _context4.sent;
|
|
211
|
-
(0, _context4.t0)(_context4.t1).toBe(true);
|
|
212
|
-
_context4.t2 = expect;
|
|
213
|
-
_context4.next = 10;
|
|
214
|
-
return adapter.hasDataForRefName('ctgB');
|
|
215
|
-
|
|
216
|
-
case 10:
|
|
217
|
-
_context4.t3 = _context4.sent;
|
|
218
|
-
(0, _context4.t2)(_context4.t3).toBe(false);
|
|
219
|
-
_context4.next = 14;
|
|
220
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
221
|
-
|
|
222
|
-
case 14:
|
|
223
|
-
featuresArray = _context4.sent;
|
|
224
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
225
|
-
return f.toJSON();
|
|
226
|
-
});
|
|
227
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
228
|
-
|
|
229
|
-
case 17:
|
|
230
|
-
case "end":
|
|
231
|
-
return _context4.stop();
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
}, _callee4);
|
|
235
|
-
})));
|
|
236
|
-
test('adapter can use gwas header', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
237
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
238
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
239
|
-
while (1) {
|
|
240
|
-
switch (_context5.prev = _context5.next) {
|
|
241
|
-
case 0:
|
|
242
|
-
adapter = new _BedTabixAdapter.default(_configSchema.default.create({
|
|
243
|
-
bedGzLocation: {
|
|
244
|
-
localPath: require.resolve('./test_data/gwas.bed.gz'),
|
|
245
|
-
locationType: 'LocalPathLocation'
|
|
246
|
-
},
|
|
247
|
-
index: {
|
|
248
|
-
location: {
|
|
249
|
-
localPath: require.resolve('./test_data/gwas.bed.gz.tbi'),
|
|
250
|
-
locationType: 'LocalPathLocation'
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}));
|
|
254
|
-
features = adapter.getFeatures({
|
|
255
|
-
refName: '1',
|
|
256
|
-
start: 0,
|
|
257
|
-
end: 100000,
|
|
258
|
-
assemblyName: 'hg19'
|
|
259
|
-
});
|
|
260
|
-
_context5.next = 4;
|
|
261
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
262
|
-
|
|
263
|
-
case 4:
|
|
264
|
-
featuresArray = _context5.sent;
|
|
265
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
266
|
-
return f.toJSON();
|
|
267
|
-
});
|
|
268
|
-
expect(featuresJsonArray.slice(0, 10)).toMatchSnapshot();
|
|
269
|
-
|
|
270
|
-
case 7:
|
|
271
|
-
case "end":
|
|
272
|
-
return _context5.stop();
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}, _callee5);
|
|
276
|
-
})));
|
|
@@ -1,63 +0,0 @@
|
|
|
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 _BigBedAdapter = _interopRequireDefault(require("./BigBedAdapter"));
|
|
12
|
-
|
|
13
|
-
var _configSchema = _interopRequireDefault(require("./configSchema"));
|
|
14
|
-
|
|
15
|
-
test('adapter can fetch features from volvox.bb', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
16
|
-
var adapter, features, featuresArray, featuresJsonArray;
|
|
17
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
switch (_context.prev = _context.next) {
|
|
20
|
-
case 0:
|
|
21
|
-
adapter = new _BigBedAdapter.default(_configSchema.default.create({
|
|
22
|
-
bigBedLocation: {
|
|
23
|
-
localPath: require.resolve('./test_data/volvox.bb'),
|
|
24
|
-
locationType: 'LocalPathLocation'
|
|
25
|
-
}
|
|
26
|
-
}));
|
|
27
|
-
features = adapter.getFeatures({
|
|
28
|
-
assemblyName: 'volvox',
|
|
29
|
-
refName: 'ctgA',
|
|
30
|
-
start: 0,
|
|
31
|
-
end: 20000
|
|
32
|
-
});
|
|
33
|
-
_context.t0 = expect;
|
|
34
|
-
_context.next = 5;
|
|
35
|
-
return adapter.hasDataForRefName('ctgA');
|
|
36
|
-
|
|
37
|
-
case 5:
|
|
38
|
-
_context.t1 = _context.sent;
|
|
39
|
-
(0, _context.t0)(_context.t1).toBe(true);
|
|
40
|
-
_context.t2 = expect;
|
|
41
|
-
_context.next = 10;
|
|
42
|
-
return adapter.hasDataForRefName('ctgB');
|
|
43
|
-
|
|
44
|
-
case 10:
|
|
45
|
-
_context.t3 = _context.sent;
|
|
46
|
-
(0, _context.t2)(_context.t3).toBe(false);
|
|
47
|
-
_context.next = 14;
|
|
48
|
-
return features.pipe((0, _operators.toArray)()).toPromise();
|
|
49
|
-
|
|
50
|
-
case 14:
|
|
51
|
-
featuresArray = _context.sent;
|
|
52
|
-
featuresJsonArray = featuresArray.map(function (f) {
|
|
53
|
-
return f.toJSON();
|
|
54
|
-
});
|
|
55
|
-
expect(featuresJsonArray).toMatchSnapshot();
|
|
56
|
-
|
|
57
|
-
case 17:
|
|
58
|
-
case "end":
|
|
59
|
-
return _context.stop();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}, _callee);
|
|
63
|
-
})));
|
package/dist/declare.d.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/index.test.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _PluginManager = _interopRequireDefault(require("@jbrowse/core/PluginManager"));
|
|
6
|
-
|
|
7
|
-
var _mobxStateTree = require("mobx-state-tree");
|
|
8
|
-
|
|
9
|
-
var _ = _interopRequireDefault(require("."));
|
|
10
|
-
|
|
11
|
-
test('plugin in a stock JBrowse', function () {
|
|
12
|
-
console.warn = jest.fn();
|
|
13
|
-
var pluginManager = new _PluginManager.default([new _.default()]);
|
|
14
|
-
pluginManager.createPluggableElements();
|
|
15
|
-
pluginManager.configure();
|
|
16
|
-
expect(function () {
|
|
17
|
-
return pluginManager.addPlugin(new _.default());
|
|
18
|
-
}).toThrow(/JBrowse already configured, cannot add plugins/);
|
|
19
|
-
var BigBedAdapter = pluginManager.getAdapterType('BigBedAdapter');
|
|
20
|
-
var config = BigBedAdapter.configSchema.create({
|
|
21
|
-
type: 'BigBedAdapter'
|
|
22
|
-
});
|
|
23
|
-
expect((0, _mobxStateTree.getSnapshot)(config)).toMatchSnapshot();
|
|
24
|
-
});
|
package/src/declare.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module '@gmod/bed'
|