DiffBind: How to change the scatter plot colors?
1
0
Entering edit mode
Senthil • 0
@senthil-8797
Last seen 7.1 years ago
Germany

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

---

Senthil

diffbind • 1.5k views
ADD COMMENT
0
Entering edit mode
Rory Stark ★ 5.1k
@rory-stark-5741
Last seen 8 weeks ago
Cambridge, UK

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 <- dba.report(tamoxifen,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)

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

> assignInNamespace("crukBlue",crukBlue.save,"DiffBind")
> assignInNamespace("crukMagenta",crukMagenta.save,"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.

Regards-

Rory

ADD COMMENT

Login before adding your answer.

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