Last data update: 2014.03.03

R: Write GRM binary files.
write_GRMBinR Documentation

Write GRM binary files.

Description

Function to write a binary GRM format recently introduced by GCTA. It takes a correlation matrix as used by other Kriging functions, and writes three files: binary file for storing the diagonal + lower triangular elements, a text file for sample IDs, and a binary file storing the number of SNPs used in the correlation matrix calculation.

Usage

write_GRMBin(X, n.snps = 0, prefix, size = 4)

Arguments

X

Correlation matrix with rownames and colnames as sample IDs.

n.snps

Number of SNPs used in correlation matrix calculation. Default is 0.0.

prefix

Base file path and names for the three output files.

size

Number of bytes to write for each value. Default is 4

Value

None. Though side effects are writing three files as described above.

References

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

Examples

  
  ## create a random genotype matrix
  nSamples <- 10
  mMarkers <- 100
  X <- matrix(rbinom(n=100, size=2, prob=0.5), nrow=nSamples)
  ## compute the Genetric Relatedness Matrix
  grm <- cor(X)
  ## write a Genetic Relatedness Matrix (GRM)
  ## NOTE: to following is not run here -- not writing any files in examples
  #write_GRMBin(grm, n.snps=mMarkers, prefix="grm.out")

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/write_GRMBin.Rd_%03d_medium.png", width=480, height=480)
> ### Name: write_GRMBin
> ### Title: Write GRM binary files.
> ### Aliases: write_GRMBin
> 
> ### ** Examples
> 
>   
>   ## create a random genotype matrix
>   nSamples <- 10
>   mMarkers <- 100
>   X <- matrix(rbinom(n=100, size=2, prob=0.5), nrow=nSamples)
>   ## compute the Genetric Relatedness Matrix
>   grm <- cor(X)
>   ## write a Genetic Relatedness Matrix (GRM)
>   ## NOTE: to following is not run here -- not writing any files in examples
>   #write_GRMBin(grm, n.snps=mMarkers, prefix="grm.out")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>