Installation

enrichR can be installed from Github or soon from CRAN.

Github

websiteLive <- TRUE
library(devtools)
install_github("wjawaid/enrichR")

CRAN

The package can be downloaded from CRAN using:

install.packages("enrichR")

Usage example

enrichR provides an interface to the Enrichr database [@kuleshov_enrichr:_2016] hosted at https://maayanlab.cloud/Enrichr/.

By default human genes are selected otherwise select your organism of choice. (This functionality was contributed by Alexander Blume)

library(enrichR)
websiteLive <- getOption("enrichR.live")
if (websiteLive) {
    listEnrichrSites()
    setEnrichrSite("Enrichr") # Human genes   
}

Then find the list of all available databases from Enrichr.

if (websiteLive) dbs <- listEnrichrDbs()
## if (is.null(dbs)) websiteLive <- FALSE
if (websiteLive) head(dbs)
library(knitr)
if (websiteLive) kable(head(dbs[c(1:6),-4]))

View and select your favourite databases. Then query enrichr, in this case I have used genes associated with embryonic haematopoiesis.

dbs <- c("GO_Molecular_Function_2015", "GO_Cellular_Component_2015", "GO_Biological_Process_2015")
if (websiteLive) {
    enriched <- enrichr(c("Runx1", "Gfi1", "Gfi1b", "Spi1", "Gata1", "Kdr"), dbs)
}

Now view the results table.

if (websiteLive) enriched[["GO_Biological_Process_2015"]]
success <- ifelse(exists("enriched"), TRUE, FALSE) & websiteLive
success <- success & (length(enriched) >= 3)
success <- success & all(dim(enriched[[3]]) > 2)                  
if (success) {
    x <- head(enriched[["GO_Biological_Process_2015"]])
    x[,1] <- gsub("GO:", "GO_", x[,1])
    kable(x)
}

Plot Enrichr GO-BP output. (Plotting function contributed by I-Hsuan Lin)

if (websiteLive) {
    plotEnrich(enriched[[3]], showTerms = 20, numChar = 40, y = "Count", orderBy = "P.value")
}

References



wjawaid/enrichR documentation built on April 25, 2023, 10:10 p.m.