@gmod/tabix 1.4.4 → 1.5.1

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 CHANGED
@@ -1,81 +1,99 @@
1
- <a name="1.4.4"></a>
2
- ## [1.4.4](https://github.com/GMOD/tabix-js/compare/v1.4.3...v1.4.4) (2020-04-06)
1
+ <a name="1.5.1"></a>
2
+ ## [1.5.1](https://github.com/GMOD/tabix-js/compare/v1.5.0...v1.5.1) (2021-12-15)
3
+
4
+
5
+
6
+ - Add esm module with less babelification for smaller bundle size
7
+
8
+ <a name="1.5.0"></a>
9
+ # [1.5.0](https://github.com/GMOD/tabix-js/compare/v1.4.6...v1.5.0) (2020-12-11)
10
+
11
+
12
+
13
+ - Use TextDecoder for chunk decoding for small speedup
14
+ - Use canMergeChunks logic to avoid too large of chunks being used
15
+ - Use time based yield instead of number-of-line based yield
16
+
17
+ <a name="1.4.6"></a>
18
+
19
+ ## [1.4.6](https://github.com/GMOD/tabix-js/compare/v1.4.5...v1.4.6) (2020-04-30)
20
+
21
+ - Fix regression with browser only version of tabix-js not being able to parse results in 1.4.5
3
22
 
23
+ <a name="1.4.5"></a>
4
24
 
25
+ ## [1.4.5](https://github.com/GMOD/tabix-js/compare/v1.4.4...v1.4.5) (2020-04-28)
26
+
27
+ - Remove the filehandle size() call because this is unnecessary and would indicate a corrupt index,
28
+ and because it additionally has a CORS configuration overhead
29
+
30
+ <a name="1.4.4"></a>
31
+
32
+ ## [1.4.4](https://github.com/GMOD/tabix-js/compare/v1.4.3...v1.4.4) (2020-04-06)
5
33
 
6
34
  - Fix usage of tabix where start column and end column are the same
7
35
 
8
36
  <a name="1.4.3"></a>
9
- ## [1.4.3](https://github.com/GMOD/tabix-js/compare/v1.4.2...v1.4.3) (2020-02-04)
10
-
11
37
 
38
+ ## [1.4.3](https://github.com/GMOD/tabix-js/compare/v1.4.2...v1.4.3) (2020-02-04)
12
39
 
13
40
  - Fix optional param for constructor for typescript
14
41
  - Update method of calculating fileOffset based IDs using updated @gmod/bgzf-filehandle
15
42
 
16
43
  <a name="1.4.2"></a>
17
- ## [1.4.2](https://github.com/GMOD/tabix-js/compare/v1.4.1...v1.4.2) (2020-02-01)
18
-
19
44
 
45
+ ## [1.4.2](https://github.com/GMOD/tabix-js/compare/v1.4.1...v1.4.2) (2020-02-01)
20
46
 
21
47
  - Fix usage of renameRefSeqs callback
22
48
 
23
49
  <a name="1.4.1"></a>
24
- ## [1.4.1](https://github.com/GMOD/tabix-js/compare/v1.4.0...v1.4.1) (2020-02-01)
25
-
26
50
 
51
+ ## [1.4.1](https://github.com/GMOD/tabix-js/compare/v1.4.0...v1.4.1) (2020-02-01)
27
52
 
28
53
  - Remove a runtime dependency on a @types module
29
54
 
30
55
  <a name="1.4.0"></a>
31
- # [1.4.0](https://github.com/GMOD/tabix-js/compare/v1.3.2...v1.4.0) (2020-02-01)
32
-
33
56
 
57
+ # [1.4.0](https://github.com/GMOD/tabix-js/compare/v1.3.2...v1.4.0) (2020-02-01)
34
58
 
35
59
  - Add typescripting of the codebase
36
60
  - Drop Node 6 support due to changes in our dependencies
37
61
 
38
62
  <a name="1.3.2"></a>
39
- ## [1.3.2](https://github.com/GMOD/tabix-js/compare/v1.3.1...v1.3.2) (2019-11-01)
40
-
41
63
 
64
+ ## [1.3.2](https://github.com/GMOD/tabix-js/compare/v1.3.1...v1.3.2) (2019-11-01)
42
65
 
43
66
  - Make <TRA> SVs to ignore their usage of the END= INFO field going with the
44
67
  since it refers to the other side of a translocation
45
68
  - Make stable fileOffset based IDs
46
69
 
