apl_topGO: Run Gene overrepresentation analysis with topGO

Description Usage Arguments Details Value Examples

View source: R/apl.R

Description

This function uses the Kolmogorov-Smirnov test as implemented by the package topGO to test for overrepresentation in Gene Ontology gene sets.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
apl_topGO(
  caobj,
  ontology,
  organism = "hs",
  ngenes = 1000,
  score_cutoff = 0,
  use_coords = FALSE,
  return_plot = FALSE,
  top_res = 15
)

Arguments

caobj

A "cacomp" object with principal row coordinates and standard column coordinates calculated.

ontology

Character string. Chooses GO sets for 'BP' (biological processes), 'CC' (cell compartment) or 'MF' (molecular function).

organism

Character string. Either 'hs' (homo sapiens), 'mm' (mus musculus) or the name of the organism package such as 'org.*.eg.db'.

ngenes

Numeric. Number of top ranked genes to test for overrepresentation.

score_cutoff

numeric. S-alpha score cutoff. Only genes with a score larger will be tested.

use_coords

Logical. Whether the x-coordinates of the row APL coordinates should be used for ranking. Only recommended when no S-alpha score (see apl_score()) can be calculated.

return_plot

Logical. Whether a plot of significant gene sets should be additionally returned.

top_res

Numeric. Number of top scoring gene sets to plot.

Details

For a chosen group of cells/samples, the top 'ngenes' group specific genes are used for gene overrepresentation analysis. The genes are ranked either by the precomputed APL score, or, if not available by their APL x-coordinates.

Value

A data.frame containing the gene sets with the highest overrepresentation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(Seurat)
set.seed(1234)
cnts <- GetAssayData(pbmc_small, slot = "counts")
cnts <- as.matrix(cnts)

# Run CA on example from Seurat

ca <- cacomp(pbmc_small,
             princ_coords = 3,
             return_input = FALSE,
             assay = "RNA",
             slot = "counts")

grp <- which(Idents(pbmc_small) == 2)
ca <- apl_coords(ca, group = grp)
ca <- apl_score(ca,
                mat = cnts)

enr <- apl_topGO(ca,
                 ontology = "BP",
                 organism = "hs")

plot_enrichment(enr)

elagralinska/APLpackage documentation built on Dec. 20, 2021, 4:15 a.m.