term_gene_graph {pathfindR} | R Documentation |
Create Term-Gene Graph
Description
Create Term-Gene Graph
Usage
term_gene_graph(
result_df,
num_terms = 10,
layout = "stress",
use_description = FALSE,
node_size = "num_genes",
node_colors = c("#E5D7BF", "green", "red")
)
Arguments
result_df |
A dataframe of pathfindR results that must contain the following columns:
|
num_terms |
Number of top enriched terms to use while creating the graph. Set to |
layout |
The type of layout to create (see |
use_description |
Boolean argument to indicate whether term descriptions
(in the 'Term_Description' column) should be used. (default = |
node_size |
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') |
node_colors |
vector of 3 colors to be used for coloring nodes (colors for term nodes, up, and down, respectively) |
Details
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.
Value
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'
).
Examples
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')