Learn R Programming

poppr (version 1.1.5)

bruvo.msn: Create minimum spanning network of selected populations using Bruvo's distance.

Description

Create minimum spanning network of selected populations using Bruvo's distance.

Usage

bruvo.msn(pop, replen = 1, add = TRUE, loss = TRUE,
  palette = topo.colors, sublist = "All", blacklist = NULL,
  vertex.label = "MLG", gscale = TRUE, glim = c(0, 0.8), gadj = 3,
  gweight = 1, wscale = TRUE, showplot = TRUE, ...)

Arguments

pop
a genind object
replen
a vector of integers indicating the length of the nucleotide repeats for each microsatellite locus.
add
if TRUE, genotypes with zero values will be treated under the genome addition model presented in Bruvo et al. 2004.
loss
if TRUE, genotypes with zero values will be treated under the genome loss model presented in Bruvo et al. 2004.
palette
a function defining the color palette to be used to color the populations on the graph. It defaults to topo.colors, but you can easily create new schemes by using
sublist
a vector of population names or indexes that the user wishes to keep. Default to "ALL".
blacklist
a vector of population names or indexes that the user wishes to discard. Default to NULL
vertex.label
a vector of characters to label each vertex. There are two defaults: "MLG" will label the nodes with the multilocus genotype from the original data set and "inds" will label the nodes with the representative in
gscale
"grey scale". If this is TRUE, this will scale the color of the edges proportional to Bruvo's distance, with the lines becoming darker for more related nodes. See greycurve for details.
glim
"grey limit". Two numbers between zero and one. They determine the upper and lower limits for the gray function. Default is 0 (black) and 0.8 (20% black). See greycu
gadj
"grey adjust". a positive integer greater than zero that will serve as the exponent to the edge weight to scale the grey value to represent that weight. See greycurve for details.
gweight
"grey weight". an integer. If it's 1, the grey scale will be weighted to emphasize the differences between closely related nodes. If it is 2, the grey scale will be weighted to emphasize the differences between more distantly related no
wscale
"width scale". If this is TRUE, the edge widths will be scaled proportional to Bruvo's distance, with the lines becoming thicker for more related nodes.
showplot
logical. If TRUE, the graph will be plotted. If FALSE, it will simply be returned.
...
any other arguments that could go into plot.igraph

Value

  • grapha minimum spanning network with nodes corresponding to MLGs within the data set. Colors of the nodes represent population membership. Width and color of the edges represent distance.
  • populationsa vector of the population names corresponding to the vertex colors
  • colorsa vector of the hexadecimal representations of the colors used in the vertex colors

Details

The minimum spanning network generated by this function is generated via igraph's minimum.spanning.tree. The resultant graph produced can be plotted using igraph functions, or the entire object can be plotted using the function plot_poppr_msn, which will give the user a scale bar and the option to layout your data.

References

Ruzica Bruvo, Nicolaas K. Michiels, Thomas G. D'Souza, and Hinrich Schulenburg. A simple method for the calculation of microsatellite genotype distances irrespective of ploidy level. Molecular Ecology, 13(7):2101-2106, 2004.

See Also

bruvo.dist, nancycats, plot_poppr_msn, minimum.spanning.tree bruvo.boot, greycurve

Examples

Run this code
# Load the data set.
data(nancycats)

# View populations 8 and 9 with default colors.
bruvo.msn(nancycats, replen=rep(2, 9), sublist=8:9, vertex.label="inds",
vertex.label.cex=0.7, vertex.label.dist=0.4)
# View heat colors.
bruvo.msn(nancycats, replen=rep(2, 9), sublist=8:9, vertex.label="inds",
palette=heat.colors, vertex.label.cex=0.7, vertex.label.dist=0.4)

# View custom colors. Here, we use black and orange.
bruvo.msn(nancycats, replen=rep(2, 9), sublist=8:9, vertex.label="inds",
palette = colorRampPalette(c("orange", "black")), vertex.label.cex=0.7,
vertex.label.dist=0.4)

# View with darker shades of grey (setting the upper limit to 1/2 black 1/2 white).
bruvo.msn(nancycats, replen=rep(2, 9), sublist=8:9, vertex.label="inds",
palette = colorRampPalette(c("orange", "black")), vertex.label.cex=0.7,
vertex.label.dist=0.4, glim=c(0, 0.5))

# View with no grey scaling.
bruvo.msn(nancycats, replen=rep(2, 9), sublist=8:9, vertex.label="inds",
palette = colorRampPalette(c("orange", "black")), vertex.label.cex=0.7,
vertex.label.dist=0.4, gscale=FALSE)

# View with no line widths.
bruvo.msn(nancycats, replen=rep(2, 9), sublist=8:9, vertex.label="inds",
palette = colorRampPalette(c("orange", "black")), vertex.label.cex=0.7,
vertex.label.dist=0.4, wscale=FALSE)

# View with no scaling at all.
bruvo.msn(nancycats, replen=rep(2, 9), sublist=8:9, vertex.label="inds",
palette = colorRampPalette(c("orange", "black")), vertex.label.cex=0.7,
vertex.label.dist=0.4, vscale=FALSE, gscale=FALSE)

# View the whole population, but without labels.
bruvo.msn(nancycats, replen=rep(2, 9), vertex.label=NA)

Run the code above in your browser using DataLab