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 || Cholmod error 'X and/or Y have wrong dimensions #2

Closed complexgenome closed 2 years ago

complexgenome commented 3 years ago

Dear Developer,

With STAAR I fitted null model using sparse genetic relationship matrix.

CH_GWAS_obj_nullmodel_sparse <-  fit_null_glmmkin( CCD01 ~ AGE +as.factor(SEX)+PC1+PC3,
data= pheno_all,family=binomial(link="logit"),id="IID",kins=as(ch_grm_all,"dgCMatrix"))

Run using null model output:

MetaSTAAR::MetaSTAAR_worker_sumstat(as.matrix(df_genotype_ch), CH_GWAS_obj_nullmodel_sparse ,df_snp_ch)

Error:

Error in t(Geno) %*% obj_nullmodel$Sigma_iX :
  Cholmod error 'X and/or Y have wrong dimensions' at file ../MatrixOps/cholmod_sdmult.c, line 88

Genotype in ch_genotype has 12508 row (one per person) and one column, that is, at the moment only one SNP.

length(CH_GWAS_obj_nullmodel_sparse$Y)

9877

 length(CH_GWAS_obj_nullmodel_sparse$X)

69139

Can you please assist?

Thank you

xihaoli commented 3 years ago

Hi Sanjeev, Thanks for your question. The number of individuals in your genotype and null model are not matched. Specifically, there are 12,508 individuals in your genotype matrix, and 9877 individuals in the null model. One needs to match the individuals in the genotype matrix and null model to have same length and order when using the MetaSTAAR_worker_sumstat() function. Please feel free to let me know if you have any questions. Best, Xihao