async skipExpectedValues(start) {

        const file = new BufferedFile({file: this.file, size: 256000})
        const range = {start: start, size: 4};
        const data = await file.read(range.start, range.size)
        const binaryParser = new BinaryParser(new DataView(data));
        const nEntries = binaryParser.getInt();   // Total # of expected value chunks
        if (nEntries === 0) {
            return range.start + range.size;
        } else {
            return parseNext(start + 4, nEntries);
        }     // Skip 4 bytes for int


        async function parseNext(start, nEntries) {

            let range = {start: start, size: 500}
            let chunkSize = 0
            let p0 = start;

            let data = await file.read(range.start, range.size)
            let binaryParser = new BinaryParser(new DataView(data));
            const type = binaryParser.getString(); // type
            const unit = binaryParser.getString(); // unit
            const binSize = binaryParser.getInt(); // binSize
            const nValues = binaryParser.getInt();
            chunkSize += binaryParser.position + nValues * 8;

            range = {start: start + chunkSize, size: 4};
            data = await file.read(range.start, range.size)
            binaryParser = new BinaryParser(new DataView(data));
            const nChrScaleFactors = binaryParser.getInt();
            chunkSize += (4 + nChrScaleFactors * (4 + 8));

            nEntries--;
            if (nEntries === 0) {
                return p0 + chunkSize;
            } else {
                return parseNext(p0 + chunkSize, nEntries);
            }
        }
    }
/**
     * This function is used when the position of the norm vector index is unknown.  We must read through the expected
     * values to find the index
     *
     * @param dataset
     * @returns {Promise}
     */
This function is used when the position of the norm vector index is unknown.  We must read through the expected
values to find the index

@param dataset
@returns {Promise}
This function is used when the position of the norm vector index is unknown . We must read through the expected values to find the index @param dataset @returns { Promise }
async skipExpectedValues(start) {
        const file = new BufferedFile({file: this.file, size: 256000})
        const range = {start: start, size: 4};
        const data = await file.read(range.start, range.size)
        const binaryParser = new BinaryParser(new DataView(data));
        const nEntries = binaryParser.getInt();   
        if (nEntries === 0) {
            return range.start + range.size;
        } else {
            return parseNext(start + 4, nEntries);
        }     
        async function parseNext(start, nEntries) {
            let range = {start: start, size: 500}
            let chunkSize = 0
            let p0 = start;
            let data = await file.read(range.start, range.size)
            let binaryParser = new BinaryParser(new DataView(data));
            const type = binaryParser.getString(); 
            const unit = binaryParser.getString(); 
            const binSize = binaryParser.getInt(); 
            const nValues = binaryParser.getInt();
            chunkSize += binaryParser.position + nValues * 8;
            range = {start: start + chunkSize, size: 4};
            data = await file.read(range.start, range.size)
            binaryParser = new BinaryParser(new DataView(data));
            const nChrScaleFactors = binaryParser.getInt();
            chunkSize += (4 + nChrScaleFactors * (4 + 8));
            nEntries--;
            if (nEntries === 0) {
                return p0 + chunkSize;
            } else {
                return parseNext(p0 + chunkSize, nEntries);
            }
        }
    }
async skipExpectedValues ( start ) { const file = new BufferedFile ( { file : this . file , size : 256000 } ) const range = { start : start , size : 4 } ; const data = await file . read ( range . start , range . size ) const binaryParser = new BinaryParser ( new DataView ( data ) ) ; const nEntries = binaryParser . getInt ( ) ; if ( nEntries === 0 ) { return range . start + range . size ; } else { return parseNext ( start + 4 , nEntries ) ; } async function parseNext ( start , nEntries ) { let range = { start : start , size : 500 } let chunkSize = 0 let p0 = start ; let data = await file . read ( range . start , range . size ) let binaryParser = new BinaryParser ( new DataView ( data ) ) ; const type = binaryParser . getString ( ) ; const unit = binaryParser . getString ( ) ; const binSize = binaryParser . getInt ( ) ; const nValues = binaryParser . getInt ( ) ; chunkSize += binaryParser . position + nValues * 8 ; range = { start : start + chunkSize , size : 4 } ; data = await file . read ( range . start , range . size ) binaryParser = new BinaryParser ( new DataView ( data ) ) ; const nChrScaleFactors = binaryParser . getInt ( ) ; chunkSize += ( 4 + nChrScaleFactors * ( 4 + 8 ) ) ; nEntries -- ; if ( nEntries === 0 ) { return p0 + chunkSize ; } else { return parseNext ( p0 + chunkSize , nEntries ) ; } } }
This function is used when the position of the norm vector index is unknown.
This function is used when the position of the norm vector index is unknown .
// Total # of expected value chunks // Skip 4 bytes for int // type // unit // binSize