rwr_find_seeds_between_attributes: RWR Find seeds between attributes

View source: R/RWR.R

rwr_find_seeds_between_attributesR Documentation

RWR Find seeds between attributes

Description

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.

Usage

rwr_find_seeds_between_attributes(X, seed = NULL, k = 15, attribute = "type")

Arguments

X

a random walk result from random_walk_restart

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.

Value

A list of igraph object for each seed. If X is a list, it returns a list of list of graph.

Examples

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)


abodein/netOmics documentation built on Oct. 20, 2024, 9:25 a.m.