Help with plotting heatmap with both row and column label annotations
1
0
Entering edit mode
23 months ago

Hi,

I am working with the transcriptomics FC data matrix (genes on rows and samples on columns) containing healthy controls and subjects treated with different compounds. I usually use ComplexHeatmap for plotting genes on y-axis (right) and samples/groups on x-axis. This time I am interested in plotting a similar heatmap but with additional annotation on y-axis (left) (I have provided an example dataset along with the example). Basically, this will help in identifying top condition and genes; that is different between subjects for comparison.

print(Input.df)
          E0 Stim 1    E0 Stim 2  E0 Stim 3   P0 Stim 1  P0 Stim 2  P0 Stim 3   R0 Stim 1
Gene_1   0.02864341  0.312575401 -1.0881433  0.04872680 -1.1258452  2.0826464 -0.32690037
Gene_2  -0.17059789  0.080230470 -0.2826396 -0.00328775 -0.8016243  2.7087269 -0.36272853
Gene_3  -0.13343139 -0.952555759  1.2838753  2.07844595  1.6697437  1.2567775  0.50958702
Gene_4   0.36260241 -0.087364689  0.4363719 -0.01461830  0.4152043 -0.4914261 -0.16521061
Gene_5   0.65949239  2.492343411  7.8758014  4.73509139  4.9869428  2.4593781 -0.28308204
Gene_6   0.12986250  0.594530215  3.8886445 -0.22032753  1.4960060  2.9811058  0.75367603
Gene_7   0.30802148  1.257403638  4.8511548  2.87228300  3.3363807  0.9741493  0.36067011
Gene_8   0.19141119 -0.005561728  2.1122420  0.77093127  1.1628178 -0.2225401  0.03739008
Gene_9  -0.40870696 -0.372470805  0.3546816  0.16857304  1.4915303 -1.4071508  0.10397316
Gene_10  0.14843173  0.019060103  2.2315277  1.23777701  1.4841049 -0.1470720  0.31101290
          R0 Stim 2  R0 Stim 3
Gene_1  -2.79322025 -0.4150097
Gene_2  -0.82672908  0.0895918
Gene_3   2.50904053  1.2459908
Gene_4  -0.34493807  1.5299697
Gene_5   2.86835551  1.6966721
Gene_6  -1.02554246  1.5783651
Gene_7   1.87564089  2.2184017
Gene_8   0.09636701  1.3912611
Gene_9   0.23346362 -1.7168698
Gene_10  0.64624116  1.8690974

print(Sample_metadata.df)
          Subject  Stims
E0 Stim 1      E0 Stim 1
E0 Stim 2      E0 Stim 2
E0 Stim 3      E0 Stim 3
P0 Stim 1      P0 Stim 1
P0 Stim 2      P0 Stim 2
P0 Stim 3      P0 Stim 3
R0 Stim 1      R0 Stim 1
R0 Stim 2      R0 Stim 2
R0 Stim 3      R0 Stim 3

Thank you,

Toufiq

pheatmap ComplexHeatmap R Heatmap annotations • 1.5k views
ADD COMMENT
1
Entering edit mode

Sorry to be blunt, but this is all described extensively in the ComplexHeatmap manual under the "annotations" tab:

https://jokergoo.github.io/ComplexHeatmap-reference/book/heatmap-annotations.html

ADD REPLY
0
Entering edit mode

ATpoint

Thank you. I am familiar with adding multiple row and column annotations on either side. I wanted to add sample metadata/condition information to the corresponding each gene, this will help in identifying top condition and genes; that is different between subjects (x-axis) for comparison. Perhaps, I was thinking if the data matrix I am using should be reshaped before plotting.

ADD REPLY
0
Entering edit mode
23 months ago
Trivas ★ 1.7k

Are you comfortable with pheatmap? With pheatmap, you would plot genes on the y-axis and the values from your conditions (E0 Stim 1 etc.) on the x-axis. I would then add an annotation_col to color your replicates. I find this blog post pretty helpful

ADD COMMENT

Login before adding your answer.

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