saigegit / SAIGE

Development for SAIGE and SAIGE-GENE(+)
GNU General Public License v3.0
64 stars 27 forks source link

full grm designation in fitNULLGLMM #87

Open jyjo43043 opened 1 year ago

jyjo43043 commented 1 year ago

Hi I am running the saige in r using fitNULLGLMM function and designate the two types of grm.

First one is from the createSparseGRM ant the other is from the gcta with pruned genotypes.

The SPAGMMATtest with the sparse GRM generated from saige works, but with generated from gcta, I encounterd the error:

"error in matrix:::readmm(sparsegrmfile) : file is not a matrixmarket file"

I think it doesn't matter if it is full or sparse, and it just a matter of the format.

Could you tell me how to transfrom the .grm.bin (from gcta) to .mtx?

Thanks in advance.

saigegit commented 1 year ago

Hi @jyjo43043,

Here is the documentation from the GRAB package showing how to generate the sparse GRM file with sample IDs and sample relatedness coefficients from GCTA. SAIGE requires two files, one is a sparse matrix and one is the sample IDs corresponding to the order of samples in the matrix. You may read in sparse GRM file and use the following R code to generate the sparseGRMFile

sparseGRM = Matrix:::sparseMatrix(i = as.vector(sparseMList$iIndex), j = as.vector(sparseMList$jIndex), x = as.vector(sparseMList$kinValue), symmetric = TRUE)
Matrix:::writeMM(sparseGRM, sparseGRMFile)
write.table(sparseGRMSampleID, sparseGRMSampleIDFile, quote=F, col.names=F, row.names=F)

Thanks, Wei