imsn()
The right hand panel contains different tabs related to your data set of choice.
sessionInfo
for reproducibility.plot_poppr_msn
is currently the most flexible way
of visualizing your minimum spanning network, but with 20 parameters, it can
become pretty intimidating trying to find the right display for your MSN. With this function, all three steps are combined into one interactive interface that will allow you to intuitively modify your minimum spanning network and even save the results to a pdf or png file.
plot_poppr_msn
diss.dist
bruvo.dist
bruvo.msn
poppr.msn
nei.dist
popsub
missingno
# Set up some data
library("poppr")
library("magrittr")
data(monpop)
splitStrata(monpop) <- ~Tree/Year/Symptom
summary(monpop)
monpop_ssr <- c(CHMFc4 = 7, CHMFc5 = 2, CHMFc12 = 4,
SEA = 4, SED = 4, SEE = 2, SEG = 6,
SEI = 3, SEL = 4, SEN = 2, SEP = 4,
SEQ = 2, SER = 4)
t26 <- monpop %>% setPop(~Tree) %>% popsub("26") %>% setPop(~Year/Symptom)
t26
imsn() # select Bruvo's distance and enter "monpop_ssr" into the Repeat Length field.
# It is also possible to run this from github if you are connected to the internet.
# This allows you to access any bug fixes that may have been updated before a formal
# release on CRAN
shiny::runGithub("grunwaldlab/poppr", subdir = "inst/msn_explorer")
# You can also use your own distance matrices, but there's a small catch.
# in order to do so, you must write a function that will subset the matrix
# to whatever populations are in your data. Here's an example with the above
# data set:
mondist <- bruvo.dist(monpop, replen = monpop_ssr)
myDist <- function(x, d = mondist){
dm <- as.matrix(d) # Convert the dist object to a square matrix
xi <- indNames(x) # Grab the sample names that exist
return(as.dist(dm[xi, xi])) # return only the elements that have the names
# in the data set
}
# After executing imsn, choose:
# Distance: custom
# myDist
imsn()
Run the code above in your browser using DataLab