@gmod/bbi 1.0.31 → 1.0.34
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/CHANGELOG.md +25 -59
- package/dist/blockView.js +33 -35
- package/dist/unzip-pako.d.ts +2 -0
- package/dist/unzip-pako.js +8 -0
- package/dist/unzip.d.ts +2 -0
- package/dist/unzip.js +5 -0
- package/esm/blockView.js +36 -38
- package/esm/unzip-pako.d.ts +2 -0
- package/esm/unzip-pako.js +8 -0
- package/esm/unzip.d.ts +2 -0
- package/esm/unzip.js +5 -0
- package/package.json +15 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,34 +1,49 @@
|
|
|
1
|
-
## [1.0.
|
|
1
|
+
## [1.0.34](https://github.com/GMOD/bbi-js/compare/v1.0.33...v1.0.34) (2022-03-11)
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
### Reverts
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
* Revert "Use subarray instead of slice since slice is deprecated under node xref 'https://nodejs.org/api/buffer.html#bufslicestart-end'" ([44116cc](https://github.com/GMOD/bbi-js/commit/44116cce54601727d37f1c449bfcc60c1b4e602d))
|
|
6
7
|
|
|
7
|
-
## [1.0.30](https://github.com/GMOD/bbi-js/compare/v1.0.29...v1.0.30) (2020-06-25)
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
- Back to slice instead of subarray, as subarray returned a UInt8Array instead
|
|
11
|
+
of a true Buffer
|
|
10
12
|
|
|
11
|
-
-
|
|
12
|
-
- Allow opts parameter to getHeader instead of just abortsignal
|
|
13
|
+
## [1.0.33](https://github.com/GMOD/bbi-js/compare/v1.0.32...v1.0.33) (2022-02-25)
|
|
13
14
|
|
|
14
|
-
## [1.0.29](https://github.com/GMOD/bbi-js/compare/v1.0.28...v1.0.29) (2020-01-28)
|
|
15
15
|
|
|
16
16
|
|
|
17
|
+
- Use subarray instead of slice since slice is deprecated under node xref
|
|
18
|
+
'https://nodejs.org/api/buffer.html#bufslicestart-end'"
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
## [1.0.32](https://github.com/GMOD/bbi-js/compare/v1.0.31...v1.0.32) (2022-02-16)
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
## [1.0.28](https://github.com/GMOD/bbi-js/compare/v1.0.27...v1.0.28) (2020-01-28)
|
|
22
23
|
|
|
24
|
+
- Use pako to decode on command line instead of using zlib to avoid need to
|
|
25
|
+
manually polyfill zlib
|
|
23
26
|
|
|
27
|
+
## [1.0.31](https://github.com/GMOD/bbi-js/compare/v1.0.30...v1.0.31) (2021-12-14)
|
|
28
|
+
|
|
29
|
+
- Add esm module builds with less babelification for smaller bundle sizes
|
|
30
|
+
|
|
31
|
+
## [1.0.30](https://github.com/GMOD/bbi-js/compare/v1.0.29...v1.0.30) (2020-06-25)
|
|
32
|
+
|
|
33
|
+
- Use abortable-promise-cache instead of abortable-memoize
|
|
34
|
+
- Allow opts parameter to getHeader instead of just abortsignal
|
|
35
|
+
|
|
36
|
+
## [1.0.29](https://github.com/GMOD/bbi-js/compare/v1.0.28...v1.0.29) (2020-01-28)
|
|
37
|
+
|
|
38
|
+
- Accidentally made the package include itself as dependency in 1.0.28, republish
|
|
39
|
+
|
|
40
|
+
## [1.0.28](https://github.com/GMOD/bbi-js/compare/v1.0.27...v1.0.28) (2020-01-28)
|
|
24
41
|
|
|
25
42
|
- Change typescript interface to use object keys instead of Map type for refsByName, refsById
|
|
26
43
|
- Typescript only release change
|
|
27
44
|
|
|
28
45
|
## [1.0.27](https://github.com/GMOD/bbi-js/compare/v1.0.26...v1.0.27) (2020-01-10)
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
|
|
32
47
|
- Reduce number of requests needed on initial header
|
|
33
48
|
- Add definedFieldCount to the returned Header
|
|
34
49
|
|
|
@@ -36,8 +51,6 @@ Thanks to @skinner for both of these contributions!
|
|
|
36
51
|
|
|
37
52
|
## [1.0.26](https://github.com/GMOD/bbi-js/compare/v1.0.25...v1.0.26) (2019-11-10)
|
|
38
53
|
|
|
39
|
-
|
|
40
|
-
|
|
41
54
|
- Fix important bug with fixed step bigwig files not using the proper start coordinate
|
|
42
55
|
|
|
43
56
|
## [1.0.25](https://github.com/GMOD/bbi-js/compare/v1.0.24...v1.0.25) (2019-11-03)
|
|
@@ -46,138 +59,97 @@ Thanks to @skinner for both of these contributions!
|
|
|
46
59
|
|
|
47
60
|
## [1.0.24](https://github.com/GMOD/bbi-js/compare/v1.0.23...v1.0.24) (2019-10-29)
|
|
48
61
|
|
|
49
|
-
|
|
50
|
-
|
|
51
62
|
- Fix the uniqueIds generated via the bigbed features
|
|
52
63
|
|
|
53
64
|
## [1.0.23](https://github.com/GMOD/bbi-js/compare/v1.0.22...v1.0.23) (2019-10-06)
|
|
54
65
|
|
|
55
|
-
|
|
56
66
|
- Small refactor of `filehandle.read()` to make it more robust
|
|
57
67
|
|
|
58
|
-
|
|
59
68
|
## [1.0.22](https://github.com/GMOD/bbi-js/compare/v1.0.21...v1.0.22) (2019-06-13)
|
|
60
69
|
|
|
61
|
-
|
|
62
|
-
|
|
63
70
|
- Bump generic-filehandle
|
|
64
71
|
- Add more checks for abort signal to allow early bailing
|
|
65
72
|
|
|
66
73
|
## [1.0.21](https://github.com/GMOD/bbi-js/compare/v1.0.20...v1.0.21) (2019-05-09)
|
|
67
74
|
|
|
68
|
-
|
|
69
|
-
|
|
70
75
|
- Add fix for reading files with greater than 256 contigs
|
|
71
76
|
|
|
72
77
|
## [1.0.20](https://github.com/GMOD/bbi-js/compare/v1.0.19...v1.0.20) (2019-05-06)
|
|
73
78
|
|
|
74
|
-
|
|
75
|
-
|
|
76
79
|
- Add fix that prevented accessing the lowest zoom/reduction level
|
|
77
80
|
|
|
78
81
|
## [1.0.19](https://github.com/GMOD/bbi-js/compare/v1.0.18...v1.0.19) (2019-05-02)
|
|
79
82
|
|
|
80
|
-
|
|
81
|
-
|
|
82
83
|
- Add regression fix since 1.0.16 for uncompressed files. Thanks to @lidaof for reporting!
|
|
83
84
|
|
|
84
85
|
## [1.0.18](https://github.com/GMOD/bbi-js/compare/v1.0.17...v1.0.18) (2019-05-02)
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
87
|
- Improve error handling of the observables (issue #20, pull #21)
|
|
89
88
|
- Bump generic-filehandle to 1.0.9 to fix compatibility with native browser fetch
|
|
90
89
|
|
|
91
90
|
## [1.0.17](https://github.com/GMOD/bbi-js/compare/v1.0.16...v1.0.17) (2019-04-30)
|
|
92
91
|
|
|
93
|
-
|
|
94
|
-
|
|
95
92
|
- Use some standard rxjs notions for combining operator results
|
|
96
93
|
- Add parsing of the extraIndex data in BigBed, allowing you to call bigbed.searchExtraIndex(name[,opts])
|
|
97
94
|
|
|
98
95
|
## [1.0.16](https://github.com/GMOD/bbi-js/compare/v1.0.15...v1.0.16) (2019-04-23)
|
|
99
96
|
|
|
100
|
-
|
|
101
|
-
|
|
102
97
|
- Pre-compile binary-parser instances for faster
|
|
103
98
|
- Important: fixed bug that caused bigwig summary blocks to not be returned in output
|
|
104
99
|
|
|
105
100
|
## [1.0.15](https://github.com/GMOD/bbi-js/compare/v1.0.14...v1.0.15) (2019-04-18)
|
|
106
101
|
|
|
107
|
-
|
|
108
|
-
|
|
109
102
|
- Make important performance improvement for BigWig data
|
|
110
103
|
|
|
111
104
|
## [1.0.14](https://github.com/GMOD/bbi-js/compare/v1.0.12...v1.0.14) (2019-04-17)
|
|
112
105
|
|
|
113
|
-
|
|
114
|
-
|
|
115
106
|
- Improve documentation for integration with @gmod/bed@2
|
|
116
107
|
- Fix some cases where abortSignal was passed incorrectly to filehandle
|
|
117
108
|
|
|
118
109
|
## [1.0.13](https://github.com/GMOD/bbi-js/compare/v1.0.12...v1.0.13) (2019-04-14)
|
|
119
110
|
|
|
120
|
-
|
|
121
|
-
|
|
122
111
|
- Added uniqueId to objects returned from BigBed to avoid issue with duplicates
|
|
123
112
|
|
|
124
113
|
## [1.0.12](https://github.com/GMOD/bbi-js/compare/v1.0.11...v1.0.12) (2019-04-12)
|
|
125
114
|
|
|
126
115
|
- Fix returning bigbed objects on empty regions
|
|
127
116
|
|
|
128
|
-
|
|
129
117
|
## [1.0.11](https://github.com/GMOD/bbi-js/compare/v1.0.10...v1.0.11) (2019-04-10)
|
|
130
118
|
|
|
131
|
-
|
|
132
|
-
|
|
133
119
|
- Removed polyfill of Array.prototype.flat which modifies global scope
|
|
134
120
|
|
|
135
121
|
## [1.0.10](https://github.com/GMOD/bbi-js/compare/v1.0.9...v1.0.10) (2019-04-09)
|
|
136
122
|
|
|
137
|
-
|
|
138
|
-
|
|
139
123
|
- Fix misinterpretation of variable step wig files in this module (the span is not variable in variable step files, only the step, use bedGraphToBigWig for variable span)
|
|
140
124
|
- Improved docs
|
|
141
125
|
|
|
142
126
|
## [1.0.9](https://github.com/GMOD/bbi-js/compare/v1.0.8...v1.0.9) (2019-04-05)
|
|
143
127
|
|
|
144
|
-
|
|
145
|
-
|
|
146
128
|
- Added caching of networking requests (thanks @rbuels for the abortable-promise-cache module!)
|
|
147
129
|
- Fix some type errors on the range class
|
|
148
130
|
- Correct using span on fixed size wiggle types
|
|
149
131
|
|
|
150
132
|
## [1.0.8](https://github.com/GMOD/bbi-js/compare/v1.0.7...v1.0.8) (2019-04-01)
|
|
151
133
|
|
|
152
|
-
|
|
153
|
-
|
|
154
134
|
- Fix @babel/runtime in deployed package
|
|
155
135
|
- Bugfix to the url argument to the BigWig/BigBed
|
|
156
136
|
|
|
157
137
|
## [1.0.7](https://github.com/GMOD/bbi-js/compare/v1.0.6...v1.0.7) (2019-04-01)
|
|
158
138
|
|
|
159
|
-
|
|
160
|
-
|
|
161
139
|
- Added getFeatureStream which returns an Observable from rxjs
|
|
162
140
|
- Added url option to BigWig and BigBed constructors to allow usage of RemoteFile filehandle
|
|
163
141
|
- Added typescript backend for better processing
|
|
164
142
|
|
|
165
143
|
## [1.0.6](https://github.com/GMOD/bbi-js/compare/v1.0.5...v1.0.6) (2019-03-15)
|
|
166
144
|
|
|
167
|
-
|
|
168
|
-
|
|
169
145
|
- Fix issue with fixed step and variable step bigwig files not working at all
|
|
170
146
|
|
|
171
147
|
## [1.0.5](https://github.com/GMOD/bbi-js/compare/v1.0.4...v1.0.5) (2019-03-07)
|
|
172
148
|
|
|
173
|
-
|
|
174
|
-
|
|
175
149
|
- Fix issue with jest being in deps instead of devDeps
|
|
176
150
|
|
|
177
151
|
## [1.0.4](https://github.com/GMOD/bbi-js/compare/v1.0.3...v1.0.4) (2019-01-28)
|
|
178
152
|
|
|
179
|
-
|
|
180
|
-
|
|
181
153
|
- Add renameRefSeqs functionality where you can apply a callback to the refseq names
|
|
182
154
|
- Consistently apply start/end coordinate filters at different zoom levels
|
|
183
155
|
|
|
@@ -187,19 +159,13 @@ Thanks to @skinner for both of these contributions!
|
|
|
187
159
|
|
|
188
160
|
## [1.0.2](https://github.com/GMOD/bbi-js/compare/v1.0.1...v1.0.2) (2019-01-24)
|
|
189
161
|
|
|
190
|
-
|
|
191
|
-
|
|
192
162
|
- Added regenerator-runtime to babel dist compilation
|
|
193
163
|
|
|
194
164
|
## [1.0.1](https://github.com/GMOD/bbi-js/compare/v1.0.0...v1.0.1) (2019-01-24)
|
|
195
165
|
|
|
196
|
-
|
|
197
|
-
|
|
198
166
|
- Added exports for BigWig and BigBed. const {BigWig, BigBed} = require('@gmod/bbi')
|
|
199
167
|
|
|
200
168
|
# 1.0.0 (2019-01-23)
|
|
201
169
|
|
|
202
|
-
|
|
203
|
-
|
|
204
170
|
- Initial version
|
|
205
171
|
- Has support for bigwig and bigbed files
|
package/dist/blockView.js
CHANGED
|
@@ -53,7 +53,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
exports.BlockView = void 0;
|
|
54
54
|
var binary_parser_1 = require("@gmod/binary-parser");
|
|
55
55
|
var abortable_promise_cache_1 = __importDefault(require("abortable-promise-cache"));
|
|
56
|
-
var
|
|
56
|
+
var unzip_1 = require("./unzip");
|
|
57
57
|
var quick_lru_1 = __importDefault(require("quick-lru"));
|
|
58
58
|
var range_1 = __importDefault(require("./range"));
|
|
59
59
|
var util_1 = require("./util");
|
|
@@ -213,10 +213,33 @@ var BlockView = /** @class */ (function () {
|
|
|
213
213
|
: buffer.readUInt32LE(4);
|
|
214
214
|
blocksToFetch_1 = [];
|
|
215
215
|
outstanding_1 = 0;
|
|
216
|
+
cirFobRecur2_1 = function (cirBlockData, offset, level) {
|
|
217
|
+
try {
|
|
218
|
+
var data = cirBlockData.slice(offset);
|
|
219
|
+
var p = _this.leafParser.parse(data).result;
|
|
220
|
+
if (p.blocksToFetch) {
|
|
221
|
+
blocksToFetch_1 = blocksToFetch_1.concat(p.blocksToFetch.filter(filterFeats_1).map(function (l) { return ({
|
|
222
|
+
offset: l.blockOffset,
|
|
223
|
+
length: l.blockSize,
|
|
224
|
+
}); }));
|
|
225
|
+
}
|
|
226
|
+
if (p.recurOffsets) {
|
|
227
|
+
var recurOffsets = p.recurOffsets
|
|
228
|
+
.filter(filterFeats_1)
|
|
229
|
+
.map(function (l) { return l.blockOffset; });
|
|
230
|
+
if (recurOffsets.length > 0) {
|
|
231
|
+
cirFobRecur_1(recurOffsets, level + 1);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
observer.error(e);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
216
239
|
filterFeats_1 = function (b) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
(
|
|
240
|
+
var startChrom = b.startChrom, startBase = b.startBase, endChrom = b.endChrom, endBase = b.endBase;
|
|
241
|
+
return ((startChrom < chrId_1 || (startChrom === chrId_1 && startBase <= end)) &&
|
|
242
|
+
(endChrom > chrId_1 || (endChrom === chrId_1 && endBase >= start)));
|
|
220
243
|
};
|
|
221
244
|
cirFobStartFetch_1 = function (off, fr, level) { return __awaiter(_this, void 0, void 0, function () {
|
|
222
245
|
var length_1, offset, resultBuffer, i, e_2;
|
|
@@ -231,7 +254,7 @@ var BlockView = /** @class */ (function () {
|
|
|
231
254
|
resultBuffer = _a.sent();
|
|
232
255
|
for (i = 0; i < off.length; i += 1) {
|
|
233
256
|
if (fr.contains(off[i])) {
|
|
234
|
-
cirFobRecur2_1(resultBuffer, off[i] - offset, level
|
|
257
|
+
cirFobRecur2_1(resultBuffer, off[i] - offset, level);
|
|
235
258
|
outstanding_1 -= 1;
|
|
236
259
|
if (outstanding_1 === 0) {
|
|
237
260
|
this.readFeatures(observer, blocksToFetch_1, __assign(__assign({}, opts), { request: request_1 }));
|
|
@@ -256,32 +279,7 @@ var BlockView = /** @class */ (function () {
|
|
|
256
279
|
var blockSpan = new range_1.default(offset[i], offset[i] + maxCirBlockSpan);
|
|
257
280
|
spans = spans.union(blockSpan);
|
|
258
281
|
}
|
|
259
|
-
spans
|
|
260
|
-
.getRanges()
|
|
261
|
-
.map(function (fr) { return cirFobStartFetch_1(offset, fr, level); });
|
|
262
|
-
}
|
|
263
|
-
catch (e) {
|
|
264
|
-
observer.error(e);
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
cirFobRecur2_1 = function (cirBlockData, offset, level) {
|
|
268
|
-
try {
|
|
269
|
-
var data = cirBlockData.slice(offset);
|
|
270
|
-
var p = _this.leafParser.parse(data).result;
|
|
271
|
-
if (p.blocksToFetch) {
|
|
272
|
-
blocksToFetch_1 = blocksToFetch_1.concat(p.blocksToFetch.filter(filterFeats_1).map(function (l) { return ({
|
|
273
|
-
offset: l.blockOffset,
|
|
274
|
-
length: l.blockSize,
|
|
275
|
-
}); }));
|
|
276
|
-
}
|
|
277
|
-
if (p.recurOffsets) {
|
|
278
|
-
var recurOffsets = p.recurOffsets
|
|
279
|
-
.filter(filterFeats_1)
|
|
280
|
-
.map(function (l) { return l.blockOffset; });
|
|
281
|
-
if (recurOffsets.length > 0) {
|
|
282
|
-
cirFobRecur_1(recurOffsets, level + 1);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
282
|
+
spans.getRanges().map(function (fr) { return cirFobStartFetch_1(offset, fr, level); });
|
|
285
283
|
}
|
|
286
284
|
catch (e) {
|
|
287
285
|
observer.error(e);
|
|
@@ -309,7 +307,7 @@ var BlockView = /** @class */ (function () {
|
|
|
309
307
|
if (request) {
|
|
310
308
|
items = items.filter(function (elt) { return elt.chromId === request.chrId; });
|
|
311
309
|
}
|
|
312
|
-
|
|
310
|
+
var feats = items.map(function (elt) { return ({
|
|
313
311
|
start: elt.start,
|
|
314
312
|
end: elt.end,
|
|
315
313
|
maxScore: elt.maxScore,
|
|
@@ -318,8 +316,8 @@ var BlockView = /** @class */ (function () {
|
|
|
318
316
|
summary: true,
|
|
319
317
|
}); });
|
|
320
318
|
return request
|
|
321
|
-
?
|
|
322
|
-
:
|
|
319
|
+
? feats.filter(function (f) { return BlockView.coordFilter(f, request); })
|
|
320
|
+
: feats;
|
|
323
321
|
};
|
|
324
322
|
BlockView.prototype.parseBigBedBlock = function (data, startOffset, offset, request) {
|
|
325
323
|
var items = [];
|
|
@@ -385,7 +383,7 @@ var BlockView = /** @class */ (function () {
|
|
|
385
383
|
var blockOffset = block.offset - blockGroup.offset;
|
|
386
384
|
var resultData = data;
|
|
387
385
|
if (isCompressed_1) {
|
|
388
|
-
resultData =
|
|
386
|
+
resultData = (0, unzip_1.unzip)(data.slice(blockOffset));
|
|
389
387
|
blockOffset = 0;
|
|
390
388
|
}
|
|
391
389
|
(0, util_1.checkAbortSignal)(signal_2);
|
package/dist/unzip.d.ts
ADDED
package/dist/unzip.js
ADDED
package/esm/blockView.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.BlockView = void 0;
|
|
7
7
|
const binary_parser_1 = require("@gmod/binary-parser");
|
|
8
8
|
const abortable_promise_cache_1 = __importDefault(require("abortable-promise-cache"));
|
|
9
|
-
const
|
|
9
|
+
const unzip_1 = require("./unzip");
|
|
10
10
|
const quick_lru_1 = __importDefault(require("quick-lru"));
|
|
11
11
|
const range_1 = __importDefault(require("./range"));
|
|
12
12
|
const util_1 = require("./util");
|
|
@@ -148,11 +148,34 @@ class BlockView {
|
|
|
148
148
|
: buffer.readUInt32LE(4);
|
|
149
149
|
let blocksToFetch = [];
|
|
150
150
|
let outstanding = 0;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
const cirFobRecur2 = (cirBlockData, offset, level) => {
|
|
152
|
+
try {
|
|
153
|
+
const data = cirBlockData.slice(offset);
|
|
154
|
+
const p = this.leafParser.parse(data).result;
|
|
155
|
+
if (p.blocksToFetch) {
|
|
156
|
+
blocksToFetch = blocksToFetch.concat(p.blocksToFetch.filter(filterFeats).map((l) => ({
|
|
157
|
+
offset: l.blockOffset,
|
|
158
|
+
length: l.blockSize,
|
|
159
|
+
})));
|
|
160
|
+
}
|
|
161
|
+
if (p.recurOffsets) {
|
|
162
|
+
const recurOffsets = p.recurOffsets
|
|
163
|
+
.filter(filterFeats)
|
|
164
|
+
.map((l) => l.blockOffset);
|
|
165
|
+
if (recurOffsets.length > 0) {
|
|
166
|
+
cirFobRecur(recurOffsets, level + 1);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
observer.error(e);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
const filterFeats = (b) => {
|
|
175
|
+
const { startChrom, startBase, endChrom, endBase } = b;
|
|
176
|
+
return ((startChrom < chrId || (startChrom === chrId && startBase <= end)) &&
|
|
177
|
+
(endChrom > chrId || (endChrom === chrId && endBase >= start)));
|
|
178
|
+
};
|
|
156
179
|
const cirFobStartFetch = async (off, fr, level) => {
|
|
157
180
|
try {
|
|
158
181
|
const length = fr.max() - fr.min();
|
|
@@ -160,7 +183,7 @@ class BlockView {
|
|
|
160
183
|
const resultBuffer = await this.featureCache.get(`${length}_${offset}`, { length, offset }, signal);
|
|
161
184
|
for (let i = 0; i < off.length; i += 1) {
|
|
162
185
|
if (fr.contains(off[i])) {
|
|
163
|
-
cirFobRecur2(resultBuffer, off[i] - offset, level
|
|
186
|
+
cirFobRecur2(resultBuffer, off[i] - offset, level);
|
|
164
187
|
outstanding -= 1;
|
|
165
188
|
if (outstanding === 0) {
|
|
166
189
|
this.readFeatures(observer, blocksToFetch, { ...opts, request });
|
|
@@ -181,32 +204,7 @@ class BlockView {
|
|
|
181
204
|
const blockSpan = new range_1.default(offset[i], offset[i] + maxCirBlockSpan);
|
|
182
205
|
spans = spans.union(blockSpan);
|
|
183
206
|
}
|
|
184
|
-
spans
|
|
185
|
-
.getRanges()
|
|
186
|
-
.map((fr) => cirFobStartFetch(offset, fr, level));
|
|
187
|
-
}
|
|
188
|
-
catch (e) {
|
|
189
|
-
observer.error(e);
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
cirFobRecur2 = (cirBlockData, offset, level) => {
|
|
193
|
-
try {
|
|
194
|
-
const data = cirBlockData.slice(offset);
|
|
195
|
-
const p = this.leafParser.parse(data).result;
|
|
196
|
-
if (p.blocksToFetch) {
|
|
197
|
-
blocksToFetch = blocksToFetch.concat(p.blocksToFetch.filter(filterFeats).map((l) => ({
|
|
198
|
-
offset: l.blockOffset,
|
|
199
|
-
length: l.blockSize,
|
|
200
|
-
})));
|
|
201
|
-
}
|
|
202
|
-
if (p.recurOffsets) {
|
|
203
|
-
const recurOffsets = p.recurOffsets
|
|
204
|
-
.filter(filterFeats)
|
|
205
|
-
.map((l) => l.blockOffset);
|
|
206
|
-
if (recurOffsets.length > 0) {
|
|
207
|
-
cirFobRecur(recurOffsets, level + 1);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
207
|
+
spans.getRanges().map(fr => cirFobStartFetch(offset, fr, level));
|
|
210
208
|
}
|
|
211
209
|
catch (e) {
|
|
212
210
|
observer.error(e);
|
|
@@ -228,9 +226,9 @@ class BlockView {
|
|
|
228
226
|
}
|
|
229
227
|
let items = features;
|
|
230
228
|
if (request) {
|
|
231
|
-
items = items.filter(
|
|
229
|
+
items = items.filter(elt => elt.chromId === request.chrId);
|
|
232
230
|
}
|
|
233
|
-
|
|
231
|
+
const feats = items.map((elt) => ({
|
|
234
232
|
start: elt.start,
|
|
235
233
|
end: elt.end,
|
|
236
234
|
maxScore: elt.maxScore,
|
|
@@ -239,8 +237,8 @@ class BlockView {
|
|
|
239
237
|
summary: true,
|
|
240
238
|
}));
|
|
241
239
|
return request
|
|
242
|
-
?
|
|
243
|
-
:
|
|
240
|
+
? feats.filter(f => BlockView.coordFilter(f, request))
|
|
241
|
+
: feats;
|
|
244
242
|
}
|
|
245
243
|
parseBigBedBlock(data, startOffset, offset, request) {
|
|
246
244
|
const items = [];
|
|
@@ -292,7 +290,7 @@ class BlockView {
|
|
|
292
290
|
let blockOffset = block.offset - blockGroup.offset;
|
|
293
291
|
let resultData = data;
|
|
294
292
|
if (isCompressed) {
|
|
295
|
-
resultData =
|
|
293
|
+
resultData = (0, unzip_1.unzip)(data.slice(blockOffset));
|
|
296
294
|
blockOffset = 0;
|
|
297
295
|
}
|
|
298
296
|
(0, util_1.checkAbortSignal)(signal);
|
package/esm/unzip.d.ts
ADDED
package/esm/unzip.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gmod/bbi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "Parser for BigWig/BigBed files",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "GMOD/bbi-js",
|
|
@@ -24,10 +24,12 @@
|
|
|
24
24
|
"lint": "eslint --report-unused-disable-directives --max-warnings 0 --ext .js,.ts src",
|
|
25
25
|
"clean": "rimraf dist esm",
|
|
26
26
|
"prebuild": "npm run clean",
|
|
27
|
-
"build": "tsc --target es2018 --outDir esm
|
|
27
|
+
"build:esm": "tsc --target es2018 --outDir esm",
|
|
28
|
+
"build:es5": "tsc --target es5 --outDir dist",
|
|
29
|
+
"build": "npm run build:esm && npm run build:es5",
|
|
28
30
|
"preversion": "npm run lint && npm test && npm run build",
|
|
29
31
|
"version": "standard-changelog && git add CHANGELOG.md",
|
|
30
|
-
"
|
|
32
|
+
"postversion": "git push origin master --follow-tags"
|
|
31
33
|
},
|
|
32
34
|
"keywords": [
|
|
33
35
|
"bionode",
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
"buffer-crc32": "^0.2.13",
|
|
44
46
|
"es6-promisify": "^6.0.1",
|
|
45
47
|
"generic-filehandle": "^2.0.0",
|
|
48
|
+
"pako": "^1.0.0",
|
|
46
49
|
"quick-lru": "^4.0.0",
|
|
47
50
|
"rxjs": "^6.5.2"
|
|
48
51
|
},
|
|
@@ -51,21 +54,26 @@
|
|
|
51
54
|
"@types/jest": "^27.0.3",
|
|
52
55
|
"@types/long": "^4.0.0",
|
|
53
56
|
"@types/node": "^12.0.2",
|
|
54
|
-
"@
|
|
55
|
-
"@typescript-eslint/
|
|
57
|
+
"@types/pako": "^1.0.3",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
59
|
+
"@typescript-eslint/parser": "^5.10.0",
|
|
56
60
|
"cross-fetch": "^3.0.2",
|
|
57
|
-
"eslint": "^7.0
|
|
61
|
+
"eslint": "^8.7.0",
|
|
58
62
|
"eslint-config-prettier": "^8.3.0",
|
|
59
63
|
"eslint-plugin-import": "^2.25.3",
|
|
60
64
|
"eslint-plugin-prettier": "^4.0.0",
|
|
61
65
|
"jest": "^27.4.3",
|
|
62
66
|
"prettier": "^2.5.1",
|
|
63
|
-
"rimraf": "^
|
|
67
|
+
"rimraf": "^3.0.2",
|
|
64
68
|
"standard-changelog": "^2.0.11",
|
|
65
69
|
"ts-jest": "^27.0.7",
|
|
66
70
|
"typescript": "^4.5.2"
|
|
67
71
|
},
|
|
68
72
|
"publishConfig": {
|
|
69
73
|
"access": "public"
|
|
74
|
+
},
|
|
75
|
+
"browser": {
|
|
76
|
+
"./esm/unzip.js": "./esm/unzip-pako.js",
|
|
77
|
+
"./dist/unzip.js": "./dist/unzip-pako.js"
|
|
70
78
|
}
|
|
71
79
|
}
|