Auto-detects PLINK2 (.pgen/.pvar[.zst]/.psam), PLINK1 (.bed/.bim/.fam),
VCF (.vcf/.vcf.gz/.bcf), or GDS (.gds) format and loads genotype data
via readGenotypes and extractBlockGenotypes.
If a stochastic genotype sidecar file (.afreq or
.stochastic_meta.tsv) is found alongside the genotype file, non-integer
dosages are automatically rescaled using the stored U_MIN/U_MAX values.
Usage
load_genotype_region(
genotype,
region = NULL,
keep_indel = TRUE,
keep_variants_path = NULL,
return_variant_info = FALSE,
stochastic_meta_path = NULL,
stochastic_meta_format = NULL
)Arguments
- genotype
Path to the genotype data file (without extension).
- region
The target region in the format "chr:start-end".
- keep_indel
Whether to keep indel SNPs.
- keep_variants_path
Path to a file listing variants to keep.
- return_variant_info
If TRUE, return a list with X (dosage matrix) and variant_info (data.frame). If FALSE (default), return only the dosage matrix.
- stochastic_meta_path
Optional explicit path to a stochastic genotype sidecar file. If NULL (default), auto-detected via
find_stochastic_meta.- stochastic_meta_format
Optional format override for the sidecar file:
"afreq"or"generic". If NULL (default), auto-detected from file extension.