Answers.Body: <p>Yes, you can do this with plink.  </p>
  
  <p>You can use the flag <code>--ld-snp &lt;variant_id&gt;</code> to calculate LD between your SNP of interest and all other SNPs.<br>
  If you have multiple SNPs of interest, and want each of those compared with every SNP in your dataset, use <code>--ld-snps &lt;snp1-snp100,snp102,snp104&gt;</code><br>
  A final option to calculate LD between a specific pair of SNPs is <code>--ld &lt;variant_id1&gt; &lt;variant_id2&gt;</code>  </p>
  
  <p><a href="https://www.cog-genomics.org/plink/1.9/ld" rel="nofollow noreferrer">This the relevant plink manual page</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-27T15:09:15.963Z
Answers.LastActivityDate: 2019-08-27T15:09:15.963Z
Answers.UserDisplayName: P1storius
Answers.Body: <p>Anyway, it would be fairly easy via the filtering options <a href="https://www.cog-genomics.org/plink/2.0/filter#snps_only" rel="nofollow noreferrer">here</a></p>
  <p>The <code>--exclude-snp</code>  is what you are wanting.</p>
  <hr />
  <p>I have worked in LD and subsampling a genome is open to forcing a result. The alternative approach is the subsample is the population, or examine disequilibrium with respect to the physical chromosome. A local shift in disequilibrium  or heterozygosity  (sliding window along a chromosome) is an indication of selective pressure. This approach is frequently used in eukaryotic parasites to identify drug resistance. I don't have experience of human genetics but there are certainly enough here who do. However, I think you need to define the biological rationale for the subsample. Just having loads of data is easily resolved because any algorithm can be written to handle automation.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-24T07:46:22.530Z
Answers.Text: The issue is that LD usually involves a 5% cut-off, even using a maximum likelihood approach I'd be cautious (I don't which PLINK uses), and is therefore sensitive variations in the data set
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-23T00:58:08.223Z
Answers.LastActivityDate: 2019-04-23T19:42:28.323Z
Answers.LastEditDate: 2020-06-18T08:30:41.743Z
Answers.UserDisplayName: M__
Body: <p>I have a set of SNPs (single nucleotide polymorphisms) { S<sub>1</sub>, S<sub>2</sub>, ..., S<sub>N</sub> } from approximately 200 humans. I wish to determine the linkage disequilibrium (LD) for a defined subset of these SNPs. By this I mean e.g. I would like to compute e.g. LD between S1 and S2, S3, S4, but not the LD between S2 and S3. </p>
  
  <p>Could this calculation be performed in PLINK?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-23T00:34:14.320Z
Comments.Text: Hi Learner, thanks for you post and hope you can hang around here.The obvious question is why do you wish to sub-sample the genome, i.e. biological rationale?
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-23T16:24:23.440Z
Comments.Text: In this case, I have a priori generated SNP pairs as the output of an eQTL analysis. Now I just want to know about the LD between pairs of SNPs, which I could compute manually, but I have thousands of pairs, and so it is ideal if there is efficient software like PLINK that I could use...
Comments.UserDisplayName: learner
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-23T19:25:39.167Z
Comments.Text: I've added a comment below
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-24T07:40:34.650Z
Comments.Text: It could be that your question is not clear, but reads that you are wanting some SNPs subject to LD, but others excluded. For an LD to work you'll need a large number of SNPs which would be input simultaneously. You can subsample a given (human) population, your data set might therefore be further broken down from 200 humans.
Comments.UserDisplayName: M__
Tags: <vcf><snp><variation><plink>
Title: How to compute LD for pairs of variants with Plink
ThreadText: # How to compute LD for pairs of variants with Plink
  
  (Asked by: username_0 on 2019-04-22)
  
  I have a set of SNPs (single nucleotide polymorphisms) { S1, S2, ..., SN } from approximately 200 humans. I wish to determine the linkage disequilibrium (LD) for a defined subset of these SNPs. By this I mean e.g. I would like to compute e.g. LD between S1 and S2, S3, S4, but not the LD between S2 and S3.
  
  Could this calculation be performed in PLINK?
  
  **Tags:** vcf, snp, variation, plink
  
  > **Comments:**
  > **username_1**: Hi username_0, thanks for you post and hope you can hang around here.The obvious question is why do you wish to sub-sample the genome, i.e. biological rationale?  
  > **username_0**: In this case, I have a priori generated SNP pairs as the output of an eQTL analysis. Now I just want to know about the LD between pairs of SNPs, which I could compute manually, but I have thousands of pairs, and so it is ideal if there is efficient software like PLINK that I could use...  
  > **username_1**: I've added a comment below  
  > **username_1**: It could be that your question is not clear, but reads that you are wanting some SNPs subject to LD, but others excluded. For an LD to work you'll need a large number of SNPs which would be input simultaneously. You can subsample a given (human) population, your data set might therefore be further broken down from 200 humans.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2019-08-27. Score: 2
  
  Yes, you can do this with plink.
  
  You can use the flag `--ld-snp <variant_id>` to calculate LD between your SNP of interest and all other SNPs.  
  If you have multiple SNPs of interest, and want each of those compared with every SNP in your dataset, use `--ld-snps <snp1-snp100,snp102,snp104>`  
  A final option to calculate LD between a specific pair of SNPs is `--ld <variant_id1> <variant_id2>`
  
  [This the relevant plink manual page](https://www.cog-genomics.org/plink/1.9/ld)
  
  
  ---
  
  ### Answer by username_1 on 2019-04-23. Score: 0
  
  Anyway, it would be fairly easy via the filtering options [here](https://www.cog-genomics.org/plink/2.0/filter#snps_only)
  
  The `--exclude-snp` is what you are wanting.
  
  ---
  
  I have worked in LD and subsampling a genome is open to forcing a result. The alternative approach is the subsample is the population, or examine disequilibrium with respect to the physical chromosome. A local shift in disequilibrium or heterozygosity (sliding window along a chromosome) is an indication of selective pressure. This approach is frequently used in eukaryotic parasites to identify drug resistance. I don't have experience of human genetics but there are certainly enough here who do. However, I think you need to define the biological rationale for the subsample. Just having loads of data is easily resolved because any algorithm can be written to handle automation.
  
  > **Comments:**
  > **username_1**: The issue is that LD usually involves a 5% cut-off, even using a maximum likelihood approach I'd be cautious (I don't which PLINK uses), and is therefore sensitive variations in the data set  
  
  ---
  
  