Open SaraAlidadiani opened 1 month ago
Hi @SaraAlidadiani There's a discussion about this in https://github.com/wjawaid/enrichR/issues/67. Short answer is, the current stable version of enrichR doesn't have the option to add background genes in the enrichment analysis.
You can do this on the Enrichr website https://maayanlab.cloud/Enrichr/, or you can follow #67 on how to install and use a revised version of enrichR (PR https://github.com/wjawaid/enrichR/pull/72) that supports a background.
Thank you for your prompt response. Following the https://github.com/wjawaid/enrichR/issues/67 I could use background. Could you also please share how we can visualize the pathways with this one? I couldn't use the same way for visualization when I was using the enrichR package without a background version. Many thanks!
Hi @SaraAlidadiani The colname of the output is probably slightly different, that could be the reason why the existing plot function is not recognise the input format. I'll have a look in the next week or so and suggest a fix.
Hi @SaraAlidadiani
I have just tested the plotEnrich
function, it is working with results from both with and without background.
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!
# Load example input genes
data(input)
# Load example background
data(background)
my_dbs <- c("KEGG_2019_Mouse","WikiPathways_2019_Mouse")
# No background
enriched1 <- enrichr(input, databases = my_dbs)
#> Uploading data to Enrichr... Done.
#> Querying KEGG_2019_Mouse... Done.
#> Querying WikiPathways_2019_Mouse... Done.
#> Parsing results... Done.
# Show KEGG_2019_Mouse results in enriched1
plotEnrich(enriched1[[1]], showTerms = 20, numChar = 40, y = "Count", orderBy = "P.value")
# With background
enriched2 <- enrichr(input, databases = my_dbs, background = background)
#> Uploading data to Speedrichr...
#> - Your gene set... Done.
#> - Your background... Done.
#> Getting enrichment results...
#> - KEGG_2019_Mouse... Done.
#> - WikiPathways_2019_Mouse... Done.
#> Parsing results... Done.
# Show KEGG_2019_Mouse results in enriched2
plotEnrich(enriched2[[1]], showTerms = 20, numChar = 40, y = "Count", orderBy = "P.value")
Created on 2024-10-28 with reprex v2.1.1
Thank you so much @ycl6, for checking and for your consideration. If I want to reference it, should I use the same reference as Kuleshov M V., Jones MR, Rouillard AD, et al. Enrichr: a comprehensive gene set enrichment analysis web server 2016 update. Nucleic Acids Res. 2016;44(W1):W90-W97. doi:10.1093/NAR/GKW377?
Thank you so much!
Hi @SaraAlidadiani Hope the plot function is working for you.
If you have used the Enrichr web service, you can cite the paper and its website (https://maayanlab.cloud/Enrichr/). If you use the R package, you can use the package website (https://cran.r-project.org/package=enrichR or https://github.com/wjawaid/enrichR) in your reference.
As the background version hasn't been implemented officially to the main enrichR package, you may want to add the following link https://github.com/ycl6/enrichR/tree/add-background
Thank you, @ycl6 , yes, the plot function works nicely. I am also trying to use another plot for visualization but I have some problems with it. in the documention it mentioned ## S4 method for signature 'enrichResultList'
dotplot(object, x = "GeneRatio", color = "p.adjust",
showCategory = 10, size = NULL, split = NULL, font.size = 12)
But if I use it :
> dotplot(
+ enriched3,
+ x = "GeneRatio",
+ color = "p.adjust",
+ showCategory = 10)
Error: unable to find an inherited method for function ‘dotplot’ for signature ‘object = "list"’
> class(enriched3)
[1] "list"
I also think the problem can be with defining the x vaiable as well.
I would really appreciate if you can let me know what I am doing wrong. Many thanks!
Hi @SaraAlidadiani
The enrichR R package doesn't have this function (i.e. a function to create dot plot).
I did a Google search, it seems you are referring to the dotplot
function from the enrichplot R package. The dotplot
function can take in an enrichResultList
object that is created by the enricher
function from the clusterProfiler R package.
If you like to perform enrichment analysis and create dot plots from the results, you can use clusterProfiler instead. It is a well developed and maintained R package. https://github.com/YuLab-SMU/clusterProfiler https://yulab-smu.top/biomedical-knowledge-mining-book/
Hello,
I am using Enrichr in "R" for my pathway analysis. It is not references in the package description https://cran.r-project.org/web/packages/enrichR/enrichR.pdf how to define the background in R.
Is it possible to share how we can provide background to do enrichR pathway analysis in R and add this option in the documentation, please?
I am writing the code that I used, but I couldn't figure out how to add the list of my background genes.
Thanks you!