color for anno_enriched
olechnwin opened this issue · 2 comments
olechnwin commented
Hi,
I am wondering if there is a way to tie the anno_enriched color to the row_split?
For example, below if I set ngroup1 to 10, setting anno_enriched to the color of partition will correctly color the first group red.
load(system.file("extdata", "chr21_test_data.RData", package = "EnrichedHeatmap"))
mat3 = normalizeToMatrix(meth, cgi, value_column = "meth", mean_mode = "absolute",
extend = 5000, w = 50, smooth = TRUE)
ngroup1=10
partition=factor(c(rep("group1",ngroup1),rep("group2",nrow(mat3)-ngroup1)),levels=c("group1","group2"))
col.partition=c("red","blue")
names(col.partition)=levels(partition)
EnrichedHeatmap(mat3, name = "methylation", column_title = "methylation near CGI",row_split=partition,
top_annotation = HeatmapAnnotation(lines = anno_enriched(gp = gpar(col = col.partition))))
However if there is no group 1, the color becomes red. I was expecting it to be blue for the group2.
ngroup1=0
Thank you in advance for your help.
jokergoo commented
I think you need to manually check how many groups are there in your data.
col.partition=c("group1" = "red", "group2" = "blue")
Then in EnrichedHeatmap()
:
anno_enriched(gp = gpar(col = col.partition[unique(as.vector(partition))]))
olechnwin commented
I think you need to manually check how many groups are there in your data.
col.partition=c("group1" = "red", "group2" = "blue")Then in
EnrichedHeatmap()
:anno_enriched(gp = gpar(col = col.partition[unique(as.vector(partition))]))
I'll do that. Thank you!