3 Computing a GRM

We can use the SNPRelate package to compute a Genetic Relationship matrix (GRM).

library(SeqArray)
data.path <- "https://github.com/UW-GAC/analysis_pipeline/raw/master/testdata"
gdsfile <- "1KG_phase3_subset_chr1.gds"
if (!file.exists(gdsfile)) download.file(file.path(data.path, gdsfile), gdsfile)
gds <- seqOpen(gdsfile)

library(SNPRelate)
grm <- snpgdsGRM(gds, method="GCTA")
## Genetic Relationship Matrix (GRM, GCTA):
## Calculating allele counts/frequencies ...
## 
[..................................................]  0%, ETC: ---    
[==================================================] 100%, completed      
## Excluding 13 SNVs (monomorphic: TRUE, MAF: NaN, missing rate: NaN)
## Working space: 1,126 samples, 1,107 SNVs
##     using 1 (CPU) core
## CPU capabilities: Double-Precision SSE2
## Wed Aug  9 10:57:55 2017    (internal increment: 680)
## 
[..................................................]  0%, ETC: ---    
[==================================================] 100%, completed in 1s
## Wed Aug  9 10:57:56 2017    Done.
names(grm)
## [1] "sample.id" "snp.id"    "grm"
dim(grm$grm)
## [1] 1126 1126
seqClose(gds)