Skip to contents

Load and analyze a single .RData file containing GO enrichment results from either UP or DOWN regulated genes. Includes validation, semantic similarity reduction, merging metadata, and plotting.

Usage

process_go(f, direction = c("UP", "DOWN"), outdir, figdir)

Arguments

f

Character. Path to the .RData file (must include full or relative path). The file must contain exactly one data frame with the columns go_id, term and p.adjust.

direction

Character. Either "UP" or "DOWN" to specify the type of enrichment.

outdir

Character. Directory to save .RData output files.

figdir

Character. Directory to save PNG plots.

Value

Invisibly, NULL. Saves processed files and figures in outdir and figdir.

Details

Requires the Bioconductor packages rrvgo and org.Hs.eg.db. Datasets with fewer than 40 unique GO terms are skipped.

See also

reduce_go_terms for batch processing of multiple enrichment files.

Examples

# \donttest{
if (all(vapply(c("rrvgo", "org.Hs.eg.db", "dplyr", "ggplot2"),
               requireNamespace, logical(1), quietly = TRUE))) {
  # Enrichment table with the columns go_id, term and p.adjust
  go_bp <- go_celltype_results[go_celltype_results$query == "SLE_UP_moDC" &
                                 go_celltype_results$source == "GO:BP", ]
  go_bp <- head(go_bp[order(go_bp$p_value), ], 60)
  go_table <- data.frame(go_id = go_bp$term_id, term = go_bp$term_name,
                         p.adjust = go_bp$p_value)

  go_dir <- file.path(tempdir(), "process_go_example")
  dir.create(go_dir, showWarnings = FALSE)
  f <- file.path(go_dir, "UP_GO_SLE_moDC.RData")
  save(go_table, file = f)

  process_go(f, direction = "UP", outdir = go_dir, figdir = go_dir)
  list.files(go_dir)
}
#> 
#> 
#> 
#> ------------------------------------
#> Dataset: SLE_moDC
#> ------------------------------------
#> Create simMatrix
#> preparing gene to GO mapping data...
#> preparing IC data...
#> Reduce semantic similarity
#> 'select()' returned 1:many mapping between keys and columns
#> Merge metadata
#> Save treemap plot
#> [1] "GOTerm_UP_ReducedBar_SLE_moDC.png"       
#> [2] "GOTerm_UP_Treemap_SLE_moDC.png"          
#> [3] "UP_GO_SLE_moDC.RData"                    
#> [4] "geneListAndGOterms_UP_SLE_moDC.RData"    
#> [5] "reducedTerms_simMatrix_UP_SLE_moDC.RData"
# }