47
70
  <a name="1.3.1"></a>
48
- ## [1.3.1](https://github.com/GMOD/tabix-js/compare/v1.3.0...v1.3.1) (2019-10-06)
49
-
50
71
 
72
+ ## [1.3.1](https://github.com/GMOD/tabix-js/compare/v1.3.0...v1.3.1) (2019-10-06)
51
73
 
52
74
  - Small refactor of `filehandle.read()` to make it more robust
53
75
 
54
76
  <a name="1.3.0"></a>
77
+
55
78
  # [1.3.0](https://github.com/GMOD/tabix-js/compare/v1.2.0...v1.3.0) (2019-08-08)
56
79
 
57
80
  - Add ability to pass an AbortSignal from an AbortController to `getLines()`
58
81
 
59
82
  <a name="1.2.0"></a>
60
- # [1.2.0](https://github.com/GMOD/tabix-js/compare/v1.1.8...v1.2.0) (2019-07-05)
61
-
62
83
 
84
+ # [1.2.0](https://github.com/GMOD/tabix-js/compare/v1.1.8...v1.2.0) (2019-07-05)
63
85
 
64
86
  - Add ability for `getLines` to be open-ended. With no `end`, getlines continues
65
- until the end of the sequence.
87
+ until the end of the sequence.
66
88
 
67
89
  <a name="1.1.8"></a>
68
- ## [1.1.8](https://github.com/GMOD/tabix-js/compare/v1.1.7...v1.1.8) (2019-06-06)
69
-
70
90
 
91
+ ## [1.1.8](https://github.com/GMOD/tabix-js/compare/v1.1.7...v1.1.8) (2019-06-06)
71
92
 
72
93
  - Add a fix for a bgzf unzipping thing that could result in duplicate features being returned
73
94
 
74
-
75
95
  ## [1.1.7](https://github.com/GMOD/tabix-js/compare/v1.1.6...v1.1.7) (2019-06-04)
76
96
 
77
-
78
-
79
97
  - Removed chunk merging from header file parsing which now results in smaller bgzf unzip calls being streamed out to clients
80
98
 
81
99
  ## [1.1.6](https://github.com/GMOD/tabix-js/compare/v1.1.5...v1.1.6) (2019-05-31)
@@ -116,7 +134,6 @@ until the end of the sequence.
116
134
 
117
135
  ## [1.0.1](https://github.com/GMOD/tabix-js/compare/v1.0.0...v1.0.1) (2018-09-15)
118
136
 
119
-
120
137
  - Add renameRefSeqs handling
121
138
  - Fix some blocksForRange
122
139
 
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # @gmod/tabix
2
2
 
