plink-ng icon indicating copy to clipboard operation
plink-ng copied to clipboard

Loading PVAR in pgenlibr

Open GabrielHoffman opened this issue 3 months ago • 2 comments

I'm working on an R package that reads PGEN files and performs statistical analysis in C++ via Rcpp (https://github.com/chrchang/plink-ng/issues/283). pgenlibr provides almost everything a user needs.

The R function pgenlibr::NewPvar() to load a .pvar file calls LoadMinimalPvar() in C++:

https://github.com/chrchang/plink-ng/blob/6287f6a083650fcad2709ba1689beda39680e367/2.0/pvar_ffi_support.cc#L64

It loads ID, REF and ALT, but not CHR or POS.

Do you have code to include chromosome and position information, so a user can intersect the variants with a BED file of genome intervals?

I'd do this myself, but that function is very hard to follow, and I'd write a new version but I'm concerned that there are some .pvar values it wouldn't parse correctly.

Best, Gabriel

GabrielHoffman avatar Nov 24 '24 23:11 GabrielHoffman