UNPKG

@gmod/bbi

Version:

Parser for BigWig/BigBed files

25 lines 928 B
import { BBI } from "./bbi.js"; import { BlockView } from "./block-view.js"; export class BigWig extends BBI { /** * Retrieves a BlockView of a specific zoomLevel * * @param scale - number * * @param opts - An object containing basesPerSpan (e.g. pixels per basepair) * or scale used to infer the zoomLevel to use */ async getView(scale, opts) { const { zoomLevels, refsByName, uncompressBufSize } = await this.getHeader(opts); const basesPerPx = 1 / scale; const maxLevel = zoomLevels.length - 1; for (let i = maxLevel; i >= 0; i -= 1) { const zh = zoomLevels[i]; if (zh && zh.reductionLevel <= 2 * basesPerPx) { return new BlockView(this.bbi, refsByName, zh.indexOffset, uncompressBufSize, 'summary'); } } return this.getUnzoomedView(opts); } } //# sourceMappingURL=bigwig.js.map