#example haplohh object (280 haplotypes, 1424 SNPs)
#see ?haplohh_cgu_bta12 for details
data(haplohh_cgu_bta12)
#using function scan_hh() with no cut-offs
scan <- scan_hh(haplohh_cgu_bta12, discard_integration_at_border = FALSE,
limehh = 0, limehhs = 0, lower_ehh_y_bound = 0, interpolate = FALSE)
#using function scan_hh_full()
scan_full <- scan_hh_full(haplohh_cgu_bta12, discard_integration_at_border = FALSE)
#both yield identical results within numerical precision
all.equal(scan, scan_full)
#calculate iHH "by hand"
m <- calc_pairwise_haplen(haplohh_cgu_bta12, mrk = "F1205400")
#extract alleles of focal marker
foc_alleles <- haplo(haplohh_cgu_bta12)[, "F1205400"]
#subset matrix to contain only ancestral or derived pairwise haplotype lengths
m_A <- m[foc_alleles == 0, foc_alleles == 0]
m_D <- m[foc_alleles == 1, foc_alleles == 1]
#calculate mean values (the matrices are symmetric and their diagonal is zero)
mean(m_A[upper.tri(m_A)])
mean(m_D[upper.tri(m_D)])
# compare with IHH_A and IHH_D from full scan
scan_full["F1205400", ]
Run the code above in your browser using DataLab