fgsea tutorial issue with BiocParallel
2
1
Entering edit mode
6.4 years ago
1769mkc ★ 1.2k

I was trying to use this fgsea library for enrichment analysis but there was this error coming up due to some issue with BiocParallel , it was resolved by adding this line register(SerialParam()) to the code .

Original source with a bit of modification

Error in registered()[[bpparamClass]] : 
  attempt to select less than one element in get1index

 

library(fgsea)
library(BiocParallel)
res <- read.csv("HSC_LSC_deseq2_CDS.txt",sep ='\t') # deseq2 output
head(res)
library(dplyr)
res2 <- res %>% 
   dplyr::select(Symbol, stat) %>% 
   na.omit() %>% 
   distinct() %>% 
   group_by(Symbol) %>% 
   summarize(stat=mean(stat))
res2
library(tidyverse)
ranks <- deframe(res2)
head(ranks, 20)
pathways.hallmark <- gmtPathways('~/mysigdb/h.all.v6.2.symbols.gmt') # files from mysigdb 
pathways.hallmark %>% 
   head() %>% 
   lapply(head)

class(pathways.hallmark)
length(pathways.hallmark)
pathways.hallmark[1]

register(SerialParam())


fgseaRes <- fgsea(pathways=pathways.hallmark, stats=ranks, nperm=1000)

fgseaResTidy <- fgseaRes %>%  as_tibble() %>% arrange(desc(NES))

fgseaResTidy %>% 
   dplyr::select(-leadingEdge, -ES, -nMoreExtreme) %>% 
   arrange(padj) %>% 
   DT::datatable()

library(ggplot2)
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_minimal()

Any mistakes in the code found would be welcomed if any issues in running

R RNA-Seq • 5.0k views
ADD COMMENT
5
Entering edit mode
5.8 years ago
mark.ziemann ★ 1.9k

I experienced the same thing just now on a not so well patched computer running an older version (R3.4.4/fgsea_1.0.2/BiocParallel_1.8.2) but tried it on another computer that I keep better updated (R3.5.2/fgsea_1.8.0/BiocParallel_1.8.2) and it worked. My advice would be to upgrade your R installation to the latest one and reinstall the packages.

ADD COMMENT
0
Entering edit mode

yes as i updated things were broken due to one or the other dependencies ..

ADD REPLY

Login before adding your answer.

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