getbd5snp_buf: Read a Format 5 SNP into pre-allocated vectors (buffered...

View source: R/format5.R

getbd5snp_bufR Documentation

Read a Format 5 SNP into pre-allocated vectors (buffered variant)

Description

Like getbd5snp but writes results into caller-supplied vectors instead of allocating new ones. Intended for tight loops where thousands of SNPs are read sequentially; pre-allocating the output vectors once avoids repeated memory allocation.

Usage

getbd5snp_buf(bd5info, snp, dosage, p0, p1, p2)

Arguments

bd5info

Object returned by getbdinfo.

snp

1-based integer index or character SNP ID.

dosage

Pre-allocated numeric(n_samples) vector.

p0

Pre-allocated numeric(n_samples) vector.

p1

Pre-allocated numeric(n_samples) vector.

p2

Pre-allocated numeric(n_samples) vector.

Details

The four output vectors must not have more than one R binding at the call site (no extra variables pointing to the same object); R's copy-on-modify semantics would otherwise prevent in-place update.

Value

NULL invisibly. dosage, p0, p1, and p2 are updated in place.


BinaryDosage documentation built on April 30, 2026, 1:09 a.m.