@gmod/tabix 1.5.6 → 1.5.7
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 +24 -21
- package/dist/csi.d.ts +40 -12
- package/dist/csi.js +14 -18
- package/dist/csi.js.map +1 -1
- package/dist/indexFile.d.ts +28 -8
- package/dist/indexFile.js +5 -14
- package/dist/indexFile.js.map +1 -1
- package/dist/tabixIndexedFile.d.ts +37 -35
- package/dist/tabixIndexedFile.js +29 -42
- package/dist/tabixIndexedFile.js.map +1 -1
- package/dist/tbi.d.ts +4 -4
- package/dist/tbi.js +4 -4
- package/dist/tbi.js.map +1 -1
- package/esm/csi.d.ts +40 -12
- package/esm/csi.js +14 -18
- package/esm/csi.js.map +1 -1
- package/esm/indexFile.d.ts +28 -8
- package/esm/indexFile.js +5 -11
- package/esm/indexFile.js.map +1 -1
- package/esm/tabixIndexedFile.d.ts +37 -35
- package/esm/tabixIndexedFile.js +29 -42
- package/esm/tabixIndexedFile.js.map +1 -1
- package/esm/tbi.d.ts +4 -4
- package/esm/tbi.js +4 -4
- package/esm/tbi.js.map +1 -1
- package/package.json +14 -14
- package/src/csi.ts +16 -28
- package/src/indexFile.ts +17 -16
- package/src/tabixIndexedFile.ts +45 -64
- package/src/tbi.ts +4 -4
- package/src/declare.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,45 +1,41 @@
|
|
|
1
|
-
## [1.5.
|
|
1
|
+
## [1.5.7](https://github.com/GMOD/tabix-js/compare/v1.5.6...v1.5.7) (2023-03-24)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
- Add
|
|
5
|
+
- Add yieldTime parameter
|
|
6
|
+
- Improve typescripting
|
|
6
7
|
|
|
7
|
-
## [1.5.
|
|
8
|
+
## [1.5.6](https://github.com/GMOD/tabix-js/compare/v1.5.5...v1.5.6) (2023-02-28)
|
|
8
9
|
|
|
10
|
+
- Add fix for fileOffset being stable in presence of Unicode characters (#137)
|
|
9
11
|
|
|
12
|
+
## [1.5.5](https://github.com/GMOD/tabix-js/compare/v1.5.4...v1.5.5) (2022-12-17)
|
|
10
13
|
|
|
11
14
|
- Use es2015 for nodejs build
|
|
12
15
|
|
|
13
16
|
## [1.5.4](https://github.com/GMOD/tabix-js/compare/v1.5.3...v1.5.4) (2022-07-18)
|
|
14
17
|
|
|
15
|
-
|
|
16
|
-
|
|
17
18
|
- Bump generic-filehandle 2->3
|
|
18
19
|
|
|
19
20
|
## [1.5.3](https://github.com/GMOD/tabix-js/compare/v1.5.2...v1.5.3) (2022-04-25)
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
22
|
- Fix esm module build to use ESM instead of CJS
|
|
24
23
|
|
|
25
24
|
<a name="1.5.2"></a>
|
|
26
|
-
## [1.5.2](https://github.com/GMOD/tabix-js/compare/v1.5.1...v1.5.2) (2021-12-15)
|
|
27
|
-
|
|
28
25
|
|
|
26
|
+
## [1.5.2](https://github.com/GMOD/tabix-js/compare/v1.5.1...v1.5.2) (2021-12-15)
|
|
29
27
|
|
|
30
28
|
- Change typescript signature of lineCallback from Promise<void> to void
|
|
31
29
|
|
|
32
30
|
<a name="1.5.1"></a>
|
|
33
|
-
## [1.5.1](https://github.com/GMOD/tabix-js/compare/v1.5.0...v1.5.1) (2021-12-15)
|
|
34
|
-
|
|
35
31
|
|
|
32
|
+
## [1.5.1](https://github.com/GMOD/tabix-js/compare/v1.5.0...v1.5.1) (2021-12-15)
|
|
36
33
|
|
|
37
34
|
- Add esm module with less babelification for smaller bundle size
|
|
38
35
|
|
|
39
36
|
<a name="1.5.0"></a>
|
|
40
|
-
# [1.5.0](https://github.com/GMOD/tabix-js/compare/v1.4.6...v1.5.0) (2020-12-11)
|
|
41
|
-
|
|
42
37
|
|
|
38
|
+
# [1.5.0](https://github.com/GMOD/tabix-js/compare/v1.4.6...v1.5.0) (2020-12-11)
|
|
43
39
|
|
|
44
40
|
- Use TextDecoder for chunk decoding for small speedup
|
|
45
41
|
- Use canMergeChunks logic to avoid too large of chunks being used
|
|
@@ -49,14 +45,16 @@
|
|
|
49
45
|
|
|
50
46
|
## [1.4.6](https://github.com/GMOD/tabix-js/compare/v1.4.5...v1.4.6) (2020-04-30)
|
|
51
47
|
|
|
52
|
-
- Fix regression with browser only version of tabix-js not being able to parse
|
|
48
|
+
- Fix regression with browser only version of tabix-js not being able to parse
|
|
49
|
+
results in 1.4.5
|
|
53
50
|
|
|
54
51
|
<a name="1.4.5"></a>
|
|
55
52
|
|
|
56
53
|
## [1.4.5](https://github.com/GMOD/tabix-js/compare/v1.4.4...v1.4.5) (2020-04-28)
|
|
57
54
|
|
|
58
|
-
- Remove the filehandle size() call because this is unnecessary and would
|
|
59
|
-
and because it additionally has a CORS configuration
|
|
55
|
+
- Remove the filehandle size() call because this is unnecessary and would
|
|
56
|
+
indicate a corrupt index, and because it additionally has a CORS configuration
|
|
57
|
+
overhead
|
|
60
58
|
|
|
61
59
|
<a name="1.4.4"></a>
|
|
62
60
|
|
|
@@ -69,7 +67,8 @@
|
|
|
69
67
|
## [1.4.3](https://github.com/GMOD/tabix-js/compare/v1.4.2...v1.4.3) (2020-02-04)
|
|
70
68
|
|
|
71
69
|
- Fix optional param for constructor for typescript
|
|
72
|
-
- Update method of calculating fileOffset based IDs using updated
|
|
70
|
+
- Update method of calculating fileOffset based IDs using updated
|
|
71
|
+
@gmod/bgzf-filehandle
|
|
73
72
|
|
|
74
73
|
<a name="1.4.2"></a>
|
|
75
74
|
|
|
@@ -121,11 +120,13 @@
|
|
|
121
120
|
|
|
122
121
|
## [1.1.8](https://github.com/GMOD/tabix-js/compare/v1.1.7...v1.1.8) (2019-06-06)
|
|
123
122
|
|
|
124
|
-
- Add a fix for a bgzf unzipping thing that could result in duplicate features
|
|
123
|
+
- Add a fix for a bgzf unzipping thing that could result in duplicate features
|
|
124
|
+
being returned
|
|
125
125
|
|
|
126
126
|
## [1.1.7](https://github.com/GMOD/tabix-js/compare/v1.1.6...v1.1.7) (2019-06-04)
|
|
127
127
|
|
|
128
|
-
- Removed chunk merging from header file parsing which now results in smaller
|
|
128
|
+
- Removed chunk merging from header file parsing which now results in smaller
|
|
129
|
+
bgzf unzip calls being streamed out to clients
|
|
129
130
|
|
|
130
131
|
## [1.1.6](https://github.com/GMOD/tabix-js/compare/v1.1.5...v1.1.6) (2019-05-31)
|
|
131
132
|
|
|
@@ -134,7 +135,8 @@
|
|
|
134
135
|
|
|
135
136
|
## [1.1.5](https://github.com/GMOD/tabix-js/compare/v1.1.4...v1.1.5) (2019-03-05)
|
|
136
137
|
|
|
137
|
-
- Fix parsing on a tabix file that should be csi files (e.g. too long of
|
|
138
|
+
- Fix parsing on a tabix file that should be csi files (e.g. too long of
|
|
139
|
+
chromosomes)
|
|
138
140
|
|
|
139
141
|
## [1.1.4](https://github.com/GMOD/tabix-js/compare/v1.1.3...v1.1.4) (2019-02-23)
|
|
140
142
|
|
|
@@ -142,7 +144,8 @@
|
|
|
142
144
|
|
|
143
145
|
## [1.1.3](https://github.com/GMOD/tabix-js/compare/v1.1.2...v1.1.3) (2018-11-23)
|
|
144
146
|
|
|
145
|
-
- Change to es6-promisify and quick-lru which can be babelified to IE11
|
|
147
|
+
- Change to es6-promisify and quick-lru which can be babelified to IE11
|
|
148
|
+
(util.promisify and lru-cache used Object.defineProperty('length', ...))
|
|
146
149
|
|
|
147
150
|
## [1.1.2](https://github.com/GMOD/tabix-js/compare/v1.1.1...v1.1.2) (2018-10-26)
|
|
148
151
|
|
package/dist/csi.d.ts
CHANGED
|
@@ -8,22 +8,14 @@ export default class CSI extends IndexFile {
|
|
|
8
8
|
private minShift;
|
|
9
9
|
constructor(args: any);
|
|
10
10
|
lineCount(refName: string, opts?: Options): Promise<number>;
|
|
11
|
-
indexCov(): Promise<
|
|
12
|
-
parseAuxData(bytes: Buffer, offset: number
|
|
13
|
-
refIdToName: never[];
|
|
14
|
-
refNameToId: {};
|
|
15
|
-
skipLines?: undefined;
|
|
16
|
-
metaChar?: undefined;
|
|
17
|
-
columnNumbers?: undefined;
|
|
18
|
-
format?: undefined;
|
|
19
|
-
coordinateType?: undefined;
|
|
20
|
-
} | {
|
|
11
|
+
indexCov(): Promise<void>;
|
|
12
|
+
parseAuxData(bytes: Buffer, offset: number): {
|
|
21
13
|
refIdToName: string[];
|
|
22
14
|
refNameToId: {
|
|
23
15
|
[key: string]: number;
|
|
24
16
|
};
|
|
25
17
|
skipLines: number;
|
|
26
|
-
metaChar: string;
|
|
18
|
+
metaChar: string | null;
|
|
27
19
|
columnNumbers: {
|
|
28
20
|
ref: number;
|
|
29
21
|
start: number;
|
|
@@ -40,7 +32,7 @@ export default class CSI extends IndexFile {
|
|
|
40
32
|
};
|
|
41
33
|
_parse(opts?: Options): Promise<{
|
|
42
34
|
csi: boolean;
|
|
43
|
-
refCount:
|
|
35
|
+
refCount: number;
|
|
44
36
|
maxBlockSize: number;
|
|
45
37
|
firstDataLine: VirtualOffset | undefined;
|
|
46
38
|
csiVersion: number;
|
|
@@ -59,6 +51,42 @@ export default class CSI extends IndexFile {
|
|
|
59
51
|
refNameToId: {
|
|
60
52
|
[key: string]: number;
|
|
61
53
|
};
|
|
54
|
+
skipLines: number;
|
|
55
|
+
metaChar: string | null;
|
|
56
|
+
columnNumbers: {
|
|
57
|
+
ref: number;
|
|
58
|
+
start: number;
|
|
59
|
+
end: number;
|
|
60
|
+
};
|
|
61
|
+
format: string;
|
|
62
|
+
coordinateType: string;
|
|
63
|
+
} | {
|
|
64
|
+
csi: boolean;
|
|
65
|
+
refCount: number;
|
|
66
|
+
maxBlockSize: number;
|
|
67
|
+
firstDataLine: VirtualOffset | undefined;
|
|
68
|
+
csiVersion: number;
|
|
69
|
+
indices: {
|
|
70
|
+
binIndex: {
|
|
71
|
+
[key: string]: Chunk[];
|
|
72
|
+
};
|
|
73
|
+
stats: {
|
|
74
|
+
lineCount: number;
|
|
75
|
+
} | undefined;
|
|
76
|
+
}[];
|
|
77
|
+
depth: number;
|
|
78
|
+
maxBinNumber: number;
|
|
79
|
+
maxRefLength: number;
|
|
80
|
+
refIdToName: never[];
|
|
81
|
+
refNameToId: {};
|
|
82
|
+
metaChar: null;
|
|
83
|
+
columnNumbers: {
|
|
84
|
+
ref: number;
|
|
85
|
+
start: number;
|
|
86
|
+
end: number;
|
|
87
|
+
};
|
|
88
|
+
coordinateType: string;
|
|
89
|
+
format: string;
|
|
62
90
|
}>;
|
|
63
91
|
parsePseudoBin(bytes: Buffer, offset: number): {
|
|
64
92
|
lineCount: number;
|
package/dist/csi.js
CHANGED
|
@@ -77,16 +77,9 @@ class CSI extends indexFile_1.default {
|
|
|
77
77
|
indexCov() {
|
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
79
|
throw new Error('CSI indexes do not support indexcov');
|
|
80
|
-
return [];
|
|
81
80
|
});
|
|
82
81
|
}
|
|
83
|
-
parseAuxData(bytes, offset
|
|
84
|
-
if (auxLength < 30) {
|
|
85
|
-
return {
|
|
86
|
-
refIdToName: [],
|
|
87
|
-
refNameToId: {},
|
|
88
|
-
};
|
|
89
|
-
}
|
|
82
|
+
parseAuxData(bytes, offset) {
|
|
90
83
|
const formatFlags = bytes.readInt32LE(offset);
|
|
91
84
|
const coordinateType = formatFlags & 0x10000 ? 'zero-based-half-open' : '1-based-closed';
|
|
92
85
|
const format = { 0: 'generic', 1: 'SAM', 2: 'VCF' }[formatFlags & 0xf];
|
|
@@ -99,10 +92,10 @@ class CSI extends indexFile_1.default {
|
|
|
99
92
|
end: bytes.readInt32LE(offset + 12),
|
|
100
93
|
};
|
|
101
94
|
const metaValue = bytes.readInt32LE(offset + 16);
|
|
102
|
-
const metaChar = metaValue ? String.fromCharCode(metaValue) :
|
|
95
|
+
const metaChar = metaValue ? String.fromCharCode(metaValue) : null;
|
|
103
96
|
const skipLines = bytes.readInt32LE(offset + 20);
|
|
104
97
|
const nameSectionLength = bytes.readInt32LE(offset + 24);
|
|
105
|
-
const { refIdToName, refNameToId } = this._parseNameBytes(bytes.
|
|
98
|
+
const { refIdToName, refNameToId } = this._parseNameBytes(bytes.subarray(offset + 28, offset + 28 + nameSectionLength));
|
|
106
99
|
return {
|
|
107
100
|
refIdToName,
|
|
108
101
|
refNameToId,
|
|
@@ -153,13 +146,16 @@ class CSI extends indexFile_1.default {
|
|
|
153
146
|
this.maxBinNumber = ((1 << ((this.depth + 1) * 3)) - 1) / 7;
|
|
154
147
|
const maxRefLength = Math.pow(2, (this.minShift + this.depth * 3));
|
|
155
148
|
const auxLength = bytes.readInt32LE(12);
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
149
|
+
const aux = auxLength && auxLength >= 30
|
|
150
|
+
? this.parseAuxData(bytes, 16)
|
|
151
|
+
: {
|
|
152
|
+
refIdToName: [],
|
|
153
|
+
refNameToId: {},
|
|
154
|
+
metaChar: null,
|
|
155
|
+
columnNumbers: { ref: 0, start: 1, end: 2 },
|
|
156
|
+
coordinateType: 'zero-based-half-open',
|
|
157
|
+
format: 'generic',
|
|
158
|
+
};
|
|
163
159
|
const refCount = bytes.readInt32LE(16 + auxLength);
|
|
164
160
|
// read the indexes for each reference sequence
|
|
165
161
|
let firstDataLine;
|
|
@@ -202,7 +198,7 @@ class CSI extends indexFile_1.default {
|
|
|
202
198
|
});
|
|
203
199
|
}
|
|
204
200
|
parsePseudoBin(bytes, offset) {
|
|
205
|
-
const lineCount = (0, util_1.longToNumber)(long_1.default.fromBytesLE(
|
|
201
|
+
const lineCount = (0, util_1.longToNumber)(long_1.default.fromBytesLE(bytes.subarray(offset + 28, offset + 36), true));
|
|
206
202
|
return { lineCount };
|
|
207
203
|
}
|
|
208
204
|
blocksForRange(refName, min, max, opts = {}) {
|
package/dist/csi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"csi.js","sourceRoot":"","sources":["../src/csi.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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|
}
|
|
8
|
+
export interface IndexData {
|
|
9
|
+
refNameToId: {
|
|
10
|
+
[key: string]: number;
|
|
11
|
+
};
|
|
12
|
+
refIdToName: string[];
|
|
13
|
+
metaChar: string | null;
|
|
14
|
+
columnNumbers: {
|
|
15
|
+
ref: number;
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
};
|
|
19
|
+
coordinateType: string;
|
|
20
|
+
format: string;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
}
|
|
8
23
|
export default abstract class IndexFile {
|
|
9
24
|
filehandle: GenericFilehandle;
|
|
10
25
|
renameRefSeq: (arg0: string) => string;
|
|
11
|
-
private
|
|
12
|
-
/**
|
|
13
|
-
* @param {filehandle} filehandle
|
|
14
|
-
* @param {function} [renameRefSeqs]
|
|
15
|
-
*/
|
|
26
|
+
private parseP?;
|
|
16
27
|
constructor({ filehandle, renameRefSeqs, }: {
|
|
17
28
|
filehandle: GenericFilehandle;
|
|
18
29
|
renameRefSeqs?: (a: string) => string;
|
|
19
30
|
});
|
|
20
31
|
abstract lineCount(refName: string, args: Options): Promise<number>;
|
|
21
|
-
protected abstract _parse(opts: Options): Promise<
|
|
32
|
+
protected abstract _parse(opts: Options): Promise<IndexData>;
|
|
33
|
+
getMetadata(opts?: Options): Promise<{
|
|
34
|
+
[key: string]: any;
|
|
22
35
|
refNameToId: {
|
|
23
36
|
[key: string]: number;
|
|
24
37
|
};
|
|
25
38
|
refIdToName: string[];
|
|
39
|
+
metaChar: string | null;
|
|
40
|
+
columnNumbers: {
|
|
41
|
+
ref: number;
|
|
42
|
+
start: number;
|
|
43
|
+
end: number;
|
|
44
|
+
};
|
|
45
|
+
coordinateType: string;
|
|
46
|
+
format: string;
|
|
26
47
|
}>;
|
|
27
|
-
getMetadata(opts?: Options): Promise<any>;
|
|
28
48
|
abstract blocksForRange(refName: string, start: number, end: number, opts: Options): Promise<Chunk[]>;
|
|
29
49
|
_findFirstData(currentFdl: VirtualOffset | undefined, virtualOffset: VirtualOffset): VirtualOffset;
|
|
30
|
-
parse(opts?: Options): Promise<
|
|
50
|
+
parse(opts?: Options): Promise<IndexData>;
|
|
31
51
|
hasRefSeq(seqId: number, opts?: Options): Promise<boolean>;
|
|
32
52
|
}
|
package/dist/indexFile.js
CHANGED
|
@@ -19,17 +19,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
19
19
|
}
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
-
};
|
|
25
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const abortable_promise_cache_1 = __importDefault(require("abortable-promise-cache"));
|
|
27
|
-
const quick_lru_1 = __importDefault(require("quick-lru"));
|
|
28
23
|
class IndexFile {
|
|
29
|
-
/**
|
|
30
|
-
* @param {filehandle} filehandle
|
|
31
|
-
* @param {function} [renameRefSeqs]
|
|
32
|
-
*/
|
|
33
24
|
constructor({ filehandle, renameRefSeqs = (n) => n, }) {
|
|
34
25
|
this.filehandle = filehandle;
|
|
35
26
|
this.renameRefSeq = renameRefSeqs;
|
|
@@ -53,13 +44,13 @@ class IndexFile {
|
|
|
53
44
|
}
|
|
54
45
|
parse(opts = {}) {
|
|
55
46
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
if (!this.
|
|
57
|
-
this.
|
|
58
|
-
|
|
59
|
-
|
|
47
|
+
if (!this.parseP) {
|
|
48
|
+
this.parseP = this._parse(opts).catch(e => {
|
|
49
|
+
this.parseP = undefined;
|
|
50
|
+
throw e;
|
|
60
51
|
});
|
|
61
52
|
}
|
|
62
|
-
return this.
|
|
53
|
+
return this.parseP;
|
|
63
54
|
});
|
|
64
55
|
}
|
|
65
56
|
hasRefSeq(seqId, opts = {}) {
|
package/dist/indexFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indexFile.js","sourceRoot":"","sources":["../src/indexFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"indexFile.js","sourceRoot":"","sources":["../src/indexFile.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoBA,MAA8B,SAAS;IAKrC,YAAY,EACV,UAAU,EACV,aAAa,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,GAIjC;QACC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,YAAY,GAAG,aAAa,CAAA;IACnC,CAAC;IAMY,WAAW,CAAC,OAAgB,EAAE;;YACzC,6DAA6D;YAC7D,MAAM,KAAuB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAA7C,EAAE,OAAO,OAAoC,EAA/B,IAAI,cAAlB,WAAoB,CAAyB,CAAA;YACnD,OAAO,IAAI,CAAA;QACb,CAAC;KAAA;IASD,cAAc,CACZ,UAAqC,EACrC,aAA4B;QAE5B,IAAI,UAAU,EAAE;YACd,OAAO,UAAU,CAAC,SAAS,CAAC,aAAa,CAAC,GAAG,CAAC;gBAC5C,CAAC,CAAC,aAAa;gBACf,CAAC,CAAC,UAAU,CAAA;SACf;aAAM;YACL,OAAO,aAAa,CAAA;SACrB;IACH,CAAC;IAEK,KAAK,CAAC,OAAgB,EAAE;;YAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBAChB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;oBACxC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;oBACvB,MAAM,CAAC,CAAA;gBACT,CAAC,CAAC,CAAA;aACH;YACD,OAAO,IAAI,CAAC,MAAM,CAAA;QACpB,CAAC;KAAA;IAEK,SAAS,CAAC,KAAa,EAAE,OAAgB,EAAE;;YAC/C,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAA;QACnE,CAAC;KAAA;CACF;AA3DD,4BA2DC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { GenericFilehandle } from 'generic-filehandle';
|
|
3
|
-
import { Options } from './indexFile';
|
|
3
|
+
import { Options, IndexData } from './indexFile';
|
|
4
4
|
import Chunk from './chunk';
|
|
5
5
|
type GetLinesCallback = (line: string, fileOffset: number) => void;
|
|
6
6
|
interface GetLinesOpts {
|
|
@@ -12,6 +12,7 @@ export default class TabixIndexedFile {
|
|
|
12
12
|
private filehandle;
|
|
13
13
|
private index;
|
|
14
14
|
private chunkSizeLimit;
|
|
15
|
+
private yieldTime;
|
|
15
16
|
private renameRefSeq;
|
|
16
17
|
private chunkCache;
|
|
17
18
|
/**
|
|
@@ -22,39 +23,50 @@ export default class TabixIndexedFile {
|
|
|
22
23
|
* @param {filehandle} [args.tbiFilehandle]
|
|
23
24
|
* @param {string} [args.csiPath]
|
|
24
25
|
* @param {filehandle} [args.csiFilehandle]
|
|
25
|
-
* @param {
|
|
26
|
+
* @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread
|
|
26
27
|
* @param {function} [args.renameRefSeqs] optional function with sig `string => string` to transform
|
|
27
28
|
* reference sequence names for the purpose of indexing and querying. note that the data that is returned is
|
|
28
29
|
* not altered, just the names of the reference sequences that are used for querying.
|
|
29
|
-
* @param {number} [args.chunkCacheSize] maximum size in bytes of the chunk cache. default 5MB
|
|
30
|
-
* @param {number} [args.blockCacheSize] maximum size in bytes of the block cache. default 5MB
|
|
31
30
|
*/
|
|
32
|
-
constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, chunkSizeLimit, renameRefSeqs, chunkCacheSize, }: {
|
|
31
|
+
constructor({ path, filehandle, tbiPath, tbiFilehandle, csiPath, csiFilehandle, yieldTime, chunkSizeLimit, renameRefSeqs, chunkCacheSize, }: {
|
|
33
32
|
path?: string;
|
|
34
33
|
filehandle?: GenericFilehandle;
|
|
35
34
|
tbiPath?: string;
|
|
36
35
|
tbiFilehandle?: GenericFilehandle;
|
|
37
36
|
csiPath?: string;
|
|
38
37
|
csiFilehandle?: GenericFilehandle;
|
|
38
|
+
yieldTime: number;
|
|
39
39
|
chunkSizeLimit?: number;
|
|
40
40
|
renameRefSeqs?: (n: string) => string;
|
|
41
41
|
chunkCacheSize?: number;
|
|
42
42
|
});
|
|
43
43
|
/**
|
|
44
|
-
* @param
|
|
45
|
-
* @param
|
|
46
|
-
* @param
|
|
47
|
-
* @param
|
|
48
|
-
* @returns
|
|
44
|
+
* @param refName name of the reference sequence
|
|
45
|
+
* @param start start of the region (in 0-based half-open coordinates)
|
|
46
|
+
* @param end end of the region (in 0-based half-open coordinates)
|
|
47
|
+
* @param opts callback called for each line in the region. can also pass a object param containing obj.lineCallback, obj.signal, etc
|
|
48
|
+
* @returns promise that is resolved when the whole read is finished, rejected on error
|
|
49
49
|
*/
|
|
50
50
|
getLines(refName: string, start: number, end: number, opts: GetLinesOpts | GetLinesCallback): Promise<void>;
|
|
51
|
-
getMetadata(opts?: Options): Promise<
|
|
51
|
+
getMetadata(opts?: Options): Promise<{
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
refNameToId: {
|
|
54
|
+
[key: string]: number;
|
|
55
|
+
};
|
|
56
|
+
refIdToName: string[];
|
|
57
|
+
metaChar: string | null;
|
|
58
|
+
columnNumbers: {
|
|
59
|
+
ref: number;
|
|
60
|
+
start: number;
|
|
61
|
+
end: number;
|
|
62
|
+
};
|
|
63
|
+
coordinateType: string;
|
|
64
|
+
format: string;
|
|
65
|
+
}>;
|
|
52
66
|
/**
|
|
53
67
|
* get a buffer containing the "header" region of
|
|
54
68
|
* the file, which are the bytes up to the first
|
|
55
69
|
* non-meta line
|
|
56
|
-
*
|
|
57
|
-
* @returns {Promise} for a buffer
|
|
58
70
|
*/
|
|
59
71
|
getHeaderBuffer(opts?: Options): Promise<Buffer>;
|
|
60
72
|
/**
|
|
@@ -66,13 +78,10 @@ export default class TabixIndexedFile {
|
|
|
66
78
|
getHeader(opts?: Options): Promise<string>;
|
|
67
79
|
/**
|
|
68
80
|
* get an array of reference sequence names, in the order in which
|
|
69
|
-
* they occur in the file.
|
|
70
|
-
*
|
|
71
|
-
* reference sequence renaming is not applied to these names.
|
|
72
|
-
*
|
|
73
|
-
* @returns {Promise} for an array of string sequence names
|
|
81
|
+
* they occur in the file. reference sequence renaming is not applied
|
|
82
|
+
* to these names.
|
|
74
83
|
*/
|
|
75
|
-
getReferenceSequenceNames(opts?: Options): Promise<
|
|
84
|
+
getReferenceSequenceNames(opts?: Options): Promise<string[]>;
|
|
76
85
|
/**
|
|
77
86
|
* @param {object} metadata metadata object from the parsed index,
|
|
78
87
|
* containing columnNumbers, metaChar, and format
|
|
@@ -83,16 +92,7 @@ export default class TabixIndexedFile {
|
|
|
83
92
|
* @returns {object} like `{startCoordinate, overlaps}`. overlaps is boolean,
|
|
84
93
|
* true if line is a data line that overlaps the given region
|
|
85
94
|
*/
|
|
86
|
-
checkLine(
|
|
87
|
-
columnNumbers: {
|
|
88
|
-
ref: number;
|
|
89
|
-
start: number;
|
|
90
|
-
end: number;
|
|
91
|
-
};
|
|
92
|
-
metaChar: string;
|
|
93
|
-
coordinateType: string;
|
|
94
|
-
format: string;
|
|
95
|
-
}, regionRefName: string, regionStart: number, regionEnd: number, line: string): {
|
|
95
|
+
checkLine(metadata: IndexData, regionRefName: string, regionStart: number, regionEnd: number, line: string): {
|
|
96
96
|
overlaps: boolean;
|
|
97
97
|
startCoordinate?: undefined;
|
|
98
98
|
} | {
|
|
@@ -102,17 +102,19 @@ export default class TabixIndexedFile {
|
|
|
102
102
|
_getVcfEnd(startCoordinate: number, refSeq: string, info: any): number;
|
|
103
103
|
/**
|
|
104
104
|
* return the approximate number of data lines in the given reference sequence
|
|
105
|
-
* @param
|
|
106
|
-
* @returns
|
|
105
|
+
* @param refSeq reference sequence name
|
|
106
|
+
* @returns number of data lines present on that reference sequence
|
|
107
107
|
*/
|
|
108
108
|
lineCount(refName: string, opts?: Options): Promise<number>;
|
|
109
|
-
_readRegion(
|
|
109
|
+
_readRegion(pos: number, size: number, opts?: Options): Promise<Buffer>;
|
|
110
110
|
/**
|
|
111
111
|
* read and uncompress the data in a chunk (composed of one or more
|
|
112
112
|
* contiguous bgzip blocks) of the file
|
|
113
|
-
* @param {Chunk} chunk
|
|
114
|
-
* @returns {Promise} for a string chunk of the file
|
|
115
113
|
*/
|
|
116
|
-
readChunk(
|
|
114
|
+
readChunk(c: Chunk, opts?: Options): Promise<{
|
|
115
|
+
buffer: Buffer;
|
|
116
|
+
cpositions: number[];
|
|
117
|
+
dpositions: number[];
|
|
118
|
+
}>;
|
|
117
119
|
}
|
|
118
120
|
export {};
|