sample.relatives: Sample random relatives of one profile or many profiles

Description Usage Arguments Details Value See Also Examples

Description

Sample random relatives of one profile or many profiles

Usage

1
2
sample.relatives(x, N, type = "FS", freqs = get.freqs(x),
  markers = names(freqs), theta = 0)

Arguments

x

An integer matrix specifying a single profile. Alternatively an integer vector containing a single profile, e.g. obtained when a row is selected from a matrix of profiles.

N

number of relatives to sample per profile (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.

theta

numeric value specifying the amount of background relatedness.

Details

When x is a single profile, the function samples N profile that are related to x with the supplied type of relationship (type).

When x is a database of profiles, there are N relatives sampled per profile in x. Hence there will be nrow(x)*N profiles returned. In this case the returned matrix contains the relatives in order of the profiles they correspond with, e.g. the relatives of 1,1,2,2,3,3,.. when N=2.

Value

An object of class profiles, which is an integer matrix with N*nrow(x) rows and twice the number of loci columns. The integers correspond to the index in the allelic frequency vector, NOT to STRs. Each row is a profile and every two columns contain the two alleles at a locus.

See Also

sample.pairs, sample.profiles

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## sample either many relatives of one profile, or one (or more) relatives of many profiles
data(freqsNLsgmplus)

# sample relatives of one profile
x1 <- sample.profiles(N=1,freqsNLsgmplus)
x1.sibs <- sample.relatives(x=x1,N=10^3,type="FS")
nrow(x1.sibs) # 10^3

# sample relatives of many profiles
x2 <- sample.profiles(N=10^3,freqsNLsgmplus)
x2.sibs <- sample.relatives(x=x2,N=1,type="FS")
nrow(x2.sibs) # 10^3

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