grm {qgg} | R Documentation |
Computing the genomic relationship matrix (GRM)
Description
The grm function is used to compute a genomic relationship matrix (GRM) based on all, or a subset of marker genotypes. GRM for additive, and non-additive (dominance and epistasis) genetic models can be constructed. The output of the grm function can either be a within-memory GRM object (n x n matrix), or a GRM-list which is a list structure that contains information about the GRM stored in a binary file on the disk.
Usage
grm(
Glist = NULL,
GRMlist = NULL,
ids = NULL,
rsids = NULL,
rws = NULL,
cls = NULL,
W = NULL,
method = "add",
scale = TRUE,
msize = 100,
ncores = 1,
fnG = NULL,
overwrite = FALSE,
returnGRM = FALSE,
miss = NA,
impute = TRUE,
pedigree = NULL,
task = "grm"
)
Arguments
Glist |
list providing information about genotypes stored on disk |
GRMlist |
list providing information about GRM matrix stored in binary files on disk |
ids |
vector of individuals used for computing GRM |
rsids |
vector marker rsids used for computing GRM |
rws |
rows in genotype matrix used for computing GRM |
cls |
columns in genotype matrix used for computing GRM |
W |
matrix of centered and scaled genotypes |
method |
indicator of method used for computing GRM: additive (add, default), dominance (dom) or epistasis (epi-pairs or epi-hadamard (all genotype markers)) |
scale |
logical if TRUE the genotypes in Glist has been scaled to mean zero and variance one |
msize |
number of genotype markers used for batch processing |
ncores |
number of cores used to compute the GRM |
fnG |
name of the binary file used for storing the GRM on disk |
overwrite |
logical if TRUE the binary file fnG will be overwritten |
returnGRM |
logical if TRUE function returns the GRM matrix to the R environment |
miss |
the missing code (miss=NA is default) used for missing values in the genotype data |
impute |
if missing values in the genotype matrix W then mean impute |
pedigree |
is a dataframe with pedigree information |
task |
either computation of GRM (task="grm" which is default) or eigenvalue decomposition of GRM (task="eigen") |
Value
Returns a genomic relationship matrix (GRM) if returnGRM=TRUE else a list structure (GRMlist) with information about the GRM stored on disk
Author(s)
Peter Soerensen
Examples
# Simulate data
W <- matrix(rnorm(1000000), ncol = 1000)
colnames(W) <- as.character(1:ncol(W))
rownames(W) <- as.character(1:nrow(W))
# Compute GRM
GRM <- grm(W = W)
# Eigen value decompostion GRM
eig <- grm(GRM=GRM, task="eigen")