Here is my code below.
However, as seen in the image, the color of BEAS-2B in the top annotation is different from the clone legend on the right. In theory, it should match the clone legend on the right. ('BEAS-2B' ="#A8D8B9")
I would like to ask what the issue might be.
Thank you in advance for your help.
Here is my code below. However, as seen in the image, the color of BEAS-2B in the top annotation is different from the clone legend on the right. In theory, it should match the clone legend on the right. ('BEAS-2B' ="#A8D8B9") I would like to ask what the issue might be. Thank you in advance for your help.
`clone= factor( str_replace_all(str_sub(new_colnames, 1,1), c("B" = 'BEAS-2B',"A"='A549',"H" = "HCC827")), levels=c('BEAS-2B','A549',"HCC827")) agent = factor( str_replace_all(str_sub(new_colnames, 3), c('Con'='Con','DMS'='DMS','B'='B[a]P','D'='DBAC','N'='NPYR','B+N'='B[a]P+NPYR','D+N'='DBAC+NPYR')), levels=c('Con','DMS','B[a]P','DBAC','NPYR','B[a]P+NPYR','DBAC+NPYR')) ha = HeatmapAnnotation(clone=clone, agent = agent, col = list(clone=c('BEAS-2B' ="#A8D8B9",A549="#B481BB",HCC827 = "#66327C"), agent=c(DMS="darkgray",Con="gainsboro",'B[a]P'='#DB005B',DBAC='#113285',NPYR='#FAD689','B[a]P+NPYR'='#F05E1C','DBAC+NPYR'='#096148') ) )
col = circlize::colorRamp2(c(-4,0,4), c("darkblue","white","red"))
ComplexHeatmap::Heatmap(heat,top_annotation = ha,col=col, cluster_rows = T,cluster_columns = F, name = "z-score(log2CPM)", show_row_names =F, show_column_names = F) `