View source: R/gen_graph_thr.R
gen_graph_thr | R Documentation |
The function allows to construct a genetic graph whose links' weights are larger or lower than a specific threshold
gen_graph_thr(mat_w, mat_thr = NULL, thr, mode = "larger")
mat_w |
A symmetric (pairwise) |
mat_thr |
(optional) A symmetric (pairwise) distance |
thr |
The threshold value (logically between min(mat_thr) and max(mat_thr))(integer or numeric) |
mode |
|
If 'mat_thr' is not defined, 'mat_w' is used for the pruning. Matrices 'mat_w' and 'mat_thr' must have the same dimensions and the same rows' and columns' names. Values in 'mat_thr' matrix must be positive. Negative values from 'mat_w' are transformed into zeros. The function works only for undirected graphs. If dist objects are specified, it is assumed that colnames and row.names of mat_w and mat_thr refer to the same populations/locations.
A graph object of class igraph
P. Savary
mat_w <- mat_gen_dist(x = data_ex_genind, dist = 'DPS') suppressWarnings(mat_thr <- mat_geo_dist(pts_pop_ex, ID = "ID", x = "x", y = "y")) mat_thr <- mat_thr[row.names(mat_w), colnames(mat_w)] graph <- gen_graph_thr(mat_w, mat_thr, thr = 6000, mode = "larger")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.