snpStats (version 1.22.0)

ibsCount: Count alleles identical by state

Description

This function counts, for all pairs of subjects and across all SNPs, the total number of alleles which are identical by state (IBS)

Usage

ibsCount(snps, uncertain = FALSE)

Arguments

snps
An input object of class "SnpMatrix" or "XSnpMatrix"
uncertain
If FALSE, uncertain genotypes are ignored. Otherwise contributions are weighted by posterior probabilities

Value

If there are N rows in the input matrix, the function returns an N*N matrix. The lower triangle contains the total number of comparisons and the upper triangle contains the number of these which are IBS. The diagonal contains the number of valid calls for each subject.

Details

For each pair of subjects the function counts the total number of alleles which are IBS. For autosomal SNPs, each locus contributes 4 comparisons, since each subject carries two copies. For SNPs on the X chromosome, the number of comparisons is also 4 for female:female comparisons, but is 2 for female:male and 1 for male:male comparisons.

See Also

ibsDist which calculates a distance matrix based on proportion of alleles which are IBS

Examples

Run this code
data(testdata)

ibs.A <- ibsCount(Autosomes[,1:100])
ibs.X <- ibsCount(Xchromosome)

Run the code above in your browser using DataCamp Workspace