individual_heterozygosity: Calculate individual based heterozygosity.

individual_heterozygosityR Documentation

Calculate individual based heterozygosity.

Description

Calculates heterozygosity within individuals across all SNPs by either a simple ratio of heterozygous to homozygous sites or standardized for differences in genotyping success according to Coltman et al (1999).

Usage

calc_het_hom_ratio(x, facets = NULL, complex_averages = FALSE)

calc_hs(x, facets = NULL, complex_averages = FALSE)

Arguments

x

snpRdata object

facets

facets over which to split snps within samples. Takes only SNP level facets. See Facets_in_snpR for details.

complex_averages

logical, default FALSE. If TRUE, will compute weighted averages for complex (snp + sample metadata) facets. This can be quite time consuming, and so is generally not recommended unless needed.

Value

A snpRdata object with heterozygote/homozygote ratios merged into the sample.stats slot.

Functions

  • calc_het_hom_ratio(): Ratio of heterozygous to homozygous sites.

  • calc_hs(): HS, Individual Heterozygosity

Het

Hom ratio:

Individual heterozygosity calculated as the number of heterozygous sites divided by the number of homozygous sites.

HS

Calculates HS, the mean heterozygosity of an individual standardized for unequal genotyping across individuals by dividing by the mean heterozygosity across all individuals *for the loci sequenced in that individual* (Coltman et al 1999). As a result, the global mean HS should be roughly equal to 1, and that in 'snpR' specifically the denominator is calculated across *all individuals in all facet levels* if facets are specified instead of within populations. As a result, the weighted mean HS in a specific population can be substantially different from one if a population is much less heterozygous.

Author(s)

William Hemstrom

References

Coltman, D. W., Pilkington, J. G., Smith, J. A., & Pemberton, J. M. (1999). Parasite-mediated selection against inbred Soay sheep in a free-living, island population. Evolution, 53(4), 1259–1267. doi: 10.1111/j.1558-5646.1999.tb04538.x

Examples

# base facet
x <- calc_het_hom_ratio(stickSNPs)
get.snpR.stats(x, stats = "het_hom_ratio")

# facet by chromosome
x <- calc_het_hom_ratio(stickSNPs, "chr")
get.snpR.stats(x, "chr", stats = "het_hom_ratio")

# Getting population means:
x <- calc_hs(stickSNPs, "pop")
get.snpR.stats(x, "pop", stats = "hs")


hemstrow/snpR documentation built on March 20, 2024, 7:03 a.m.