gen_graph_thr {graph4lg} | R Documentation |
Create a graph of genetic differentiation using a link weight threshold
Description
The function allows to construct a genetic graph whose links' weights are larger or lower than a specific threshold
Usage
gen_graph_thr(mat_w, mat_thr = NULL, thr, mode = "larger")
Arguments
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 |
|
Details
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.
Value
A graph object of class igraph
Author(s)
P. Savary
Examples
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")