Learn R Programming

hscovar (version 0.4.2)

LDdam: Calculation of maternal LD matrix

Description

Matrix containing linkage disequilibrium between marker pairs on maternal gametes is set up by counting haplotypes frequencies.

Usage

LDdam(inMat, pos_chr)

Arguments

inMat

[MATRIX] The maternal HAPLOTYPE matrix.

pos_chr

[LIST] The marker positions in Morgan on chromosomes.

Value

Dd

(p x p) matrix of maternal LD

Details

The function generates a block diagonal sparse matrix based on Matrix::bdiag. Use as.matrix() to obtain a regular one.

Examples

Run this code
# NOT RUN {
 ## haplotype matrix of n individuals at p SNPs
 p <- 10; n <- 4
 mat <- matrix(ncol = p, nrow = 2 * n, sample(c(0, 1), size = 2 * n * p, replace = TRUE))
 LDdam(mat, list(1:p))
# }

Run the code above in your browser using DataLab