Hello,
I have an output from plink as a plink.ld file that looks like this:
CHR_A BP_A SNP_A CHR_B BP_B SNP_B R2
1 JANIGQ010000021.1 15082 . JANIGQ010000021.1 15155 . 0.896000
2 JANIGQ010000021.1 18234 . JANIGQ010000021.1 18262 . 0.936724
3 JANIGQ010000021.1 18234 . JANIGQ010000021.1 18276 . 0.883963
4 JANIGQ010000021.1 18234 . JANIGQ010000021.1 18297 . 0.938125
5 JANIGQ010000021.1 18262 . JANIGQ010000021.1 18276 . 1.000000
6 JANIGQ010000021.1 18262 . JANIGQ010000021.1 18297 . 1.000000
There are some old threads on this topic, but the software are out of date in those threads. Does anyone have any advice on how to format the LD file output from plink to plot an LD heat map.
This is not straightforward with LDheatmap or snp.plotter as the plink.ld requires quite a bit of reformatting and often does not result in a square matrix.
An example set of code for plotting in R would be incredibly helpful.
I'm interested in viewing a particular part of this chromosome, which should also help to reduce the memory requirements for plotting:
# Read the data
ld_data <- read.table("Chr5.ld", header = TRUE)
# Filter the data for the desired range
filtered_ld_data <- subset(ld_data, BP_A >= 48540000 & BP_A <= 48560000 & BP_B >= 48540000 & BP_B <= 48560000)
Thanks a million!!!!