3
3
  [![NPM version](https://img.shields.io/npm/v/@gmod/tabix.svg?style=flat-square)](https://npmjs.org/package/@gmod/tabix)
4
- [![Build Status](https://img.shields.io/travis/GMOD/tabix-js/master.svg?style=flat-square)](https://travis-ci.org/GMOD/tabix-js)
5
- [![Greenkeeper badge](https://badges.greenkeeper.io/GMOD/tabix-js.svg)](https://greenkeeper.io/)
6
- [![codecov](https://codecov.io/gh/GMOD/tabix-js/branch/master/graph/badge.svg)](https://codecov.io/gh/GMOD/tabix-js)
4
+ [![Coverage Status](https://img.shields.io/codecov/c/github/GMOD/tabix-js/master.svg?style=flat-square)](https://codecov.io/gh/GMOD/tabix-js/branch/master)
5
+ [![Build Status](https://img.shields.io/github/workflow/status/GMOD/tabix-js/Push/master?logo=github&style=flat-query)](https://github.com/GMOD/tabix-js/actions?query=branch%3Amaster+workflow%3APush+)
6
+
7
7
 
8
8
 
9
9
  Read Tabix-indexed files using either .tbi or .csi indexes.
@@ -14,60 +14,157 @@ Read Tabix-indexed files using either .tbi or .csi indexes.
14
14
 
15
15
  ## Usage
16
16
 
17
+
18
+ ### Importing the module
19
+
17
20
  ```js
21
+
22
+ // import with require in node.js
18
23
  const {TabixIndexedFile} = require('@gmod/tabix')
19
24
 
20
- const tbiIndexed = new TabixIndexedFile({ path: 'path/to/my/file.gz' })
21
- // by default, assumes tabix index at path/to/my/file.gz.tbi.
22
- // can also provide `tbiPath` if the TBI is named differently
25
+ // or with es6 imports, this will also give typescript types
26
+ import {TabixIndexedFile} from '@gmod/tabix'
27
+ ```
28
+
29
+
30
+ ### TabixIndexedFile constructor
31
+
32
+
33
+ Basic usage of TabixIndexedFile under node.js supplies a path and optionally a tbiPath to the constructor. If no tbiPath is supplied, it assumes that the path+'.tbi' is the location of the tbiPath.
23
34
 
35
+ ```
36
+ // basic usage under node.js provides a file path on the filesystem to bgzipped file
37
+ // it assumes the tbi file is path+'.tbi' if no tbiPath is supplied
38
+ const tbiIndexed = new TabixIndexedFile({
39
+ path: 'path/to/my/file.gz'
40
+ tbiPath: 'path/to/my/file.gz.tbi'
41
+ })
42
+
43
+ ```
44
+
45
+ You can also use CSI indexes. Note also the usage of the renameRefSeqs callback. The renameRefSeqs callback makes it so that you can use file.getLines('1',0,100,...) even when the file itself contains names like 'chr1' (can also do the reverse by customizing the renameRefSeqs callback)
46
+
47
+ ```
24
48
  // can also open tabix files that have a .csi index
25
- // also trims chr off the chr names
49
+ // note also usage of renameRefSeqs callback to trim chr off the chr names
26
50
  const csiIndexed = new TabixIndexedFile({
27
51
  path: 'path/to/my/file.gz',
28
52
  csiPath: 'path/to/my/file.gz.csi'
29
- renameRefSeqs: (refSeq) => { return refSeq.replace('chr','') }
53
+ renameRefSeqs: refSeq => refSeq.replace('chr','')
30
54
  })
55
+ ```
56
+
57
+ #### TabixIndexedFile constructor with remote files
31
58
 
59
+
60
+ The basic usage of fetching remote files is done by supplying a [generic-filehandle](https://github.com/GMOD/generic-filehandle) module RemoteFile filehandle, as seen below
61
+
62
+
63
+ ```
32
64
  // use a remote file or other filehandle, note RemoteFile comes from https://github.com/GMOD/generic-filehandle
33
65
  const {RemoteFile} = require('generic-filehandle')
34
66
  const remoteTbiIndexed = new TabixIndexedFile({
35
67
  filehandle: new RemoteFile('http://yourhost/file.vcf.gz'),
36
68
  tbiFilehandle: new RemoteFile('http://yourhost/file.vcf.gz.tbi') // can also be csiFilehandle
37
69
  })
70
+ ```
71
+
72
+
73
+ This works in both the browser and in node.js, but note that in node.js you have to also supply a custom fetch function to the RemoteFile constructor e.g. like this
74
+
75
+
76
+ ```
77
+ // for node.js you have to manually supply a fetch function e.g. node-fetch to RemoteFile
78
+ const fetch = require('node-fetch')
79
+ const remoteTbiIndexedForNodeJs = new TabixIndexedFile({
80
+ filehandle: new RemoteFile('http://yourhost/file.vcf.gz', {fetch}),
81
+ tbiFilehandle: new RemoteFile('http://yourhost/file.vcf.gz.tbi', {fetch}) // can also be csiFilehandle
82
+ })
83
+ ```
84
+
85
+
86
+ ### getLines
87
+
88
+
89
+ The basic function this module provides is just called `getLines` and it returns text contents from the tabix file (it unzips the bgzipped data) and supplies it to a callback that you provide one line at a time.
90
+
91
+
92
+ Important: the `start` and `end` values that are supplied to `getLines` are 0-based half-open coordinates. This is different from the 1-based values that are supplied to the tabix command line tool
38
93
 
94
+
95
+ ```
39
96
  // iterate over lines in the specified region
40
97
  const lines = []
41
- await tbiIndexed.getLines('ctgA',200,300, (line, fileOffset) => lines.push(line))
42
- // alternative API usage
98
+ await tbiIndexed.getLines('ctgA',200,300, function(line, fileOffset) {
99
+ lines.push(line)
100
+ })
101
+
102
+ ```
103
+
104
+ After running this, your `lines` array would contain an array of lines from the file that match your query range
105
+
106
+
107
+ You can also supply some extra arguments to getLines with this format, but these are sort of obscure and only used in some circumstances
108
+
109
+
110
+ ```
111
+ const lines = []
43
112
  const aborter = new AbortController()
44
113
  await tbiIndexed.getLines('ctgA',200,300, {
45
114
  lineCallback: (line, fileOffset) => lines.push(line),
46
115
  signal: aborter.signal // an optional AbortSignal from an AbortController
47
116
  })
48
- // lines is now an array of strings, which are data lines.
49
- // commented (meta) lines are skipped.
50
- // line strings do not include any trailing whitespace characters.
51
- // the callback is also called with a `fileOffset`,
52
- // which gives the virtual file offset where the line is found in the file
53
117
 
118
+ ```
119
+
120
+ After running the above demo, lines is now an array of strings, containing the lines from the tabix file
121
+
122
+ Notes about the returned values of `getLines`:
123
+
124
+ - commented (meta) lines are skipped.
125
+ - line strings do not include any trailing whitespace characters.
126
+ - the callback is also called with a `fileOffset` that can be used to uniquely identify lines based on their virtual file offset where the line is found in the file
127
+ - if getLines is called with an undefined `end` parameter it gets all lines from start going to the end of the contig e.g.
128
+
129
+ ```
130
+ const lines = []
131
+ await tbiIndexed.getLines('ctgA', 0, undefined, line=>lines.push(line))`
132
+ console.log(lines)
133
+ ```
134
+
135
+
136
+
137
+
138
+ ### lineCount
139
+
140
+
141
+ ```
54
142
  // get the approximate number of data lines in the
55
143
  // file for the given reference sequence, excluding header, comment, and whitespace lines
144
+ // uses the extra bin from tabix
56
145
  const numLines = await tbiIndexed.lineCount('ctgA')
57
146
  // or const numLines = await tbiIndexed.lineCount('ctgA', { signal: aborter.signal })
58
147
 
148
+ ```
149
+
150
+
151
+ ### getHeader
152
+
153
+ ```
59
154
  // get the "header text" string from the file, which is the first contiguous
60
155
  // set of lines in the file that all start with a "meta" character (usually #)
61
156
  const headerText = await tbiIndexed.getHeader()
62
157
  // or const headerText = await tbiIndexed.getHeader({ signal: aborter.signal })
158
+ ```
63
159
 
160
+ #### getHeaderBuffer
161
+
162
+ ```
64
163
  // or if you want a nodejs Buffer object instead, there is getHeaderBuffer()
65
164
  const headerBuffer = await tbiIndexed.getHeaderBuffer()
66
165
  // or const headerBuffer = await tbiIndexed.getHeaderBuffer({ signal: aborter.signal })
67
166
  ```
68
167
 
69
- You may also use e.g. `tbiIndexed.getLines('ctgA', 200, undefined, lineCallback)`
70
- to get all lines starting at 200 and going to the end of ctgA.
71
168
 
72
169
  ## Academic Use
73
170
 
package/dist/chunk.js CHANGED
@@ -1,66 +1,37 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
4
-
5
- var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
6
-
7
- _Object$defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
-
11
- exports.default = void 0;
12
-
13
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
14
-
15
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
16
-
17
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
18
-
2
+ Object.defineProperty(exports, "__esModule", { value: true });
19
3
  // little class representing a chunk in the index
20
- var Chunk = /*#__PURE__*/function () {
21
- /**
22
- * @param {VirtualOffset} minv
23
- * @param {VirtualOffset} maxv
24
- * @param {number} bin
25
- * @param {number} [fetchedSize]
26
- */
27
- function Chunk(minv, maxv, bin) {
28
- var fetchedSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
29
- (0, _classCallCheck2.default)(this, Chunk);
30
- (0, _defineProperty2.default)(this, "minv", void 0);
31
- (0, _defineProperty2.default)(this, "maxv", void 0);
32
- (0, _defineProperty2.default)(this, "bin", void 0);
33
- (0, _defineProperty2.default)(this, "_fetchedSize", void 0);
34
- this.minv = minv;
35
- this.maxv = maxv;
36
- this.bin = bin;
37
- this._fetchedSize = fetchedSize;
38
- }
39
-
40
- (0, _createClass2.default)(Chunk, [{
41
- key: "toUniqueString",
42
- value: function toUniqueString() {
43
- return "".concat(this.minv, "..").concat(this.maxv, " (bin ").concat(this.bin, ", fetchedSize ").concat(this.fetchedSize(), ")");
4
+ var Chunk = /** @class */ (function () {
5
+ /**
6
+ * @param {VirtualOffset} minv
7
+ * @param {VirtualOffset} maxv
8
+ * @param {number} bin
9
+ * @param {number} [fetchedSize]
10
+ */
11
+ function Chunk(minv, maxv, bin, fetchedSize) {
12
+ if (fetchedSize === void 0) { fetchedSize = undefined; }
13
+ this.minv = minv;
14
+ this.maxv = maxv;
15
+ this.bin = bin;
16
+ this._fetchedSize = fetchedSize;
44
17
  }
45
- }, {
46
- key: "toString",
47
- value: function toString() {
48
- return this.toUniqueString();
49
- }
50
- }, {
51
- key: "compareTo",
52
- value: function compareTo(b) {
53
- return this.minv.compareTo(b.minv) || this.maxv.compareTo(b.maxv) || this.bin - b.bin;
54
- }
55
- }, {
56
- key: "fetchedSize",
57
- value: function fetchedSize() {
58
- if (this._fetchedSize !== undefined) return this._fetchedSize;
59
- return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;
60
- }
61
- }]);
62
- return Chunk;
63
- }();
64
-
18
+ Chunk.prototype.toUniqueString = function () {
19
+ return "".concat(this.minv, "..").concat(this.maxv, " (bin ").concat(this.bin, ", fetchedSize ").concat(this.fetchedSize(), ")");
20
+ };
21
+ Chunk.prototype.toString = function () {
22
+ return this.toUniqueString();
23
+ };
24
+ Chunk.prototype.compareTo = function (b) {
25
+ return (this.minv.compareTo(b.minv) ||
26
+ this.maxv.compareTo(b.maxv) ||
27
+ this.bin - b.bin);
28
+ };
29
+ Chunk.prototype.fetchedSize = function () {
30
+ if (this._fetchedSize !== undefined) {
31
+ return this._fetchedSize;
32
+ }
33
+ return this.maxv.blockPosition + (1 << 16) - this.minv.blockPosition;
34
+ };
35
+ return Chunk;
36
+ }());
65
37
  exports.default = Chunk;
66
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9jaHVuay50cyJdLCJuYW1lcyI6WyJDaHVuayIsIm1pbnYiLCJtYXh2IiwiYmluIiwiZmV0Y2hlZFNpemUiLCJ1bmRlZmluZWQiLCJfZmV0Y2hlZFNpemUiLCJ0b1VuaXF1ZVN0cmluZyIsImIiLCJjb21wYXJlVG8iLCJibG9ja1Bvc2l0aW9uIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFQTtJQUNxQkEsSztBQU1uQjs7Ozs7O0FBTUEsaUJBQ0VDLElBREYsRUFFRUMsSUFGRixFQUdFQyxHQUhGLEVBS0U7QUFBQSxRQURBQyxXQUNBLHVFQURjQyxTQUNkO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBLFNBQUtKLElBQUwsR0FBWUEsSUFBWjtBQUNBLFNBQUtDLElBQUwsR0FBWUEsSUFBWjtBQUNBLFNBQUtDLEdBQUwsR0FBV0EsR0FBWDtBQUNBLFNBQUtHLFlBQUwsR0FBb0JGLFdBQXBCO0FBQ0Q7Ozs7cUNBRWdCO0FBQ2YsdUJBQVUsS0FBS0gsSUFBZixlQUF3QixLQUFLQyxJQUE3QixtQkFDRSxLQUFLQyxHQURQLDJCQUVpQixLQUFLQyxXQUFMLEVBRmpCO0FBR0Q7OzsrQkFFVTtBQUNULGFBQU8sS0FBS0csY0FBTCxFQUFQO0FBQ0Q7Ozs4QkFFU0MsQyxFQUFVO0FBQ2xCLGFBQ0UsS0FBS1AsSUFBTCxDQUFVUSxTQUFWLENBQW9CRCxDQUFDLENBQUNQLElBQXRCLEtBQ0EsS0FBS0MsSUFBTCxDQUFVTyxTQUFWLENBQW9CRCxDQUFDLENBQUNOLElBQXRCLENBREEsSUFFQSxLQUFLQyxHQUFMLEdBQVdLLENBQUMsQ0FBQ0wsR0FIZjtBQUtEOzs7a0NBRWE7QUFDWixVQUFJLEtBQUtHLFlBQUwsS0FBc0JELFNBQTFCLEVBQXFDLE9BQU8sS0FBS0MsWUFBWjtBQUNyQyxhQUFPLEtBQUtKLElBQUwsQ0FBVVEsYUFBVixJQUEyQixLQUFLLEVBQWhDLElBQXNDLEtBQUtULElBQUwsQ0FBVVMsYUFBdkQ7QUFDRCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBWaXJ0dWFsT2Zmc2V0IGZyb20gJy4vdmlydHVhbE9mZnNldCdcblxuLy8gbGl0dGxlIGNsYXNzIHJlcHJlc2VudGluZyBhIGNodW5rIGluIHRoZSBpbmRleFxuZXhwb3J0IGRlZmF1bHQgY2xhc3MgQ2h1bmsge1xuICBwdWJsaWMgbWludjogVmlydHVhbE9mZnNldFxuICBwdWJsaWMgbWF4djogVmlydHVhbE9mZnNldFxuICBwdWJsaWMgYmluOiBudW1iZXJcbiAgcHVibGljIF9mZXRjaGVkU2l6ZT86IG51bWJlclxuXG4gIC8qKlxuICAgKiBAcGFyYW0ge1ZpcnR1YWxPZmZzZXR9IG1pbnZcbiAgICogQHBhcmFtIHtWaXJ0dWFsT2Zmc2V0fSBtYXh2XG4gICAqIEBwYXJhbSB7bnVtYmVyfSBiaW5cbiAgICogQHBhcmFtIHtudW1iZXJ9IFtmZXRjaGVkU2l6ZV1cbiAgICovXG4gIGNvbnN0cnVjdG9yKFxuICAgIG1pbnY6IFZpcnR1YWxPZmZzZXQsXG4gICAgbWF4djogVmlydHVhbE9mZnNldCxcbiAgICBiaW46IG51bWJlcixcbiAgICBmZXRjaGVkU2l6ZSA9IHVuZGVmaW5lZCxcbiAgKSB7XG4gICAgdGhpcy5taW52ID0gbWludlxuICAgIHRoaXMubWF4diA9IG1heHZcbiAgICB0aGlzLmJpbiA9IGJpblxuICAgIHRoaXMuX2ZldGNoZWRTaXplID0gZmV0Y2hlZFNpemVcbiAgfVxuXG4gIHRvVW5pcXVlU3RyaW5nKCkge1xuICAgIHJldHVybiBgJHt0aGlzLm1pbnZ9Li4ke3RoaXMubWF4dn0gKGJpbiAke1xuICAgICAgdGhpcy5iaW5cbiAgICB9LCBmZXRjaGVkU2l6ZSAke3RoaXMuZmV0Y2hlZFNpemUoKX0pYFxuICB9XG5cbiAgdG9TdHJpbmcoKSB7XG4gICAgcmV0dXJuIHRoaXMudG9VbmlxdWVTdHJpbmcoKVxuICB9XG5cbiAgY29tcGFyZVRvKGI6IENodW5rKSB7XG4gICAgcmV0dXJuIChcbiAgICAgIHRoaXMubWludi5jb21wYXJlVG8oYi5taW52KSB8fFxuICAgICAgdGhpcy5tYXh2LmNvbXBhcmVUbyhiLm1heHYpIHx8XG4gICAgICB0aGlzLmJpbiAtIGIuYmluXG4gICAgKVxuICB9XG5cbiAgZmV0Y2hlZFNpemUoKSB7XG4gICAgaWYgKHRoaXMuX2ZldGNoZWRTaXplICE9PSB1bmRlZmluZWQpIHJldHVybiB0aGlzLl9mZXRjaGVkU2l6ZVxuICAgIHJldHVybiB0aGlzLm1heHYuYmxvY2tQb3NpdGlvbiArICgxIDw8IDE2KSAtIHRoaXMubWludi5ibG9ja1Bvc2l0aW9uXG4gIH1cbn1cbiJdfQ==
package/dist/csi.d.ts CHANGED
@@ -63,10 +63,9 @@ export default class CSI extends IndexFile {
63
63
  parsePseudoBin(bytes: Buffer, offset: number): {
64
64
  lineCount: number;
65
65
  };
66
- blocksForRange(refName: string, beg: number, end: number, opts?: Options): Promise<Chunk[]>;
66
+ blocksForRange(refName: string, min: number, max: number, opts?: Options): Promise<Chunk[]>;
67
67
  /**
68
68
  * calculate the list of bins that may overlap with region [beg,end) (zero-based half-open)
69
- * @returns {Array[number]}
70
69
  */
71
- reg2bins(beg: number, end: number): number[];
70
+ reg2bins(beg: number, end: number): number[][];
72
71
  }