Home

Awesome

An R interface to the Enrichr database

Wajid Jawaid 2023-07-25

<!-- README.md is generated from README.Rmd. Please edit that file -->

CRAN_Status_Badge Project Status: Active - The project has reached a stable, usable
state and is being actively
developed. CRAN mirror
downloads

Installation

enrichR can be installed from Github or from CRAN.

Github

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 et al. 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)

Initialising connection to Enrichr website

library(enrichR)
#> Welcome to enrichR
#> Checking connection ...
#> Enrichr ... Connection is Live!
#> FlyEnrichr ... Connection is Live!
#> WormEnrichr ... Connection is Live!
#> YeastEnrichr ... Connection is Live!
#> FishEnrichr ... Connection is Live!
#> OxEnrichr ... Connection is Live!
listEnrichrSites()
#> Enrichr ... Connection is Live!
#> FlyEnrichr ... Connection is Live!
#> WormEnrichr ... Connection is Live!
#> YeastEnrichr ... Connection is Live!
#> FishEnrichr ... Connection is Live!
#> OxEnrichr ... Connection is Live!
setEnrichrSite("Enrichr") # Human genes
#> Connection changed to https://maayanlab.cloud/Enrichr/
#> Connection is Live!

Select gene-set libraries

List all available databases from Enrichr.

dbs <- listEnrichrDbs()
head(dbs)
geneCoveragegenesPerTermlibraryNamenumTermsappytercategoryId
13362275Genome_Browser_PWMs615ea115789fcbf12797fd692cec6df0ab4dbc79c6a1
278841284TRANSFAC_and_JASPAR_PWMs3267d42eb43a64a4e3b20d721fc7148f685b53b6b301
600277Transcription_Factor_PPIs290849f222220618e2599d925b6b51868cf1dab37631
471721370ChEA_20133537ebe772afb55b63b41b79dd8d06ea0fdd9fa26307
47107509Drug_Perturbations_from_GEO_2014701ad270a6876534b7cb063e004289dcd4d3164f3427
214933713ENCODE_TF_ChIP-seq_2014498497787ebc418d308045efb63b8586f10c526af517

Select the 2023 GO databases.

dbs <- c("GO_Molecular_Function_2023", "GO_Cellular_Component_2023",
         "GO_Biological_Process_2023")

Perform analysis

Without background

Query with enrichr using genes available from the package.

# Load example input genes
data(input)
length(input)
#> [1] 375
head(input)
#> [1] "Nsun3"    "Polrmt"   "Nlrx1"    "Sfxn5"    "Zc3h12c"  "Slc25a39"

enriched <- enrichr(input, dbs)
#> Uploading data to Enrichr... Done.
#>   Querying GO_Molecular_Function_2023... Done.
#>   Querying GO_Cellular_Component_2023... Done.
#>   Querying GO_Biological_Process_2023... Done.
#> Parsing results... Done.

Now view the "GO_Biological_Process_2023" results from enriched.

head(enriched[["GO_Biological_Process_2023"]])
TermOverlapP.valueAdjusted.P.valueOld.P.valueOld.Adjusted.P.valueOdds.RatioCombined.ScoreGenes
Mitochondrial Transcription (GO:0006390)3/120.00126850.71239250017.577061117.23788TFAM;POLRMT;TFB1M
Alpha-Amino Acid Metabolic Process (GO:1901605)4/290.00199370.7123925008.45283052.55773SRR;ALDH6A1;KMO;GNMT
Protein Transmembrane Import Into Intracellular Organelle (GO:0044743)4/320.00288820.7123925007.54601544.12249DNAJC19;TIMM44;TRIM37;PEX1
Neutrophil Degranulation (GO:0043312)2/50.00337740.71239250035.070599199.57464VAMP8;STXBP2
Medium-Chain Fatty Acid Biosynthetic Process (GO:0051792)2/50.00337740.71239250035.070599199.57464ABHD3;OXSM
Mitochondrial RNA Metabolic Process (GO:0000959)3/200.00588190.7123925009.30170847.77237TFAM;POLRMT;TFB1M

With background

You can now try adding a background to enrichr.

# Load example background
data(background)
length(background)
#> [1] 20625
head(background)
#> [1] "A1BG"     "A2M"      "NAT1"     "NAT2"     "SERPINA3" "AADAC"

enriched2 <- enrichr(input, dbs, background = background)
#> Uploading data to Speedrichr...
#>  - Your gene set... Done.
#>  - Your background... Done.
#> Getting enrichment results...
#>  - GO_Molecular_Function_2023... Done.
#>  - GO_Cellular_Component_2023... Done.
#>  - GO_Biological_Process_2023... Done.
#> Parsing results... Done.

Now view the "GO_Biological_Process_2023" results from enriched2.

