Package: pgenlibr 0.3.7

Christopher Chang

pgenlibr: PLINK 2 Binary (.pgen) Reader

A thin wrapper over PLINK 2's core libraries which provides an R interface for reading .pgen files. A minimal .pvar loader is also included. Chang et al. (2015) \doi{10.1186/s13742-015-0047-8}.

Authors:Christopher Chang [aut, cre], Eric Biggers [ctb, cph], Yann Collet [ctb], Meta Platforms, Inc. [cph], Evan Nemerson [ctb, cph], Przemyslaw Skibinski [ctb], Nick Terrell [ctb]

pgenlibr_0.3.7.tar.gz
pgenlibr_0.3.7.tar.gz(r-4.5-noble)pgenlibr_0.3.7.tar.gz(r-4.4-noble)
pgenlibr.pdf |pgenlibr.html
pgenlibr/json (API)
NEWS

# Install 'pgenlibr' in R:
install.packages('pgenlibr', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/chrchang/plink-ng/issues

Uses libs:
  • libzstd– Fast lossless compression algorithm
  • libdeflate– Fast, whole-buffer DEFLATE-based compression and decompression
  • zlib– Compression library
  • c++– GNU Standard C++ Library v3

2.79 score 62 scripts 324 downloads 23 exports 1 dependencies

Last updated 6 months agofrom:3eb1129c85. Checks:OK: 2. Indexed: no.

TargetResultDate
Doc / VignettesOKNov 02 2024
R-4.5-linux-x86_64OKNov 02 2024

Exports:AlleleCodeBufBoolBufBufClosePgenClosePvarGetAlleleCodeGetAlleleCtGetMaxAlleleCtGetRawSampleCtGetVariantCtGetVariantIdGetVariantsByIdHardcallPhasePresentIntAlleleCodeBufIntBufNewPgenNewPvarReadReadAllelesReadHardcallsReadIntListReadListVariantScores

Dependencies:Rcpp

Readme and manuals

Help Manual

Help pageTopics
PLINK 2 Binary (.pgen) Readerpgenlibr-package pgenlibr
Returns an empty two-row numeric matrix that ReadAlleles() can load to.AlleleCodeBuf
Returns a bool buffer that ReadAlleles() can load phasing information to.BoolBuf
Returns a numeric buffer that Read() or ReadHardcalls() can load to.Buf
Closes a pgen object, releasing resources.ClosePgen
Closes a pvar object, releasing memory.ClosePvar
Look up an allele code.GetAlleleCode
Returns the effective number of alleles for a variant. Note that if no pvar was provided to the NewPgen() call, this function may return 2 even at multiallelic variants, since the .pgen may not store allele-count information.GetAlleleCt
Returns the maximum GetAlleleCt() value across all variants in the file.GetMaxAlleleCt
Returns the number of samples in the file.GetRawSampleCt
Returns the number of variants in the file.GetVariantCt
Convert variant index to variant ID string.GetVariantId
Convert variant ID string to variant index(es).GetVariantsById
Returns whether explicitly phased hardcalls are present.HardcallPhasePresent
Returns an empty two-row integer matrix that ReadAlleles() can load to.IntAlleleCodeBuf
Returns an integer buffer that ReadHardcalls() can load to.IntBuf
Opens a .pgen or PLINK 1 .bed file.NewPgen
Loads variant IDs and allele codes from a .pvar or .bim file (which can be compressed with gzip or Zstd).NewPvar
Loads the variant_numth variant, and then fills buf with numeric dosages in [0, 2] indicating the dosages of the first ALT (or user-specified) allele for each sample, with missing values represented by NA.Read
Loads the variant_numth variant, and then fills acbuf with integer allele codes, where each column of the buffer corresponds to a sample. An allele code of 0 corresponds to the REF allele, 1 to the first ALT, 2 to the second ALT, etc. Missing hardcalls are represented by a pair of NA codes.ReadAlleles
Loads the variant_numth variant, and then fills buf with {0, 1, 2, NA} values indicating the number of copies of the first ALT (or user-specified) allele each sample has.ReadHardcalls
Load hardcalls for multiple variants as an integer matrix.ReadIntList
Load dosages for multiple variants as a numeric matrix.ReadList
Compute variant scores.VariantScores