View source: R/visualize_term_gene_graph.R
| create_term_gene_plot | R Documentation |
Create Term-Gene Plot
create_term_gene_plot(
graph,
layout = "stress",
gene_node_fill = c("#7E2795", "white", "#27AE60"),
term_node_fill = c("#CCBB44", "white", "#4477AA"),
gene_node_color = c("green", "red"),
term_node_color = "#E5D7BF",
term_fill_label = NULL,
term_size_label = NULL
)
graph |
A igraph returned from create_term_gene_graph. |
layout |
The type of layout to create (see |
gene_node_fill |
A character vector to customize the fill gradient colors of the gene nodes when 'genes_df' is supplied, color order is in low -> mid -> high (default: |
term_node_fill |
A character vector to customize the fill gradient colors of the term nodes when 'term_fill' is supplied, color order is in low -> mid -> high (default: |
gene_node_color |
A character vector to customize the fill gradient colors of the term nodes when 'genes_df' is not supplied, color order is in up -> down (default: |
term_node_color |
A character to customize the fill color of the terms when 'term_fill' is not specified (default: |
term_fill_label |
A character to change the term node legend name (default: |
term_size_label |
A character to change the term node size legend name (default: |
This function creates a visualization of the term-gene graph (adapted from the Gene-Concept network visualization in the enrichplot package).
It displays which input genes are involved in enriched biological terms, showing connections between genes and pathway/terms nodes.
The graph facilitates investigation of multi-term relationships and identifies shared versus distinct genes across enriched terms.
Node coloring depends on the inputs provided to create_term_gene_graph:
If 'genes_df' was NOT supplied: term nodes are beige ('term_node_color'), up-regulated genes are green, and down-regulated genes are red.
If 'genes_df' WAS supplied: gene nodes are colored by logFC using a gradient ('gene_node_fill': default purple → white → green), and term nodes can be colored by 'term_fill' values (default yellow → white → blue) if 'term_fill' was provided.
Term node size reflects either the number of associated genes (‘term_size = ’num_genes'‘) or statistical significance ('term_size = ’p_val''). When 'use_edge_weights = TRUE' was set in 'create_term_gene_graph', edge widths represent hub gene importance (genes appearing in multiple terms). The layout can be customized via the 'layout' parameter (default: "stress"), and legends automatically reflect the applied coloring schemes.
A ggraph object
# Normal gene-term with up/down regulated genes
g <- create_term_gene_graph(
result_df = example_pathfindR_output
)
plt <- create_term_gene_plot(g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.