Last data update: 2014.03.03

R: Read the GRM binary file.
read_GRMBinR Documentation

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.

Details

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

Value

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

References

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

Examples

  ## 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)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(OmicKriging)
Loading required package: doParallel
Loading required package: foreach
Loading required package: iterators
Loading required package: parallel
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/OmicKriging/read_GRMBin.Rd_%03d_medium.png", width=480, height=480)
> ### Name: read_GRMBin
> ### Title: Read the GRM binary file.
> ### Aliases: read_GRMBin
> 
> ### ** Examples
> 
>   ## 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)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>