summary_plot_rwr_attributes: Summary Plot RWR attributes

View source: R/plot.R

summary_plot_rwr_attributesR Documentation

Summary Plot RWR attributes

Description

Based on the results of rwr_find_seeds_between_attributes which identify the closest k neighbors from a seed, this function returns a barplot of the node types (layers) reached for each seed.

Usage

summary_plot_rwr_attributes(
  X,
  color = NULL,
  seed.id = NULL,
  seed.type = NULL,
  plot = TRUE
)

Arguments

X

a 'rwr.attributes' or 'list.rwr.attributes' object from rwr_find_seeds_between_attributes()

color

(optional) a named character vector or list, list of color to apply to each type

seed.id

(optional) a character vector, to filter the results and filter on specific seeds IDs

seed.type

(optional) a character vector, to filter the results and filter on specific seeds types

plot

logical, if TRUE then the plot is produced

Value

a 'ggplot' object

See Also

random_walk_restart, rwr_find_seeds_between_attributes

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)
summary_plot_rwr_attributes(rwr_res_type)



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