Retrieves a comprehensive pedigree table for the given dataset, which contains genotype names and pedigree strings. The function recursively traces parentage across generations and builds a pedigree table where each row corresponds to an individual, with columns for the female and male parents. It also handles cases of similar genotype names by standardizing them.
Arguments
- data
A data frame containing genotype/germplasm data, including names and pedigree strings.
- geno_column
The name of the column that identifies the genotype/germplasm names.
- pedigree_column
The name of the column that contains the pedigree strings.
Value
A data frame with three columns: - `Variety`: The identifier for the individual genotype. - `Female`: The identifier for the female parent. - `Male`: The identifier for the male parent. The pedigree table is sorted such that individuals appear before any row where they are listed as a parent. For founders (i.e., individuals with no parent information), `NA` is used for the parental columns.
Author
Khaled Al-Shamaa, k.el-shamaa@cgiar.org
Examples
if (interactive()) {
set_qbms_config("https://bms.icarda.org/ibpworkbench")
login_bms()
set_crop("wheat")
set_program("Wheat International Nurseries")
set_trial("IDYT39")
set_study("IDYT39 Environment Number 9")
germplasm <- get_germplasm_list()
pedigree_table <- get_pedigree_table(germplasm, "germplasmName", "pedigree")
#############################
# nadiv package way
# library(nadiv)
# Get additive relationship matrix in sparse matrix format
# A <- nadiv::makeA(pedigree_table)
# Get A inverse matrix using base R function
# AINV <- solve(as.matrix(A))
#############################
# ASReml-R package way
# library(asreml)
# Represent A inverse matrix in an efficient way using i, j index and Ainverse value
# Actual genotype names of any given index are in the attr(ainv, "rowNames")
# ainv <- asreml::ainverse(pedigree_table)
#############################
# Dummy data set for testing
test <- data.frame(genotype = c("X", "Y"),
pedigree = c("A//B/D/2/C", "B/C/3/A//B/C/2/D"))
pedigree_table <- get_pedigree_table(test, "genotype", "pedigree")
}