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?