sample.pairs: Sample random profile pairs with given relationship (sibs,...

Description Usage Arguments Details Value See Also Examples

Description

Sample random profile pairs with given relationship (sibs, parent/offspring, etc.)

Usage

1
sample.pairs(N = 1, type = "FS", freqs, markers = names(freqs))

Arguments

N

The number of pairs to be sampled (integer).

type

A character string giving the type of relative. Should be one of ibdprobs, e.g. "FS" (full sibling) or "PO" (parent/offspring) or "UN" (unrelated).

freqs

A list specifying the allelic frequencies. Should contain a vector of allelic frequencies for each locus, named after that locus.

markers

A character vector naming the markers of the resulting sample. Default to all markers of the freqs argument.

Details

The function randomly samples N pairs of DNA profiles according to the specified allelic frequencies. It returns two matrices containing profiles. The i'th profile in the first and the second matrix are sampled as relatives.

Value

A list containing two integer matrices of class profiles:

  1. x1 An integer matrix with N profiles.

  2. x2 An integer matrix with N profiles.

See Also

sample.profiles, sample.relatives,ki,ibs.pairs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## 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)

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