| Title: | PLINK 2 Genotype Ingestion into File-Backed Storage |
|---|---|
| Description: | Uses the 'PLINK 2' pgenlib library and its native importers (<https://github.com/chrchang/plink-ng>) to ingest PGEN, PLINK 1 BED, PED/MAP, TPED/TFAM, VCF/BCF, BGEN, Oxford GEN, HAPS/legend, EIGENSTRAT, and legacy dosage sources into bounded, file-backed 'Rfmalloc' layouts. Hardcalls, dosages, and phase are transferred as typed record panels, allowing the destination to choose a packed codec or full-precision storage without constructing a complete R matrix. The vendored native readers are also exposed through 'R_RegisterCCallable' for sibling packages. |
| Authors: | Sounkou Mahamane Toure [aut, cre], Christopher Chang [cph] (Author of the vendored pgenlib library and plink2 program), Shaun Purcell [cph] (Co-author of the vendored plink2 format-import closure), Eric Biggers [cph] (Author of included libdeflate library), Yann Collet [cph] (Author of included Zstd library), Meta Platforms, Inc. [cph] (Zstd library), Evan Nemerson [cph] (Author of included SIMDe library), Mutsuo Saito [cph] (Co-author of included SFMT library), Makoto Matsumoto [cph] (Co-author of included SFMT library) |
| Maintainer: | Sounkou Mahamane Toure <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.0 |
| Built: | 2026-07-21 19:32:20 UTC |
| Source: | https://github.com/RGenomicsETL/Rfmalloc |
Streams hardcalls into fmalloc-backed, 2-bit .bed storage. path selects
the reader: a path ending in
.bed is read with rpgen_read_bed_hardcalls() (PLINK 1, counts from the
companion .bim/.fam); anything else is read with
rpgen_read_hardcalls() (PLINK 2 .pgen). One pgenlib reader remains open
while bounded variant panels are decoded directly into an Rfmalloc-owned
codec sink. No full genotype matrix is allocated in R or C.
rpgen_bed( path, pvar = NULL, bim = NULL, fam = NULL, runtime = NULL, block_size = NULL )rpgen_bed( path, pvar = NULL, bim = NULL, fam = NULL, runtime = NULL, block_size = NULL )
path |
Path to a |
pvar |
Path to the companion |
bim, fam
|
Paths to the companion |
runtime |
Runtime handle from |
block_size |
Number of variants in the transient decode panel. |
An fmalloc_tensor of dtype "bed", n_sample x n_variant.
rpgen_dosage(), rpgen_read_hardcalls(),
rpgen_read_bed_hardcalls()
pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") rt <- Rfmalloc::open_fmalloc(tempfile(), size_gb = 0.5) tn <- rpgen_bed(pgen, runtime = rt) dim(tn) Rfmalloc::cleanup_fmalloc(rt)pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") rt <- Rfmalloc::open_fmalloc(tempfile(), size_gb = 0.5) tn <- rpgen_bed(pgen, runtime = rt) dim(tn) Rfmalloc::cleanup_fmalloc(rt)
A PLINK 1 .bed file carries no header of its own (unlike a .pgen's -
see rpgen_info()): its sample and variant counts come from the companion
.fam (one line per sample) and .bim (one line per variant) instead.
This reads exactly those two line counts, with no pgenlib involvement.
rpgen_bed_info(bed)rpgen_bed_info(bed)
bed |
Path to a |
A list with n_sample and n_variant, both integers.
rpgen_info(), rpgen_read_bed_hardcalls()
Streams dosages from one open PLINK 2 .pgen reader into fmalloc-backed,
1-byte fixed-point storage. As with rpgen_bed(), only one bounded variant
panel is decoded at a time.
rpgen_dosage(path, pvar = NULL, runtime = NULL, block_size = NULL)rpgen_dosage(path, pvar = NULL, runtime = NULL, block_size = NULL)
path |
Path to a |
pvar |
Path to the companion |
runtime |
Runtime handle from |
block_size |
Number of variants in the transient decode panel. |
An fmalloc_tensor of dtype "dosage", n_sample x n_variant.
rpgen_bed(), rpgen_read_dosages(),
Rfmalloc::fmalloc_dosage_standardize()
pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") rt <- Rfmalloc::open_fmalloc(tempfile(), size_gb = 0.5) tn <- rpgen_dosage(pgen, runtime = rt) dim(tn) Rfmalloc::cleanup_fmalloc(rt)pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") rt <- Rfmalloc::open_fmalloc(tempfile(), size_gb = 0.5) tn <- rpgen_dosage(pgen, runtime = rt) dim(tn) Rfmalloc::cleanup_fmalloc(rt)
Reads hardcall phase with pgenlib's PgrGetP() and writes packed locus rows
directly into Rfmalloc::create_fmalloc_haplotypes() storage. The result has
dimensions n_variant x (2 * n_sample), with the two haplotypes of each
sample adjacent in the second dimension. No dense haplotype matrix is
constructed.
rpgen_haplotypes(path, pvar = NULL, runtime = NULL, block_size = NULL)rpgen_haplotypes(path, pvar = NULL, runtime = NULL, block_size = NULL)
path |
Path to a |
pvar |
Path to the companion |
runtime |
Runtime handle from |
block_size |
Number of variants in the transient decode panel. |
Every heterozygous call must carry phase and every genotype must be present.
The function errors at the first unphased heterozygote or missing genotype
instead of inventing phase. Multiallelic alleles are collapsed to the binary
reference/non-reference view returned by PgrGetP().
An Rfmalloc::fmalloc_haplotypes object with variants in rows and
haplotypes in columns.
rpgen_bed(), rpgen_dosage(),
Rfmalloc::fmalloc_hap_materialize()
Converts bcf to a .pgen by calling plink2's own BcfToPgen() importer
BCF's binary-sibling counterpart to rpgen_import_vcf()'s VcfToPgen(),
living in the same vendored closure - with the defaults a plain
plink2 --bcf <bcf> --make-pgen (no other flags) would use.
rpgen_import_bcf(bcf, out = tempfile(fileext = ".pgen"))rpgen_import_bcf(bcf, out = tempfile(fileext = ".pgen"))
bcf |
Path to a BCF file. |
out |
Path to the |
The produced .pgen can be read back with any of Rpgen's existing .pgen
readers, exactly as rpgen_import_vcf()'s can.
out, invisibly on success; an R error is raised on failure.
rpgen_import_vcf(), rpgen_read_hardcalls()
vcf <- system.file("extdata", "tiny.vcf", package = "Rpgen") if (nzchar(vcf) && nzchar(Sys.which("bcftools"))) { bcf <- tempfile(fileext = ".bcf") system2("bcftools", c("view", shQuote(vcf), "-Ob", "-o", shQuote(bcf))) pgen <- rpgen_import_bcf(bcf) rpgen_info(pgen)$n_sample unlink(c(bcf, pgen, sub("\\.pgen$", ".pvar", pgen), sub("\\.pgen$", ".psam", pgen))) }vcf <- system.file("extdata", "tiny.vcf", package = "Rpgen") if (nzchar(vcf) && nzchar(Sys.which("bcftools"))) { bcf <- tempfile(fileext = ".bcf") system2("bcftools", c("view", shQuote(vcf), "-Ob", "-o", shQuote(bcf))) pgen <- rpgen_import_bcf(bcf) rpgen_info(pgen)$n_sample unlink(c(bcf, pgen, sub("\\.pgen$", ".pvar", pgen), sub("\\.pgen$", ".psam", pgen))) }
Convenience wrapper chaining rpgen_import_vcf() and rpgen_bed(): the
VCF is imported to a (by default temporary) .pgen via plink2's own
importer, immediately read back through Rpgen's existing .pgen reader,
and packed into fmalloc-backed 2-bit .bed storage. The intermediate
.pgen/.pvar/.psam files are removed afterward unless keep = TRUE.
rpgen_import_bed( vcf, out = tempfile(fileext = ".pgen"), keep = FALSE, runtime = NULL )rpgen_import_bed( vcf, out = tempfile(fileext = ".pgen"), keep = FALSE, runtime = NULL )
vcf |
Path to a VCF file; see |
out |
Path to the intermediate |
keep |
Keep the intermediate |
runtime |
Runtime handle from |
An fmalloc_tensor of dtype "bed", n_sample x n_variant; see
rpgen_bed().
rpgen_import_vcf(), rpgen_bed()
vcf <- system.file("extdata", "tiny.vcf", package = "Rpgen") if (nzchar(vcf)) { rt <- Rfmalloc::open_fmalloc(tempfile(), size_gb = 0.5) tn <- rpgen_import_bed(vcf, runtime = rt) dim(tn) Rfmalloc::cleanup_fmalloc(rt) }vcf <- system.file("extdata", "tiny.vcf", package = "Rpgen") if (nzchar(vcf)) { rt <- Rfmalloc::open_fmalloc(tempfile(), size_gb = 0.5) tn <- rpgen_import_bed(vcf, runtime = rt) dim(tn) Rfmalloc::cleanup_fmalloc(rt) }
Converts bgen (any of v1.1/v1.2/v1.3) to a .pgen by calling plink2's
own OxBgenToPgen() importer, with the defaults a plain
plink2 --bgen <bgen> --sample <sample> --make-pgen (or, if sample is
NULL, plink2 --bgen <bgen> --make-pgen alone) would use. Unlike
rpgen_import_gen()'s .gen, a BGEN v1.2/v1.3 file may carry its own
sample identifier block, so sample may be omitted when the file has one
plink2's own importer raises a clear error if it does not.
rpgen_import_bgen(bgen, sample = NULL, out = tempfile(fileext = ".pgen"))rpgen_import_bgen(bgen, sample = NULL, out = tempfile(fileext = ".pgen"))
bgen |
Path to a BGEN file (v1.1, v1.2, or v1.3). |
sample |
Path to a companion |
out |
Path to the |
The produced .pgen can be read back with any of Rpgen's existing .pgen
readers, exactly as rpgen_import_vcf()'s can.
out, invisibly on success; an R error is raised on failure.
rpgen_import_gen(), rpgen_import_haps()
bgen <- system.file("extdata", "tiny.bgen", package = "Rpgen") samp <- system.file("extdata", "tiny.sample", package = "Rpgen") if (nzchar(bgen) && nzchar(samp)) { pgen <- rpgen_import_bgen(bgen, sample = samp) rpgen_info(pgen)$n_sample unlink(c(pgen, sub("\\.pgen$", ".pvar", pgen), sub("\\.pgen$", ".psam", pgen))) }bgen <- system.file("extdata", "tiny.bgen", package = "Rpgen") samp <- system.file("extdata", "tiny.sample", package = "Rpgen") if (nzchar(bgen) && nzchar(samp)) { pgen <- rpgen_import_bgen(bgen, sample = samp) rpgen_info(pgen)$n_sample unlink(c(pgen, sub("\\.pgen$", ".pvar", pgen), sub("\\.pgen$", ".psam", pgen))) }
Calls PLINK 2's own EigfileToPgen() importer for an EIGENSOFT
PACKEDANCESTRYMAP or TGENO file and its .ind/.snp companions. The
importer validates the sample and variant hashes stored in the binary
header, matching a plain plink2 --eigfile <prefix> --make-pgen
conversion.
rpgen_import_eigenstrat(geno, ind, snp, out = tempfile(fileext = ".pgen"))rpgen_import_eigenstrat(geno, ind, snp, out = tempfile(fileext = ".pgen"))
geno |
Path to a PACKEDANCESTRYMAP |
ind |
Path to the companion |
snp |
Path to the companion |
out |
Path to the |
out, invisibly on success; an R error is raised on failure.
Converts the Oxford-format gen/sample pair to a .pgen by calling
plink2's own OxGenToPgen() importer, with the defaults a plain
plink2 --gen <gen> --sample <sample> --make-pgen would use. Unlike
rpgen_import_vcf()'s VCF/BCF, a .gen file carries no sample IDs or
pedigree of its own, so sample is required, not optional.
rpgen_import_gen(gen, sample, out = tempfile(fileext = ".pgen"))rpgen_import_gen(gen, sample, out = tempfile(fileext = ".pgen"))
gen |
Path to an Oxford-format |
sample |
Path to the companion |
out |
Path to the |
gen's rows must carry an explicit leading chromosome column (plink2's
original 5-column .gen layout: chr id pos a1 a2 <probabilities>...);
this function does not expose an --oxford-single-chr equivalent.
The produced .pgen can be read back with any of Rpgen's existing .pgen
readers, exactly as rpgen_import_vcf()'s can.
out, invisibly on success; an R error is raised on failure.
rpgen_import_bgen(), rpgen_import_haps()
Converts the Oxford-format haps/legend/sample triple to a .pgen by
calling plink2's own OxHapslegendToPgen() importer, with the defaults a
plain plink2 --haps <haps> --legend <legend> <chr> --sample <sample> --make-pgen would use.
rpgen_import_haps(haps, legend, sample, chr, out = tempfile(fileext = ".pgen"))rpgen_import_haps(haps, legend, sample, chr, out = tempfile(fileext = ".pgen"))
haps |
Path to a |
legend |
Path to the companion |
sample |
Path to the companion |
chr |
Chromosome code for every variant in |
out |
Path to the |
A .haps/.legend pair encodes phased haplotypes and the produced .pgen
carries that phase. rpgen_haplotypes() and rpgen_ingest() recover it
through pgenlib's PgrGetP() path. The hardcall and dosage readers expose
the corresponding phase-collapsed non-reference count.
chr is required: the classic IMPUTE2 .legend format (id position a0 a1, no chromosome column) does not carry its own chromosome, so plink2
itself requires one whenever --legend is used (confirmed via
plink2 --help legend).
out, invisibly on success; an R error is raised on failure.
rpgen_import_gen(), rpgen_import_bgen(), rpgen_read_hardcalls()
Calls PLINK 2's own PedmapToPgen() importer with the defaults of a plain
plink2 --pedmap <prefix> --make-pgen conversion. The resulting .pgen,
.pvar, and .psam files are ordinary PLINK 2 files and can be consumed
by every Rpgen reader.
rpgen_import_ped(ped, map, out = tempfile(fileext = ".pgen"))rpgen_import_ped(ped, map, out = tempfile(fileext = ".pgen"))
ped |
Path to the sample-major |
map |
Path to the companion |
out |
Path to the |
out, invisibly on success; an R error is raised on failure.
rpgen_import_tped(), rpgen_ingest()
Converts the legacy PLINK 1.x --import-dosage text format (dosage,
plus companion fam/map files) to a .pgen by calling plink2's own
Plink1DosageToPgen() importer, with the defaults a plain
plink2 --import-dosage <dosage> --fam <fam> --map <map> --make-pgen (no
--import-dosage modifiers) would use - in particular, the per-sample
column format (a single dosage value, or a double/triple-probability
layout) is auto-inferred from dosage's own column count, the same as
the plain command would do.
rpgen_import_plink1_dosage(dosage, fam, map, out = tempfile(fileext = ".pgen"))rpgen_import_plink1_dosage(dosage, fam, map, out = tempfile(fileext = ".pgen"))
dosage |
Path to a PLINK 1 |
fam |
Path to the companion |
map |
Path to the companion |
out |
Path to the |
The produced .pgen can be read back with any of Rpgen's existing .pgen
readers, exactly as rpgen_import_vcf()'s can.
out, invisibly on success; an R error is raised on failure.
rpgen_import_vcf(), rpgen_read_dosages()
Calls PLINK 2's own TpedToPgen() importer with the defaults of a plain
plink2 --tfile <prefix> --make-pgen conversion. The resulting .pgen,
.pvar, and .psam files are ordinary PLINK 2 files and can be consumed
by every Rpgen reader.
rpgen_import_tped(tped, tfam, out = tempfile(fileext = ".pgen"))rpgen_import_tped(tped, tfam, out = tempfile(fileext = ".pgen"))
tped |
Path to the variant-major |
tfam |
Path to the companion |
out |
Path to the |
out, invisibly on success; an R error is raised on failure.
rpgen_import_ped(), rpgen_ingest()
Converts vcf to a .pgen by calling plink2's own VcfToPgen() importer
(vendored by tools/vendor-plink2-import/, see its PROVENANCE.md) with
the defaults a plain plink2 --vcf <vcf> --make-pgen (no other flags)
would use - no argv parsing happens; every default matches what plink2.cc
itself computes for that combination (see src/rpgen_import.cpp's
comments for exactly which). The design choice this embodies: reuse
plink2's own import code rather than maintain a second parser for each
format. The identical closure covers BCF, BGEN, and Oxford inputs.
rpgen_import_vcf(vcf, out = tempfile(fileext = ".pgen"))rpgen_import_vcf(vcf, out = tempfile(fileext = ".pgen"))
vcf |
Path to a VCF file (may be gzip/bgzip-compressed; plink2's own importer detects that from the file's magic bytes, not its extension). |
out |
Path to the |
The produced .pgen (plus its companion .pvar/.psam, written next to
it with the same base name) can be read back with any of Rpgen's existing
.pgen readers - rpgen_info(), rpgen_read_hardcalls(),
rpgen_read_dosages(), or rpgen_bed()/rpgen_dosage() for the
Rfmalloc tensor surface - since it is an ordinary .pgen, not a special
format of its own.
out, invisibly on success (matching the input, since plink2's
importer writes exactly there); an R error is raised on failure, with
plink2's own diagnostic already relayed to the R console (see
src/rpgen_import.cpp's top comment for why the error path has two
halves).
rpgen_bed(), rpgen_read_hardcalls()
vcf <- system.file("extdata", "tiny.vcf", package = "Rpgen") if (nzchar(vcf)) { pgen <- rpgen_import_vcf(vcf) info <- rpgen_info(pgen) info$n_sample unlink(c(pgen, sub("\\.pgen$", ".pvar", pgen), sub("\\.pgen$", ".psam", pgen))) }vcf <- system.file("extdata", "tiny.vcf", package = "Rpgen") if (nzchar(vcf)) { pgen <- rpgen_import_vcf(vcf) info <- rpgen_info(pgen) info$n_sample unlink(c(pgen, sub("\\.pgen$", ".pvar", pgen), sub("\\.pgen$", ".psam", pgen))) }
Opens a PLINK 2 .pgen file through Rpgen's vendored pgenlib
(PgfiInitPhase1() / PgfiInitPhase2() / PgrInit()), reads its header
counts, and closes it again. This is a thin wrapper around the
RC_rpgen_info .Call entry point, itself a thin wrapper around the
Rpgen_open_info C-callable registered for other packages to link
against (see inst/include/Rpgen.h).
rpgen_info(path)rpgen_info(path)
path |
Path to a |
A list with n_sample and n_variant, both integers.
pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") rpgen_info(pgen)pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") rpgen_info(pgen)
rpgen_ingest() is the composition point for Rpgen's format matrix. It
accepts PGEN, PLINK1 BED, PED/MAP, TPED/TFAM, VCF/BCF, BGEN, Oxford GEN,
HAPS/legend, EIGENSTRAT, and legacy PLINK1 dosage sources, then writes one
of four compute-facing Rfmalloc
representations:
rpgen_ingest( path, format = NULL, representation = c("hardcall", "dosage", "haplotype", "f64"), runtime = NULL, block_size = NULL, sample = NULL, pvar = NULL, bim = NULL, fam = NULL, legend = NULL, chr = NULL, map = NULL, tfam = NULL, ind = NULL, snp = NULL )rpgen_ingest( path, format = NULL, representation = c("hardcall", "dosage", "haplotype", "f64"), runtime = NULL, block_size = NULL, sample = NULL, pvar = NULL, bim = NULL, fam = NULL, legend = NULL, chr = NULL, map = NULL, tfam = NULL, ind = NULL, snp = NULL )
path |
Primary genotype path. |
format |
One of |
representation |
Destination representation: |
runtime |
Runtime handle from |
block_size |
Number of variants per transient PGEN or BED panel. |
sample |
Companion Oxford |
pvar |
Optional PGEN |
bim, fam
|
Companion PLINK1 paths. BED infers |
legend, chr
|
Companion HAPS legend path and chromosome code. |
map |
Companion PLINK1 |
tfam |
Companion PLINK1 |
ind, snp
|
Companion EIGENSTRAT |
"hardcall": 2-bit sample by variant genotypes;
"dosage": 1-byte fixed-point sample by variant dosages;
"haplotype": locus-major phased ref/non-ref bits;
"f64": uncompressed, full-precision dosage values.
PGEN and BED are read by one persistent pgenlib reader into bounded record
panels. Other formats use PLINK2's own importer closure, with its terminal
STPgenWriter append redirected to the same Rfmalloc record sink. Their
decoded hardcall, dosage, and phase records therefore enter the selected
destination without a temporary PGEN serialization and read-back. PED/MAP
retains PLINK2's bounded sample-major transpose scratch file because that
source-to-destination layout change requires a transpose.
Format is inferred from path when possible. Use format explicitly for
ambiguous legacy dosage paths. Companion arguments are used only by the
formats that require them.
An Rfmalloc::fmalloc_tensor for hardcalls or compressed dosages,
an Rfmalloc::fmalloc_haplotypes object for phased haplotypes, or an
fmalloc-backed numeric matrix for "f64".
Reads every sample and every variant from a PLINK 1 .bed/.bim/.fam
fileset through Rpgen's vendored pgenlib. PgfiInitPhase1() opens a .bed
transparently, in the exact same code path a .pgen takes (its vrtypes
simply come back NULL) - the one real difference is that a .bed has no
header to read its sample/variant counts back from, so they are counted
from the companion .fam/.bim first (see rpgen_bed_info()) and passed
in explicitly. Genotypes are then read via the same plink2::PgrGet()
rpgen_read_hardcalls() uses; a .bed is biallelic hardcalls only, so
there is no dosage counterpart to this function. This is a thin wrapper
around the RC_rpgen_read_bed_hardcalls .Call entry point, itself a
thin wrapper around the Rpgen_read_bed_hardcalls C-callable (see
inst/include/Rpgen.h) - the lower-level counterpart to rpgen_bed() for
callers who want the plain R matrix rather than an Rfmalloc tensor.
rpgen_read_bed_hardcalls(bed, bim = NULL, fam = NULL)rpgen_read_bed_hardcalls(bed, bim = NULL, fam = NULL)
bed |
Path to a |
bim |
Path to the companion |
fam |
Path to the companion |
An integer matrix of 0, 1, 2, or NA hardcall dosages,
n_sample x n_variant, samples in rows and variants in columns.
rpgen_bed(), rpgen_bed_info(), rpgen_read_hardcalls()
Reads every sample and every variant from a PLINK 2 .pgen file through
Rpgen's vendored pgenlib, via plink2::PgrGet() (rpgen_read_hardcalls())
or plink2::PgrGetD() (rpgen_read_dosages()). Both return a dense
n_sample x n_variant matrix, samples in rows and variants in columns,
matching PLINK's own .bed orientation. These are thin wrappers around the
RC_rpgen_read_hardcalls/RC_rpgen_read_dosages .Call entry points,
themselves thin wrappers around the Rpgen_read_hardcalls/
Rpgen_read_dosages C-callables (see inst/include/Rpgen.h) - the
lower-level counterpart to rpgen_bed()/rpgen_dosage(), for callers who
want the plain R matrix rather than an Rfmalloc tensor.
rpgen_read_hardcalls(path, pvar = NULL) rpgen_read_dosages(path, pvar = NULL)rpgen_read_hardcalls(path, pvar = NULL) rpgen_read_dosages(path, pvar = NULL)
path |
Path to a |
pvar |
Path to the companion |
For a multiallelic variant, plink2::PgrGet()/PgrGetD() collapse every
ALT allele into a single non-reference count - the same encoding
pgenlibr::ReadIntList()/ReadList() return by calling the identical
pgenlib entry points. Allele identity (which ALT allele is present) is not
needed to produce that collapsed encoding, only for an allele-specific
read (plink2::PgrGet1()/PgrGet1D(), not exposed here), which is the
only thing pgenlibr's own .pvar requirement (NewPgen(..., pvar = )) at
this fixture's multiallelic-plus-dosage combination actually guards
against - so unlike pgenlibr::NewPgen(), rpgen_read_hardcalls()/
rpgen_read_dosages() do not require a .pvar for this file at all.
rpgen_read_hardcalls() returns an integer matrix of 0, 1,
2, or NA hardcall dosages. rpgen_read_dosages() returns a numeric
matrix of dosages in [0, 2], or NA for missing.
pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") hc <- rpgen_read_hardcalls(pgen) dim(hc) ds <- rpgen_read_dosages(pgen) dim(ds)pgen <- system.file("extdata", "chr21_phase3_start.pgen", package = "Rpgen") hc <- rpgen_read_hardcalls(pgen) dim(hc) ds <- rpgen_read_dosages(pgen) dim(ds)