G_matrix: G_matrix

Description Usage Arguments Details Author(s) Examples

View source: R/G_matrix.R

Description

Computes genomic relationship matrices allowing the user to specify several options, for example centering the markers, weighting and scaling.

The computations can be done in parallel. The number of cpu cores can be specified in the UNIX commmand line with if you are using OpenBLAS or GOTOBlas2,

$export OPENBLAS_NUM_THREADS=4

or

$export GOTO_NUM_THREADS=4

or

export OMP_NUM_THREADS=4

Usage

1
2
  G_matrix(n, p, n_submatrix, file, centers = NULL, weights = NULL, 
           center_internally = 1, standard_internally = 1)

Arguments

n

Number of rows.

p

Number of columns.

n_submatrix

Number of submatrices.

file

Input file coded as binary.

centers

vector for centering the columns of the input matrix.

weights

vector for weighting the columns of the input matrix.

center_internally

logical, if 1 then the routine will center the columns of the input matrix.

standard_internally

logical, if 1 then the routine will standardize each of the columns of the input matrix internally.

Details

This routine will calculate genomic relationship matrix (G) for a given matrix with markers information (X).

The Genomic relationship matrix is computed by dividing the matrix X into k blocks (sub matrices):

G = XX' = X_1 * X_1' + ... + X_k * X_k'

The columns of X can be centered by providing a vector with centers or the columns can be centered internally by subtracting the sample mean internally. The columns of X can be weighted by a vector with weights and optionally standardized.

The element i, column j of X is centered and weighted as follows:

(X[i,j]-centers[j])*weights[j]/d[j]

then

Z = ZZ' = Z_1 * Z_1' + ... + Z_k * Z_k'

where c[j]=0 if the vector with centers is not given or center_internally=0. The weights (w[j]=1) if the vector with weights is not given. d[j] are the standard deviation for column j and are computed internally if standard_internally is set to 1. If standard_internally is not set then d[j]=1.

Author(s)

Paulino Perez, Gustavo de los Campos

Examples

1
2
3
4
5
6
7
## Not run: 
library(BGLRutils)
genos_file = system.file("extdata/mouse/bin/genosInt.bin", package="BGLRutils")
A=G_matrix(n=1814,p=10346,file=genos_file,n_submatrix=2)
A=A/10346

## End(Not run)

BGLRutils documentation built on May 2, 2019, 4:48 p.m.