gca: Genetic connectedness analysis

View source: R/GCA.R

gcaR Documentation

Genetic connectedness analysis

Description

Estimates genetic connectedness across units using pedigree or genomic data.

Usage

gca(
  Kmatrix,
  Xmatrix,
  sigma2a,
  sigma2e,
  MUScenario,
  statistic,
  NumofMU,
  Uidx = NULL,
  scale = TRUE,
  diag = TRUE
)

Arguments

Kmatrix

A relationship matrix with a dimension of n by n, where n refers to the total number of individuals.

Xmatrix

A design matrix which associates fixed effects with phenotypes and the intercept is excluded. The first column of Xmatrix should start with design matrix of unit effects, following with other fixed effects if applicable.

sigma2a

Additive genetic variance.

sigma2e

Residual variance.

MUScenario

A vector of units which will be treatd as a factor.

statistic

A statistic measures genetic connectedness, which includes

  • 'PEVD_IdAve' : Individual average PEVD, the optional argument of 'scale' is available.

  • 'PEVD_GrpAve' : Groupd average PEVD, the optional arguments of 'scale' and 'diag' are available.

  • 'PEVD_contrast' : Contrast PEVD, the optional argument of 'scale' is available.

  • 'CD_IdAve' : Individual average CD.

  • 'CD_GrpAve' : Group average CD, the optional argument of 'diag' is available.

  • 'CD_contrast' : Contrast CD.

  • 'r_IdAve' : Individual average r.

  • 'r_GrpAve' : Group average r, the optional argument of 'diag' is available.

  • 'r_contrast' : Contrast r.

  • 'VED0' : Variance of estimate of unit effects differences. The optional argument of 'scale' is available.

  • 'VED1' : Variance of estimate of unit effects differences with the correction of unit effect. The optional argument of 'scale' is available.

  • 'VED2' : Variance of estimate of unit effects differences with the correction of unit effect and additional fixed effects. The additional argument of 'Uidx' is required and the optional argument of 'scale' is available.

  • 'CDVED0' : Coefficient of determination of VED, the optional argument of 'diag' is available.

  • 'CDVED1' : Coefficient of determination of VED with the correction of unit effect. The optional argument of 'diag' is available.

  • 'CDVED2' : Coefficient of determination of VED with the correction of unit effect and additional fixed effects. The additional argument of 'Uidx' is required and the optional argument of 'diag' is available.

  • 'CR0' : Connectedness rating.

  • 'CR1' : Connectedness rating with the correction of unit effect.

  • 'CR2' : Connectedness rating with the correction of unit effect and additional fixed effects. The additional argument of 'Uidx' is required.

NumofMU

The number of management unit to summarize connectedness. The available options include 'Pairwise' and 'Overall', where the prior calculates the connectedness across all pairwise units, and the later averages all pairwise connectedness across units.

Uidx

An interger to indicate the last column of unit effects in Xmatrix. This Uidx is required for statistics VED2, CDVED2 and CR2. The default is NULL.

scale

Logical argument. Should sigma2a be used to scale statistic (e.g., PEVD_IdAve, PEVD_GrpAve, PEVD_contrast, VED0, VED1, and VED2) to remove units effects? Default is TRUE.

diag

Logical argument. Should diagonal elements of PEV matrix (e.g., PEVD_GrpAve, CD_GrpAve, and r_GrpAve) or K matrix (CDVED0, CDVED1, and CDVED2) be included? Default is TRUE.

Value

A value of overall connectedness measurements across units when NumofMU is set as 'Overall'. A matrix of connectedness measurments with diagonal as NA when NumofMU is set as 'Pairwise'.

Author(s)

Haipeng Yu and Gota Morota

Maintainer: Haipeng Yu haipengyu@vt.edu

Examples

# Load cattle data
data(GCcattle)

# Compute genomic relationship matrix
G <- computeG(cattle.W, maf = 0.05, impute = 'mean', method = 'G1')

# The heritability of simulated phenotype was set to 0.6 with additive genetic variace (Vu) = 0.6 and residual variance (Ve) = 0.4
var <- list(Vu = 0.6, Ve = 0.4) 

# Design matrix of fixed effects
## unit effect
X1 <- model.matrix(~ -1 + factor(cattle.pheno$Unit))
## unit effect and sex effect
X2 <- model.matrix(~ -1 + factor(cattle.pheno$Unit) + factor(cattle.pheno$Sex))

# Calculate CD_IdAve
CD_IdAve <- gca(Kmatrix = G, Xmatrix = X1, sigma2a = var$Vu, sigma2e = var$Ve, 
                MUScenario = as.factor(cattle.pheno$Unit), statistic = 'CD_IdAve', 
                NumofMU = 'Overall')

# Calculate CDVED1
CDVED1 <- gca(Kmatrix = G, Xmatrix = X1, sigma2a = var$Vu, sigma2e = var$Ve, 
              MUScenario = as.factor(cattle.pheno$Unit), statistic = 'CDVED1',
              NumofMU = 'Pairwise', diag = TRUE)

# Calculate CDVED2
CDVED2 <- gca(Kmatrix = G, Xmatrix = X2, sigma2a = var$Vu, sigma2e = var$Ve,
              MUScenario = as.factor(cattle.pheno$Unit), statistic = 'CDVED2', 
              NumofMU = 'Pairwise', Uidx = 8, diag = TRUE)




HaipengU/GCA documentation built on Oct. 1, 2023, 3:13 p.m.