How to order columns of heatmap as they are in matrix data
1
1
Entering edit mode
7.0 years ago
Mehmet ▴ 820

Dear All,

I made a complex heatmap using complexheatmap package of R. I want to order columns of the heatmap based on order in my matrix data.

Any idea?

this is heatmap command I run:

hmap <- Heatmap(heat, name="Z-score",col=colorRamp2(myBreaks, myCol), column_order = samplesnames, cluster_columns = FALSE, heatmap_legend_param=list(color_bar="continuous", legend_direction="horizontal", legend_width=unit(3,"cm"), title_position="topcenter", title_gp=gpar(fontsize=10, fontface="bold")), split=df$EffectorName, cluster_rows=TRUE, show_row_dend=TRUE, row_title="Transcript", row_title_side="left", row_title_gp=gpar(fontsize=5, fontface="bold"), show_row_names=TRUE, row_names_side="left", row_title_rot=0,  show_column_dend=TRUE, column_title="Samples", column_title_side="top", column_title_gp=gpar(fontsize=10, fontface="bold"), column_title_rot=0, show_column_names=TRUE, clustering_distance_columns=function(x) as.dist(1-cor(t(x))), clustering_method_columns="ward.D2", column_dend_height=unit(5,"mm"), clustering_distance_rows="euclidean", clustering_method_rows="ward.D2", row_dend_width=unit(5,"mm"), top_annotation_height=unit(0.5,"cm"), top_annotation=ColAnn, bottom_annotation_height=unit(1, "cm"), bottom_annotation=boxAnnCol)
RNA-Seq R rna-seq • 25k views
ADD COMMENT
0
Entering edit mode

This is a continuation of the discussion, here: C: Heatmap based with FPKM values (the discussion became too long and off topic).

Mehmet, can you please again paste a sample of your data and the Heatmap() command that you are using so that everyone else can see. The ordering functions that I mention do work, as I use them a lot, but there must be some problem with your data and/or the way that you are executing the Heatmap() function.

When you paste your data, make sure that it looks presentable to others!

Thanks.

ADD REPLY
0
Entering edit mode

I don't know how to paste data as it is readable. Please follow the previous topic (Heatmap based with FPKM values).

ADD REPLY
0
Entering edit mode

Hi Kevin,

Now it is okay, I figured it out.

Here is my command:

hmap <- Heatmap(heat, name="Z-score",col=colorRamp2(myBreaks, myCol), cluster_columns = FALSE, heatmap_legend_param=list(color_bar="continuous", legend_direction="horizontal", legend_width=unit(3,"cm"), title_position="topcenter", title_gp=gpar(fontsize=10, fontface="bold")), split=df$EffectorName, cluster_rows=TRUE, show_row_dend=TRUE, row_title="Transcript", row_title_side="left", row_title_gp=gpar(fontsize=5, fontface="bold"), show_row_names=TRUE, row_names_side="left", row_title_rot=0,  show_column_dend=TRUE, column_title="Samples", column_title_side="top", column_title_gp=gpar(fontsize=10, fontface="bold"), column_title_rot=0, show_column_names=TRUE, clustering_distance_columns=function(x) as.dist(1-cor(t(x))), clustering_method_columns="ward.D2", column_dend_height=unit(5,"mm"), clustering_distance_rows="euclidean", clustering_method_rows="ward.D2", row_dend_width=unit(5,"mm"), top_annotation_height=unit(0.5,"cm"), top_annotation=ColAnn, bottom_annotation_height=unit(1, "cm"), bottom_annotation=boxAnnCol)

Thank you very very very much......

ADD REPLY
1
Entering edit mode

Glad that you got it working! Now you see why it is called 'complex' heatmap! :)

ADD REPLY
2
Entering edit mode
7.0 years ago
said3427 ▴ 120
Heatmap(matrix_data, cluster_columns = FALSE)
ADD COMMENT
0
Entering edit mode

It worked perfectly.

ADD REPLY

Login before adding your answer.

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