Answers.Body: <p>I originally thought you were working on humans. I spotted &quot;non model organism&quot;, that changes things alot, albeit I guess humans are a non-model organism in a way. The question is what the organism. LD has been applied to every kingdom of life, except viruses. Arlequin isn't bad for relatively small to medium data sets (but tricky to get the format right - thats a separate question). If it's a genome sequence then I still suspect its plink. There are a number of recent LD programs BTW.</p>
  <p>I did notice Colony was written in Fortran! Wow, the author must be a physicist at ZSL anyway...</p>
  <p>If you have a defined number of SNPs - sounds small to medium data set - then I'd use Arlquein <a href="http://cmpg.unibe.ch/software/arlequin35/Arl35Methods.html" rel="nofollow noreferrer">http://cmpg.unibe.ch/software/arlequin35/Arl35Methods.html</a>, Arlquin does loads of pop gen BTW its very famous for AMOVA BTW (very cool calculation). HAPLOVIEW has been used for LD, these authors used it <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4641910/" rel="nofollow noreferrer">here</a>, what surprised me was they avoided using Arlequin for the LD but used HAPLOVIEW. There's a plethora of recent LD algorithms, never used them so can' say, e.g. <a href="https://onlinelibrary.wiley.com/doi/10.1111/1755-0998.13438" rel="nofollow noreferrer">quickLD</a>, stuff in R.</p>
  <p><em>What I am definitely saying is the LD works on from raw alleles</em> Thats the most important part of this response. I've attempted to describe the rationale below.</p>
  <hr />
  <p>If this is human genomes, or large genome data I'd would recommend plink analysis performed directly on your data, as described here <a href="https://www.cog-genomics.org/plink/1.9/ld" rel="nofollow noreferrer">https://www.cog-genomics.org/plink/1.9/ld</a></p>
  <p>Using any sort of matrix will remove the linkage disequilibrium signal, <strong>IF</strong> its a single matrix for all your data. If its multiple matrices you can perform a correlation statistic between the matrices - but its better just to do a straight linkage disequilibrium calculation, e.g. plink.</p>
  <p>The reason why correlation matrices will fail is because LD needs to identify incongruence/disparity and whether that incongruence occurs within random expectations.</p>
  <p>Basically you are making a phylogenetic tree - thats what the correlation matrix is about, but the tree assumes clonality. LD is about deviation from random expectations (equilibrium), so either a random distribution, e.g. Poison or a randomisation process is needed. What I'm attempting to say is &quot;a tree&quot; (single matrix) and LD are very different calculations. Whilst, technically you can do LD via matrices (plural), its better to do a LD calculation from the raw alleles.</p>
  <hr />
  <p>From the comments, it appears a &quot;tree like structure&quot; (ancestors) is wanted to direct an LD calculation.</p>
  <p>What you can do is subdivide the populations and perform LD on each subdivision. A tree (here using a correlation or kinship matrix) is a continuum so it's at what point do you call the the subdivision? Its doable but the information is not presented here.</p>
  <p>What you can do is use &quot;<a href="https://www.frontiersin.org/articles/10.3389/fgene.2013.00098/full" rel="nofollow noreferrer">Structure</a>&quot; - this has been upgraded alot. This is a HWE, I think using Bayes and it designates how many populations (at LD) are present in your data. You can then perform a specific LD directly on each subdivision.</p>
  <p>If you compare the output of &quot;Structure&quot;,basically Bayesian HWE you should see a correlation with your kinship matrix. What you are inferring is a partial LD parameter that will define ancestry and whilst its doable it has never been calculated in this manner that I'm aware of: its random or it ain't and thats the criteria of significance. This is definitely how LD works in small genomes (everything below higher eukaryotes).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-13T13:02:36.973Z
Answers.Text: I think there is a misunderstanding -- I have the raw alleles, and I use them for the calculation, the issue being, since I know for a fact I have *families* in the data (I just do not know the actual pedigree), I could have a much greater power if this information, or a proxy, i.e. a kinship matrix could be included in the information, because to some degree one could theoretically count how the alleles are passed from (putative) parents to (putative) offspring
Answers.UserDisplayName: user1256923
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-13T15:34:42.700Z
Answers.Text: @user1256923 answered above
Answers.UserDisplayName: M__
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-13T01:54:00.833Z
Answers.LastActivityDate: 2023-07-13T15:34:16.370Z
Answers.LastEditDate: 2023-07-13T15:34:16.370Z
Answers.UserDisplayName: M__
Body: <p>I have a bunch of samples of a non-model organism divided in two groups: parental generation and offspring. I do not have a pedigree so I do not actually know who is a parent of who, and which are the sibships. I have a bunch of SNPs that I can use to create a kinship matrix, but I cannot resolve families just using it.</p>
  <p>I want to perform linkage disequilibrium (LD) between the SNPs. I can calculate the correlation between them, but I feel I am losing a lot of power because there is kinship between samples. Is there a program that could take the kinship matrix in account when calculating the LD?</p>
  <p>I could, in theory, reconstruct the pedigree from the markers. I run multiple instance of <a href="https://www.zsl.org/about-zsl/resources/software/colony" rel="nofollow noreferrer">Colony</a> but the results are underwhelming -- most samples are not allocated (admittedly this raises questions on the SNP situation, but this is a whole different issue).</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-12T14:20:36.830Z
