Hello, I have my genetic data in *.bim *.bed and *.fam format. I have a *.txt file containing the SNPs of my interest. I want to estimate pairwise linkage disequilibrium (LD) among all of the SNPs in that Text file. I want to obtain the LD r2 values both as a list and a square matrix format. I have used the following codes for the list and matrix format, respectively:
plink --bfile plink_binary.0 --allow-no-sex --extract file.txt --r2 --out file
plink --bfile plink_binary.0 --extract file.txt --r2 square --write-snplist --out file
Both of them produce the desire results. However, there is a discrepancy between the two output files. I used output which is in List format in R and used the dcast
function to convert the list into a matrix format. So that I can plot the LD heatmap. When I want to do that, I cannot produce the LD heatmap and shows the error that it is not a square matrix. But if I used the matrix output from PLINK then everything is fine.
However, the matrix from PLINK and the matrix from R is not the same. I see that in the List output format there is a SNP that is not present (may be it has no LD or very low LD). But I am not sure whether that SNP is omitted when PLINK produce the output as a matrix. Because in the matrix output, the name of the SNPs are not printed.
Does anyone have any ideas on what is wrong here? Any suggestions will be appreciated. Thank you.
Thank you very much. I have solved the issue with the
--inter-chr
command.