package?poppr
This function allows the user to quickly view indices of heterozygosity,
evenness, and linkage to aid in the decision of a path to further analyze
a specified dataset. It natively takes
and
objects, but can convert any raw data formats
that adegenet can take (fstat, structure, genetix, and genpop) as well as
genalex files exported into a csv format (see read.genalex
for
details).
poppr(dat, total = TRUE, sublist = "ALL", blacklist = NULL, sample = 0,
method = 1, missing = "ignore", cutoff = 0.05, quiet = FALSE,
clonecorrect = FALSE, strata = 1, keep = 1, hist = TRUE,
index = "rbarD", minsamp = 10, legend = FALSE, ...)
genind
object OR a
genclone
object OR any fstat, structure, genetix,
genpop, or genalex formatted file.TRUE
(default), indices will be calculated for the
pooled populations.popNames
).
Defaults to "ALL".shufflepop
for details."zero"
and
"mean"
will set the missing values to those documented in
tab
. "loci"
and "geno"
will remove any loci or
genonumeric
a number from 0 to 1 indicating the percent
missing data allowed for analysis. This is to be used in conjunction with
the flag missing
(see missingno
for details)FALSE
(default) will display a progress bar for each
population analyzed.FALSE
. must be used with the strata
parameter, or the user will potentially get undesired results. see
clonecorrect
for details.formula
indicating the hierarchical levels to be used.
The hierarchies should be present in the strata
slot. See
strata
for details.integer
. This indicates which strata you wish to keep
after clone correcting your data sets. To combine strata, just set keep
from 1 to the number of straifications set in strata. see
clonecorr
logical
if TRUE
(default) and sampling > 0
,
a histogram will be produced for each population.character
Either "Ia" or "rbarD". If hist = TRUE
,
this will determine the index used for the visualization.integer
indicating the minimum number of individuals
to resample for rarefaction analysis. See rarefy
for
details.logical
. When this is set to TRUE
, a legend
describing the resulting table columns will be printed. Defaults to
FALSE
diversity_stats
mlg
)minsamp
.ia
).sample
. Lowest value
is 1/n where n is the number of observed values.ia
).sample
. Lowest value is 1/n where n is the number of observed
values.sample > 0
. These are
relatively quick to bootstrap, so the function
diversity_stats
should suit the need to produce confidence
intervals for these statistics. last_plot
command from p <- last_plot(); p +
facet_wrap(~population, ncol = 1, scales = "free_y")
The name for the
groupings is "population" and the name for the x axis is "value".}clonecorrect
, poppr.all
,
ia
, missingno
, mlg
,
diversity_stats
data(nancycats)
poppr(nancycats)
# Sampling
poppr(nancycats, sample = 999, total = FALSE)
# Customizing the plot
library("ggplot2")
p <- last_plot()
p + facet_wrap(~population, scales = "free_y", ncol = 1)
# Turning off diversity statistics (see get_stats)
poppr(nancycats, total=FALSE, H = FALSE, G = FALSE, lambda = FALSE, E5 = FALSE)
# The previous version of poppr contained a definition of Hexp, which
# was calculated as (N/(N - 1))*lambda. It basically looks like an unbiased
# Simpson's index. This statistic was originally included in poppr because it
# was originally included in the program multilocus. It was finally figured
# to be an unbiased Simpson's diversity metric (Lande, 1996; Good, 1953).
data(Aeut)
uSimp <- function(x){
lambda <- vegan::diversity(x, "simpson")
x <- drop(as.matrix(x))
if (length(dim(x)) > 1){
N <- rowSums(x)
} else {
N <- sum(x)
}
return((N/(N-1))*lambda)
}
poppr(Aeut, uSimp = uSimp)
# Demonstration with viral data
# Note: this is a larger data set that could take a couple of minutes to run
# on slower computers.
data(H3N2)
strata(H3N2) <- data.frame(other(H3N2)$x)
setPop(H3N2) <- ~country
poppr(H3N2, total = FALSE, sublist=c("Austria", "China", "USA"),
clonecorrect = TRUE, strata = ~country/year)
Run the code above in your browser using DataLab