chuiqin / irGSEA

The integration of single cell rank-based gene set enrichment analysis
Other
106 stars 17 forks source link

Top parament in plotting functions #37

Closed Yumo-Xie closed 5 months ago

Yumo-Xie commented 5 months ago

Hello,

Very helpful tool! Thank you for your work.

I've encounted an issue when using plotting functions from the package. The pathways showed in the plot seem to be chosen by their names rather than significance or degree of difference. Like in GOBP, I can always find pathways like GOBP_Acid and GOBP_3UTR in the plot. Besides, if I specified top = 5, I only found pathways that begin with numbers following "GOBP". Is this how the parament designed to be, or maybe it is a bug?

Thank you!

Yumo-Xie commented 5 months ago

Well, I found it is related to the spread() function from tidyR. Because spread() do not keep the order of the original data https://github.com/tidyverse/tidyr/issues/453.

For a quick solve, I changed the "Name" column into factor by adding ",Name = factor(Name, levels = unique(Name))" in the mutate() line 88, 107 and 184 of irGSEA.heatmap.R right before spread(). After these changes, everything seems to work fine.

The original function output, only pathways begining with "A" and numbers are considered as top.

Screenshot 2024-03-14 at 14 46 53

After modification, the chosen pathways align with the integrated results.

Screenshot 2024-03-14 at 14 47 09

I suppose similar changes can be applied to irGSEA.bubble function too.

Hope this would help.

chuiqin commented 5 months ago

Thank you very much for pointing this out, I will fix it in the next version.