fgsea resulting in an empty datafram
1
0
Entering edit mode
2.5 years ago
Storm • 0

Hi there,

Ran into an issue with fgsea and I wasn't able to find an appropriate solution anywhere.

The code:

fgsea$Entrez = convert2EntrezID(fgsea$ensembl_gene_id, "org.Hs.eg.db", "ensembl_gene_id")

gseaDat <- filter(fgsea, !is.na(entrez))
ranks <- gseaDat$log2FoldChange
names(ranks) <- gseaDat$entrez
head(ranks)

load("mouse_H_v5-1.rdata")
pathwaysH <- Mm.H

fgseaRes <- fgsea(pathwaysH, ranks, minSize=15, maxSize = 500, nperm=1000)

This is resulting in fgseaRes being 0 obs. of 8 variables.

Please let me know if there is an error I am making or something else I should be doing in the code. Thanks!

pathway fgsea enrichment • 2.2k views
ADD COMMENT
2
Entering edit mode

It looks like you are mixing both human and mouse data at the same time? org.Hs.eg.db is a homo sapiens (Hs) database, while later you are loading mouse pathways.

ADD REPLY
0
Entering edit mode

Great catch, thanks! However, even after replacing org.Hs.eg.db with org.Mm.eg.db fgseaRes comes out as 0 obs. of 8 variables, not sure why.

Empty data.table (0 rows and 8 cols): pathway,pval,padj,ES,NES,nMoreExtreme...

ADD REPLY
0
Entering edit mode

In the first line you write "Entrez", while in the others "entrez", that could be a reason.

ADD REPLY
1
Entering edit mode
2.5 years ago
alserg ▴ 1000

Empty result in fgsea means that no input pathway passed the size limits. A common reason is that you are using different gene ID types for stats and for pathways. For example, you rank gene IDs seems to be of Entrez type, but I suspect pathway gene IDs are gene symbols. The size of intersection length(intersect(names(ranks), unlist(pathwaysH))) should be non-zero.

For MSigDB based pathways I recomment use msigdbr package. There you can easily select the required gene IDs type. For example:

library(msigdbr)
# Hallmark pathways from MSigDB
df <- msigdbr(species = "Homo sapiens", category = "H")
df
pathways <- split(df$entrez_gene, df$gs_name)
ADD COMMENT
0
Entering edit mode

Right on, thanks!

ADD REPLY

Login before adding your answer.

Traffic: 2047 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6