ibs.pairs: Counts IBS alleles between profile pairs

Description Usage Arguments Details Value See Also Examples

Description

Counts IBS alleles between profile pairs

Usage

1
ibs.pairs(x1, x2)

Arguments

x1

N profiles

x2

N profiles

Details

A profile consists of two alleles at each locus. When two profiles are compared at a locus, there can be 0, 1 or 2 alleles IBS (identical by state). The function compares two databases of profiles (x1 and x2) and counts the number of IBS alleles between profile pairs. The function expects x1 and x2 to be of equal size.

Value

Data frame with three columns, containing for each profile pair:

  1. ibs: the number of alleles IBS, ranges from 0 to 2*nloci

  2. full.matches: the number of loci for which 2 alleles are IBS, ranges from 0 to nloci

  3. partial.matches: the number of loci for which 1 allele is IBS, ranges from 0 to nloci

See Also

ibs.db for comparing one profile against a db

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Compare the number of IBS alleles of simulated parent/offspring pairs
## with simulated unrelated pairs

data(freqsNLsgmplus)

#sample PO pairs and UN pairs
po.pairs <- sample.pairs(N=10^4,"PO",freqsNLsgmplus)
unr.pairs <- sample.pairs(N=10^4,"UN",freqsNLsgmplus)

#count the IBS alleles
po.pairs.ibs <- ibs.pairs(x1=po.pairs$x1,x2=po.pairs$x2)
unr.pairs.ibs <- ibs.pairs(x1=unr.pairs$x1,x2=unr.pairs$x2)

#plot together in a histogram
hist(po.pairs.ibs$ibs,breaks=0:20,xlim=c(0,20),
col="#FF0000FF",main="PO pairs vs. UN pairs",xlab="IBS")
hist(unr.pairs.ibs$ibs,breaks=0:20,col="#0000FFBB",add=TRUE)
legend("topright",legend=c("PO","UN"),fill=c("red","blue"))

DNAprofiles documentation built on Jan. 15, 2017, 9:27 p.m.