Create a minimum spanning network of selected populations using a distance matrix.
1 2 3 4 5 
gid 
a 
distmat 
a distance matrix that has been derived from your data set. 
palette 
a 
mlg.compute 
if the multilocus genotypes are set to "custom" (see

sublist 
a 
blacklist 
a 
vertex.label 
a 
gscale 
"grey scale". If this is 
glim 
"grey limit". Two numbers between zero and one. They determine
the upper and lower limits for the 
gadj 
"grey adjust". a positive 
gweight 
"grey weight". an 
wscale 
"width scale". If this is 
showplot 
logical. If 
include.ties 
logical. If 
threshold 
numeric. By default, this is 
clustering.algorithm 
string. By default, this is 
... 
any other arguments that could go into plot.igraph 
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.
Each node on the graph represents a different multilocus genotype.
The edges on the graph represent genetic distances that connect the
multilocus genotypes. In genclone objects, it is possible to set the
multilocus genotypes to a custom definition. This creates a problem for
clone correction, however, as it is very possible to define custom lineages
that are not monophyletic. When clone correction is performed on these
definitions, information is lost from the graph. To circumvent this, The
clone correction will be done via the computed multilocus genotypes, either
"original" or "contracted". This is specified in the mlg.compute
argument, above.
If your incoming data set is of the class genclone
,
and it contains contracted multilocus genotypes, this function will retain
that information for creating the minimum spanning network. You can use the
arguments threshold
and clustering.algorithm
to change the
threshold or clustering algorithm used in the network. For example, if you
have a data set that has a threshold of 0.1 and you wish to have a minimum
spanning network without a threshold, you can simply add
threshold = 0.0
, and no clustering will happen.
The threshold
and clustering.algorithm
arguments can also be
used to filter uncontracted data sets.
All filtering will use the distance matrix supplied in the argument
distmat
.
graph 
a 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. 
populations 
a vector of the population names corresponding to the vertex colors 
colors 
a vector of the hexadecimal representations of the colors used in the vertex colors 
The edges of these graphs may cross each other if the graph becomes too large.
Javier F. Tabima, Zhian N. Kamvar, Jonah C. Brooks
plot_poppr_msn
nancycats
,
upgma
, nj
, nodelabels
,
tab
, missingno
, bruvo.msn
,
greycurve
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35  # 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)
## Not run:
# 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
library("igraph")
data(microbov)
micro.dist < diss.dist(microbov, percent = TRUE)
micro.msn < poppr.msn(microbov, micro.dist, 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")
## End(Not run)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.