Body: <p>I have a txt file summarising the result of a GWAS on an European population. Its structure is the next one:</p>
  <pre><code>data = data.frame(chr = c('1', '1', '1', '1', '1'),
                bp = c(740098, 787889, 952073, 993492),
                snp = c('rs12138618',  'rs4951864',  'rs3128126',  'rs4075116'),
                p = c(0.1, 0.04, 0.7, 0.9))
  </code></pre>
  <p>Imagine the first two snp listed (rs12138618, rs4951864) belong to the same LD-block (for r^2 = 0.1 or similar criteria). Where can I get this information from (table/database) or what package in R can I use to label these dependent SNPs and obtain something as:</p>
  <pre><code>   chr    bp        snp    p    ld_block
  1   1 740098 rs12138618 0.10        21
  2   1 787889  rs4951864 0.04        21
  3   1 952073  rs3128126 0.70        29
  4   1 993492  rs4075116 0.90        34
  </code></pre>
  <p>I am using big data, so something computationally-wise is preferred.</p>
  <p><strong>Note:</strong> Obviously I am making up the numbers, but I hope my point is clear. I am also new to GWAS, so it is very likely that I can be missing/misunderstanding concepts.</p>
  <p>What if I do not have the genotype data but I know that my population is CEU? Is there any reference-genotype data that I can provide to plink instead?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-21T09:48:53.643Z
Comments.Text: Is your overall goal to find the 'best' SNP within each block of LD, or do you explicitly need to know all SNPs within some LD block for another reason? Can you clarify what the overall goal is please.
Comments.UserDisplayName: user438383
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-21T11:11:32.890Z
Comments.Text: I want to explicitly know to which LD block belongs each SNP, in order to obtain something similar to the represented output stated in my question. My problem is that I do not know from where can I get some "reference-genotype data" for an European population (I thought 1000G may have something but I did not manage to find it)
Comments.UserDisplayName: Gero
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-21T19:40:27.197Z
Comments.Text: @Gero what if one SNP is in LD with more than one LD block? Most frequently SNPs are in continuous LD with other SNPs upstream and downstream, and you can't neatly split them, though there are of course inference techniques for segmentation. You can infer "[haplotype blocks](https://en.wikipedia.org/wiki/Haplotype_block)", which are one way of segmenting this information. Usually this is somewhat data dependent, do you want to do this according to your specific data using a [tool](https://www.broadinstitute.org/haploview/haploview) or using some global reference (e.g. tag SNPs from HapMap)?
Comments.UserDisplayName: Maximilian Press
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-23T17:43:20.553Z
Comments.Text: My plan was to: 1) Do a LD matrix, 2) find all SNP pairs based on r^2,  3) Create LD blocks considering LD as a transitive property (if one SNP is in LD with more than one block then I will consider those "2 blocks" as 1 big unique block). Even if LD is continuous as long as the distribution of the SNPs in the genome is not homogenous I guess many blocks will be obtained, hopefully ∼1,000,000
Comments.UserDisplayName: Gero
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-11-23T17:44:16.697Z
Comments.Text: On the other hand, thank you for the tools. I'll try to investigate how they work and do the maths for the segmentation! (P.S. My plan is to use a global/population reference).
Comments.UserDisplayName: Gero
Tags: <r><gwas><ld>
Title: LD block labels annotation for GWAS summary data
ThreadText: # LD block labels annotation for GWAS summary data
  
  (Asked by: username_0 on 2022-11-19)
  
  I have a txt file summarising the result of a GWAS on an European population. Its structure is the next one:
  
  ```
  data = data.frame(chr = c('1', '1', '1', '1', '1'),
                bp = c(740098, 787889, 952073, 993492),
                snp = c('rs12138618',  'rs4951864',  'rs3128126',  'rs4075116'),
                p = c(0.1, 0.04, 0.7, 0.9))
  
  ```
  
  Imagine the first two snp listed (rs12138618, rs4951864) belong to the same LD-block (for r^2 = 0.1 or similar criteria). Where can I get this information from (table/database) or what package in R can I use to label these dependent SNPs and obtain something as:
  
  ```
     chr    bp        snp    p    ld_block
  1   1 740098 rs12138618 0.10        21
  2   1 787889  rs4951864 0.04        21
  3   1 952073  rs3128126 0.70        29
  4   1 993492  rs4075116 0.90        34
  
  ```
  
  I am using big data, so something computationally-wise is preferred.
  
  **Note:** Obviously I am making up the numbers, but I hope my point is clear. I am also new to GWAS, so it is very likely that I can be missing/misunderstanding concepts.
  
  What if I do not have the genotype data but I know that my population is CEU? Is there any reference-genotype data that I can provide to plink instead?
  
  **Tags:** r, gwas, ld
  
  > **Comments:**
  > **username_1**: Is your overall goal to find the 'best' SNP within each block of LD, or do you explicitly need to know all SNPs within some LD block for another reason? Can you clarify what the overall goal is please.  
  > **username_0**: I want to explicitly know to which LD block belongs each SNP, in order to obtain something similar to the represented output stated in my question. My problem is that I do not know from where can I get some "reference-genotype data" for an European population (I thought 1000G may have something but I did not manage to find it)  
  > **username_2**: @username_0 what if one SNP is in LD with more than one LD block? Most frequently SNPs are in continuous LD with other SNPs upstream and downstream, and you can't neatly split them, though there are of course inference techniques for segmentation. You can infer "[haplotype blocks](https://en.wikipedia.org/wiki/Haplotype_block)", which are one way of segmenting this information. Usually this is somewhat data dependent, do you want to do this according to your specific data using a [tool](https://www.broadinstitute.org/haploview/haploview) or using some global reference (e.g. tag SNPs from HapMap)?  
  > **username_0**: My plan was to: 1) Do a LD matrix, 2) find all SNP pairs based on r^2,  3) Create LD blocks considering LD as a transitive property (if one SNP is in LD with more than one block then I will consider those "2 blocks" as 1 big unique block). Even if LD is continuous as long as the distribution of the SNPs in the genome is not homogenous I guess many blocks will be obtained, hopefully ∼1,000,000  
  > **username_0**: On the other hand, thank you for the tools. I'll try to investigate how they work and do the maths for the segmentation! (P.S. My plan is to use a global/population reference).  
  
  ---
  
  ## 0 answers
  
  