I'm trying to perform a GSEA analysis following this pipeline:
https://learn.gencore.bio.nyu.edu/rna-seq-analysis/gene-set-enrichment-analysis/
But when I run the code: the following message appears:
**> Error in (function (classes, fdef, mtable) : unable to find an
inherited method for function ‘species’ for signature ‘"character"’**
This is the code I'm running:
library(clusterProfiler)
library(enrichplot)
library(ggplot2)
# SET THE DESIRED ORGANISM HERE
organism = "org.Dm.eg.db"
BiocManager::install(organism, character.only = TRUE)
library(organism, character.only = TRUE)
original_gene_list <- df$log2FoldChange
names(original_gene_list) <- df$X
gene_list<-na.omit(original_gene_list)
# sort the list in decreasing order (required for clusterProfiler)
gene_list = sort(gene_list, decreasing = TRUE)
gse <- gseGO(geneList=gene_list,
ont ="ALL",
keyType = "ENSEMBL",
minGSSize = 3,
maxGSSize = 800,
pvalueCutoff = 0.05,
verbose = TRUE,
OrgDb = organism,
pAdjustMethod = "none")
What I read is that I may have two packages in which the function"species" is present, but here I'm not running any function called species.
How can I solve this problem?
In this case, "OrgDb" parametrer of gseGO needs the object, not the variable annotation name. It means that you cannot use:
OrgDb = "org.Dm.eg.db"
Instead, you must use:
OrgDb = org.Dm.eg.db
Or which I think is the best option, obtain the boject by it's name:
OrgDb = get("org.Dm.eg.db")
The most elegant option is update your organism assignation to organism = get("org.Dm.eg.db")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With