wjawaid / enrichR

An R interface to enrichR
76 stars 17 forks source link

Background is not referenced in the package description #81

Open SaraAlidadiani opened 2 days ago

SaraAlidadiani commented 2 days ago

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.

# reading the file
options(stringsAsFactors = FALSE)
genes <- read.csv("list_of_significant_genes.csv")
background <- read.csv("list_of_Background_genes.csv") #I don't know how to use my background list

genes_path <- genes$hgnc_symbol
background_genes <- background$hgnc_symbol
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 (websiteLive) head(dbs)

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

if (websiteLive) {
  enriched <- enrichr(genes_path, dbs)
}

#Now view the results table.

if (websiteLive) enriched[["GO_Biological_Process_2023"]]
 version  R version 4.4.0 (2024-04-24)

Thanks you!

ycl6 commented 2 days 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.

SaraAlidadiani commented 1 day ago

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!

ycl6 commented 1 day ago

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.