Function to compute gametic LD matrix for a single parent. Uses a matrix of recombination frequencies and the supplied haplotypes of the parent as in Bijma et al. 2020 and Lehermeier et al. 2017b (and others).
calcGameticLD(parentGID, recombFreqMat, haploMat)
parentGID | string, the GID of an individual. Needs to correspond to renames in haploMat |
---|---|
recombFreqMat | a square symmetric matrix with values = (1-2*c1), where c1=matrix of expected recomb. frequencies. The choice to do 1-2c1 outside the function was made for computation efficiency; every operation on a big matrix takes time. |
haploMat | matrix of phased haplotypes, 2 rows per sample, cols = loci, 0,1, rownames assumed to contain GIDs with a suffix, separated by "_" to distinguish haplotypes |
Potentially really large matrix representing the LD between loci in gametes
Columns of haploMat and row/cols of recombFreqMat should be in same order. May be worth computing in an R session using multi-threaded BLAS.