@gmod/tabix 1.4.5 → 1.5.2
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 +41 -25
- package/README.md +114 -17
- package/dist/chunk.js +33 -62
- package/dist/csi.d.ts +2 -3
- package/dist/csi.js +324 -556
- package/dist/index.js +11 -36
- package/dist/indexFile.d.ts +1 -1
- package/dist/indexFile.js +112 -174
- package/dist/tabixIndexedFile.d.ts +10 -11
- package/dist/tabixIndexedFile.js +476 -781
- package/dist/tbi.d.ts +1 -1
- package/dist/tbi.js +309 -516
- package/dist/util.d.ts +4 -0
- package/dist/util.js +136 -106
- package/dist/virtualOffset.js +44 -68
- package/esm/chunk.d.ts +18 -0
- package/esm/chunk.js +35 -0
- package/esm/csi.d.ts +71 -0
- package/esm/csi.js +254 -0
- package/esm/index.d.ts +4 -0
- package/esm/index.js +12 -0
- package/esm/indexFile.d.ts +32 -0
- package/esm/indexFile.js +45 -0
- package/esm/tabixIndexedFile.d.ts +118 -0
- package/esm/tabixIndexedFile.js +403 -0
- package/esm/tbi.d.ts +45 -0
- package/esm/tbi.js +240 -0
- package/esm/util.d.ts +25 -0
- package/esm/util.js +98 -0
- package/esm/virtualOffset.d.ts +10 -0
- package/esm/virtualOffset.js +41 -0
- package/package.json +23 -40
- package/dist/declare.d.js +0 -2
package/dist/util.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="long" />
|
|
2
|
+
import Chunk from './chunk';
|
|
3
|
+
import VirtualOffset from './virtualOffset';
|
|
2
4
|
export declare function longToNumber(long: Long): number;
|
|
3
5
|
/**
|
|
4
6
|
* Properly check if the given AbortSignal is aborted.
|
|
@@ -19,3 +21,5 @@ export declare function checkAbortSignal(signal?: AbortSignal): void;
|
|
|
19
21
|
* @param {AbortSignal} signal
|
|
20
22
|
*/
|
|
21
23
|
export declare function abortBreakPoint(signal?: AbortSignal): Promise<void>;
|
|
24
|
+
export declare function canMergeBlocks(chunk1: Chunk, chunk2: Chunk): boolean;
|
|
25
|
+
export declare function optimizeChunks(chunks: Chunk[], lowest: VirtualOffset): Chunk[];
|
package/dist/util.js
CHANGED
|
@@ -1,76 +1,72 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.optimizeChunks = exports.canMergeBlocks = exports.abortBreakPoint = exports.checkAbortSignal = exports.longToNumber = void 0;
|
|
45
55
|
function longToNumber(long) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
56
|
+
if (long.greaterThan(Number.MAX_SAFE_INTEGER) ||
|
|
57
|
+
long.lessThan(Number.MIN_SAFE_INTEGER)) {
|
|
58
|
+
throw new Error('integer overflow');
|
|
59
|
+
}
|
|
60
|
+
return long.toNumber();
|
|
51
61
|
}
|
|
52
|
-
|
|
53
|
-
var AbortError =
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
function AbortError() {
|
|
59
|
-
var _this;
|
|
60
|
-
|
|
61
|
-
(0, _classCallCheck2.default)(this, AbortError);
|
|
62
|
-
|
|
63
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
64
|
-
args[_key] = arguments[_key];
|
|
62
|
+
exports.longToNumber = longToNumber;
|
|
63
|
+
var AbortError = /** @class */ (function (_super) {
|
|
64
|
+
__extends(AbortError, _super);
|
|
65
|
+
function AbortError() {
|
|
66
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
65
67
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "code", void 0);
|
|
69
|
-
return _this;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return AbortError;
|
|
73
|
-
}( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
|
|
68
|
+
return AbortError;
|
|
69
|
+
}(Error));
|
|
74
70
|
/**
|
|
75
71
|
* Properly check if the given AbortSignal is aborted.
|
|
76
72
|
* Per the standard, if the signal reads as aborted,
|
|
@@ -82,52 +78,86 @@ var AbortError = /*#__PURE__*/function (_Error) {
|
|
|
82
78
|
* @param {AbortSignal} [signal] an AbortSignal, or anything with an `aborted` attribute
|
|
83
79
|
* @returns nothing
|
|
84
80
|
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
81
|
function checkAbortSignal(signal) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
82
|
+
if (!signal) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (signal.aborted) {
|
|
86
|
+
// console.log('bam aborted!')
|
|
87
|
+
if (typeof DOMException !== 'undefined') {
|
|
88
|
+
// eslint-disable-next-line no-undef
|
|
89
|
+
throw new DOMException('aborted', 'AbortError');
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
var e = new AbortError('aborted');
|
|
93
|
+
e.code = 'ERR_ABORTED';
|
|
94
|
+
throw e;
|
|
95
|
+
}
|
|
97
96
|
}
|
|
98
|
-
}
|
|
99
97
|
}
|
|
98
|
+
exports.checkAbortSignal = checkAbortSignal;
|
|
100
99
|
/**
|
|
101
100
|
* Skips to the next tick, then runs `checkAbortSignal`.
|
|
102
101
|
* Await this to inside an otherwise synchronous loop to
|
|
103
102
|
* provide a place to break when an abort signal is received.
|
|
104
103
|
* @param {AbortSignal} signal
|
|
105
104
|
*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
function
|
|
109
|
-
|
|
105
|
+
function abortBreakPoint(signal) {
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
return __generator(this, function (_a) {
|
|
108
|
+
switch (_a.label) {
|
|
109
|
+
case 0: return [4 /*yield*/, Promise.resolve()];
|
|
110
|
+
case 1:
|
|
111
|
+
_a.sent();
|
|
112
|
+
checkAbortSignal(signal);
|
|
113
|
+
return [2 /*return*/];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
exports.abortBreakPoint = abortBreakPoint;
|
|
119
|
+
function canMergeBlocks(chunk1, chunk2) {
|
|
120
|
+
return (chunk2.minv.blockPosition - chunk1.maxv.blockPosition < 65000 &&
|
|
121
|
+
chunk2.maxv.blockPosition - chunk1.minv.blockPosition < 5000000);
|
|
110
122
|
}
|
|
111
|
-
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
exports.canMergeBlocks = canMergeBlocks;
|
|
124
|
+
function optimizeChunks(chunks, lowest) {
|
|
125
|
+
var mergedChunks = [];
|
|
126
|
+
var lastChunk = null;
|
|
127
|
+
if (chunks.length === 0) {
|
|
128
|
+
return chunks;
|
|
129
|
+
}
|
|
130
|
+
chunks.sort(function (c0, c1) {
|
|
131
|
+
var dif = c0.minv.blockPosition - c1.minv.blockPosition;
|
|
132
|
+
if (dif !== 0) {
|
|
133
|
+
return dif;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
return c0.minv.dataPosition - c1.minv.dataPosition;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
chunks.forEach(function (chunk) {
|
|
140
|
+
if (!lowest || chunk.maxv.compareTo(lowest) > 0) {
|
|
141
|
+
if (lastChunk === null) {
|
|
142
|
+
mergedChunks.push(chunk);
|
|
143
|
+
lastChunk = chunk;
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
if (canMergeBlocks(lastChunk, chunk)) {
|
|
147
|
+
if (chunk.maxv.compareTo(lastChunk.maxv) > 0) {
|
|
148
|
+
lastChunk.maxv = chunk.maxv;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
mergedChunks.push(chunk);
|
|
153
|
+
lastChunk = chunk;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
127
156
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
157
|
+
// else {
|
|
158
|
+
// console.log(`skipping chunk ${chunk}`)
|
|
159
|
+
// }
|
|
160
|
+
});
|
|
161
|
+
return mergedChunks;
|
|
132
162
|
}
|
|
133
|
-
|
|
163
|
+
exports.optimizeChunks = optimizeChunks;
|
package/dist/virtualOffset.js
CHANGED
|
@@ -1,72 +1,48 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
exports.fromBytes = fromBytes;
|
|
12
|
-
exports.default = void 0;
|
|
13
|
-
|
|
14
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
17
|
-
|
|
18
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
19
|
-
|
|
20
|
-
var VirtualOffset = /*#__PURE__*/function () {
|
|
21
|
-
function VirtualOffset(blockPosition, dataPosition) {
|
|
22
|
-
(0, _classCallCheck2.default)(this, VirtualOffset);
|
|
23
|
-
(0, _defineProperty2.default)(this, "blockPosition", void 0);
|
|
24
|
-
(0, _defineProperty2.default)(this, "dataPosition", void 0);
|
|
25
|
-
this.blockPosition = blockPosition; // < offset of the compressed data block
|
|
26
|
-
|
|
27
|
-
this.dataPosition = dataPosition; // < offset into the uncompressed data
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
(0, _createClass2.default)(VirtualOffset, [{
|
|
31
|
-
key: "toString",
|
|
32
|
-
value: function toString() {
|
|
33
|
-
return "".concat(this.blockPosition, ":").concat(this.dataPosition);
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
key: "compareTo",
|
|
37
|
-
value: function compareTo(b) {
|
|
38
|
-
return this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition;
|
|
39
|
-
}
|
|
40
|
-
}], [{
|
|
41
|
-
key: "min",
|
|
42
|
-
value: function min() {
|
|
43
|
-
var min;
|
|
44
|
-
var i = 0;
|
|
45
|
-
|
|
46
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
47
|
-
args[_key] = arguments[_key];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
for (; !min; i += 1) {
|
|
51
|
-
min = args[i];
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
for (; i < args.length; i += 1) {
|
|
55
|
-
if (min.compareTo(args[i]) > 0) min = args[i];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return min;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fromBytes = void 0;
|
|
4
|
+
var VirtualOffset = /** @class */ (function () {
|
|
5
|
+
function VirtualOffset(blockPosition, dataPosition) {
|
|
6
|
+
this.blockPosition = blockPosition; // < offset of the compressed data block
|
|
7
|
+
this.dataPosition = dataPosition; // < offset into the uncompressed data
|
|
59
8
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
9
|
+
VirtualOffset.prototype.toString = function () {
|
|
10
|
+
return "".concat(this.blockPosition, ":").concat(this.dataPosition);
|
|
11
|
+
};
|
|
12
|
+
VirtualOffset.prototype.compareTo = function (b) {
|
|
13
|
+
return (this.blockPosition - b.blockPosition || this.dataPosition - b.dataPosition);
|
|
14
|
+
};
|
|
15
|
+
VirtualOffset.min = function () {
|
|
16
|
+
var args = [];
|
|
17
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
18
|
+
args[_i] = arguments[_i];
|
|
19
|
+
}
|
|
20
|
+
var min;
|
|
21
|
+
var i = 0;
|
|
22
|
+
for (; !min; i += 1) {
|
|
23
|
+
min = args[i];
|
|
24
|
+
}
|
|
25
|
+
for (; i < args.length; i += 1) {
|
|
26
|
+
if (min.compareTo(args[i]) > 0) {
|
|
27
|
+
min = args[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return min;
|
|
31
|
+
};
|
|
32
|
+
return VirtualOffset;
|
|
33
|
+
}());
|
|
64
34
|
exports.default = VirtualOffset;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
35
|
+
function fromBytes(bytes, offset, bigendian) {
|
|
36
|
+
if (offset === void 0) { offset = 0; }
|
|
37
|
+
if (bigendian === void 0) { bigendian = false; }
|
|
38
|
+
if (bigendian) {
|
|
39
|
+
throw new Error('big-endian virtual file offsets not implemented');
|
|
40
|
+
}
|
|
41
|
+
return new VirtualOffset(bytes[offset + 7] * 0x10000000000 +
|
|
42
|
+
bytes[offset + 6] * 0x100000000 +
|
|
43
|
+
bytes[offset + 5] * 0x1000000 +
|
|
44
|
+
bytes[offset + 4] * 0x10000 +
|
|
45
|
+
bytes[offset + 3] * 0x100 +
|
|
46
|
+
bytes[offset + 2], (bytes[offset + 1] << 8) | bytes[offset]);
|
|
71
47
|
}
|
|
72
|
-
|
|
48
|
+
exports.fromBytes = fromBytes;
|
package/esm/chunk.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import VirtualOffset from './virtualOffset';
|
|
2
|
+
export default class Chunk {
|
|
3
|
+
minv: VirtualOffset;
|
|
4
|
+
maxv: VirtualOffset;
|
|
5
|
+
bin: number;
|
|
6
|
+
_fetchedSize?: number;
|
|
7
|
+
/**
|
|
8
|
+
* @param {VirtualOffset} minv
|
|
9
|
+
* @param {VirtualOffset} maxv
|
|
10
|
+
* @param {number} bin
|
|
11
|
+
* @param {number} [fetchedSize]
|
|
12
|
+
*/
|
|
13
|
+
constructor(minv: VirtualOffset, maxv: VirtualOffset, bin: number, fetchedSize?: undefined);
|
|
14
|
+
toUniqueString(): string;
|
|
15
|
+
toString(): string;
|
|
16
|
+
compareTo(b: Chunk): number;
|
|
17
|
+
fetchedSize(): number;
|
|
18
|
+
}
|
package/esm/chunk.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// little class representing a chunk in the index
|
|
4
|
+
class Chunk {
|
|
5
|
+
/**
|
|
6
|
+
* @param {VirtualOffset} minv
|
|
7
|
+
* @param {VirtualOffset} maxv
|
|
8
|
+
* @param {number} bin
|
|
9
|
+
* @param {number} [fetchedSize]
|
|
10
|
+
*/
|
|
11
|
+
constructor(minv, maxv, bin, fetchedSize = undefined) {
|
|
12
|
+
this.minv = minv;
|
|
13
|
+
this.maxv = maxv;
|
|
14
|
+
this.bin = bin;
|
|
15
|
+
this._fetchedSize = fetchedSize;
|
|
16
|
+
}
|
|
17
|
+
toUniqueString() {
|
|
18
|
+
return `${this.minv}..${this.maxv} (bin ${this.bin}, fetchedSize ${this.fetchedSize()})`;
|
|
19
|
+
}
|
|
20
|
+
toString() {
|
|
21
|
+
return this.toUniqueString();
|
|
22
|
+
}
|
|
23
|
+
compareTo(b) {
|
|
24
|
+
return (this.minv.compareTo(b.minv) ||
|
|
25
|
+
this.maxv.compareTo(b.maxv) ||
|
|
26
|
+
this.bin - b.bin);
|
|
27
|
+
}
|
|
28
|
+
fetchedSize() {
|
|
29
|
+
if (this._fetchedSize !== undefined) {
|
|
30
|
+
return this._fetchedSize;
|
|
31
|
+
}
|
|
32
|
+
return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.default = Chunk;
|
package/esm/csi.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import VirtualOffset from './virtualOffset';
|
|
3
|
+
import Chunk from './chunk';
|
|
4
|
+
import IndexFile, { Options } from './indexFile';
|
|
5
|
+
export default class CSI extends IndexFile {
|
|
6
|
+
private maxBinNumber;
|
|
7
|
+
private depth;
|
|
8
|
+
private minShift;
|
|
9
|
+
constructor(args: any);
|
|
10
|
+
lineCount(refName: string, opts?: Options): Promise<number>;
|
|
11
|
+
indexCov(): Promise<never[]>;
|
|
12
|
+
parseAuxData(bytes: Buffer, offset: number, auxLength: number): {
|
|
13
|
+
refIdToName: never[];
|
|
14
|
+
refNameToId: {};
|
|
15
|
+
skipLines?: undefined;
|
|
16
|
+
metaChar?: undefined;
|
|
17
|
+
columnNumbers?: undefined;
|
|
18
|
+
format?: undefined;
|
|
19
|
+
coordinateType?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
refIdToName: string[];
|
|
22
|
+
refNameToId: {
|
|
23
|
+
[key: string]: number;
|
|
24
|
+
};
|
|
25
|
+
skipLines: number;
|
|
26
|
+
metaChar: string;
|
|
27
|
+
columnNumbers: {
|
|
28
|
+
ref: number;
|
|
29
|
+
start: number;
|
|
30
|
+
end: number;
|
|
31
|
+
};
|
|
32
|
+
format: string;
|
|
33
|
+
coordinateType: string;
|
|
34
|
+
};
|
|
35
|
+
_parseNameBytes(namesBytes: Buffer): {
|
|
36
|
+
refNameToId: {
|
|
37
|
+
[key: string]: number;
|
|
38
|
+
};
|
|
39
|
+
refIdToName: string[];
|
|
40
|
+
};
|
|
41
|
+
_parse(opts?: Options): Promise<{
|
|
42
|
+
csi: boolean;
|
|
43
|
+
refCount: any;
|
|
44
|
+
maxBlockSize: number;
|
|
45
|
+
firstDataLine: VirtualOffset | undefined;
|
|
46
|
+
csiVersion: number;
|
|
47
|
+
indices: {
|
|
48
|
+
binIndex: {
|
|
49
|
+
[key: string]: Chunk[];
|
|
50
|
+
};
|
|
51
|
+
stats: {
|
|
52
|
+
lineCount: number;
|
|
53
|
+
} | undefined;
|
|
54
|
+
}[];
|
|
55
|
+
depth: number;
|
|
56
|
+
maxBinNumber: number;
|
|
57
|
+
maxRefLength: number;
|
|
58
|
+
refIdToName: string[];
|
|
59
|
+
refNameToId: {
|
|
60
|
+
[key: string]: number;
|
|
61
|
+
};
|
|
62
|
+
}>;
|
|
63
|
+
parsePseudoBin(bytes: Buffer, offset: number): {
|
|
64
|
+
lineCount: number;
|
|
65
|
+
};
|
|
66
|
+
blocksForRange(refName: string, min: number, max: number, opts?: Options): Promise<Chunk[]>;
|
|
67
|
+
/**
|
|
68
|
+
* calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)
|
|
69
|
+
*/
|
|
70
|
+
reg2bins(beg: number, end: number): number[][];
|
|
71
|
+
}
|