Create Term-Gene Graph
term_gene_graph(
result_df,
num_terms = 10,
layout = "stress",
use_description = FALSE,
node_size = "num_genes",
node_colors = c("#E5D7BF", "green", "red")
)
A dataframe of pathfindR results that must contain the following columns:
Description of the enriched term (necessary if use_description = TRUE
)
ID of the enriched term (necessary if use_description = FALSE
)
the lowest adjusted-p value of the given term over all iterations
the up-regulated genes in the input involved in the given term's gene set, comma-separated
the down-regulated genes in the input involved in the given term's gene set, comma-separated
Number of top enriched terms to use while creating the graph. Set to NULL
to use
all enriched terms (default = 10, i.e. top 10 terms)
The type of layout to create (see ggraph
for details. Default = 'stress')
Boolean argument to indicate whether term descriptions
(in the 'Term_Description' column) should be used. (default = FALSE
)
Argument to indicate whether to use number of significant genes ('num_genes') or the -log10(lowest p value) ('p_val') for adjusting the node sizes (default = 'num_genes')
vector of 3 colors to be used for coloring nodes (colors for term nodes, up, and down, respectively)
a ggraph
object containing the term-gene graph.
Each node corresponds to an enriched term (beige), an up-regulated gene (green)
or a down-regulated gene (red). An edge between a term and a gene indicates
that the given term involves the gene. Size of a term node is proportional
to either the number of genes (if node_size = 'num_genes'
) or
the -log10(lowest p value) (if node_size = 'p_val'
).
This function (adapted from the Gene-Concept network visualization
by the R package enrichplot
) can be utilized to visualize which input
genes are involved in the enriched terms as a graph. The term-gene graph
shows the links between genes and biological terms and allows for the
investigation of multiple terms to which significant genes are related. The
graph also enables determination of the overlap between the enriched terms
by identifying shared and distinct significant term-related genes.
p <- term_gene_graph(example_pathfindR_output)
p <- term_gene_graph(example_pathfindR_output, num_terms = 5)
p <- term_gene_graph(example_pathfindR_output, node_size = 'p_val')