IBS: Identity by state

View source: R/IBS.R

IBSR Documentation

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)

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.

Value

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

Author(s)

James M. Curran

Examples


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


jmcurran/relSim documentation built on Jan. 13, 2024, 2:13 a.m.