# NOT RUN {
# Using a data set of the Aphanomyces eutieches root rot pathogen.
data(Aeut)
adist <- diss.dist(Aeut, percent = TRUE)
amsn <- poppr.msn(Aeut, adist, showplot = FALSE)
# Default
library("igraph") # To get all the layouts.
set.seed(500)
plot_poppr_msn(Aeut, amsn, gadj = 15)
# }
# NOT RUN {
# Different layouts (from igraph) can be used by supplying the function name.
set.seed(500)
plot_poppr_msn(Aeut, amsn, gadj = 15, layfun = layout_with_kk)
# Removing link between populations (cutoff = 0.2) and labelling no individuals
set.seed(500)
plot_poppr_msn(Aeut, amsn, inds = "none", gadj = 15, beforecut = TRUE, cutoff = 0.2)
# Labelling individual #57 because it is an MLG that crosses populations
# Showing clusters of MLGS with at most 5% variation
# Notice that the Mt. Vernon population appears to be more clonal
set.seed(50)
plot_poppr_msn(Aeut, amsn, gadj = 15, cutoff = 0.05, inds = "057")
data(partial_clone)
pcmsn <- bruvo.msn(partial_clone, replen = rep(1, 10))
# You can plot using a color palette or a vector of named colors
# Here's a way to define the colors beforehand
pc_colors <- nPop(partial_clone) %>%
RColorBrewer::brewer.pal("Set2") %>%
setNames(popNames(partial_clone))
pc_colors
# Labelling the samples contained in multilocus genotype 9
set.seed(999)
plot_poppr_msn(partial_clone, pcmsn, palette = pc_colors, inds = 9)
# Doing the same thing, but using one of the sample names as input.
set.seed(999)
plot_poppr_msn(partial_clone, pcmsn, palette = pc_colors, inds = "sim 20")
# Note that this is case sensitive. Nothing is labeled.
set.seed(999)
plot_poppr_msn(partial_clone, pcmsn, palette = pc_colors, inds = "Sim 20")
# Something pretty
data(microbov)
mdist <- diss.dist(microbov, percent = TRUE)
micmsn <- poppr.msn(microbov, mdist, showplot = FALSE)
plot_poppr_msn(microbov, micmsn, palette = "terrain.colors", inds = "n",
quantiles = FALSE)
plot_poppr_msn(microbov, micmsn, palette = "terrain.colors", inds = "n",
cutoff = 0.3, quantiles = FALSE)
### Utilizing vectors for palettes
data(Pram)
Pram_sub <- popsub(Pram, blacklist = c("Nursery_CA", "Nursery_OR"))
# Creating the network for the forest
min_span_net_sub <- bruvo.msn(Pram_sub, replen = other(Pram)$REPLEN,
add = TRUE, loss = TRUE, showplot = FALSE,
include.ties = TRUE)
# Creating the network with nurseries
min_span_net <- bruvo.msn(Pram, replen = other(Pram)$REPLEN,
add = TRUE, loss = TRUE, showplot = FALSE,
include.ties = TRUE)
# Only forest genotypes
set.seed(70)
plot_poppr_msn(Pram,
min_span_net_sub,
inds = "ALL",
mlg = TRUE,
gadj = 9,
nodescale = 5,
palette = other(Pram)$comparePal,
cutoff = NULL,
quantiles = FALSE,
beforecut = TRUE)
# With Nurseries
set.seed(70)
plot_poppr_msn(Pram,
min_span_net,
inds = "ALL",
mlg = TRUE,
gadj = 9,
nodescale = 5,
palette = other(Pram)$comparePal,
cutoff = NULL,
quantiles = FALSE,
beforecut = TRUE)
# }
Run the code above in your browser using DataLab