Answers.Body: <p>You haven't given any information about what format your input file data is in, so I'm just going to assume that it's a standard genomic variant storage format. In which case...</p>
  <p>Have a look at the &quot;Linkage disequilibrium based SNP pruning&quot; function of PLINK, which takes a <a href="https://www.cog-genomics.org/plink/2.0/input#vcf" rel="nofollow noreferrer">VCF file</a> (<a href="https://www.cog-genomics.org/plink/2.0/input" rel="nofollow noreferrer">and various other formats</a>) as input:</p>
  <p><a href="https://www.cog-genomics.org/plink/2.0/ld" rel="nofollow noreferrer">https://www.cog-genomics.org/plink/2.0/ld</a></p>
  <blockquote>
  <p>These commands produce a pruned subset of variants that are in approximate linkage equilibrium with each other, writing the IDs to plink2.prune.in (and the IDs of all excluded variants to plink2.prune.out). These files are valid input for --extract/--exclude in a future PLINK run; and, for backward compatibility, they do not affect the set of variants in the current run.</p>
  </blockquote>
  <p>This uses the <span class="math-container">$r^2$</span> statistic for SNP correlation to identify highly-correlated SNPs based on provided input parameters.</p>
  <p>There's also an LD statistic output report that can be produced if you're interested in the actual correlation / disequilibrium statistics (e.g. <span class="math-container">$D^\prime$</span>, <span class="math-container">$r^2$</span>), rather than just fetching a list. That might be closer to what you want to work with, given that you seem to have a separate application in mind from what is provided by PLINK.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-12-12T03:39:19.663Z
Answers.LastActivityDate: 2024-12-12T03:47:14.917Z
Answers.LastEditDate: 2024-12-12T03:47:14.917Z
Answers.UserDisplayName: gringer
Body: <p>I'm interested to extract highly correlated SNPs. I need to use them in a simulation study to test a method's performance for independent SNPs and correlated SNPs.</p>
  <p>My interest is not looking at pair-wise high correlation, but, the extracted set of SNPs should be correlated with ALMOST each other. For instance, if we extract highly correlated SNP pairs, we cannot gurantee that the extracted set of SNPs are highly correlated with almost all the other SNPs (with each other). How can I extract such a SNP set - that is, when we compute the summary of distribution of the extracted SNPs, the proportion of off-diagonal LD elements that are greater than say 0.7 for instance (indicating high correlation) should be at least more than 50%?</p>
  <p>I am not aware about existing method &quot;names&quot;, but I tried my own code (kind of a trial and error) to randomly pick a sample of SNPs (100 SNPs in my case) in small LD Window (tried 15Mb, 10MB, 5Mb,...) and obtained the summary statistics/heatmap/computed percentage of SNP correlation &lt; 0.5. The issue was, every time, I could find not more than 2% (I need to reach at least 50% of correlated SNPs to achieve my goal).</p>
  
Tags: <snp><correlation><ld>
Title: How to extract highly correlated SNPs
ThreadText: # How to extract highly correlated SNPs
  
  (Asked by: username_0 on 2024-12-10)
  
  I'm interested to extract highly correlated SNPs. I need to use them in a simulation study to test a method's performance for independent SNPs and correlated SNPs.
  
  My interest is not looking at pair-wise high correlation, but, the extracted set of SNPs should be correlated with ALMOST each other. For instance, if we extract highly correlated SNP pairs, we cannot gurantee that the extracted set of SNPs are highly correlated with almost all the other SNPs (with each other). How can I extract such a SNP set - that is, when we compute the summary of distribution of the extracted SNPs, the proportion of off-diagonal LD elements that are greater than say 0.7 for instance (indicating high correlation) should be at least more than 50%?
  
  I am not aware about existing method "names", but I tried my own code (kind of a trial and error) to randomly pick a sample of SNPs (100 SNPs in my case) in small LD Window (tried 15Mb, 10MB, 5Mb,...) and obtained the summary statistics/heatmap/computed percentage of SNP correlation < 0.5. The issue was, every time, I could find not more than 2% (I need to reach at least 50% of correlated SNPs to achieve my goal).
  
  **Tags:** snp, correlation, ld
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-12-12. Score: 0
  
  You haven't given any information about what format your input file data is in, so I'm just going to assume that it's a standard genomic variant storage format. In which case...
  
  Have a look at the "Linkage disequilibrium based SNP pruning" function of PLINK, which takes a [VCF file](https://www.cog-genomics.org/plink/2.0/input#vcf) ([and various other formats](https://www.cog-genomics.org/plink/2.0/input)) as input:
  
  <https://www.cog-genomics.org/plink/2.0/ld>
  
  > These commands produce a pruned subset of variants that are in approximate linkage equilibrium with each other, writing the IDs to plink2.prune.in (and the IDs of all excluded variants to plink2.prune.out). These files are valid input for --extract/--exclude in a future PLINK run; and, for backward compatibility, they do not affect the set of variants in the current run.
  
  This uses the $r^2$ statistic for SNP correlation to identify highly-correlated SNPs based on provided input parameters.
  
  There's also an LD statistic output report that can be produced if you're interested in the actual correlation / disequilibrium statistics (e.g. $D^\prime$, $r^2$), rather than just fetching a list. That might be closer to what you want to work with, given that you seem to have a separate application in mind from what is provided by PLINK.
  
  
  ---
  
  