Learn R Programming

poppr (version 1.1.5)

poppr.msn: Create a minimum spanning network of selected populations using a distance matrix.

Description

Create a minimum spanning network of selected populations using a distance matrix.

Usage

poppr.msn(pop, distmat, 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
distmat
a distance matrix that has been derived from your data set.
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 the observed distance, with the lines becoming darker for more related nodes. See greycurve for detai
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 the inverse of the observed 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

See Also

nancycats, upgma, nj, nodelabels, na.replace, missingno, bruvo.msn, greycurve.

Examples

Run this code
# Load the data set and calculate the distance matrix for all individuals.
data(Aeut)
A.dist <- diss.dist(Aeut)

# Graph it.
A.msn <- poppr.msn(Aeut, A.dist, gadj=15, vertex.label=NA)

# Set subpopulation structure.
Aeut.sub <- as.genclone(Aeut)
setpop(Aeut.sub) <- ~Pop/Subpop

# Plot respective to the subpopulation structure
As.msn <- poppr.msn(Aeut.sub, A.dist, gadj=15, vertex.label=NA)

# Show only the structure of the Athena population.
As.msn <- poppr.msn(Aeut.sub, A.dist, gadj=15, vertex.label=NA, sublist=1:10)

# Let's look at the structure of the microbov data set
data(microbov)
micro.dist <- diss.dist(microbov)
micro.msn <- poppr.msn(microbov, diss.dist(microbov), vertex.label=NA)

# Let's plot it and show where individuals have < 15% of their genotypes
different.

edge_weight <- E(micro.msn$graph)$weight
edge_labels <- ifelse(edge_weight < 0.15, round(edge_weight, 3), NA)
plot.igraph(micro.msn$graph, edge.label = edge_labels, vertex.size = 2,
edge.label.color = "red")

Run the code above in your browser using DataLab