import LRU from '@jbrowse/quick-lru'; import type Chunk from './chunk.ts'; import type { Options } from './indexFile.ts'; import type { GenericFilehandle } from 'generic-filehandle2'; type GetLinesCallback = (line: string, fileOffset: number, start: number, end: number) => void; interface GetLinesOpts { signal?: AbortSignal; lineCallback: GetLinesCallback; } export default class TabixIndexedFile { private filehandle; private index; private chunkCache; cache: LRU; /** * @param {object} args * @param {string} [args.path] * @param {object} [args.filehandle] * @param {string} [args.url] * @param {string} [args.tbiPath] * @param {string} [args.tbiUrl] * @param {object} [args.tbiFilehandle] * @param {string} [args.csiPath] * @param {string} [args.csiUrl] * @param {object} [args.csiFilehandle] * @param {number} [args.chunkCacheSize] * @param {number} [args.yieldTime] yield to main thread after N milliseconds if reading features is taking a long time to avoid hanging main thread * @param {Function} [args.renameRefSeqs] optional function with sig `string => string` to transform reference sequence names for the purpose of indexing and querying. note that the data that is returned is not altered, just the names of the reference sequences that are used for querying. */ constructor({ path, filehandle, url, tbiPath, tbiUrl, tbiFilehandle, csiPath, csiUrl, csiFilehandle, chunkCacheSize, }: { path?: string; filehandle?: GenericFilehandle; url?: string; tbiPath?: string; tbiUrl?: string; tbiFilehandle?: GenericFilehandle; csiPath?: string; csiUrl?: string; csiFilehandle?: GenericFilehandle; chunkCacheSize?: number; }); /** * @param {string} refName name of the reference sequence * @param {number|undefined} start start of the region (0-based half-open) * @param {number|undefined} end end of the region (0-based half-open) * @param {GetLinesOpts|GetLinesCallback} opts callback invoked for each line, or an options object with `lineCallback` and optional `signal` * @returns {Promise} promise that is resolved when the whole read is finished, rejected on error */ getLines(refName: string, s: number | undefined, e: number | undefined, opts: GetLinesOpts | GetLinesCallback): Promise; getMetadata(opts?: Options): Promise<{ refNameToId: Record; refIdToName: string[]; metaChar: string | undefined; columnNumbers: { ref: number; start: number; end: number; }; coordinateType: string; format: string; maxRefLength: number; skipLines?: number; maxBinNumber?: number; maxBlockSize: number; firstDataLine?: import("./virtualOffset.ts").default; refCount?: number; csi?: boolean; csiVersion?: number; depth?: number; }>; getHeaderBuffer(opts?: Options): Promise>; getHeader(opts?: Options): Promise; getReferenceSequenceNames(opts?: Options): Promise; /** * return the number of data lines in the given reference sequence * @param {string} refName reference sequence name * @returns {number} number of data lines present on that reference sequence */ lineCount(refName: string, opts?: Options): Promise; readChunk(c: Chunk, opts?: Options): Promise<{ buffer: Uint8Array; cpositions: number[]; dpositions: number[]; }>; } export {};