compute LD for a list of SNPs with all the other SNPs

35 views
Skip to first unread message

Anni Malmberg

unread,
Jul 10, 2024, 5:25:40 AM (6 days ago) Jul 10
to plink2-users
Hi,

I have a list of 241 SNPs. I would like to compute LD r2 values between all such pairs of SNPs where one pair is from the given list and the other is any other SNP in my genome-wide genotype data.

What I have tried:

plink-1.9/plink --bfile "$genotype_data" \
--r2 \
--ld-snp-list "$snplist" \
--out LD_between_pairs_of_snps

However, the output includes less SNP pairs than expected so I guess some pre-defined filtering was applied to produce R2 values only between some smaller set of pairs of SNPs.

In the documentation of ld-snp-list it says "You can request values for all pairs in matrix format (if you specify 'bin', 'bin4', 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)" so next I tried using the 'inter-chr' modifier for --r2, but the output file still does not seem to include all the SNP pairs that I wanted. 

Then I read the documentation further and found the 'yes-really' modifier, and tried running  

plink-1.9/plink --bfile "$genotype_data" \
--r2 yes-really \
--ld-snp-list "$snplist" \
--out LD_between_pairs_of_snps

but then I got the error saying "--ld-snp/--ld-snps/--ld-snp-list cannot be used with the --r/--r2 matrix output modifiers".

I think computing R2 values between all possible pairs of SNPs in my genome-wide genotype data with the 'yes-really' modifier would not be possible due to memory issues. 

Best,
Anni

Chris Chang

unread,
Jul 10, 2024, 9:57:46 AM (6 days ago) Jul 10
to Anni Malmberg, plink2-users
—ld-window-r2 is the other setting you need to adjust to get “—r2 inter-chr” + —ld-snp-list to do what you want.

--
You received this message because you are subscribed to the Google Groups "plink2-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plink2-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/plink2-users/6bb08b4f-4ace-453a-a70e-5808a1625806n%40googlegroups.com.

Anni Malmberg

unread,
Jul 10, 2024, 11:02:55 AM (6 days ago) Jul 10
to plink2-users
Hi,

Thanks for the fast response. Based on the documentation it seems that I need to give some value to --ld-window-r2 to filter out variants with R2 lower than this value. So if use --ld-window-r2 0, does that prevent any variants from getting filtered?

Best,
Anni

Christopher Chang

unread,
Jul 10, 2024, 4:37:54 PM (6 days ago) Jul 10
to plink2-users
The only SNP-pairs that still get filtered under "--ld-window-r2 0" are those where the r^2 value is "nan", i.e. at least one of the SNPs exhibits no variation at all, across all samples genotyped at both SNPs.  If you want that case to be reported as well, you can use e.g. "--ld-window-r2 -1".  (This detail is mentioned in the plink 2.0 documentation.)
Reply all
Reply to author
Forward
0 new messages