Closed akhst7 closed 4 years ago
MDS doesn't produce a seriation matrix unlike other methods, and therefore, it can't be used to generate the dendrogram.
Yes, you cannot get the dendrogram from a seriation object, but you can obtain the ordering by get_order()
function (https://www.rdocumentation.org/packages/seriation/versions/1.2-8/topics/get_order) and assign to row_order
/column_order
argument in Heatmap()
.
I created the heatmap with a following;
o1.mds<-seriate(dist(n5.merged.df[1:73,]), method = "MDS")
o2.mds<-seriate(dist(t(n5.merged.df[1:73,])), method = "MDS")
Heatmap(as.matrix(n5.merged.df[1:73,]),cluster_rows = F,cluster_columns = F,row_order = get_order(o1.mds),column_order = get_order(o2.mds) ,row_names_gp = gpar(fontsize=8), column_names_gp = gpar(fontsize=10, column_names_rot = 90, column_names_centered = T), column_title = "Heatmap with serration", name="Subset")
I want to add only the column dendrogram ;
Heatmap(as.matrix(n5.merged.df[1:73,]),cluster_rows = F, cluster_columns = as.dendrogram(o2.mds[[1]]), row_order = get_order(o1.mds), column_order = get_order(o2.mds) ,row_names_gp = gpar(fontsize=8), column_names_gp = gpar(fontsize=10, column_names_rot = 90, column_names_centered = T), column_title = "Heatmap with serration", name="Subset")
but I get this following error message;
Any way to address this issue ?
Thanks.