poppr (version 2.3.0)

win.ia: Calculate windows 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 scan windows across the loci positions and calculate the index of association.

Usage

win.ia(x, window = 100L, min.snps = 3L, threads = 1L, quiet = FALSE)

Arguments

x
a genlight or snpclone object.
window
an integer specifying the size of the window.
min.snps
an integer specifying the minimum number of snps allowed per window. If a window does not meet this criteria, the value will return as NA.
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 may increase stability on some systems. Other values may be specified, but should be used with caution.
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, samp.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)
position(x) <- sort(sample(1e4, 1e3))
res <- win.ia(x, window = 300L) # Calculate for windows of size 300
plot(res, type = "l")

## Not run: 
# # unstructured snps
# set.seed(999)
# x <- glSim(n.ind = 10, n.snp.nonstruc = 1e3, ploidy = 2)
# position(x) <- sort(sample(1e4, 1e3))
# res <- win.ia(x, window = 300L) # Calculate for windows of size 300
# plot(res, type = "l")
# ## End(Not run)

Run the code above in your browser using DataLab