I created a heatmap object based on Complex Heatmap using ArchR. I need to re-order the columns and change the top annotation. The reordering is working as expected, but it seems like when I try to replace the top annotation that the order does not correspond.
changed order
I think you can see in the image below the pattern of the "group by" changes considerably.
Knames<-h_sub_mat@listData[["ATAC"]]@listData[["colData"]]@rownames
cellnames<-h_sub_mat@listData[["ATAC"]]@listData[["colData"]]@listData[["groupBy"]]
df<-data.frame(Knames, cellnames)
df[c('celltype', 'condition')] <- str_split_fixed(df$cellnames, '_', 2) #this is the meta data with cell type and condition.
df<-df[with(df, order(condition, celltype)),]
df<-df[with(df, order(condition, decreasing = TRUE)),]
condition<-df$condition
celltype<-df$celltype
reorder<-as.numeric(row.names(df))
reorder
trying to add the more complex top annotation
The above was created using "celltype.condition" to pull the cells out. The goal is to have the cells of the two different conditions plotted by the order of the same cell type. I had added this information into columns in the dataframe "df" above.
Below, I think you can see that see that the heatmap is in the write order, but something is off about the annotations.
Hi,
Thanks for the wonderful and flexible package.
I created a heatmap object based on Complex Heatmap using ArchR. I need to re-order the columns and change the top annotation. The reordering is working as expected, but it seems like when I try to replace the top annotation that the order does not correspond.
original order
changed order I think you can see in the image below the pattern of the "group by" changes considerably.
trying to add the more complex top annotation The above was created using "celltype.condition" to pull the cells out. The goal is to have the cells of the two different conditions plotted by the order of the same cell type. I had added this information into columns in the dataframe "df" above.
Below, I think you can see that see that the heatmap is in the write order, but something is off about the annotations.
Below is my session information in case that helps.
Thanks in advance! Ana