head(enriched2[["GO_Biological_Process_2023"]])
TermRankP.valueAdjusted.P.valueOld.P.valueOld.Adjusted.P.valueOdds.RatioCombined.ScoreGenes
Mitochondrial Transcription (GO:0006390)10.00037110.2405150027.116000214.19193TFAM;POLRMT;TFB1M
Alpha-Amino Acid Metabolic Process (GO:1901605)20.00041450.2405150013.057671101.69976SRR;ALDH6A1;KMO;GNMT
Protein Transmembrane Import Into Intracellular Organelle (GO:0044743)30.00060970.2405150011.65691386.29136DNAJC19;TIMM44;TRIM37;PEX1
Monocarboxylic Acid Biosynthetic Process (GO:0072330)40.00121760.240515006.81653245.74506ALDH1A3;SRR;SCP2;OXSM;MCAT
Neutrophil Degranulation (GO:0043312)50.00146630.2405150054.031872352.55862VAMP8;STXBP2
Medium-Chain Fatty Acid Biosynthetic Process (GO:0051792)60.00146630.2405150054.031872352.55862ABHD3;OXSM

By default, the results table from analysis with a background does not have the ‘Overlap’ column. We can calculate the annotated genes in each term from GMT files and replace the ‘Rank’ column with ‘Overlap’ by setting include_overlap = TRUE.

enriched3 <- enrichr(input, dbs, background = background, include_overlap = TRUE)
#> Uploading data to Speedrichr...
#>  - Your gene set... Done.
#>  - Your background... Done.
#> Getting enrichment results...
#>  - GO_Molecular_Function_2023... Done.
#>    - Download GMT file... Done.
#>  - GO_Cellular_Component_2023... Done.
#>    - Download GMT file... Done.
#>  - GO_Biological_Process_2023... Done.
#>    - Download GMT file... Done.
#> Parsing results... Done.

Now view the "GO_Biological_Process_2023" results from enriched3.

head(enriched3[["GO_Biological_Process_2023"]])
TermOverlapP.valueAdjusted.P.valueOld.P.valueOld.Adjusted.P.valueOdds.RatioCombined.ScoreGenes
Mitochondrial Transcription (GO:0006390)3/120.00037110.2405150027.116000214.19193TFAM;POLRMT;TFB1M
Alpha-Amino Acid Metabolic Process (GO:1901605)4/290.00041450.2405150013.057671101.69976SRR;ALDH6A1;KMO;GNMT
Protein Transmembrane Import Into Intracellular Organelle (GO:0044743)4/320.00060970.2405150011.65691386.29136DNAJC19;TIMM44;TRIM37;PEX1
Monocarboxylic Acid Biosynthetic Process (GO:0072330)5/650.00121760.240515006.81653245.74506ALDH1A3;SRR;SCP2;OXSM;MCAT
Neutrophil Degranulation (GO:0043312)2/50.00146630.2405150054.031872352.55862VAMP8;STXBP2
Medium-Chain Fatty Acid Biosynthetic Process (GO:0051792)2/50.00146630.2405150054.031872352.55862ABHD3;OXSM

Visualise results

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

plotEnrich(enriched[["GO_Biological_Process_2023"]], showTerms = 20, numChar = 40, 
       y = "Count", orderBy = "P.value")
<img src="./tools/README-unnamed-chunk-18-1.png" style="display: block; margin: auto;" />

Export results

Export results to text files or Excel.

# To text files
printEnrich(enriched)

# To Excel
printEnrich(enriched, outFile = "excel")

Save Enrichr results as text or Excel files. By default (i.e. outFile="txt"), the results from the selected databases are saved into individual text files. When using outFile="excel", the results are saved into worksheets in a single Excel 2007 (XLSX) file. (Print function contributed by I-Hsuan Lin and Kai Hu)

printEnrich(enriched)

Using enrichR behind a proxy

If your computer is behind an HTTP or HTTPS proxy, you can set the RCurl Proxy options explicitly using RCurlOptions and enrichR will use the provided settings to connect to the Enrichr database via httr::use_proxy().

For example:

options(RCurlOptions = list(proxy = 'http://ip_or_url',
                            proxyusername = 'myuser',
                            proxypassword = 'mypwd',
                            proxyport = 'port_num',
                            proxyauth = 'basic'))

References2

<div id="refs" class="references csl-bib-body hanging-indent"> <div id="ref-kuleshov_enrichr:_2016" class="csl-entry">

Kuleshov, Maxim V., Matthew R. Jones, Andrew D. Rouillard, Nicolas F. Fernandez, Qiaonan Duan, Zichen Wang, Simon Koplev, et al. 2016. “Enrichr: A Comprehensive Gene Set Enrichment Analysis Web Server 2016 Update.” Nucleic Acids Res 44 (Web Server issue): W90–97.

</div> </div>