data(partial_clone)
pc <- as.genclone(partial_clone) # convert to genclone object
# Get MLGs at threshold 0.05
mlg.filter(pc, threshold = 0.05, distance = "nei.dist")
pc # 26 mlgs
# Set MLGs at threshold 0.05
mlg.filter(pc, distance = "nei.dist") <- 0.05
pc # 25 mlgs
# The distance definition is persistant
mlg.filter(pc) <- 0.1
pc # 24 mlgs
# You can still change the definition
mlg.filter(pc, distance = diss.dist, percent = TRUE) <- 0.1
pc
# Even with custom definitions
data(Pinf)
Pinf
mlg.filter(Pinf, distance = function(x) dist(tab(x))) <- 3
Pinf
mlg.filter(Pinf) <- 4
Pinf
# on genlight/snpclone objects
set.seed(999)
gc <- as.snpclone(glSim(100, 0, n.snp.struc = 1e3, ploidy = 2))
gc # 100 mlgs
mlg.filter(gc) <- 0.25
gc # 82 mlgs
Run the code above in your browser using DataLab