Genotype API Documentation - v0.1.0
    Preparing search index...

    Class BAIReader

    BAI reader class for loading and querying BAM index files

    Optimized for both small indexes (loaded entirely in memory) and large indexes (streaming access with selective caching).

    const reader = new BAIReader('/path/to/file.bam.bai');
    const index = await reader.readIndex();
    const chunks = await reader.queryRegion(0, 1000, 2000);
    const reader = new BAIReader('/path/to/file.bam.bai', {
    cacheIndex: true,
    validateOnLoad: true,
    bufferSize: 256 * 1024
    });
    Index

    Constructors

    Methods

    • Query genomic region and return relevant chunks for BAM file access

      Parameters

      • referenceId: number

        Reference sequence ID (0-based)

      • start: number

        Start coordinate (0-based, inclusive)

      • end: number

        End coordinate (0-based, exclusive)

      Returns Promise<BAIQueryResult>

      Promise resolving to query result with chunks

      If query parameters are invalid or index not loaded

    • Validate index integrity and structure

      Parameters

      • thorough: boolean = false

        Whether to perform thorough validation (slower)

      Returns Promise<{ isValid: boolean; warnings: string[]; errors: string[] }>

      Promise resolving to validation result