MyNixOS website logo
Description

Provides an R Interface to 'Enrichr'.

Provides an R interface to all 'Enrichr' databases. 'Enrichr' is a web-based tool for analysing gene sets and returns any enrichment of common annotated biological features. Quoting from their website 'Enrichment analysis is a computational method for inferring knowledge about an input gene set by comparing it to annotated gene sets representing prior biological knowledge.' See <https://maayanlab.cloud/Enrichr/> for further details.

An R interface to the Enrichr database

Wajid Jawaid 2025-02-02

CRAN_Status_Badge Project Status: Active - The project has reached a stable, usablestate and is being activelydeveloped. CRAN mirrordownloads

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 connections ...
#> 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 example 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 the enriched object.

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 add background genes when using 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 the enriched2 object.

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 the enriched3 object.

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 the "GO_Biological_Process_2023" results. (Plotting function contributed by I-Hsuan Lin)

plotEnrich(enriched[["GO_Biological_Process_2023"]], showTerms = 20, numChar = 40, 
       y = "Count", orderBy = "P.value")

Export results

Export Enrichr results as text or Excel files. By default (i.e. outFile = "txt"), the results from all 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)

# To text files
printEnrich(enriched)

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

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'))

References

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. https://doi.org/10.1093/nar/gkw377.

Metadata

Version

3.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows