write_GRMBin: Write GRM binary files.

Description Usage Arguments Value References Examples

View source: R/correlation_matrices.R

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

1
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

1
2
3
4
5
6
7
8
9
## 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")

vtrubets/OmicKriging documentation built on Oct. 29, 2020, 12:44 a.m.