Learn R Programming

OmicKriging (version 1.4.0)

read_GRMBin: Read the GRM binary file.

Description

Function provided by GCTA maintainers (modified slightly) for accessing their recently introduced binary GRM format. The GRM is stored as a vector of numerics which correspond to the lower triangular elements including the diagonal. We simply read these, pull the diagonal elements, and inflate them into a full symmetric matrix. We add sample IDs to colnames and rownames for compatibility with other Kriging functions.

Usage

read_GRMBin(prefix, size = 4)

Arguments

prefix
The file path prefix to GRM binary files (e.g., test.grm.bin, test.grm.N.bin, test.grm.id.)
size
The length (in bytes) of each value in the raw GRM vector. Default is 4, and matches GRM writen by GCTA 1.11.

Value

GRM of dim (N.samples x N.samples) with rownames and colnames as sample ID.

Details

Note that the GRM is described by three files, and this function assumes that all have a common prefix that is passed in.

References

http://www.complextraitgenomics.com/software/gcta/estimate_grm.html

Examples

Run this code
  ## read binary Genetic Relatedness Matrix (GRM) generated by GCTA
  grmFile <- system.file(package = "OmicKriging",
                         "doc/vignette_data/ig_genotypes.grm.bin")
  grmFileBase <- substr(grmFile,1, nchar(grmFile) - 4)
  GRM <- read_GRMBin(grmFileBase)

Run the code above in your browser using DataLab