match.G2A: Check the genomic relationship matrix G against the pedigree...

View source: R/match_G2A.R

match.G2AR Documentation

Check the genomic relationship matrix G against the pedigree relationship matrix A or vice versa

Description

Assesses a given genomic relationship matrix \boldsymbol{G} against the pedigree relationship matrix \boldsymbol{A}, or vice versa, to determine the matched and mismatched individuals. If requested, it provides the cleaned versions containing only the matched individuals between both matrices. The user should provide the matrices \boldsymbol{G}and \boldsymbol{A} in full form (ng \times ng and na \times na, respectively). Individual names should be assigned to rownames and colnames for both matrices.

Usage

match.G2A(
  A = NULL,
  G = NULL,
  clean = TRUE,
  ord = TRUE,
  mism = FALSE,
  RMdiff = FALSE,
  message = TRUE
)

Arguments

A

Input of the pedigree relationship matrix \boldsymbol{A} in full form (na \times na) (default = NULL).

G

Input of the genomic relationship matrix \boldsymbol{G} in full form (ng \times ng) (default = NULL).

clean

If TRUE generates new clean \boldsymbol{G} and \boldsymbol{A} matrices in full form containing only matched individuals (default = TRUE).

ord

If TRUE it will order by ascending order of individual names both of the clean \boldsymbol{A} and \boldsymbol{G} matrices (default = TRUE).

mism

If TRUE generates two data frames with mismatched individual names from the \boldsymbol{G} and \boldsymbol{A} matrices (default = FALSE).

RMdiff

If TRUE it generates the matrix (in lower diagonal row-wise sparse form) of matched observations from both the \boldsymbol{G} and \boldsymbol{A} matrices. This matrix can be used to identify inconsistent values between matched matrices, but it can be very large (default = FALSE).

message

If TRUE diagnostic messages are printed on screen (default = TRUE).

Value

A list with the following elements:

  • Gclean: a matrix with the portion of \boldsymbol{G} containing only matched individuals.

  • Aclean: a matrix with the portion of \boldsymbol{A} containing only matched individuals.

  • mismG: a vector containing the names of the individuals from matrix \boldsymbol{G} that are missing in matrix \boldsymbol{A}.

  • mismA: a vector containing the names of the individuals from matrix \boldsymbol{A} that are missing in matrix \boldsymbol{G}.

  • RM: a data frame with the observations from both the \boldsymbol{G} and \boldsymbol{A} matched matrices, together with their absolute relationship difference.

  • plotG2A: scatterplot with the pairing of matched pedigree- against genomic-based relationship values. This graph might take a long to plot with large datasets.

Examples


# Get A matrix.
A <- AGHmatrix::Amatrix(data = ped.pine)
A[1:5,1:5]
dim(A)

# Read and filter genotypic data.
M.clean <- qc.filtering(
 M = geno.pine655,
 maf = 0.05,
 marker.callrate = 0.2, ind.callrate = 0.20,
 na.string = "-9",
 plots = FALSE)$M.clean

# Get G matrix.
G <- G.matrix(M = M.clean, method = "VanRaden", na.string = "-9")$G
G[1:5, 1:5]
dim(G)

# Match G2A.
check <- match.G2A(
 A = A, G = G,
 clean = TRUE, ord = TRUE, mism = TRUE, RMdiff = TRUE)
ls(check)
dim(check$Aclean)
dim(check$Gclean)
check$Aclean[1:5, 1:5]
check$Gclean[1:5, 1:5]
head(check$mismG)
head(check$mismA)
check$plotG2A
head(check$RM)



ASRgenomics documentation built on May 29, 2024, 12:03 p.m.