Skip to contents

Plots the results from the data frame generated via apl_topGO.

Usage

plot_enrichment(genenr, ntop = 10)

Arguments

genenr

data.frame. gene enrichment results table.

ntop

numeric. Number of elements to plot.

Value

Returns a ggplot plot.

Examples

library(Seurat)
set.seed(1234)
cnts <- GetAssayData(pbmc_small, assay = "RNA", 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")
#> Warning: 
#> Parameter top is >nrow(obj) and therefore ignored.

grp <- which(Idents(pbmc_small) == 2)
ca <- apl_coords(ca, group = grp)
ca <- apl_score(ca,
                mat = cnts)
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |=======                                                               |  10%
  |                                                                            
  |==============                                                        |  20%
  |                                                                            
  |=====================                                                 |  30%
  |                                                                            
  |============================                                          |  40%
  |                                                                            
  |===================================                                   |  50%
  |                                                                            
  |==========================================                            |  60%
  |                                                                            
  |=================================================                     |  70%
  |                                                                            
  |========================================================              |  80%
  |                                                                            
  |===============================================================       |  90%
  |                                                                            
  |======================================================================| 100%

enr <- apl_topGO(ca,
                 ontology = "BP",
                 organism = "hs")
#> 
#> groupGOTerms: 	GOBPTerm, GOMFTerm, GOCCTerm environments built.
#> 
#> Building most specific GOs .....
#> 	( 1326 GO terms found. )
#> 
#> Build GO DAG topology ..........
#> 	( 3590 GO terms and 7903 relations. )
#> 
#> Annotating nodes ...............
#> 	( 207 genes annotated to the GO terms. )
#> 
#> 			 -- Elim Algorithm -- 
#> 
#> 		 the algorithm is scoring 612 nontrivial nodes
#> 		 parameters: 
#> 			 test statistic: fisher
#> 			 cutOff: 0.01
#> 
#> 	 Level 12:	5 nodes to be scored	(0 eliminated genes)
#> 
#> 	 Level 11:	13 nodes to be scored	(0 eliminated genes)
#> 
#> 	 Level 10:	22 nodes to be scored	(8 eliminated genes)
#> 
#> 	 Level 9:	37 nodes to be scored	(11 eliminated genes)
#> 
#> 	 Level 8:	64 nodes to be scored	(17 eliminated genes)
#> 
#> 	 Level 7:	88 nodes to be scored	(17 eliminated genes)
#> 
#> 	 Level 6:	119 nodes to be scored	(24 eliminated genes)
#> 
#> 	 Level 5:	119 nodes to be scored	(24 eliminated genes)
#> 
#> 	 Level 4:	83 nodes to be scored	(24 eliminated genes)
#> 
#> 	 Level 3:	47 nodes to be scored	(24 eliminated genes)
#> 
#> 	 Level 2:	14 nodes to be scored	(24 eliminated genes)
#> 
#> 	 Level 1:	1 nodes to be scored	(24 eliminated genes)

plot_enrichment(enr)