scan_hh: Compute iHH, iES and inES over a whole chromosome

Description Usage Arguments Details Value References See Also Examples

View source: R/scan_hh.R

Description

Compute integrated EHH (iHH), integrated EHHS (iES) and integrated normalized EHHS (inES) for all markers of a chromosome (or linkage group).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
scan_hh(
  haplohh,
  limhaplo = 2,
  limhomohaplo = 2,
  limehh = 0.05,
  limehhs = 0.05,
  phased = TRUE,
  polarized = TRUE,
  scalegap = NA,
  maxgap = NA,
  discard_integration_at_border = TRUE,
  lower_ehh_y_bound = limehh,
  lower_ehhs_y_bound = limehhs,
  interpolate = TRUE,
  threads = 1
)

Arguments

haplohh

an object of class haplohh (see data2haplohh)

limhaplo

if there are less than limhaplo chromosomes that can be used for the calculation of EHH(S), the calculation is stopped. The option is intended for the case of missing data, which leads to the successive exclusion of haplotypes: the further away from the focal marker the less haplotypes contribute to EHH(S).

limhomohaplo

if there are less than limhomohaplo homozygous chromosomes, the calculation is stopped. This option is intended for unphased data and should be invoked only if relatively low frequency variants are not filtered subsequently (see main vignette and Klassmann et al. 2020).

limehh

limit at which EHH stops to be evaluated.

limehhs

limit at which EHHS stops to be evaluated.

phased

logical. If TRUE (default) chromosomes are expected to be phased. If FALSE, the haplotype data is assumed to consist of pairwise ordered chromosomes belonging to diploid individuals. EHH(S) is then estimated over individuals which are homozygous at the focal marker.

polarized

logical. TRUE by default. If FALSE, use major and minor allele instead of ancestral and derived. If there are more than two alleles then the minor allele refers to the second-most frequent allele.

scalegap

scale or cap gaps larger than the specified size to the specified size (default=NA, i.e. no scaling).

maxgap

maximum allowed gap in bp between two markers. If exceeded, further calculation of EHH(S) is stopped at the gap (default=NA, i.e no limitation).

discard_integration_at_border

logical. If TRUE (default) and computation reaches first or last marker or a gap larger than maxgap, iHH, iES and inES are set to NA.

lower_ehh_y_bound

lower y boundary of the area to be integrated over (default: limehh). Can be set to zero for compatibility with the program hapbin.

lower_ehhs_y_bound

lower y boundary of the area to be integrated (default: limehhs). Can be set to zero for compatibility with the program hapbin.

interpolate

logical. If TRUE (default), integration is performed over a continuous EHH(S) curve (values are interpolated linearly between consecutive markers), otherwise the EHH(S) curve decreases stepwise at markers.

threads

number of threads to parallelize computation

Details

Integrated EHH (iHH), integrated EHHS (iES) and integrated normalized EHHS (inES) are computed for all markers of the chromosome (or linkage group). This function is several times faster as a procedure calling in turn calc_ehh and calc_ehhs for all markers. To perform a whole genome-scan this function needs to be called for each chromosome and results concatenated.

Note that setting limehh or limehhs to zero is likely to reduce power, since even under neutrality a tiny fraction (<<0.05) of extremely long shared haplotypes is expected which, if fully accounted for, would obfuscate the signal at selected sites.

Value

The returned value is a dataframe with markers in rows and the following columns

  1. chromosome name

  2. position in the chromosome

  3. sample frequency of the ancestral / major allele

  4. sample frequency of the second-most frequent remaining allele

  5. number of evaluated haplotypes at the focal marker for the ancestral / major allele

  6. number of evaluated haplotypes at the focal marker for the second-most frequent remaining allele

  7. iHH of the ancestral / major allele

  8. iHH of the second-most frequent remaining allele

  9. iES (used by Sabeti et al 2007)

  10. inES (used by Tang et al 2007)

Note that in case of unphased data the evaluation is restricted to haplotypes of homozygous individuals which reduces the power to detect selection, particularly for iHS (for appropriate parameter setting see the main vignette and Klassmann et al (2020)).

References

Gautier, M. and Naves, M. (2011). Footprints of selection in the ancestral admixture of a New World Creole cattle breed. Molecular Ecology, 20, 3128-3143.

Klassmann, A. and Gautier, M. (2020). Detecting selection using Extended Haplotype Homozygosity-based statistics on unphased or unpolarized data (preprint). https://doi.org/10.22541/au.160405572.29972398/v1

Sabeti, P.C. et al. (2002). Detecting recent positive selection in the human genome from haplotype structure. Nature, 419, 832-837.

Sabeti, P.C. et al. (2007). Genome-wide detection and characterization of positive selection in human populations. Nature, 449, 913-918.

Tang, K. and Thornton, K.R. and Stoneking, M. (2007). A New Approach for Using Genome Scans to Detect Recent Positive Selection in the Human Genome. Plos Biology, 7, e171.

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

See Also

data2haplohh, calc_ehh, calc_ehhs ihh2ihs,ines2rsb, ies2xpehh

Examples

1
2
3
4
#example haplohh object (280 haplotypes, 1424 SNPs)
#see ?haplohh_cgu_bta12 for details
data(haplohh_cgu_bta12)
scan <- scan_hh(haplohh_cgu_bta12)

rehh documentation built on Sept. 15, 2021, 5:06 p.m.