Package: pgenlibr 0.7.0

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 and a basic .pgen writer are 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.7.0.tar.gz
pgenlibr_0.7.0.zip(r-4.7-x86_64)pgenlibr_0.7.0.zip(r-4.7-arm64)pgenlibr_0.7.0.zip(r-4.6-x86_64)pgenlibr_0.7.0.zip(r-4.6-arm64)pgenlibr_0.7.0.zip(r-4.5-x86_64)
pgenlibr_0.7.0.tgz(r-4.6-x86_64)pgenlibr_0.7.0.tgz(r-4.6-arm64)pgenlibr_0.7.0.tgz(r-4.5-x86_64)pgenlibr_0.7.0.tgz(r-4.5-arm64)
pgenlibr_0.7.0.tar.gz(r-4.7-arm64)pgenlibr_0.7.0.tar.gz(r-4.7-x86_64)pgenlibr_0.7.0.tar.gz(r-4.6-arm64)pgenlibr_0.7.0.tar.gz(r-4.6-x86_64)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
pgenlibr/json (API)

# 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.93 score 1 packages 95 scripts 1.2k downloads 35 exports 1 dependencies

Last updated from:de407a580a. Checks:14 OK, 1 FAIL. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK146
linux-devel-x86_64OK117
source / vignettesOK154
linux-release-arm64OK145
linux-release-x86_64OK116
macos-release-arm64OK204
macos-release-x86_64OK273
macos-oldrel-arm64OK176
macos-oldrel-x86_64OK228
windows-devel-arm64OK355
windows-devel-x86_64OK197
windows-release-arm64OK383
windows-release-x86_64OK152
windows-oldrel-x86_64OK111
wasm-releaseFAIL86

Exports:AlleleCodeBufAppendAllelesAppendBiallelicAppendDosagesBoolBufBufClosePgenClosePgenWriterClosePvarGetAlleleCodeGetAlleleCtGetMaxAlleleCtGetRawSampleCtGetVariantChromGetVariantCtGetVariantIdGetVariantPosGetVariantsByIdGetWrittenVariantCtHardcallPhasePresentHasSparseHasSparseHardcallsIntAlleleCodeBufIntBufNewPgenNewPgenWriterNewPvarReadReadAllelesReadHardcallsReadIntListReadListReadSparseReadSparseHardcallsVariantScores

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
Appends a hardcall variant, specified as allele codes, to a .pgen being written. Unlike AppendBiallelic(), this supports phased and multiallelic hardcalls.AppendAlleles
Appends an unphased biallelic hardcall variant to a .pgen being written.AppendBiallelic
Appends a biallelic dosage variant to a .pgen being written.AppendDosages
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
Finalizes a .pgen being written, and releases resources. This must be called after all variant_ct variants have been appended; the .pgen is not valid before then.ClosePgenWriter
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 the number of variants appended so far to a .pgen being written.GetWrittenVariantCt
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
Creates a new .pgen file for writing.NewPgenWriter
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