reshape.GRM: Reshape a Genetic Relationship Matrix

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/bm_grm.r

Description

Reshapes a GRM into a data frame listing relationship of (possibly all) pairs of individuals. Options are provided to specify ranges of relationship values to include or exclude. This is useful in the Quality Control process.

Usage

1
 reshape.GRM(K, include = c(-Inf, +Inf), exclude) 

Arguments

K

A symmetric matrix (such as produced by GRM)

include

Range of values to include (default is to include all values)

exclude

Range of values to exclude (default it to exclude nothing)

Details

The relationship between individuals i and j is the coefficient k_ij in the matrix K. The functions lists all pair i, j with i < j and k_ij in the range defined by include and outside the range defined by exclude.

Value

A data frame with three columns named i, j, k.

Author(s)

Herv<c3><a9> Perdry and Claire Dandine-Roulland

See Also

GRM

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# temporarily set nb threads to 2 to comply with CRAN rules
n.threads <- getNumThreads()
setThreadOptions(2)

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

# List all pairs if individuals with a relationship above 0.07
pairs <- reshape.GRM(K, exclude = c(-Inf, 0.07))

# Exclude first individual from each such pair
x1 <- x[ -pairs$i, ]

# back to previous nb threads value
setThreadOptions(n.threads)

gaston documentation built on Jan. 31, 2018, 1:05 a.m.