I just had exactly this issue. Thanks!
I am trying to perform GSEA on DESeq2 results by ranking the t stat 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
My code:
res.fgsea <- fgsea(pathways = gmt.file, stats=ranked_genes,
minSize=15, maxSize=500)
cp.res <- collapsePathways(fgseaRes=res.fgsea[order(pval)][padj < 0.05],
pathways = gmt.file,
stats=ranked_genes)
Please could you help me with this issue.
3 answers
Hello, I've had the same error.
In my case, the names of ranked_genes contain NA values.
I recommend that you check this. table(is.na(names(ranked_genes)))
I think your issue is that you're sending ALL pathways to collapsePathways and not those present in your reduced fgseaRes object.
Hi, as the error says, it means that some of your values in ranked_genes seem to be non-finite numbers (such as NAs or Infs). Can you check that all(is.finite(ranked_genes)) is true? If not, you should do something with these genes, e.g. remove them from your vector.
Running all(is.finite(ranked_genes)) returns TRUE so I am not sure why it is saying that not all the stats values are finite.
Can you please submit an issue with a reproducible example at https://github.com/ctlab/fgsea/issues ?
Log in to answer this question.
I encountered the same issue while I am sure the data type of stats are finite numbers. Is there a solution to this issue now? (PS: I was analyzing GSE48301 using hugene10sttranscriptcluster.db and GO file (c2.all.v2023.2.Hs.symbols.gmt.txt))