xihaoli / MetaSTAAR

An R package for performing MetaSTAAR procedure in whole-genome sequencing studies
GNU General Public License v3.0
21 stars 7 forks source link

Error in MetaSTAAR_worker_sumstat || use a sparse genetic relatedness matrix when fitting null model! #1

Closed complexgenome closed 2 years ago

complexgenome commented 2 years ago

Dear Developers,

I am interested in using metaSTAAR to conduct meta-analysis from large-scale GWAS studies.

I fit null model using dense genetic relationship matrix (GRM) with STAAR R library. Later on I use null model object from STAAR library in metaSTAAR where I receive an error for using sparse GRM.

Fit null model:

CH_GWAS_obj_nullmodel<-fit_null_glmmkin( AD~ AGE+as.factor(SEX)+PC1+PC2+PC3+PC4,data=pheno,family=binomial(link="logit"),id="IID",kins=grm_all)

Move to metaSTAAR:

MetaSTAAR_worker_sumstat(df_genotype_ch,CH_GWAS_obj_nullmodel,df_snp_ch)

Error:

Error in MetaSTAAR::MetaSTAAR_worker_sumstat(as.matrix(df_genotype_ch),  :
  Please use a sparse genetic relatedness matrix when fitting the null model!

Can you please help?

I use tutorial from https://htmlpreview.github.io/?https://github.com/xihaoli/STAAR/blob/master/docs/STAAR_vignette.html

Library and R versions:

R 4.0 MetaSTAAR_0.9.6 STAAR_0.9.6

xihaoli commented 2 years ago

Hi Sanjeev, Thanks for your question. When the dataset contains related samples, MetaSTAAR assumes a sparse GRM as input when fitting the null mixed model to better facilitate sparse matrix computations. There is a use_sparse option in the fit_null_glmmkin() function to transform a dense GRM to sparse GRM, with a specified cutoff as kins_cutoff. Alternatively, you can convert a dense GRM to sparse GRM before fitting the null model. Best, Xihao