tidyHeatmap
tidyHeatmap copied to clipboard
Add argument to force direction of an annotation
I'm trying to add a sample annotation to a gene expression heatmap. Since the data is in a tidy format, it is unclear if the annotation column I want to use applies to genes (rows) or samples (columns). I get a tile added on both row and column sides of heat map for the same variable. (Surprisingly this only happens for 1 of 3 variables I'm using to annotate my samples).
Is there a way to specify which annotations/variables go with rows and which with columns?
Thanks for an awesome package!!
my_mat <- structure(list(gene = c("23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8",
"8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd",
"9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f",
"12211f2cab", "23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7",
"4e71370e99", "503e85a48f", "12211f2cab", "23d4c9accd", "9811052cd0",
"bf1591f9c8", "8fea8007d7", "4e71370e99", "503e85a48f", "12211f2cab",
"23d4c9accd", "9811052cd0", "bf1591f9c8", "8fea8007d7", "4e71370e99",
"503e85a48f", "12211f2cab"), sample = c("69afaccda6", "69afaccda6",
"69afaccda6", "69afaccda6", "69afaccda6", "69afaccda6", "69afaccda6",
"c8140f2cc6", "c8140f2cc6", "c8140f2cc6", "c8140f2cc6", "c8140f2cc6",
"c8140f2cc6", "c8140f2cc6", "5a7e98232d", "5a7e98232d", "5a7e98232d",
"5a7e98232d", "5a7e98232d", "5a7e98232d", "5a7e98232d", "c2f7b8ae36",
"c2f7b8ae36", "c2f7b8ae36", "c2f7b8ae36", "c2f7b8ae36", "c2f7b8ae36",
"c2f7b8ae36", "d06a461846", "d06a461846", "d06a461846", "d06a461846",
"d06a461846", "d06a461846", "d06a461846", "b7f606fd99", "b7f606fd99",
"b7f606fd99", "b7f606fd99", "b7f606fd99", "b7f606fd99", "b7f606fd99",
"1f4c7ebe5c", "1f4c7ebe5c", "1f4c7ebe5c", "1f4c7ebe5c", "1f4c7ebe5c",
"1f4c7ebe5c", "1f4c7ebe5c", "32f3962947", "32f3962947", "32f3962947",
"32f3962947", "32f3962947", "32f3962947", "32f3962947", "b1016e1885",
"b1016e1885", "b1016e1885", "b1016e1885", "b1016e1885", "b1016e1885",
"b1016e1885", "4d2b8c3b0e", "4d2b8c3b0e", "4d2b8c3b0e", "4d2b8c3b0e",
"4d2b8c3b0e", "4d2b8c3b0e", "4d2b8c3b0e", "aeaea63b2b", "aeaea63b2b",
"aeaea63b2b", "aeaea63b2b", "aeaea63b2b", "aeaea63b2b", "aeaea63b2b",
"d9f2de4c6e", "d9f2de4c6e", "d9f2de4c6e", "d9f2de4c6e", "d9f2de4c6e",
"d9f2de4c6e", "d9f2de4c6e", "dd0c24d980", "dd0c24d980", "dd0c24d980",
"dd0c24d980", "dd0c24d980", "dd0c24d980", "dd0c24d980", "76fcf26d96",
"76fcf26d96", "76fcf26d96", "76fcf26d96", "76fcf26d96", "76fcf26d96",
"76fcf26d96", "b0a9df4e2c", "b0a9df4e2c", "b0a9df4e2c", "b0a9df4e2c",
"b0a9df4e2c", "b0a9df4e2c", "b0a9df4e2c", "f4c96715ba", "f4c96715ba",
"f4c96715ba", "f4c96715ba", "f4c96715ba", "f4c96715ba", "f4c96715ba",
"1ea0af4bfd", "1ea0af4bfd", "1ea0af4bfd", "1ea0af4bfd", "1ea0af4bfd",
"1ea0af4bfd", "1ea0af4bfd", "a6323e1812", "a6323e1812", "a6323e1812",
"a6323e1812", "a6323e1812", "a6323e1812", "a6323e1812", "3896318001",
"3896318001", "3896318001", "3896318001", "3896318001", "3896318001",
"3896318001", "5e1f4358f7", "5e1f4358f7", "5e1f4358f7", "5e1f4358f7",
"5e1f4358f7", "5e1f4358f7", "5e1f4358f7", "a3e575a3d6", "a3e575a3d6",
"a3e575a3d6", "a3e575a3d6", "a3e575a3d6", "a3e575a3d6", "a3e575a3d6",
"862b760dbd", "862b760dbd", "862b760dbd", "862b760dbd", "862b760dbd",
"862b760dbd", "862b760dbd", "8b4e5a4346", "8b4e5a4346", "8b4e5a4346",
"8b4e5a4346", "8b4e5a4346", "8b4e5a4346", "8b4e5a4346", "1fdf1272ff",
"1fdf1272ff", "1fdf1272ff", "1fdf1272ff", "1fdf1272ff", "1fdf1272ff",
"1fdf1272ff", "8dd86cc3ca", "8dd86cc3ca", "8dd86cc3ca", "8dd86cc3ca",
"8dd86cc3ca", "8dd86cc3ca", "8dd86cc3ca", "6894ea116f", "6894ea116f",
"6894ea116f", "6894ea116f", "6894ea116f", "6894ea116f", "6894ea116f",
"591a098489", "591a098489", "591a098489", "591a098489", "591a098489",
"591a098489", "591a098489", "aa5c7ad759", "aa5c7ad759", "aa5c7ad759",
"aa5c7ad759", "aa5c7ad759", "aa5c7ad759", "aa5c7ad759", "f57ef76df7",
"f57ef76df7", "f57ef76df7", "f57ef76df7", "f57ef76df7", "f57ef76df7",
"f57ef76df7", "a82dbaf481", "a82dbaf481", "a82dbaf481", "a82dbaf481",
"a82dbaf481", "a82dbaf481", "a82dbaf481", "805031c46d", "805031c46d",
"805031c46d", "805031c46d", "805031c46d", "805031c46d", "805031c46d",
"42f46327f8", "42f46327f8", "42f46327f8", "42f46327f8", "42f46327f8",
"42f46327f8", "42f46327f8", "7d31735f10", "7d31735f10", "7d31735f10",
"7d31735f10", "7d31735f10", "7d31735f10", "7d31735f10", "e0aec6c8b1",
"e0aec6c8b1", "e0aec6c8b1", "e0aec6c8b1", "e0aec6c8b1", "e0aec6c8b1",
"e0aec6c8b1", "3bfe15e0d9", "3bfe15e0d9", "3bfe15e0d9", "3bfe15e0d9",
"3bfe15e0d9", "3bfe15e0d9", "3bfe15e0d9", "7fccfe2004", "7fccfe2004",
"7fccfe2004", "7fccfe2004", "7fccfe2004", "7fccfe2004", "7fccfe2004",
"2357b8996a", "2357b8996a", "2357b8996a", "2357b8996a", "2357b8996a",
"2357b8996a", "2357b8996a", "4b7e162a38", "4b7e162a38", "4b7e162a38",
"4b7e162a38", "4b7e162a38", "4b7e162a38", "4b7e162a38", "cb50ad058c",
"cb50ad058c", "cb50ad058c", "cb50ad058c", "cb50ad058c", "cb50ad058c",
"cb50ad058c", "d9693ec59a", "d9693ec59a", "d9693ec59a", "d9693ec59a",
"d9693ec59a", "d9693ec59a", "d9693ec59a"), treatment = structure(c(2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,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L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
1L), levels = c("PD", "PR", "CR"), class = "factor"), TPM = c(19.380045,
0, 3.267072, 3.968264, 6.030809, 13.413329, 0, 38.130024,
0.113256, 0.343518, 1.168443, 2.921347, 14.0089, 0.199056,
15.35862, 0.269429, 0.06675, 0.08171, 1.459363, 12.183334,
0.081186, 6.769901, 0, 0.206705, 0.493409, 1.281004, 7.219058,
0, 25.200628, 2.080746, 0.913836, 2.495217, 4.828447, 6.885907,
0.048215, 13.504421, 0.298124, 0.077277, 0.086118, 2.235733,
11.103624, 0.078631, 18.708677, 0, 1.12623, 1.481046, 3.351257,
18.233658, 0.222725, 23.83412, 0.182229, 0.935622, 1.246243,
2.596699, 19.366228, 0.17308, 18.548864, 0.199853, 0.102659,
0.125665, 3.4828, 18.065275, 0.204714, 13.621723, 0, 0.064558,
0.079026, 2.468442, 11.171528, 0.210098, 20.659096, 0.118081,
0.086743, 0.554853, 2.132967, 12.027474, 0.108018, 26.998135,
0, 3.768134, 5.035879, 1.82884, 13.713241, 0, 21.049936,
2.449747, 0.761283, 3.061663, 3.238811, 12.355487, 0.07781,
33.644562, 1.382978, 0.909895, 1.875423, 2.776497, 10.886573,
0.049218, 39.328728, 0, 0, 0.275055, 3.226585, 30.282692,
0.388151, 9.833051, 0, 0, 0.187135, 4.112715, 17.866749,
0, 13.150364, 0.118649, 0.121893, 0, 3.187802, 14.731766,
0.105317, 7.802191, 0.10922, 0.239051, 0.073156, 3.401621,
15.829642, 0.236233, 9.88043, 0.169871, 0, 0, 1.152752, 8.318324,
0.165086, 49.973904, 2.446795, 0.66154, 0.429733, 2.540752,
8.247058, 0.063508, 15.6388, 0.285821, 0.467553, 0.956948,
4.928184, 11.135147, 0.096481, 9.258784, 0.167066, 0.179081,
0.268904, 1.250554, 10.698588, 0.06753, 31.600224, 12.527265,
0.116434, 0.265673, 6.797572, 35.142231, 0.957198, 12.096243,
0, 0.906156, 1.970007, 2.773932, 13.368867, 0.173809, 17.725138,
0.752818, 0, 0, 1.12262, 8.487818, 0, 23.031214, 0, 0.093887,
0.114928, 2.082398, 10.165085, 0.086409, 5.589263, 0.071541,
0, 0, 1.054487, 7.657198, 0.910551, 12.870563, 0, 0, 0, 10.027321,
25.57996, 0.56607, 29.153332, 0, 0.53892, 1.229019, 4.917233,
21.939363, 0.143802, 12.393344, 0.074334, 2.346946, 3.191433,
3.852221, 8.823092, 0, 12.568549, 0, 0, 0, 1.361589, 11.981364,
0.130088, 6.228916, 0, 0.770399, 1.12556, 2.056302, 9.400592,
0.338013, 16.778822, 0, 0.590287, 0.896422, 0.649123, 11.322244,
0, 17.868988, 0, 0.100813, 0.402996, 4.877803, 10.989128,
0.101358, 19.749079, 0.066033, 0, 0.081968, 2.790113, 14.7997,
0.057855, 18.077623, 0.450493, 0.15479, 0.345612, 2.814891,
10.265402, 0.334558, 15.287863, 2.671423, 0.089092, 0.327173,
1.443506, 7.998384, 0.064146, 14.458039, 0, 1.344173, 3.354766,
3.211932, 13.094709, 0, 30.637623, 7.918821, 0.272094, 0.111025,
2.187107, 8.071058, 0, 11.604349, 0.972779, 0.135701, 0.497012,
1.709469, 7.733548, 0.175792), TPM.scaled = c(0.0437766540186058,
-0.382268193387281, 3.21944519629024, 2.41576792730187, 1.67544648960279,
0.00801455217146102, -0.764412395903893, 1.95179450363951,
-0.334026036261941, -0.23699790184921, 0.17748029607248,
-0.0458025567914314, 0.104941144526848, 0.155724486243524,
-0.36544784062812, -0.267503093506274, -0.564213627430423,
-0.691297040888992, -0.855086788547154, -0.192161789463985,
-0.389129897943418, -1.23944504123182, -0.382268193387281,
-0.398748411532203, -0.36216857893035, -0.953817777594722,
-1.00007613752934, -0.764412395903893, 0.636085384561715,
0.504039600194724, 0.437274478563361, 1.23815590127608, 1.00987654666069,
-1.0542950151607, -0.541538431930249, -0.554133107355577,
-0.255280264705048, -0.551767824652669, -0.687773111366905,
-0.425325588008578, -0.367879900372734, -0.400940392145485,
-0.0245424693075739, -0.382268193387281, 0.688382470885798,
0.427387496706093, 0.19217500252119, 0.792502151470033, 0.265134500830109,
0.49702807384954, -0.304646521680761, 0.463031508991418,
0.23967669280986, -0.225512120829774, 0.97682299768978, 0.0356503581054057,
-0.0408052105405892, -0.297139460004761, -0.521759335424499,
-0.656157675611466, 0.264990899068514, 0.765098549883359,
0.181878606085127, -0.542196330797255, -0.382268193387281,
-0.566805172950404, -0.693442736632477, -0.296509045359929,
-0.356828819431419, 0.206766160207995, 0.173934247185802,
-0.331970794966736, -0.540576415030344, -0.313047815419662,
-0.482211917380588, -0.217527327216009, -0.265098907559911,
0.819001612938212, -0.382268193387281, 3.81183797974488,
3.26926157900852, -0.650562039920351, 0.0568239269840172,
-0.764412395903893, 0.21370654220255, 0.661218065100846,
0.256914969571748, 1.6909952347761, 0.129930289361535, -0.164144636758838,
-0.404735466799065, 1.49534910923153, 0.206820614065649,
0.43261513508971, 0.742668066835881, -0.125984570390634,
-0.403204007485621, -0.536902061799261, 2.07377590044064,
-0.382268193387281, -0.643130444701734, -0.536729401722043,
0.123162562069414, 2.75343007911291, 1.02981661976206, -0.927735632060415,
-0.382268193387281, -0.643130444701734, -0.607016126672562,
0.613681634976982, 0.732789306025036, -0.764412395903893,
-0.590162325083407, -0.331728851535507, -0.499019469306201,
-0.756619246254176, 0.101694153140053, 0.222584445005832,
-0.277584287144953, -1.13439811046005, -0.335745197685246,
-0.360506563270663, -0.698135446771917, 0.220054097674177,
0.401258993479084, 0.327575266263189, -0.922914294516667,
-0.309910495136957, -0.643130444701734, -0.756619246254176,
-1.02481193436466, -0.821175372595961, -0.00130192786380122,
3.15704035744915, 0.659960640789251, 0.138991372491713, -0.413073691509391,
-0.256481697045408, -0.832773604428604, -0.470846499314902,
-0.33693642516964, -0.260520810540263, -0.0903544946544988,
0.00840282913196557, 1.06508616689088, -0.362749669097506,
-0.318428720322825, -0.986173654121573, -0.311105303807019,
-0.431407560001157, -0.541646754374121, -0.970673437339946,
-0.433797749397043, -0.45225479376472, 1.28731509518499,
4.9538048312717, -0.505473505343416, -0.544229743549679,
2.09988971565295, 3.54429893553491, 3.6602378699396, -0.69743080168598,
-0.382268193387281, 0.4281946110481, 0.818282256925962, -0.127404431383951,
0.000778554869199577, 0.0390201625176588, -0.12462844635311,
-0.0616002884393354, -0.643130444701734, -0.756619246254176,
-1.04149156455983, -0.79359096058684, -0.764412395903893,
0.415323503430143, -0.382268193387281, -0.532130246602086,
-0.664741258024953, -0.510204490702632, -0.520623044452336,
-0.364986566742872, -1.35958802261546, -0.351794821884633,
-0.643130444701734, -0.756619246254176, -1.07920672598582,
-0.928770756349615, 3.44461199007901, -0.618635173097891,
-0.382268193387281, -0.643130444701734, -0.756619246254176,
3.88772387678523, 1.98808088057801, 1.85224766396463, 1.03831675699514,
-0.382268193387281, -0.00597911640428765, 0.225907146056587,
1.05902421845509, 1.39558953806931, -0.099687273694249, -0.667197487230522,
-0.350605124695512, 2.13160376694819, 1.79473850475823, 0.469484648780844,
-0.739026573930405, -0.764412395903893, -0.649368439670372,
-0.382268193387281, -0.643130444701734, -0.756619246254176,
-0.909209786114627, -0.225031529357327, -0.163080274667692,
-1.29449625149596, -0.382268193387281, 0.267692583148456,
0.143197929989074, -0.524649984847504, -0.645040958302317,
0.79805358324416, -0.220926571240709, -0.382268193387281,
0.0547507735249318, -0.0399840488748034, -1.30359679682204,
-0.332300445327518, -0.764412395903893, -0.10999011701589,
-0.382268193387281, -0.523941813996526, -0.434448306670924,
1.03719766135314, -0.386513626860966, -0.295884775029878,
0.0813299472312007, -0.354140991636755, -0.643130444701734,
-0.69109078548593, -0.118447405757104, 0.233640408316791,
-0.496977506643389, -0.0887591970209581, -0.190377661407819,
-0.460126187841417, -0.480323345621795, -0.104731493206459,
-0.50429688860305, 0.782082836681287, -0.372648148371698,
0.755642452532126, -0.537799252427044, -0.495064211424373,
-0.863864463311687, -0.873244217382195, -0.467897342641353,
-0.457091923164396, -0.382268193387281, 0.946050903942895,
1.92531336424803, 0.115051363966071, -0.0438394683504806,
-0.764412395903893, 1.18935979133836, 2.9908070249627, -0.321440669741136,
-0.667861470575929, -0.452242609708783, -0.86141683966764,
-0.764412395903893, -0.747486459461459, 0.0320935831740626,
-0.482694624169388, -0.359288198243399, -0.716640100985938,
-0.916345125608135, 0.0481865852193022)), row.names = c(NA,
-280L), class = c("tbl_df", "tbl", "data.frame"))
my_heatmap <- my_mat %>%
heatmap(gene,
sample,
TPM.scaled,
scale = "row",
palette_value = circlize::colorRamp2(
seq(-2, 2, length.out = 11),
RColorBrewer::brewer.pal(11, "RdBu"))
) %>%
add_tile(c(treatment, timepoint, response))
my_heatmap
Hello @antass,
you have only one value of treatment.
> my_mat |> distinct(treatment)
# A tibble: 1 × 1
treatment
<fct>
1 AG120
It is a bit strange to want to plot a unique value as annotation, you can simply write it in the methods and figure caption. Of course, with one value, it is impossible to understand if it is row or column-wise. This is such an odd scenario that I would not like to add complexity to the interface to allow that.
Am I seeying this right?
Hi @stemangiola, thanks so much for taking a look.
Yes, that's correct. In this example, the treatment variable only has one value. This is a possible outcome of user filtering via a Shiny app. They might want to see multiple treatments on one plot, or just one, etc.. If they happen to choose a single treatment, I could add a conditional line to exclude the variable from annotation..
Just trying to see how I could generalize my code without having to foresee every possibility (which I'm sure you're also trying to do haha ;))
So just to double check I'm not missing anything: there is no way to specify which variables are column annotations and which are row, right?
Thanks again!
At the moment no, is all automatic. I see now your use case make sense.
Let me ponder on the cost of adding a new argument. Let's leave this issue open.
Close for inactivity. Feel free to post updates if any.