More informative GSEA enrichment ggplot
Entering edit mode
4.9 years ago

Hi Everyone,

I would like to ask a question:

I have the following dataset, "data", generated after GSEA enrichment analysis in the following format:


and ran the following code

data <- read.table(file.path(working_dir,"data.csv"),header = TRUE, sep = ",", quote="\"", stringsAsFactors = FALSE) 
s1<- ggplot(data, aes(x="Groups", y=Pathways, size=NES, color=padj)) + geom_point(alpha = 0.8) + facet_wrap(Group ~ .) + theme_classic()
s1 = s1+scale_color_gradient(low = "red2",  high = "mediumblue", space = "Lab", limit = c(0.001, 0.05))
s1+scale_size(range = c(2, 8))

the resulting output is


I understand the size of the dots correspond to the NES, however, it is not very informative at one glance (hard to distinguish between positive and negative NES).

What I want to change is that negative NES to show a downwards pointing arrow or triangle, and a positive NES to show an upwards pointing arrow/triangle. Of course the arrows will keep the color of the padj.

Can anyone teach me how to do that, please?

Thank you in advance!

R ggplot • 2.0k views
Entering edit mode
4.9 years ago
Ido Tamir 5.2k

of course its an R question and not a bioinformatics one and of course your example is not reproducible so thats what you get: something like:

+ geom_point(aes(shape = sign(NES)) + geom_shape_manual(values = c(24, 1, 25))

Login before adding your answer.

Traffic: 3679 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6