Entering edit mode
4 months ago
Sara
▴
30
Hi All,
I am using Enrichr in "R" for my pathway analysis. On the Enrichr website, there is an option to set the list of background genes, but I couldn't find the documentation on how to define the list of backgrounds in R. Is it possible? I really appreciate your help.
Many thanks in advance!
below is the code that I used in R:
# 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)
Background is not references in the package description https://cran.r-project.org/web/packages/enrichR/enrichR.pdf so I would open an issue at their GitHub so they add that option. background is critical for proper enrichment stats.
Or you use something like clusterProfiler which accepts background.