Comments.Text: Welcome to the site. Why not just do LD directly?
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-12T17:54:46.223Z
Comments.Text: what do you mean?  I have only a vague idea of actual distances (and surely no genetic distance) because it is a non model organism. All I can do is a correlation
Comments.UserDisplayName: user1256923
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-12T19:26:30.697Z
Comments.Text: Well given my data -- unphased, no pedigree, it's not I can get much more than a correlation, hence my question -- I can create a kinship matrix, and maybe use it a prior to have some idea of the segregation and the LD, but I have no idea if anyone made some software able to do that
Comments.UserDisplayName: user1256923
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-07-12T20:52:48.003Z
Comments.Text: yes, LD is linkage disequilibrium
Comments.UserDisplayName: user1256923
Tags: <phylogenetics><phylogeny><plink><pedigree>
Title: Finding linkage disequilibrium when I have a kinship matrix but not pedigree
ThreadText: # Finding linkage disequilibrium when I have a kinship matrix but not pedigree
  
  (Asked by: username_0 on 2023-07-12)
  
  I have a bunch of samples of a non-model organism divided in two groups: parental generation and offspring. I do not have a pedigree so I do not actually know who is a parent of who, and which are the sibships. I have a bunch of SNPs that I can use to create a kinship matrix, but I cannot resolve families just using it.
  
  I want to perform linkage disequilibrium (LD) between the SNPs. I can calculate the correlation between them, but I feel I am losing a lot of power because there is kinship between samples. Is there a program that could take the kinship matrix in account when calculating the LD?
  
  I could, in theory, reconstruct the pedigree from the markers. I run multiple instance of [Colony](https://www.zsl.org/about-zsl/resources/software/colony) but the results are underwhelming -- most samples are not allocated (admittedly this raises questions on the SNP situation, but this is a whole different issue).
  
  **Tags:** phylogenetics, phylogeny, plink, pedigree
  
  > **Comments:**
  > **username_1**: Welcome to the site. Why not just do LD directly?  
  > **username_0**: what do you mean?  I have only a vague idea of actual distances (and surely no genetic distance) because it is a non model organism. All I can do is a correlation  
  > **username_0**: Well given my data -- unphased, no pedigree, it's not I can get much more than a correlation, hence my question -- I can create a kinship matrix, and maybe use it a prior to have some idea of the segregation and the LD, but I have no idea if anyone made some software able to do that  
  > **username_0**: yes, LD is linkage disequilibrium  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-07-13. Score: 2
  
  I originally thought you were working on humans. I spotted "non model organism", that changes things alot, albeit I guess humans are a non-model organism in a way. The question is what the organism. LD has been applied to every kingdom of life, except viruses. Arlequin isn't bad for relatively small to medium data sets (but tricky to get the format right - thats a separate question). If it's a genome sequence then I still suspect its plink. There are a number of recent LD programs BTW.
  
  I did notice Colony was written in Fortran! Wow, the author must be a physicist at ZSL anyway...
  
  If you have a defined number of SNPs - sounds small to medium data set - then I'd use Arlquein <http://cmpg.unibe.ch/software/arlequin35/Arl35Methods.html>, Arlquin does loads of pop gen BTW its very famous for AMOVA BTW (very cool calculation). HAPLOVIEW has been used for LD, these authors used it [here](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4641910/), what surprised me was they avoided using Arlequin for the LD but used HAPLOVIEW. There's a plethora of recent LD algorithms, never used them so can' say, e.g. [quickLD](https://onlinelibrary.wiley.com/doi/10.1111/1755-0998.13438), stuff in R.
  
  *What I am definitely saying is the LD works on from raw alleles* Thats the most important part of this response. I've attempted to describe the rationale below.
  
  ---
  
  If this is human genomes, or large genome data I'd would recommend plink analysis performed directly on your data, as described here <https://www.cog-genomics.org/plink/1.9/ld>
  
  Using any sort of matrix will remove the linkage disequilibrium signal, **IF** its a single matrix for all your data. If its multiple matrices you can perform a correlation statistic between the matrices - but its better just to do a straight linkage disequilibrium calculation, e.g. plink.
  
  The reason why correlation matrices will fail is because LD needs to identify incongruence/disparity and whether that incongruence occurs within random expectations.
  
  Basically you are making a phylogenetic tree - thats what the correlation matrix is about, but the tree assumes clonality. LD is about deviation from random expectations (equilibrium), so either a random distribution, e.g. Poison or a randomisation process is needed. What I'm attempting to say is "a tree" (single matrix) and LD are very different calculations. Whilst, technically you can do LD via matrices (plural), its better to do a LD calculation from the raw alleles.
  
  ---
  
  From the comments, it appears a "tree like structure" (ancestors) is wanted to direct an LD calculation.
  
  What you can do is subdivide the populations and perform LD on each subdivision. A tree (here using a correlation or kinship matrix) is a continuum so it's at what point do you call the the subdivision? Its doable but the information is not presented here.
  
  What you can do is use "[Structure](https://www.frontiersin.org/articles/10.3389/fgene.2013.00098/full)" - this has been upgraded alot. This is a HWE, I think using Bayes and it designates how many populations (at LD) are present in your data. You can then perform a specific LD directly on each subdivision.
  
  If you compare the output of "Structure",basically Bayesian HWE you should see a correlation with your kinship matrix. What you are inferring is a partial LD parameter that will define ancestry and whilst its doable it has never been calculated in this manner that I'm aware of: its random or it ain't and thats the criteria of significance. This is definitely how LD works in small genomes (everything below higher eukaryotes).
  
  > **Comments:**
  > **username_0**: I think there is a misunderstanding -- I have the raw alleles, and I use them for the calculation, the issue being, since I know for a fact I have *families* in the data (I just do not know the actual pedigree), I could have a much greater power if this information, or a proxy, i.e. a kinship matrix could be included in the information, because to some degree one could theoretically count how the alleles are passed from (putative) parents to (putative) offspring  
  > **username_1**: @username_0 answered above  
  
  ---
  
  