rwr_find_seeds_between_attributes {netOmics} | R Documentation |
From rwr results, this function returns a subgraph if any vertex shares different attributes value. In biological context, this might be useful to identify vertex shared between clusters or omics types.
rwr_find_seeds_between_attributes(X, seed = NULL, k = 15, attribute = "type")
X |
a random walk result from |
seed |
a character vector or NULL. If NULL, all the seeds from X are considered. |
k |
a integer, k closest nodes to consider in the search |
attribute |
a character value or NULL. If NULL, the closest node is returned. |
A list of igraph object for each seed. If X is a list, it returns a list of list of graph.
graph1 <- igraph::graph_from_data_frame( list(from = c("A", "B", "A", "D", "C", "A", "C"), to = c("B", "C", "D", "E", "D", "F", "G")), directed = FALSE) graph1 <- igraph::set_vertex_attr(graph = graph1, name = 'type', index = c("A","B","C"), value = "1") graph1 <- igraph::set_vertex_attr(graph = graph1, name = 'type', index = c("D","E"), value = "2") graph1 <- igraph::set_vertex_attr(graph = graph1, name = 'type', index = c("F", "G"), value = "3") rwr_res <- random_walk_restart(X = graph1, seed = c("A", "B", "C", "D", "E")) rwr_res_type <- rwr_find_seeds_between_attributes(X = rwr_res, attribute = "type", k = 3)