Yup! Of course, I wws bashing my head against a wall for hours with that!
Thanks for your help!
I am trying to run GSEA on RStudio using this:
library(clusterProfiler)
library(enrichplot)
# SET THE DESIRED ORGANISM HERE
organism = "org.Hs.eg.db"
library(organism, character.only = TRUE)
# reading in data from deseq2
df = read.csv("expression_set_full-gsea.csv", header=TRUE)
# we want the log2 fold change
original_gene_list <- df$logFC
# name the vector
names(original_gene_list) <- df$X
# omit any NA values
gene_list<-na.omit(original_gene_list)
write.csv(df, file ="dfff.csv")
# 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",
nPerm = 10000,
minGSSize = 3,
maxGSSize = 800,
pvalueCutoff = 0.05,
verbose = TRUE,
OrgDb = organism,
pAdjustMethod = "none")
But i keep getting the following error:
preparing geneSet collections...
GSEA analysis...
leading edge analysis...
done...
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘species’ for signature ‘"character"’
In addition: Warning messages:
1: In .GSEA(geneList = geneList, exponent = exponent, minGSSize = minGSSize, :
We do not recommend using nPerm parameter incurrent and future releases
2: In fgsea(pathways = geneSets, stats = geneList, nperm = nPerm, minSize = minGSSize, :
You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
3: In serialize(data, node$con) :
'package:stats' may not be available when loading
4: In serialize(data, node$con) :
'package:stats' may not be available when loading
Any idea what is happening here and how can I fix it. The "In addition" warnings are non fatal, but the error before obviously stops the function.
Thanks in advance!
You aren't passing the OrgDb parameter properly. It has to be an actual OrgDb object, rather than the string associated with it. So that parameter should be OrgDb = org.Hs.eg.db rather than a character variable for "org.Hs.eg.db".
Yup! Of course, I wws bashing my head against a wall for hours with that!
Thanks for your help!
I'd like to use the clusterProfiler function in a pipeline. Is it possible to enter the orgdb as a variable?
Sure. xx <- org.Hs.eg.db. If you're asking how to evaluate a string as an expression or whatever, see this stackoverflow question for options.
Log in to answer this question.