privefl / bigsnpr

R package for the analysis of massive SNP arrays.
https://privefl.github.io/bigsnpr/
195 stars 44 forks source link

Use the genotype matrix for another library #522

Open garyzhubc opened 5 days ago

garyzhubc commented 5 days ago

If I want to use the genotype matrix as input to another library, is it something doable? For instance, something like:

library(susieR)
sus <- susie(pcsk9_updown_bigsnp_obj$genotypes,y)

gives

Error in susie(pcsk9_updown_bigsnp_obj$genotypes, y) : 
  Input X must be a double-precision matrix, or a sparse matrix, or a trend filtering matrix
privefl commented 4 days ago

Have you looked a bit about the documentation and some of the examples from bigstatsr/bigsnpr? You should know how to access a standard R matrix from an FBM.

garyzhubc commented 4 days ago

I know that you can use X[] to retrieve a numerical matrix but then lose the utilities of the bigsnpr matrix.

garyzhubc commented 4 days ago

But I wonder if there's a way to keep the utility of the bigsnpr matrix

privefl commented 4 days ago

I think SuSiE expects a matrix that is not too big anyway.