I have a dataframe called "ListerTFHeat" that is 20,000 by 20,000. First few rows/columns below. I want to pull out the top twelve rows and columns to create a simple heatmap, instead of plotting the whole thing.
ListerTFHeat[1:20,1:20]
TFName 0610009B22Rik 0610009O20Rik 0610010F05Rik 0610010K14Rik 0610030E20Rik 0610037L13Rik 0610040J01Rik 1110004E09Rik
1: Afp 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
2: Ahr 0.000000 0 0.0000 0 4.293800 0.00000 0.000000 0.00000
3: Aire 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
4: Alx1 10.212000 0 128.1400 0 3.775000 16.15100 8.031200 70.98600
5: Alx3 0.089674 0 1.1713 0 0.033633 0.14696 0.075401 0.61377
6: Alx4 8.916400 0 119.6300 0 3.451800 14.90500 7.940900 61.04400
7: Ar 159.390000 0 602.0300 0 78.846000 22.38300 4.474100 460.23000
8: Arhgef12 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
9: Arid3a 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
10: Arid3b 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
11: Arid5a 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
12: Arid5b 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
13: Arnt 23.332000 0 4.2158 0 18.824000 0.00000 0.000000 0.00000
14: Arnt2 68.152000 0 13.3690 0 34.317000 0.00000 0.000000 0.00000
15: Arntl 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
16: Arntl2 0.000000 0 0.0000 0 0.000000 0.00000 0.000000 0.00000
17: Arx 1.815100 0 28.8670 0 0.804270 2.97110 1.669500 13.50500
18: Ascl1 12.171000 0 74.4150 0 5.630500 14.19200 0.000000 0.00000
19: Ascl2 73.566000 0 438.6500 0 38.658000 91.22500 0.000000 0.00000
20: Atf1 0.000000 0 185.5600 0 13.039000 0.00000 0.000000 35.42100
If there is some sort of function that can extract a subset of the data that would result in a heatmap with the highest values, that would be ideal.
If not, (I think) the next best would be taking the top 12 rowsums and all columns. Then of those columns, selecting the top 12 colsums. Then creating the heatmap.
What is a way to code this in R? I haven't been able to find a post for this because most of them have been about scaling/sizing a heatmap.
You mean something like this? depends on how you define "top" row or column