Package: pgenlibr 0.6.2

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.6.2.tar.gz
pgenlibr_0.6.2.zip(r-4.7)pgenlibr_0.6.2.zip(r-4.6)pgenlibr_0.6.2.zip(r-4.5)
pgenlibr_0.6.2.tgz(r-4.6-x86_64)pgenlibr_0.6.2.tgz(r-4.6-arm64)pgenlibr_0.6.2.tgz(r-4.5-x86_64)pgenlibr_0.6.2.tgz(r-4.5-arm64)
pgenlibr_0.6.2.tar.gz(r-4.7-arm64)pgenlibr_0.6.2.tar.gz(r-4.7-x86_64)pgenlibr_0.6.2.tar.gz(r-4.6-arm64)pgenlibr_0.6.2.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html
card.svg |card.png
pgenlibr/json (API)
NEWS

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

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

On CRAN:

Conda:

libzstdlibdeflatezlibcpp

3.44 score 91 scripts 1.2k downloads 29 exports 1 dependencies

Last updated from:61d513f8db. Checks:12 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK141
linux-devel-x86_64OK121
source / vignettesOK170
linux-release-arm64OK126
linux-release-x86_64OK103
macos-release-arm64OK108
macos-release-x86_64OK223
macos-oldrel-arm64OK105
macos-oldrel-x86_64OK303
windows-develOK174
windows-releaseOK136
windows-oldrelOK165
wasm-releaseFAIL91

Exports:AlleleCodeBufBoolBufBufClosePgenClosePvarGetAlleleCodeGetAlleleCtGetMaxAlleleCtGetRawSampleCtGetVariantChromGetVariantCtGetVariantIdGetVariantPosGetVariantsByIdHardcallPhasePresentHasSparseHasSparseHardcallsIntAlleleCodeBufIntBufNewPgenNewPvarReadReadAllelesReadHardcallsReadIntListReadListReadSparseReadSparseHardcallsVariantScores

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
Retrieve chromosome ID for given variant index.GetVariantChrom
Returns the number of variants in the file.GetVariantCt
Convert variant index to variant ID string.GetVariantId
Retrieve POS (base-pair coordinate on a chromosome) for given variant index.GetVariantPos
Convert variant ID string to variant index(es).GetVariantsById
Returns whether explicitly phased hardcalls are present.HardcallPhasePresent
Returns whether dosages for the variant_numth variant and given allele are represented in a sparse manner that is supported by ReadSparse(), under the current sample subset.HasSparse
Returns whether hardcalls for the variant_numth variant and given allele are represented in a sparse manner that is supported by ReadSparseHardcalls().HasSparseHardcalls
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 positions, 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
If HasSparse() is true, returns a sparse representation for the (variant, allele) pair. If HasSparse() is false, the function fails.ReadSparse
If HasSparseHardcalls() is true, returns a sparse representation for the (variant, allele) pair. If HasSparseHardcalls() is false, the function fails.ReadSparseHardcalls
Compute variant scores.VariantScores