Question: DiffBind: How to change the scatter plot colors?
gravatar for Senthil
4 months ago by
Senthil0 wrote:

How to change the default scatter plot colors of dba.plotMA function?



ADD COMMENTlink modified 4 months ago by Rory Stark1.8k • written 4 months ago by Senthil0
gravatar for Rory Stark
4 months ago by
Rory Stark1.8k
CRUK, Cambridge, UK
Rory Stark1.8k wrote:

Hi Senthil-

Currently there is not an official way to change the colors of the MA plots in DiffBind.

I can think of two ways to get MA plots with different colors. One is to do your own plotting, and the other is to hack some un-exported variables.

Suppose you want to change the color of the dots from blue to black, and the color of the dots representing significantly bound sites from magenta to green. Here's some code that makes a MA plot (example uses built-in tamoxifen dataset):

> data(tamoxifen_analysis) 
> report <-,th=1)
> plot(report$Conc,report$Fold,pch=20,cex=.15,col="black")
> points(report$Conc[sigDB],report$Fold[sigDB],pch=20,cex=.15,col="green")

You still have to fill in the labels for the axes etc.

The second way involves a hack, but lets you use the logic in dba.plotMA(). The default colors are set using two internal variables, crukBlue and crukMagenta. You can change the values for these variables using assignInNamespace():

> data(tamoxifen_analysis)
> dba.plotMA(tamoxifen, bSmooth=FALSE)

> <- getFromNamespace("crukBlue", "DiffBind")
> <- getFromNamespace("crukMagenta", "DiffBind")
> assignInNamespace("crukBlue","black","DiffBind")
> assignInNamespace("crukMagenta","green","DiffBind")
> dba.plotMA(tamoxifen, bSmooth=FALSE)

> assignInNamespace("crukBlue",,"DiffBind")
> assignInNamespace("crukMagenta",,"DiffBind")

There isn't a way to change the horizontal line at 0 fold using this hack as it is hard-wired in the code.



ADD COMMENTlink written 4 months ago by Rory Stark1.8k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 120 users visited in the last hour