gl.plot.faststructure {dartR.popgen} | R Documentation |
Plots fastStructure analysis results (Q-matrix)
Description
This function takes a fastStructure run object (output from
gl.run.faststructure
) and plots the typical structure bar
plot that visualize the q matrix of a fastStructure run.
Usage
gl.plot.faststructure(
sr,
k.range,
met_clumpp = "greedyLargeK",
iter_clumpp = 100,
clumpak = TRUE,
plot_theme = NULL,
colors_clusters = NULL,
ind_name = TRUE,
border_ind = 0.15,
den = FALSE,
x = NULL
)
Arguments
sr |
fastStructure run object from |
k.range |
The number for K of the q matrix that should be plotted. Needs to be within you simulated range of K's in your sr structure run object. If NULL, all the K's are plotted [default NULL]. |
met_clumpp |
The algorithm to use to infer the correct permutations. One of 'greedy' or 'greedyLargeK' or 'stephens' [default "greedyLargeK"]. |
iter_clumpp |
The number of iterations to use if running either 'greedy' 'greedyLargeK' [default 100]. |
clumpak |
Whether use the Clumpak method (see details) [default TRUE]. |
plot_theme |
Theme for the plot. See Details for options [default NULL]. |
colors_clusters |
A color palette for clusters (K) or a list with as many colors as there are clusters (K) [default NULL]. |
ind_name |
Whether to plot individual names [default TRUE]. |
border_ind |
The width of the border line between individuals [default 0.25]. |
den |
Whether to include a dendrogram. It is necessary to include the original genlight object used in gl.run.structure in the parameter x [default FALSE]. |
x |
The original genlight object used in gl.run.structure description [default NULL]. |
Details
The function outputs a barplot which is the typical output of fastStructure.
This function is based on the methods of CLUMPP and Clumpak as implemented in the R package starmie (https://github.com/sa-lee/starmie).
The Clumpak method identifies sets of highly similar runs among all the replicates of the same K. The method then separates the distinct groups of runs representing distinct modes in the space of possible solutions.
The CLUMPP method permutes the clusters output by independent runs of clustering programs such as structure, so that they match up as closely as possible.
This function averages the replicates within each mode identified by the Clumpak method.
Examples of other themes that can be used can be consulted in
Value
List of Q-matrices
Author(s)
Bernd Gruber & Luis Mijangos (Post to https://groups.google.com/d/forum/dartr)
References
Raj, A., Stephens, M., & Pritchard, J. K. (2014). fastSTRUCTURE: variational inference of population structure in large SNP data sets. Genetics, 197(2), 573-589.
Pritchard, J.K., Stephens, M., Donnelly, P. (2000) Inference of population structure using multilocus genotype data. Genetics 155, 945-959.
Kopelman, Naama M., et al. "Clumpak: a program for identifying clustering modes and packaging population structure inferences across K." Molecular ecology resources 15.5 (2015): 1179-1191.
Mattias Jakobsson and Noah A. Rosenberg. 2007. CLUMPP: a cluster matching and permutation program for dealing with label switching and multimodality in analysis of population structure. Bioinformatics 23(14):1801-1806. Available at clumpp
See Also
gl.run.faststructure
Examples
## Not run:
t1 <- gl.filter.callrate(platypus.gl, threshold = 1)
res <- gl.run.faststructure(t1,
exec = "./fastStructure", k.range = 2:3,
num.k.rep = 2, output = paste0(getwd(), "/res_str")
)
qmat <- gl.plot.faststructure(res, k.range = 2:3)
gl.map.structure(qmat, K = 2, t1, scalex = 1, scaley = 0.5)
## End(Not run)