calcHet: Calculate individual heterozygosity

Description Usage Arguments Details Value

View source: R/stats.R

Description

Calculate individual heterozygosity

Usage

1
calcHet(gt, nLoci = NULL)

Arguments

gt

A genotype matrix with N rows and L columns, where N is the number of individuals and L is the number of loci, for which the i,jth element gives the number of the counted allele in each individual at each locus.

nLoci

An optional argument giving the number of genotyped base pairs in each individual. If not specified, this is assumed to be the number of non-missing genotypes in each row of gt. Default is NULL.

Details

The data matrix gt should consist of 0s, 1s, and 2s, with missing data indicated with NA. This can be generated from a VCF file using vcf2R. If nLoci is not specified, and gt consists only of polymorphic loci, this function will return heterozygosity at polymorphic sites, which may not be comparable across datasets.

Value

A vector giving the proportion of loci that are heterozygous in each individual.


gbradburd/popgenstuff documentation built on Oct. 16, 2021, 12:05 a.m.