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.
evannoMethodStructure(
data = NULL,
writetable = FALSE,
exportplot = FALSE,
returnplot = FALSE,
returndata = TRUE,
pointsize = NA,
pointtype = 20,
pointcol = "steelblue",
linesize = NA,
linecol = "steelblue",
ebwidth = 0.2,
ebcol = "grey30",
textcol = "grey30",
xaxisbreaks = waiver(),
xaxislabels = waiver(),
basesize = 6,
gridsize = NA,
imgtype = "png",
height = NA,
width = NA,
dpi = 300,
units = "cm",
theme = "theme_bw",
font = "",
na.rm = TRUE,
outputfilename = "evannoMethodStructure",
exportpath = NULL
)
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.
A logical indicating if the output table is to be exported as a text file.
A logical indicating if the Evanno plots are to be exported as an image. If Evanno method cannot be computed, a kPlot (elpd over k) is exported instead.
A logical indicating if the plot must be returned. A
gtable object is returned alone when returndata=FALSE
. When
returndata=TRUE
, the gtable object is returned in a list. See 'Value'.
A logical indicating if the data must be returned. A
data.frame object is returned alone when returnplot=FALSE
. When
returnplot=TRUE
, the data.frame object is returned in a list. See 'Value'.
A numeric indicating size of points. Default for
basesize=6
is 1.8.
A character or number for the type of points. Defaults to 20. Same as pch in standard R.
A colour character for the colour of points. Defaults to "steelblue".
A numeric indicating the thickness of the line. Default for
basesize=6
is 0.24.
A colour character for the colour of line. Defaults to "steelblue".
A numeric indicating size od width of error abrs. Defaults to 0.2.
A colour character for colour for errorbar. Defaults to "grey30".
A colour character for all text elements on the plot. Defaults to "grey30".
A numeric vector indicating x-axis breaks. Automatically calculated by default.
A character vector indicating x-axis labels. Automatically calculated by default.
A numeric indicating the base size of various plot elements such as pointsize, linesize etc. Increase basesize with larger figure dimensions. Defaults to 6. Manually specified arguments (eg: pointsize) override basesize.
A numeric indicating thickness of background grid. Default
for basesize=6
is 0.18.
A character indicating the type of exported image. Default set to 'png'. Other possible options are 'jpeg', 'tiff' or 'pdf'.
A numeric denoting the height of exported image. Default units in 'cm'.
A numeric denoting the width of exported image. Default units in 'cm'.
A numeric denoting the resolution of exported image. Default set
to 300. If imgtype="pdf"
, dpi is fixed at 300.
A character denoting the unit of measure of the export image. Default is 'cm'. Other options are 'px', 'in' or 'mm'.
A character indicating ggplot theme to be used. Use like "theme_grey", "theme_bw" etc.
A character indicating font family to be used in the plots.
Uses default system fonts by default for jpeg, png and tiff. Uses 'Helvetica'
as default for pdf. Use package extrafonts
to import custom fonts.
See vignette for examples.
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.
A character indicating output file name. Defaults to 'evannoMethodStructure'.
A path to where content must be exported. For example,
exportpath="./dir/anotherdir"
. To use the current working directory, set exportpath=getwd()
.
When returndata=TRUE
and returnplot=FALSE
, a data.frame is
returned.
When returndata=FALSE
and returnplot=TRUE
, a gtable plot object is
returned.
When returndata=TRUE
and returnplot=TRUE
, a list with data.frame
and gtable object is returned.
The data.frame contains Evanno results 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.
The gtable object is a result of gridExtra::arrangeGrob()
. This is
suitable for plotting in a report.
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 further customisation is required.
See the vignette for more details.
# 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=TRUE,exportpath=getwd())
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab