collapsePathways function throwing error
3
0
Entering edit mode
20 months ago
Pac314 ▴ 10

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.

GSEA fgsea R • 3.7k views
ADD COMMENT
0
Entering edit mode

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))

ADD REPLY
1
Entering edit mode
5 months ago
H_y ▴ 10

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)))

ADD COMMENT
0
Entering edit mode

I just had exactly this issue. Thanks!

ADD REPLY
0
Entering edit mode
20 months ago
Trivas ★ 1.8k

I think your issue is that you're sending ALL pathways to collapsePathways and not those present in your reduced fgseaRes object.

ADD COMMENT
0
Entering edit mode

Ok, should I filter the pathways gmt file to include only those in fgseaRes?

ADD REPLY
0
Entering edit mode

I don't think so, collapsePathways filters the pathway list in the begining to contain only the pathways present in the filtered fgseaRes table.

ADD REPLY
0
Entering edit mode
20 months ago
alserg ▴ 1000

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.

ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

Can you please submit an issue with a reproducible example at https://github.com/ctlab/fgsea/issues ?

ADD REPLY

Login before adding your answer.

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