Learn R Programming

poppr (version 2.1.1)

samp.ia: Calculate random samples of the index of association for genlight objects.

Description

Genlight objects can contain millions of loci. Since it does not make much sense to calculate the index of association over that many loci, this function will randomly sample sites to calculate the index of association.

Usage

samp.ia(x, n.snp = 100L, reps = 100L, threads = 1L, quiet = FALSE)

Arguments

x
a genlight or snpclone object.
n.snp
the number of snps to be used to calculate standardized index of association.
reps
the number of times to perform the calculation.
threads
The maximum number of parallel threads to be used within this function. A value of 0 (default) will attempt to use as many threads as there are available cores/CPUs. In most cases this is ideal. A value of 1 will force the function to run serially, which
quiet
if FALSE, a progress bar will be printed to the screen.

Value

  • Index of association representing the samples in this genlight object.

See Also

genlight, snpclone, win.ia, ia, bitwise.dist

Examples

Run this code
# with structured snps assuming 1e4 positions
set.seed(999)
x <- glSim(n.ind = 10, n.snp.nonstruc = 5e2, 
           n.snp.struc = 5e2, ploidy = 2,
           parallel = FALSE)
position(x) <- sort(sample(1e4, 1e3))
res <- samp.ia(x)
hist(res, breaks = "fd")

# with unstructured snps assuming 1e4 positions
set.seed(999)
x <- glSim(n.ind = 10, n.snp.nonstruc = 1e3, ploidy = 2)
position(x) <- sort(sample(1e4, 1e3))
res <- samp.ia(x)
hist(res, breaks = "fd")

Run the code above in your browser using DataLab