Skip to contents

Computes \(\ln(iHH_A / iHH_D)\) at a core SNP (Voight et al. 2006). A long haplotype carrying the derived allele drives \(iHH_D\) up and the score negative; the reverse gives a positive score. Both routes the paper describes are available: the raw statistic, and the frequency-binned standardised score when standardize supplies the bin mean and standard deviation.

Usage

morie_ihstst(hap, core, positions = NULL, min_ehh = 0.05, standardize = NULL)

Arguments

hap

Haplotype matrix, chromosomes by sites, coded 0/1 with 0 ancestral at the core.

core

Core site index, 0-based.

positions

Optional physical positions.

min_ehh

EHH threshold at which integration stops, default 0.05 as in the paper.

standardize

Optional c(mean, sd) of the empirical distribution in this SNP's derived-allele-frequency bin.

Value

A list with estimate, ihs_unstandardized, ihh_a, ihh_d, daf, truncated_a, truncated_d, standardized, core, method.

References

Voight, B. F., Kudaravalli, S., Wen, X. and Pritchard, J. K. (2006). A map of recent positive selection in the human genome. PLoS Biology, 4(3), e72.

Examples

set.seed(2)
hap <- matrix(rbinom(30 * 9, 1, 0.5), 30, 9)
hap[hap[, 5] == 1, ] <- 1             # chromosomes carrying the derived allele share one long haplotype
morie_ihstst(hap, core = 4)$estimate  # negative: long derived-allele haplotypes
#> [1] -1.089463