The order of those tied genes will be arbitrary, which may produce unexpected results.
1
0
Entering edit mode
Gordon • 0
@4cb8e748
Last seen 2 days ago
United States

Hi all,

I ran the following code:

library(tidyverse)
res <- read_csv("1_FGSEAFULL.csv")
res
library(org.Hs.eg.db)
ens2symbol <- AnnotationDbi::select(org.Hs.eg.db,
                                    key=res$row, 
                                    columns="SYMBOL",
                                    keytype="ENSEMBL")
ens2symbol <- as_tibble(ens2symbol)
ens2symbol
res <- inner_join(res, ens2symbol, by=c("row"="ENSEMBL"))
res
res2 <- res %>% 
  dplyr::select(SYMBOL, stat) %>% 
  na.omit() %>% 
  distinct() %>% 
  group_by(SYMBOL) %>% 
  summarize(stat=mean(stat))
res2
library(fgsea)
ranks <- deframe(res2)
head(ranks, 50)
pathways.hallmark <- gmtPathways("human.gmt")
pathways.hallmark %>% 
  head() %>% 
  lapply(head)
fgseaRes <- fgsea(pathways=pathways.hallmark, stats=ranks, eps=0)
fgseaResTidy <- fgseaRes %>%
  as_tibble() %>%
  arrange(desc(NES))
fgseaResTidy %>% 
  dplyr::select(-leadingEdge, -ES) %>% 
  arrange(padj) %>% 
  DT::datatable()
ggplot(fgseaResTidy, aes(reorder(pathway, NES), NES)) +
  geom_col(aes(fill=padj<0.05)) +
  coord_flip() +
  labs(x="Pathway", y="Normalized Enrichment Score",
       title="Hallmark pathways NES from GSEA") + 
  theme_classic() +
  theme(axis.title.y = element_text(face = "bold")) +
  theme(axis.title.y = element_text(color = "black")) +
  theme(axis.title.y = element_text(size = "15")) +
  theme(axis.text.y.left = element_text(face = "bold")) +
  theme(axis.text.y.left = element_text(color = "black")) +
  theme(title = element_text(face = "bold")) +
  theme(axis.text.y.right = element_text (face = "bold"))
devtools::install_github("ctlab/fgsea")

Initially, nprem = 1000 was used, resulting in a warning regarding using FGSEA Simple. So instead, I used eps=0, which migrated the issue. However, this is still persistent. "Warning message: In preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (33.92% of the list). The order of those tied genes will be arbitrary, which may produce unexpected results."

Does anyone know how to solve this warning as the consistency of the plot is being questioned due to the variation?

fgsea gsea • 333 views
ADD COMMENT
0
Entering edit mode
Guido Hooiveld ★ 3.9k
@guido-hooiveld-2020
Last seen 17 hours ago
Wageningen University, Wageningen, the …

The warning informs you that there are (many!! i.e 33.92% of your input...) genes in your preranked list having the same numerical/ranking value (e.g. log2FC). So double-check your input to find out why this is the case.

ADD COMMENT
0
Entering edit mode

I looked into my data (which was provided by another company); majority of the data has duplicates with a sigfig of 4. However, I am unable to actually calculate the following:

p-value,padj, and IfcSE. Do you happen to know the excel formula?

ADD REPLY

Login before adding your answer.

Traffic: 616 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