How to color different column bars independently using dba.plotHeatmap (DiffBind)?
1
0
Entering edit mode
Gary ▴ 20
@gary-7967
Last seen 5.8 years ago

Hi,

I would like to color (1) the column bar of the antibody factor using "orange", "orchid1", and "mediumpurple1", (2) the column bar of the sex factor using "magenta", and "cyan". The commands I used and the figure I produced are below. Could you teach me how to perform it correctly? In addition, may I change the text size? Many thanks.

Best,

Gary

 

> histone <- dba(sampleSheet="histone.csv", bRemoveM=FALSE, bRemoveRandom = FALSE, bCorPlot = TRUE, peakFormat="narrow")

F_H3K27ac_C114 Feather H3K27ac Female  1 MACS2
F_H3K27ac_C115 Feather H3K27ac Female  2 MACS2
M_H3K27ac_C97 Feather H3K27ac Male  1 MACS2
M_H3K27ac_C113 Feather H3K27ac Male  2 MACS2
F_H3K4me3_C216 Feather H3K4me3 Female  1 MACS2
F_H3K4me3_C222 Feather H3K4me3 Female  2 MACS2
M_H3K4me3_C213 Feather H3K4me3 Male  1 MACS2
M_H3K4me3_C219 Feather H3K4me3 Male  2 MACS2
F_H3K27me3_C217 Feather H3K27me3 Female  1 MACS2
F_H3K27me3_C223 Feather H3K27me3 Female  2 MACS2
M_H3K27me3_C214 Feather H3K27me3 Male  1 MACS2
M_H3K27me3_C220 Feather H3K27me3 Male  2 MACS2
> histone
12 Samples, 25341 sites in matrix (41612 total):
                ID  Tissue   Factor Condition Replicate Caller Intervals
1   F_H3K27ac_C114 Feather  H3K27ac    Female         1  MACS2     20891
2   F_H3K27ac_C115 Feather  H3K27ac    Female         2  MACS2     18264
3    M_H3K27ac_C97 Feather  H3K27ac      Male         1  MACS2     20169
4   M_H3K27ac_C113 Feather  H3K27ac      Male         2  MACS2     18482
5   F_H3K4me3_C216 Feather  H3K4me3    Female         1  MACS2     20790
6   F_H3K4me3_C222 Feather  H3K4me3    Female         2  MACS2     20258
7   M_H3K4me3_C213 Feather  H3K4me3      Male         1  MACS2     20421
8   M_H3K4me3_C219 Feather  H3K4me3      Male         2  MACS2     20274
9  F_H3K27me3_C217 Feather H3K27me3    Female         1  MACS2      9517
10 F_H3K27me3_C223 Feather H3K27me3    Female         2  MACS2     10442
11 M_H3K27me3_C214 Feather H3K27me3      Male         1  MACS2      8773
12 M_H3K27me3_C220 Feather H3K27me3      Male         2  MACS2      9940
> histone$config$factor <- "Antibody"
> histone$config$condition <- "Sex"
> dba.plotHeatmap(histone, attributes = DBA_ID, ColAttributes=c(DBA_FACTOR, DBA_CONDITION), colSideCols = c("magenta", "cyan"), correlations=FALSE, colScheme="Blues", scale="row", sortFun = mean, maxSites=25341, margin = 10)

 

diffbind dba.plotHeatmap • 984 views
ADD COMMENT
1
Entering edit mode
Rory Stark ★ 5.2k
@rory-stark-5741
Last seen 8 weeks ago
Cambridge, UK

You're pretty close! As per the documentation, the colSideCols value can be a list of color vectors, one for each column bar. So you can change your value to:

colSideCols = list(c("orange","orchid1","mediumpurple1"), c("magenta", "cyan"))

You can also pass in more parameters to the underlying plotting function. For example, you can set the cexCol to another value to change the size of the column labels. Currently there is not a way to change the size of the column bar or its labels.

ADD COMMENT

Login before adding your answer.

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