CovMat {hscovar} | R Documentation |
Calculation of covariance or correlation matrix
Description
The theoretical covariance between pairs of markers is calculated from either paternal haplotypes and maternal linkage disequilibrium (LD) or vise versa. A genetic map is required. The implementation relies on paternal half-sib families and biallelic markers such as single nucleotide polymorphisms (SNP). If parental haplotypes are incomplete (i.e., SNP alleles are missing), those parents will be discarded at the corresponding pairs of SNPs. If maternal half-sib families are used, the roles of sire/dam are swapped. Multiple families can be considered.
Usage
CovMat(linkMat, haploMat, nfam, pos_chr, map_fun = "haldane", corr = F)
Arguments
linkMat |
(p x p) matrix of maternal LD between pairs of p markers; matrix is block diagonal in case of multiple chromosomes and must not contain missing values; use zeros if LD is uncertain |
haploMat |
(2N x p) matrix of sires haplotypes for all chromosomes (2 lines per sire); coding with 0's and 1's reflecting reference and alternate alleles, respectively; missing values can be coded as NA or any integer but not 0 and 1 |
nfam |
vector (LEN N) containing number of progeny per family or scalar value in case of equal family size |
pos_chr |
list (LEN number of chromosomes) of vectors (LEN number of markers) of genetic positions in Morgan per chromosome |
map_fun |
character string of mapping function used; so far "haldane" (default) and "kosambi" are enabled |
corr |
logical; |
Value
list (LEN 2) of matrix (DIM p1
x p1
) and vector
(LEN p1
) with p1 \le p
K
covariance matrix OR
R
correlation matrix
valid.snps
vector of SNP indices considered for covariance/ correlation matrix
Note
Family size is used for weighting covariance terms in case of multiple half-sib families. It only matters if number of progeny differs.
If maternal haplotypes (H.mothers) are used instead of maternal LD (matLD), LD can be estimated from counting haplotype frequencies as:
matLD <- LDdam(inMat = H.mother, pos.chr)
If multiple chromosomes are considered, SNP positions are provided as, e.g.
pos.chr <- list(pos.snp.chr1, pos.snp.chr2, pos.snp.chr3)
References
Wittenburg, Bonk, Doschoris, Reyer (2020) Design of Experiments for Fine-Mapping Quantitative Trait Loci in Livestock Populations. BMC Genetics 21:66. doi: 10.1186/s12863-020-00871-1
Examples
### 1: INPUT DATA
data(testdata)
### 2: COVARIANCE/CORRELATION MATRIX
corrmat <- CovMat(matLD, H.sire, 100, pos.chr, corr = TRUE)
### 3: TAGSNPS FROM CORRELATION MATRIX
bin <- tagSNP(corrmat$R)
bin <- tagSNP(corrmat$R, 0.5)