@gmod/tabix 1.5.6 → 1.5.8
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 +28 -21
- package/README.md +19 -22
- 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,45 @@
|
|
|
1
|
-
## [1.5.
|
|
1
|
+
## [1.5.8](https://github.com/GMOD/tabix-js/compare/v1.5.7...v1.5.8) (2023-03-24)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
-
|
|
5
|
+
- Make yieldTime optional
|
|
6
6
|
|
|
7
|
-
## [1.5.
|
|
7
|
+
## [1.5.7](https://github.com/GMOD/tabix-js/compare/v1.5.6...v1.5.7) (2023-03-24)
|
|
8
8
|
|
|
9
|
+
- Add yieldTime parameter
|
|
10
|
+
- Improve typescripting
|
|
9
11
|
|
|
12
|
+
## [1.5.6](https://github.com/GMOD/tabix-js/compare/v1.5.5...v1.5.6) (2023-02-28)
|
|
10
13
|
|
|
11
|
-
-
|
|
14
|
+
- Add fix for fileOffset being stable in presence of Unicode characters (#137)
|
|
12
15
|
|
|
13
|
-
## [1.5.
|
|
16
|
+
## [1.5.5](https://github.com/GMOD/tabix-js/compare/v1.5.4...v1.5.5) (2022-12-17)
|
|
14
17
|
|
|
18
|
+
- Use es2015 for nodejs build
|
|
15
19
|
|
|
20
|
+
## [1.5.4](https://github.com/GMOD/tabix-js/compare/v1.5.3...v1.5.4) (2022-07-18)
|
|
16
21
|
|
|
17
22
|
- Bump generic-filehandle 2->3
|
|
18
23
|
|
|
19
24
|
## [1.5.3](https://github.com/GMOD/tabix-js/compare/v1.5.2...v1.5.3) (2022-04-25)
|
|
20
25
|
|
|
21
|
-
|
|
22
|
-
|
|
23
26
|
- Fix esm module build to use ESM instead of CJS
|
|
24
27
|
|
|
25
28
|
<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
29
|
|
|
30
|
+
## [1.5.2](https://github.com/GMOD/tabix-js/compare/v1.5.1...v1.5.2) (2021-12-15)
|
|
29
31
|
|
|
30
32
|
- Change typescript signature of lineCallback from Promise<void> to void
|
|
31
33
|
|
|
32
34
|
<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
35
|
|
|
36
|
+
## [1.5.1](https://github.com/GMOD/tabix-js/compare/v1.5.0...v1.5.1) (2021-12-15)
|
|
36
37
|
|
|
37
38
|
- Add esm module with less babelification for smaller bundle size
|
|
38
39
|
|
|
39
40
|
<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
41
|
|
|
42
|
+
# [1.5.0](https://github.com/GMOD/tabix-js/compare/v1.4.6...v1.5.0) (2020-12-11)
|
|
43
43
|
|
|
44
44
|
- Use TextDecoder for chunk decoding for small speedup
|
|
45
45
|
- Use canMergeChunks logic to avoid too large of chunks being used
|
|
@@ -49,14 +49,16 @@
|
|
|
49
49
|
|
|
50
50
|
## [1.4.6](https://github.com/GMOD/tabix-js/compare/v1.4.5...v1.4.6) (2020-04-30)
|
|
51
51
|
|
|
52
|
-
- Fix regression with browser only version of tabix-js not being able to parse
|
|
52
|
+
- Fix regression with browser only version of tabix-js not being able to parse
|
|
53
|
+
results in 1.4.5
|
|
53
54
|
|
|
54
55
|
<a name="1.4.5"></a>
|
|
55
56
|
|
|
56
57
|
## [1.4.5](https://github.com/GMOD/tabix-js/compare/v1.4.4...v1.4.5) (2020-04-28)
|
|
57
58
|
|
|
58
|
-
- Remove the filehandle size() call because this is unnecessary and would
|
|
59
|
-
and because it additionally has a CORS configuration
|
|
59
|
+
- Remove the filehandle size() call because this is unnecessary and would
|
|
60
|
+
indicate a corrupt index, and because it additionally has a CORS configuration
|
|
61
|
+
overhead
|
|
60
62
|
|
|
61
63
|
<a name="1.4.4"></a>
|
|
62
64
|
|
|
@@ -69,7 +71,8 @@
|
|
|
69
71
|
## [1.4.3](https://github.com/GMOD/tabix-js/compare/v1.4.2...v1.4.3) (2020-02-04)
|
|
70
72
|
|
|
71
73
|
- Fix optional param for constructor for typescript
|
|
72
|
-
- Update method of calculating fileOffset based IDs using updated
|
|
74
|
+
- Update method of calculating fileOffset based IDs using updated
|
|
75
|
+
@gmod/bgzf-filehandle
|
|
73
76
|
|
|
74
77
|
<a name="1.4.2"></a>
|
|
75
78
|
|
|
@@ -121,11 +124,13 @@
|
|
|
121
124
|
|
|
122
125
|
## [1.1.8](https://github.com/GMOD/tabix-js/compare/v1.1.7...v1.1.8) (2019-06-06)
|
|
123
126
|
|
|
124
|
-
- Add a fix for a bgzf unzipping thing that could result in duplicate features
|
|
127
|
+
- Add a fix for a bgzf unzipping thing that could result in duplicate features
|
|
128
|
+
being returned
|
|
125
129
|
|
|
126
130
|
## [1.1.7](https://github.com/GMOD/tabix-js/compare/v1.1.6...v1.1.7) (2019-06-04)
|
|
127
131
|
|
|
128
|
-
- Removed chunk merging from header file parsing which now results in smaller
|
|
132
|
+
- Removed chunk merging from header file parsing which now results in smaller
|
|
133
|
+
bgzf unzip calls being streamed out to clients
|
|
129
134
|
|
|
130
135
|
## [1.1.6](https://github.com/GMOD/tabix-js/compare/v1.1.5...v1.1.6) (2019-05-31)
|
|
131
136
|
|
|
@@ -134,7 +139,8 @@
|
|
|
134
139
|
|
|
135
140
|
## [1.1.5](https://github.com/GMOD/tabix-js/compare/v1.1.4...v1.1.5) (2019-03-05)
|
|
136
141
|
|
|
137
|
-
- Fix parsing on a tabix file that should be csi files (e.g. too long of
|
|
142
|
+
- Fix parsing on a tabix file that should be csi files (e.g. too long of
|
|
143
|
+
chromosomes)
|
|
138
144
|
|
|
139
145
|
## [1.1.4](https://github.com/GMOD/tabix-js/compare/v1.1.3...v1.1.4) (2019-02-23)
|
|
140
146
|
|
|
@@ -142,7 +148,8 @@
|
|
|
142
148
|
|
|
143
149
|
## [1.1.3](https://github.com/GMOD/tabix-js/compare/v1.1.2...v1.1.3) (2018-11-23)
|
|
144
150
|
|
|
145
|
-
- Change to es6-promisify and quick-lru which can be babelified to IE11
|
|
151
|
+
- Change to es6-promisify and quick-lru which can be babelified to IE11
|
|
152
|
+
(util.promisify and lru-cache used Object.defineProperty('length', ...))
|
|
146
153
|
|
|
147
154
|
## [1.1.2](https://github.com/GMOD/tabix-js/compare/v1.1.1...v1.1.2) (2018-10-26)
|
|
148
155
|
|
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Read Tabix-indexed files using either .tbi or .csi indexes.
|
|
|
14
14
|
|
|
15
15
|
### Importing the module
|
|
16
16
|
|
|
17
|
-
```
|
|
17
|
+
```typescript
|
|
18
18
|
// import with require in node.js
|
|
19
19
|
const { TabixIndexedFile } = require('@gmod/tabix')
|
|
20
20
|
|
|
@@ -28,7 +28,7 @@ Basic usage of TabixIndexedFile under node.js supplies a path and optionally a
|
|
|
28
28
|
tbiPath to the constructor. If no tbiPath is supplied, it assumes that the
|
|
29
29
|
path+'.tbi' is the location of the tbiPath.
|
|
30
30
|
|
|
31
|
-
```
|
|
31
|
+
```typescript
|
|
32
32
|
// basic usage under node.js provides a file path on the filesystem to bgzipped file
|
|
33
33
|
// it assumes the tbi file is path+'.tbi' if no tbiPath is supplied
|
|
34
34
|
const tbiIndexed = new TabixIndexedFile({
|
|
@@ -43,7 +43,7 @@ The renameRefSeqs callback makes it so that you can use
|
|
|
43
43
|
file.getLines('1',0,100,...) even when the file itself contains names like
|
|
44
44
|
'chr1' (can also do the reverse by customizing the renameRefSeqs callback)
|
|
45
45
|
|
|
46
|
-
```
|
|
46
|
+
```typescript
|
|
47
47
|
// can also open tabix files that have a .csi index
|
|
48
48
|
// note also usage of renameRefSeqs callback to trim chr off the chr names
|
|
49
49
|
const csiIndexed = new TabixIndexedFile({
|
|
@@ -59,12 +59,12 @@ The basic usage of fetching remote files is done by supplying a
|
|
|
59
59
|
[generic-filehandle](https://github.com/GMOD/generic-filehandle) module
|
|
60
60
|
RemoteFile filehandle, as seen below
|
|
61
61
|
|
|
62
|
-
```
|
|
62
|
+
```typescript
|
|
63
63
|
// use a remote file or other filehandle, note RemoteFile comes from https://github.com/GMOD/generic-filehandle
|
|
64
|
-
const {RemoteFile} = require('generic-filehandle')
|
|
64
|
+
const { RemoteFile } = require('generic-filehandle')
|
|
65
65
|
const remoteTbiIndexed = new TabixIndexedFile({
|
|
66
66
|
filehandle: new RemoteFile('http://yourhost/file.vcf.gz'),
|
|
67
|
-
tbiFilehandle: new RemoteFile('http://yourhost/file.vcf.gz.tbi') // can also be csiFilehandle
|
|
67
|
+
tbiFilehandle: new RemoteFile('http://yourhost/file.vcf.gz.tbi'), // can also be csiFilehandle
|
|
68
68
|
})
|
|
69
69
|
```
|
|
70
70
|
|
|
@@ -72,12 +72,12 @@ This works in both the browser and in node.js, but note that in node.js you have
|
|
|
72
72
|
to also supply a custom fetch function to the RemoteFile constructor e.g. like
|
|
73
73
|
this
|
|
74
74
|
|
|
75
|
-
```
|
|
75
|
+
```typescript
|
|
76
76
|
// for node.js you have to manually supply a fetch function e.g. node-fetch to RemoteFile
|
|
77
77
|
const fetch = require('node-fetch')
|
|
78
78
|
const remoteTbiIndexedForNodeJs = new TabixIndexedFile({
|
|
79
|
-
filehandle: new RemoteFile('http://yourhost/file.vcf.gz', {fetch}),
|
|
80
|
-
tbiFilehandle: new RemoteFile('http://yourhost/file.vcf.gz.tbi', {fetch}) // can also be csiFilehandle
|
|
79
|
+
filehandle: new RemoteFile('http://yourhost/file.vcf.gz', { fetch }),
|
|
80
|
+
tbiFilehandle: new RemoteFile('http://yourhost/file.vcf.gz.tbi', { fetch }), // can also be csiFilehandle
|
|
81
81
|
})
|
|
82
82
|
```
|
|
83
83
|
|
|
@@ -91,13 +91,12 @@ Important: the `start` and `end` values that are supplied to `getLines` are
|
|
|
91
91
|
0-based half-open coordinates. This is different from the 1-based values that
|
|
92
92
|
are supplied to the tabix command line tool
|
|
93
93
|
|
|
94
|
-
```
|
|
94
|
+
```typescript
|
|
95
95
|
// iterate over lines in the specified region
|
|
96
96
|
const lines = []
|
|
97
|
-
await tbiIndexed.getLines('ctgA',200,300, function(line, fileOffset) {
|
|
98
|
-
|
|
97
|
+
await tbiIndexed.getLines('ctgA', 200, 300, function (line, fileOffset) {
|
|
98
|
+
lines.push(line)
|
|
99
99
|
})
|
|
100
|
-
|
|
101
100
|
```
|
|
102
101
|
|
|
103
102
|
After running this, your `lines` array would contain an array of lines from the
|
|
@@ -106,14 +105,13 @@ file that match your query range
|
|
|
106
105
|
You can also supply some extra arguments to getLines with this format, but these
|
|
107
106
|
are sort of obscure and only used in some circumstances
|
|
108
107
|
|
|
109
|
-
```
|
|
108
|
+
```typescript
|
|
110
109
|
const lines = []
|
|
111
110
|
const aborter = new AbortController()
|
|
112
|
-
await tbiIndexed.getLines('ctgA',200,300, {
|
|
111
|
+
await tbiIndexed.getLines('ctgA', 200, 300, {
|
|
113
112
|
lineCallback: (line, fileOffset) => lines.push(line),
|
|
114
|
-
signal: aborter.signal // an optional AbortSignal from an AbortController
|
|
113
|
+
signal: aborter.signal, // an optional AbortSignal from an AbortController
|
|
115
114
|
})
|
|
116
|
-
|
|
117
115
|
```
|
|
118
116
|
|
|
119
117
|
After running the above demo, lines is now an array of strings, containing the
|
|
@@ -129,7 +127,7 @@ Notes about the returned values of `getLines`:
|
|
|
129
127
|
- if getLines is called with an undefined `end` parameter it gets all lines from
|
|
130
128
|
start going to the end of the contig e.g.
|
|
131
129
|
|
|
132
|
-
```
|
|
130
|
+
```typescript
|
|
133
131
|
const lines = []
|
|
134
132
|
await tbiIndexed.getLines('ctgA', 0, undefined, line=>lines.push(line))`
|
|
135
133
|
console.log(lines)
|
|
@@ -137,18 +135,17 @@ console.log(lines)
|
|
|
137
135
|
|
|
138
136
|
### lineCount
|
|
139
137
|
|
|
140
|
-
```
|
|
138
|
+
```typescript
|
|
141
139
|
// get the approximate number of data lines in the
|
|
142
140
|
// file for the given reference sequence, excluding header, comment, and whitespace lines
|
|
143
141
|
// uses the extra bin from tabix
|
|
144
142
|
const numLines = await tbiIndexed.lineCount('ctgA')
|
|
145
143
|
// or const numLines = await tbiIndexed.lineCount('ctgA', { signal: aborter.signal })
|
|
146
|
-
|
|
147
144
|
```
|
|
148
145
|
|
|
149
146
|
### getHeader
|
|
150
147
|
|
|
151
|
-
```
|
|
148
|
+
```typescript
|
|
152
149
|
// get the "header text" string from the file, which is the first contiguous
|
|
153
150
|
// set of lines in the file that all start with a "meta" character (usually #)
|
|
154
151
|
const headerText = await tbiIndexed.getHeader()
|
|
@@ -157,7 +154,7 @@ const headerText = await tbiIndexed.getHeader()
|
|
|
157
154
|
|
|
158
155
|
#### getHeaderBuffer
|
|
159
156
|
|
|
160
|
-
```
|
|
157
|
+
```typescript
|
|
161
158
|
// or if you want a nodejs Buffer object instead, there is getHeaderBuffer()
|
|
162
159
|
const headerBuffer = await tbiIndexed.getHeaderBuffer()
|
|
163
160
|
// or const headerBuffer = await tbiIndexed.getHeaderBuffer({ signal: aborter.signal })
|
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAuB;AACvB,2DAA6C;AAE7C,iEAA0D;AAC1D,oDAA2B;AAC3B,iCAAqD;AAErD,4DAAgD;AAEhD,MAAM,UAAU,GAAG,QAAQ,CAAA,CAAC,QAAQ;AACpC,MAAM,UAAU,GAAG,QAAQ,CAAA,CAAC,QAAQ;AAEpC,SAAS,MAAM,CAAC,GAAW,EAAE,IAAY;IACvC,OAAO,GAAG,GAAG,SAAA,CAAC,EAAI,IAAI,CAAA,CAAA;AACxB,CAAC;AACD,SAAS,MAAM,CAAC,GAAW,EAAE,IAAY;IACvC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,SAAA,CAAC,EAAI,IAAI,CAAA,CAAC,CAAA;AACpC,CAAC;AAED,MAAqB,GAAI,SAAQ,mBAAS;IAIxC,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,YAAY,GAAG,CAAC,CAAA;QACrB,IAAI,CAAC,KAAK,GAAG,CAAC,CAAA;QACd,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAA;IACnB,CAAC;IACK,SAAS,CAAC,OAAe,EAAE,OA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AAC,GAAG,EAAE,CAAC,CAAC,CAAA;YAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE;gBAC3C,MAAM,IAAI,KAAK,CACb,SAAS,GAAG,IAAI,GAAG,mDAAmD,IAAI,CAAC,QAAQ,WAAW,IAAI,CAAC,KAAK,0DAA0D,CACnK,CAAA;aACF;YACD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;SAClB;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AArPD,sBAqPC"}
|
package/dist/indexFile.d.ts
CHANGED
|
@@ -5,28 +5,48 @@ export interface Options {
|
|
|
5
5
|
[key: string]: unknown;
|
|
6
6
|
signal?: AbortSignal;
|
|
7
7
|
}
|
|
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,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