@gmod/bbi 2.0.3 → 2.0.5

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/src/blockView.ts CHANGED
@@ -16,6 +16,8 @@ interface CoordRequest {
16
16
  end: number
17
17
  }
18
18
  interface DataBlock {
19
+ blockOffset: bigint
20
+ blockSize: bigint
19
21
  startChrom: number
20
22
  endChrom: number
21
23
  startBase: number
@@ -200,8 +202,13 @@ export class BlockView {
200
202
  }
201
203
  const request = { chrId, start, end }
202
204
  if (!this.cirTreePromise) {
203
- const off = Number(cirTreeOffset)
204
- this.cirTreePromise = bbi.read(Buffer.alloc(48), 0, 48, off, opts)
205
+ this.cirTreePromise = bbi.read(
206
+ Buffer.alloc(48),
207
+ 0,
208
+ 48,
209
+ Number(cirTreeOffset),
210
+ opts,
211
+ )
205
212
  }
206
213
  const { buffer } = await this.cirTreePromise
207
214
  const cirBlockSize = isBigEndian
@@ -218,7 +225,10 @@ export class BlockView {
218
225
  try {
219
226
  const data = cirBlockData.subarray(offset)
220
227
 
221
- const p = this.leafParser.parse(data)
228
+ const p = this.leafParser.parse(data) as {
229
+ blocksToFetch: DataBlock[]
230
+ recurOffsets: DataBlock[]
231
+ }
222
232
  if (p.blocksToFetch) {
223
233
  blocksToFetch = blocksToFetch.concat(
224
234
  p.blocksToFetch
@@ -232,7 +242,7 @@ export class BlockView {
232
242
  if (p.recurOffsets) {
233
243
  const recurOffsets = p.recurOffsets
234
244
  .filter(filterFeats)
235
- .map((l: { blockOffset: bigint }) => Number(l.blockOffset))
245
+ .map(l => Number(l.blockOffset))
236
246
  if (recurOffsets.length > 0) {
237
247
  cirFobRecur(recurOffsets, level + 1)
238
248
  }