Skip to contents

Construct a GenotypeHandle from one of several input forms. Exactly one of the following must be specified:

path

A single file path with a recognized extension: .vcf, .vcf.gz, .vcf.bgz, .bcf, or .gds. Format is auto-detected from the extension.

plink1Prefix

A path prefix; the constructor appends .bed, .bim, and .fam to locate the triplet.

plink2Prefix

A path prefix; the constructor appends .pgen, .pvar (or .pvar.zst), and .psam to locate the triplet.

bed + bim + fam

Explicit PLINK1 triplet. The three files must share a stem; if they don't, use plink1Prefix or arrange symlinks at a common stem.

pgen + pvar + psam

Explicit PLINK2 triplet. Same shared-stem requirement.

genoMeta

One genotype file per chromosome. Either a path to a whitespace/TSV meta file whose first column is the chromosome (#chr) and second column the per-chromosome payload (a .bed/.pgen/.vcf[.gz]/.bcf/.gds file or a PLINK prefix; relative paths resolve against the meta file's directory), or a named character vector mapping chromosome to payload. All shards must share one format and identical sample IDs in the same order. Extraction is routed to the correct file by the requested region's chromosome.

The constructor opens the file for metadata only (sample IDs and SNP info); dosage extraction is deferred until extractBlockGenotypes() is called.

Usage

GenotypeHandle(
  path = NULL,
  plink1Prefix = NULL,
  plink2Prefix = NULL,
  bed = NULL,
  bim = NULL,
  fam = NULL,
  pgen = NULL,
  pvar = NULL,
  psam = NULL,
  ldMeta = NULL,
  region = NULL,
  genoMeta = NULL,
  ...
)

Arguments

path

Single file path (.vcf/.vcf.gz/.vcf.bgz/.bcf/.gds), or NULL.

Path prefix for a PLINK1 triplet, or NULL.

Path prefix for a PLINK2 triplet, or NULL.

bed, bim, fam

Explicit paths to the PLINK1 triplet, or all NULL.

pgen, pvar, psam

Explicit paths to the PLINK2 triplet, or all NULL.

ldMeta

Path to an LD-meta TSV file (columns chrom, start, end, path; the path column may be comma-separated as ld_file,bim_file). Requires region. The constructor resolves the row covering region, then delegates to the appropriate file-based handler. When the resolved row points at PLINK1 / PLINK2 / VCF / GDS files, the corresponding reader is used; .cor.xz (pre-computed LD-matrix) rows are not supported here — use loadLdMatrix for that case.

region

Region specification for ldMeta lookup: "chr:start-end" string or a one-row data.frame with chrom, start, end.

genoMeta

One-file-per-chromosome specification: a path to a #chr,path meta file or a named character vector (names = chromosomes, values = payload paths/prefixes). Optionally pass format via ... to force a single backend for every shard.

...

Additional arguments forwarded to the format-specific reader.

Value

A GenotypeHandle object.