displaying UP, DOWN, and NON-regulated genes
2
0
Entering edit mode
Bogdan ▴ 660
@bogdan-2367
Last seen 19 hours ago
Palo Alto, CA, USA

Dear all,

may I ask for a simple advice on how to make a scatter plot in ggplot2 that colours differently UP, DOWN and NON-regulated genes (in total, 5000 genes). BUT would like to show the NON-reg genes in the background (perhaps in a GREY transparent color), and bring in the foreground only UP-- and DOWN- genes.

a piece of example at a smaller scale is below, although we work with > 5000 genes. thanks a lot !

mycolours <- c("U" = "green", "D" = "red", "U"="grey")

x <- c(1,2,3,4,5,6)
y <- c(1,2,3,4,5,6)
z <- c("U","U","D","D","N", "N")
t <- data.frame(x,y,z)

ggplot(data = t, aes(y = y, x = x)) +
geom_point(size=2, aes(colour=z)) +
scale_color_manual("Status", values = mycolours)

ggplot2 • 1.3k views
0
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia

ggplot2 is not a Bioconductor package so, if you want help with it, better to consult the ggplot2 documentation:

or post to the ggplot2 forum:

or write to the package authors.

Personally I use the plotWithHighlights() and plotMD() functions of the limma package, which are specifically designed for the purpose you describe. For example:

plotWithHighlights(x,y,status=z,values=c("U","D"),hl.col=c("green","red"))

The argument 'values' specifies the foreground points. Any other values of 'status' not listed by 'values' are assumed to be background. The foreground colors are specified by hl.col and the background by bg.col. If you are using diffHic, for example, you'll find that these functions are already loaded for you.

0
Entering edit mode
Bogdan ▴ 660
@bogdan-2367
Last seen 19 hours ago
Palo Alto, CA, USA

thank you Gordon ! it is a very good suggestion, thanks a lot !

will get back to you shall I have any questions regarding how to set the genes display in the BACKGROUND vs FOREGROUND.