Question: fgsea tutorial issue with BiocParallel
1
gravatar for krushnach80
22 months ago by
krushnach80720
krushnach80720 wrote:

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

rna-seq R • 1.4k views
ADD COMMENTlink modified 15 months ago by mark.ziemann1.2k • written 22 months ago by krushnach80720
4
gravatar for mark.ziemann
15 months ago by
mark.ziemann1.2k
Australia/Mebourne/Geelong/Deakin
mark.ziemann1.2k wrote:

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 COMMENTlink written 15 months ago by mark.ziemann1.2k

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

ADD REPLYlink written 15 months ago by krushnach80720
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2189 users visited in the last hour