Obtain an LD matrix for SNPs in a BGEN file

306 views
Skip to first unread message

Alia K. Saeed

unread,
Aug 11, 2023, 5:33:58 PM8/11/23
to plink2-users
Hi,
Apologies for such a blunt question, but I've had a roadblock trying to obtain an LD correlation matrix for my SNPs using LDstore2. Earlier while Googling, I bumped into someone using plink2 to do the same thing which confused me as initially, my understanding was that PLINK isn't typically used for generating matrices, regardless of the input file format.
Question is, can I use PLINK to obtain an LD matrix using any file format? If so, does it work with a BGEN file too?!
By matrix I mean something like below (for 3 SNPs):
1.00 0.95 0.98
0.95 1.00 0.96
0.97 0.96 1.00

Thank you for your input in advance!
Alia

Christopher Chang

unread,
Aug 12, 2023, 1:29:17 PM8/12/23
to plink2-users
From the --r/--r2 documentation:

"You can request values for all pairs in matrix format (if you specify 'bin' and/or one of the matrix shape modifiers), all pairs in table format (with 'inter-chr'), or a limited window in table format (this is the default)."

"--r2 square" generates the format you want.  (Though it does not automatically generate a companion file listing the SNP IDs; this was a plink 1.x design mistake which will be corrected in plink 2.0, but you can work around it by including --write-snplist in the same command.)

Christopher Chang

unread,
Aug 12, 2023, 1:33:57 PM8/12/23
to plink2-users
As for BGEN, plink 1.9 can import it, but dosages are either rounded to the nearest integer or converted to missing genotypes, depending on the --hard-call-threshold setting.

On Friday, August 11, 2023 at 2:33:58 PM UTC-7 olla...@hotmail.com wrote:
Reply all
Reply to author
Forward
0 new messages