Learn R Programming

DNAprofiles (version 0.3.1)

ibs.db: Counts IBS alleles between case profile and all database profiles

Description

Counts IBS alleles between case profile and all database profiles

Usage

ibs.db(x, db)

Arguments

x
case profile
db
database of profiles

Value

Data frame with three columns
  1. ibs: the number of alleles IBS of x and a db profile, 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$

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 a single profile with a database of $N$ profiles and counts the number of IBS alleles.

See Also

ibs.pairs for comparing many profile pairs

Examples

Run this code
## monte-carlo simulation of number of IBS alleles for FS, PO and UN w.r.t a single case profile

data(freqsNLsgmplus)

#start with a single case profile
x <- sample.profiles(N=1,freqs=freqsNLsgmplus)

# sample siblings
x.fs <- sample.relatives(x,N=10^3,type="FS")
# sample parent/offspring
x.po <- sample.relatives(x,N=10^3,type="PO")
# sample unrelated profiles
x.unr <- sample.profiles(N=10^3,freqs=freqsNLsgmplus)

# make histograms of the number of ibs alleles
hist(ibs.db(x,x.fs)$ibs,xlim=c(0,20),main="FS",xlab="IBS")
hist(ibs.db(x,x.po)$ibs,xlim=c(0,20),main="PO",xlab="IBS")
hist(ibs.db(x,x.unr)$ibs,xlim=c(0,20),main="UN",xlab="IBS")

Run the code above in your browser using DataLab