Learn R Programming

poppr (version 2.9.6)

informloci: Remove all non-phylogentically informative loci

Description

This function will facilitate in removing phylogenetically uninformative loci from a genclone or genind object. The user has the ability to define what uninformative means by setting a cutoff value for either percentage of differentiating genotypes or minor allele frequency.

Usage

informloci(pop, cutoff = 2/nInd(pop), MAF = 0.01, quiet = FALSE)

Value

A genind object with user-defined informative loci.

Arguments

pop

a genclone or genind object.

cutoff

numeric. A number from 0 to 1 defining the minimum number of differentiating samples.

MAF

numeric. A number from 0 to 1 defining the minimum minor allele frequency. This is passed as the thresh parameter of isPoly.

quiet

logical. When quiet = TRUE (default), messages indicating the loci removed will be printed to screen. When quiet = FALSE, nothing will be printed to screen.

Author

Zhian N. Kamvar

Details

This function will remove uninformative loci using a traditional MAF cutoff (using isPoly from adegenet) as well as analyzing the number of observed genotypes in a locus. This is important for clonal organisms that can have fixed heterozygous sites not detected by MAF methods.

Examples

Run this code
# We will use a dummy data set to demonstrate how this detects uninformative
# loci using both MAF and a cutoff.

genos <- c("A/A", "A/B", "A/C", "B/B", "B/C", "C/C")

v <- sample(genos, 100, replace = TRUE)
w <- c(rep(genos[2], 99), genos[3])           # found by cutoff
x <- c(rep(genos[1], 98), genos[3], genos[2]) # found by MAF
y <- c(rep(genos[1], 99), genos[2])           # found by both
z <- sample(genos, 100, replace = TRUE)
dat <- df2genind(data.frame(v = v, w = w, x = x, y = y, z = z), sep = "/")

informloci(dat)

if (FALSE) {
# Ignore MAF
informloci(dat, MAF = 0)

# Ignore cutoff
informloci(dat, cutoff = 0)

# Real data
data(H3N2)
informloci(H3N2)

}

Run the code above in your browser using DataLab