| gl.plot.snmf | R Documentation |
This function takes a Q matrix (output from
gl.run.snmf) and plots the typical structure bar
plot that visualize the Q matrix of a structure run.
gl.plot.snmf(
snmf.result,
border.ind = 0.25,
plot.K,
plot.theme = NULL,
color.clusters = NULL,
ind.name = TRUE,
plot.out = TRUE,
plot.file = NULL,
plot.dir = NULL,
den = FALSE,
inverse.den = TRUE,
x = NULL,
plot.colors.pop = gl.colors("dis"),
verbose = 2
)
snmf.result |
run object from |
border.ind |
The width of the border line between individuals [default 0.25]. |
plot.K |
The number for K of the Q matrix that should be plotted. Needs to be within you simulated range of K's in your snmf run object [required]. |
plot.theme |
Theme for the plot. See Details for options [default NULL]. |
color.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]. |
plot.out |
Specify if plot is to be produced [default TRUE]. |
plot.file |
Name for the RDS binary file to save (base name only, exclude extension) [default NULL]. |
plot.dir |
Directory in which to save files [default = working directory]. |
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]. |
inverse.den |
Flip dendrogram upside down [default TRUE]. |
x |
The original genlight object used in gl.run.structure description [default NULL]. |
plot.colors.pop |
A color palette for population plots or a list with as many colors as there are populations in the dataset [default gl.colors("dis")]. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log ; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity]. |
The function outputs a barplot which is the typical output of snmf. Plots and table are saved to the working directory specified in plot.dir if plot.file is set.
Examples of other themes that can be used can be consulted in
The Q matrices can be input to other R packages for plotting ancestry proportion, e.g. FSTruct https://github.com/MaikeMorrison/FSTruct
Q-matrix
Ching Ching Lau (Post to https://groups.google.com/d/forum/dartr)
Frichot E, Mathieu F, Trouillon T, Bouchard G, Francois O. (2014). Fast and Efficient Estimation of Individual Ancestry Coefficients. Genetics, 194(4): 973–983.
gl.run.snmf, gl.plot.snmf
# examples need LEA to be installed on the system (see above)
## Not run:
m <- gl.run.snmf(x=bandicoot.gl, minK=1,
maxK=5, rep=10)
Q <- gl.plot.snmf(snmf.result=m, plot.K = 3, ind.name=T)
gl.map.snmf(bandicoot.gl, qmat=Q)
# move population 4 (out of 5) 0.5 degrees to the right and populations 1
# 0.3 degree to the north of the map.
mp <- data.frame(lon=c(0,0,0,0.5,0), lat=c(-0.3,0,0,0,0))
gl.map.snmf(bandicoot.gl, qmat=Q, movepops=mp)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.