Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

GRM

Genetic Relationship Matrix


Description

Compute the Genetic Relationship Matrix

Usage

GRM(x, which.snps, autosome.only = TRUE, chunk = 1L)

Arguments

x

A bed.matrix

which.snps

Logical vector, giving which snps to use in the computation. The default is to use all autosomal SNPs

autosome.only

If TRUE, only autosomal SNPs will be considered.

chunk

Parameter for the parallelization: how many SNPs are treated by each task

Details

The Genetic Relationship Matrix (GRM) is computed by the formula XX'/q, with X the standardized genotype matrix and q the number of SNPs (ncol(x)).

If x is not standardized before this computation, the function will use standardize(x) <- "p" by default.

Value

The GRM is a symmetric square matrix of dimension equal to the number of individuals. Each entry can be interpreted as an estimated kinship coefficient between individuals, although some authors might disagree. Note in particular that some entries will be negative.

Author(s)

Hervé Perdry and Claire Dandine-Roulland

See Also

Examples

# load chr2 data set (~10k SNPs in low LD)
x <- read.bed.matrix( system.file("extdata", "chr2.bed", package="gaston") )

# Compute Genetic Relationship Matrix
K <- GRM(x)
dim(K)

gaston

Genetic Data Handling (QC, GRM, LD, PCA) & Linear Mixed Models

v1.5.7
GPL-3
Authors
Hervé Perdry [cre, aut, cph], Claire Dandine-Roulland [aut, cph], Deepak Bandyopadhyay [cph] (C++ gzstream class), Lutz Kettner [cph] (C++ gzstream class)
Initial release
2020-09-18

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.