Hi all!
I'm trying to do a heatmap with plink
's output for IBD calculation (.genome
file).
This file has several columns, but only three are important to me, so my parsed input format looks like this:
IID1 IID2 PI_HAT
ID1 ID2 0.0163
ID1 ID3 0
ID1 ID4 0.0155
ID2 ID1 0.0096
ID2 ID3 0.0125
ID2 ID4 0.475
...
I would like to do a heatmap with the PIHAT values for all my IDs (I have hundreds). To my understanding, R
asks for a matrix as input for the plot, but I'm not able to parse this input into the correct format (I actually get the heatmap, but all the values are wrong). Could someone please give me advice or if there's another way to do the plot, I'd be as well to try it. Thank you very much in advance!
Woooow, thank you very much, it's working! Just for me to understand... what is the difference between long and wide format?? I hadn't heard before about this before.
This is a common problem, reshaping the data from wide-to-long or from long-to-wide. Depending on the problem you might want to convert between them, e.g.: ggplot prefers data in long format, and heatmap better to have wide. See below StackOverflow posts for more info: