Learn R Programming

relSim (version 1.0.0)

IBS: Identity by state

Description

Calculates the total number of alleles that are shared by two profiles. If the two profiles in question are indeed relatives then the matching alleles may be identical by descent, or by random chance alone, hence identity by state.

Usage

IBS(prof1, prof2, nLoci = length(prof1)/2, bPrint = FALSE)

Value

An integer between 0 and 2*nLoci representing the total number of alleles that match in the two profiles.

Arguments

prof1

A matrix consisting of 2 columns and nLoci rows. Each entry in the matrix is the (coded) allele held by the individual.

prof2

See prof1

nLoci

The number of loci in the profiles. Specifying this value speeds up computation enormously.

bPrint

If true then the result is printed locus by locus. This feature exists primarily for debugging purposes.

Author

James M. Curran

Examples

Run this code

data(fbiCaucs)
P1 = randomProfile(fbiCaucs)
C1 = randomChild(P1, fbiCaucs)
IBS(P1, C1)
IBS(P1, C1, bPrint = TRUE)

Run the code above in your browser using DataLab