Learn R Programming

pophelper (version 2.0.0)

evannoMethodStructure: Perform the Evanno method for STRUCTURE runs.

Description

The Evanno method for detecting the appropriate number of population clusters from STRUCTURE results. Creates table and figure with Evanno method derivatives. Refer to return for detailed list of columns. See details for Evanno method reference.

Usage

evannoMethodStructure(data = NULL, writetable = FALSE, exportplot = FALSE,
  na.rm = TRUE, imgtype = "png", basesize = NA, height = NA,
  width = NA, res = NA, units = NA)

Arguments

data

A dataframe with summarised runs. An output from summariseQ() derived from STRUCTURE runs. Must have minimum 7 columns named elpdmean, elpdsd, k, runs, loci, elpdmax and elpdmin.

writetable

A logical indicating if the output table is to be exported as a file in the working directory.

exportplot

A logical indicating if the Evanno plots are to be exported as an image in the working directory. If Evanno method cannot be computed, a kPlot (elpd over k) is exported instead.

na.rm

Default set to FALSE. Does not remove NAs for plot and this generates warnings from ggplot. If set to TRUE, NAs are removed before plotting and warning messages from ggplot are avoided.

imgtype

A character indicating the type of exported image. Default set to 'png'. Other possible options are 'jpeg' or 'pdf'.

basesize

A numeric indicating the base size of various plot elements such as point size, line thickness etc. Increase basesize with larger figure dimensions. Defaults to 5.

height

A numeric denoting the height of exported image. Default units in 'cm'. If imgtype is pdf, height must be in inches.

width

A numeric denoting the width of exported image. Default units in 'cm'. If imgtype is pdf, height must be in inches.

res

A numeric denoting the resolution of exported image. Default set to 200. If imgtype is pdf, this option does not apply.

units

A character denoting the unit of measure of the export image. By default, units is set to 'cm' for png and jpeg and to 'in' if imgtype is 'pdf'. Other options include 'px', 'in' and 'mm' etc.

Value

Returns a dataframe with all values sorted by K. The table has 16 columns namely Mean estimated ln probability of data, Standard deviation, Value of K, Number of runs for each K, Number of runs for each K, Number of individuals for each K, Number of loci for each K, Estimated ln probability of data plus standard deviation, Estimated ln probability of data minus standard deviation, First derivative, Max error of first derivative, Min error of first derivative, Second derivative, Max error of second derivative, Min error of second derivative and the Third derivative.

Details

The Evanno method is based on the paper: Evanno, G., Regnaut, S., and Goudet, J. (2005). Detecting the number of clusters of individuals using the software STRUCTURE: a simulation study. Molecular ecology, 14(8), 2611-2620. The Evanno plot generated from this function can be recreated from the returned dataframe if furthur customisation is required.

See the vignette for more details.

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
sfiles <- list.files(path=system.file("files/structure",package="pophelper"),full.names=TRUE)
tr1 <- tabulateQ(readQ(sfiles))
sr1 <- summariseQ(tr1)
evannoMethodStructure(sr1)
evannoMethodStructure(data=sr1,exportplot=T)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab