| kin2gds {GENESIS} | R Documentation |
kin2gds and mat2gds write kinship matrices to
GDS files.
kin2gds(ibdobj, gdsfile) mat2gds(mat, gdsfile)
ibdobj |
A list with elements |
mat |
A matrix with sample identifiers in colnames. |
gdsfile |
A character string with the name of the GDS file to create. |
When using pcair or pcairPartition with large sample sizes, it can be more memory efficient to read data from GDS files. kin2gds and mat2gds store kinship matrices in GDS files for use with these functions.
Stephanie M. Gogarten
library(gdsfmt)
# KING results from the command-line program
file.kin0 <- system.file("extdata", "MXL_ASW.kin0", package="GENESIS")
file.kin <- system.file("extdata", "MXL_ASW.kin", package="GENESIS")
KINGmat <- kingToMatrix(c(file.kin0, file.kin), estimator="Kinship")
gdsfile <- tempfile()
mat2gds(KINGmat, gdsfile)
gds <- openfn.gds(gdsfile)
gds
closefn.gds(gds)
# KING results from SNPRelate
library(SNPRelate)
geno <- snpgdsOpen(snpgdsExampleFileName())
king <- snpgdsIBDKING(geno)
closefn.gds(geno)
kin2gds(king, gdsfile)
gds <- openfn.gds(gdsfile)
gds
closefn.gds(gds)