Create Term-Gene Graph

term_gene_graph(
result_df,
num_terms = 10,
layout = "stress",
use_description = FALSE,
node_size = "num_genes"
)

## Arguments

result_df A dataframe of pathfindR results that must contain the following columns: Term_DescriptionDescription of the enriched term (necessary if use_description = TRUE) IDID of the enriched term (necessary if use_description = FALSE) lowest_pthe lowest adjusted-p value of the given term over all iterations Up_regulatedthe up-regulated genes in the input involved in the given term's gene set, comma-separated Down_regulatedthe 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")

## 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").

## 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.

## Examples

p <- term_gene_graph(RA_output)
p <- term_gene_graph(RA_output, num_terms = 5)
p <- term_gene_graph(RA_output, node_size = "p_val")