-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in preparePathwaysAndStats #149
Comments
Can you please provide a reproducible example? |
#General Bioconductor packages #Annotation and data import packages #Quality control and pre-processing packages #Analysis and statistics packages #Plotting and color options packages #Formatting/documentation packages #Helpers: library(GEOquery) load series and platform data from GEOgset <- getGEO("GSE48301", GSEMatrix =TRUE, getGPL=FALSE) ex <- exprs(gset) Translate array IDs to gene symbolsanno_gset <- AnnotationDbi::select(hugene10sttranscriptcluster.db, anno_gset <- subset(anno_gset, !is.na(SYMBOL)) head(anno_summarized) head(anno_filtered) nrow(probe_stats) table(ids_to_exlude) validObject(gset_final) GSEA plotGSEA = function(gene_list, GO_file, pval) { if ( any( duplicated(names(gene_list)) ) ) { fgRes <- fgsea::fgsea(pathways = myGO, message("Collapsing Pathways -----") fgRes$Enrichment = ifelse(fgRes$NES > 0, "Up-regulated", "Down-regulated") total_up = sum(fgRes$Enrichment == "Up-regulated") colos = setNames(c("firebrick2", "dodgerblue2"), g1= ggplot(filtRes, aes(reorder(pathway, NES), NES)) + output = list("Results" = fgRes, "Plot" = g1) Need to download gene symbols GO file from gsea websiteGO_file = "/Users/txiao/Documents/YuLab/PublicDatabase/c2.all.v2023.2.Hs.symbols.gmt.txt" error occursdim(res$Results) |
Thanks for the example. Indeed there is a bug in incorrect handling of NA in gene names. As a workaround you can apply |
A colleague got the same error, we checked the known suspects
Then I found that there was one gene without name/empty string "", and that this causes the same issue. So, additionally one should check for: Or to follow the previous post, run this before running fgsea: ( ... although one should probably rather take care of why gene names turn up being "" or NA in the first place... ) |
@bug1303 thanks for the report, unexpectedly empty strings break look up in named vectors for some reason. I've added the additional check into fgsea. |
I am trying to perform GSEA on GSE48301 results and successfully ran fgsea to extract a list of enriched pathways. However, when I run the collapsePathway function, I receive this error message:
Error in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, :
Not all stats values are finite numbers
I checked the gene_list I fed into stats using is.finite() and was sure that it only contains finite numbers. I saw a post (https://www.biostars.org/p/9557480/#9587941) reflecting the same issue 11 months ago and seemed to be unsolved.
The text was updated successfully, but these errors were encountered: