Monday, March 24, 2014

Autosomal DNA Cousin Calculator

Autosomal DNA Cousin Calculator


Can you calculate your genetic cousins? Mar 24, 2014

Update  Jan 31, 2018:

Data and phylogenetic tree resulting from the use of the half life decay rate calculations. Basically, an update to the previous article by applying the autosomal half life decay equation.

The thought occurred to me to respond to a query from Lucy Sinkular on the Rootsweb Genealogy-DNA email list regarding matching autosomal chromosome segments to an adopted person, along with her known cousins. I thought I would mention something that I had put into my autosomal DNA spreadsheet to estimate cousin relationships. I used my "CousinCalc" equation (from my spreadsheet) to informed her that I got an estimation of 10th cousin for her genetic cousin, who was adopted.


I used my "CousinCalc" to estimate that her adopted genetic cousin was on the order of 10th cousin.

Back on September 28, 2011 Jared Roach, M.D., Ph.D. Senior Research Scientist Institute for Systems Biology posted a note on the Genealogy-DNA email list for the logic behind the prediction of cousin relationships. The theory is that the number of segments, when combined with the size of the segments, can be used to estimate distant relationships.


"Maximum-likelihood Estimation of Recent Shared Ancestry (ERSA)," Genome Res., May 21, 2011. ( see http://genome.cshlp.org/content/21/5/768/F1.expansion.html)


Long autosomal segments are unlikely to be from distant relationships, and short segments can either be from close or distant relationships. The equation given in the paper is based on an equation given by Thomas in 1994:


                  (dt/100)

   P(t) = e^



d = number of meiosis
t = length of segment in cM



For these past 20 years or so, the "number of meiosis" has been taken to be the number of segments. Terms have been introduced to define valid segments (Identical By Descent, or IBD) and invalid segments (Identical By State, or IBS). Segments are considered to be IBS if, in general, they are small (less than 5 to 7 cM, or less than 500 SNPs).



The above equation does not always work well, so a large number of probability distribution functions and Monte Carlo simulations have been invented in order to help make some reasonable estimates of relatedness between two matching individuals. The topic is popular because the predicting relatedness has a number of applications, from family history to medicine.


However, the thought that was nagging me was why were these scientists not using SNP's vs. cMs?? 


So, I thought I would try to find out. Upon investigating, I found that this equation worked for predicting my 4th and fifth cousins:


      CousinCalc = (1,000 x ToTal_cMs)/ToTal_SNPs


But that would change, as I attempted to incorporate closer relationships.



When I ignore the concept of IBD and IBS (and just use the sum of the figures as given by Family Tree DNA in their Family Finder product), this equation works for the distant cousins that I knew about thus far. An alternative method (such as an average size), would make use of segment counts. That type of calculation returns fairly dependable results. However, this 'CousinCal' equation does not use segment counts. My thought here was  to perform a study of the combination of SNP's and CentiMorgans.

But, the questions that bothered me was, 'is my sample too small??'
Would this be a statistically valid equation?



I don't have enough data to answer that, so I asked around.

I looked at Tim Janzen's autosomal segment matches to his mother, which has made publicly available. My "CousinCalc" came back with a cousin estimation of 6th cousin. Clearly, my "CousinCalc" equation (above) does not work for cousins less than 1. 

However, to be fair, Tim Janzen does not list his small segments for close relationships, and I believe this may be because companies such as Family Tree DNA do not report small segments for close relationships. So, the sum of any small segments is an unknown part of the equation. Yet, in use of my equation, I do find that the sum of all segments delivers nearly the same result as the sum of the largest segments.

Therefore, I can see that the expectation is that the "CousinCalc" equation will not to hold for cousins less than 1.

Tim Janzen has his provided information in the past.

For more distant relationships, you should begin to see a departure from large segments reflecting the results of this equation. Therefore, for distant relationships, you would want to use sums in cMs and SNPs for the above.

Ann Turner had the most patience with this idea. However, she wasn't exactly warming up to the idea of using the above equation. She explained that 23AndMe uses segments vs. cMs, as in the article Cryptic Distant Relatives are Common in both Isolated and Cosmopolitan Samples” and the chart (Fig, 3) is given on this page:

   http://blog.23andme.com/news/announcements/how-many-relatives-do-you-have/


Simulated data showing the relationship between shared identical segments of DNA (IBD-half) and # of shared segments for different degrees of relatedness in a population with European ancestry. http://blog.23andme.com/news/announcements/how-many-relatives-do-you-have/
In short, this is the basis for the "Relative Finder" tool available at 23AndMe, as described here:     ( https://www.23andme.com/ancestry/ )

I should note that the Team at Huff Lab has the ERSA software is freely available for download from their web site:


The data chosen for the chart were IBD segments, which basically means that the chart includes matching segments that are larger than 10 cMs. Which means, the number of IBD segments in the matches to your autosomal DNA that are over 10 cMs is an indication of how related they might be to you. Because segments do not fit very well, there are some fairly heavy duty probability equations behind the above chart. 

Then I thought, well, let me draw up what SNP's vs. cMs might look like.

Here is what my fourth cousin's matching segments look like for the individual segments:


and here is what my fifth cousin's matching segments look like for individual segments:

Individual autosomal segments vs. Centimorgans (cMs)


 This appeared to be a direct (near linear) relationship between SNP's and cMs. However, perhaps not statistically valid (not enough sample data). So, I thought I would see if Family Tree DNA's Chromosome Browser matching segments might give enough data to support the same direct (linear) relationship between SNP's and cMs. That produced the following chart:


When matching autosomal DNA segments are summed, the sums produce a chart that shows a direct relationship between total SNP's and total cMs. 1076 individual segments where SNP's and cM's have been summed per matching person.




Elizabeth Harris wrote me to say that she did not use SNP's because they did not work for her. Basically, she tested with 23AndMe, and the calculation did not work for 4 of her cousins with matching segments on chromosome 15.The 'CousinCalc' equation came out to be 33rd cousins for that segment, and the math is rather tortuous if you want the equation to come out as fourth cousins for that particular segment on chromosome 15.


Ann Turner cited this chart from Rutgers' University:


http://web.archive.org/web/20070113005025/http://compgen.rutgers.edu/maps/compare.pdf


The basic point there being that the marker position along chromosome 15 begins at about 20 MB. As does chromosome 13 and 14, but it is not a common phenomena among chromosome measurements.


However, I should point out that unfortunately, Elizabeth only gave the values for chromosome 15, and I did not get to see what 'CousinCalc' looks like using sums across all matching chromosomes for her 4th cousins. Elizabeth did not provide data for any other matching chromosome, so I did not get to see what the data looks like from 23AndMe.


And finally, Ann Turner also pointed out that chromosome 15 has some poor regions being reported out, and a number of other chromosomes have the same problem. She cited Table 3 of this article: "Relationship Estimation from Whole-Genome Sequence Data," Hong Li, et. al. Jan 2014.


  http://www.plosgenetics.org/article/fetchObject.action?uri=info%3Adoi%2F10.1371%2Fjournal.pgen.1004144&representation=PDF


That Table 3 shows two segments on chromosome 15 - one between starting location of 20,967,673 and ending at 25,145,260 that show a length of 10.46 cMs and the other starting at 27,115,823 and ending at 30,295,750 with a length of 9.29 cMs. That's two to three times what you might expect to be the length in cMs.Other chromosomes showing this type of anomaly include chromosomes 1, 2, 6, 8, 9, 10, 16, 17, 21, and 22. A total of some 14 regions.


Finally, the GedMatch.com web site has a utility that plugs relationship calculations into some of their reports. However, I think that Tim Janzen mentioned that GedMatch has not yet converted to Build 37. Family Tree DNA is now at Build 37, so the results may look slightly different at GedMatch than what you may see at your vendor.


     http://gedmatch.com/


That would be a brief overview regarding why SNP's are not usually compared vs. the use of  Centimorgans.

 An easy way to determine an estimate is to add all of your segment results and use the average. Take the total shared DNA and divide by the number of segments shared in order to get the average size in cMs.

Then go to the table on this site and look up the relationship:


 http://www.isogg.org/wiki/Autosomal_DNA_statistics

 Pretty handy for a quick reference.

In August, 2015, Robert James Liguori commented on this story (below) and lent the data that he had on hand. I then used Robert's data to derive a simple equation that would return large cousin values for small cM and SNP values, and at the same time deliver small cousin values for large cM values and large SNP values. Normally, a mathematician would want to derive that sort of equation using differential equations or a series, or a transformation, or probability distribution. Since I have limited data, I used no tools to derive the equation, and kept it simple for direct testing.

CCalc_V2 = SQRT(1/SQRT((F3*F3) / G3)*(0.75*SQRT(G3/F3))*(G3/(F3*600)))   
where:

   F3 is the cM segment values from column 'F' on line 3
   G3 is the SNP segment value from column 'G' on line 3 

  
I would imagine that some academics would prefer exponential or natural logs in the equation, but this one was fairly straightforward for me to test. It certainly can be improved. 

  
 In the event that you prefer the equation for programming purposes:


Alpha =  sqrt(1/sqrt((cMs * cMs) / SNPs) * (.75*sqrt(SNPs / cMs)) * (SNPs/(cMs * 600)))


A few things I know about the use of the equation at the moment:

 - This works better on individual segments than it does on sums. Largest segment is good.
 - It still does not work well for cousins less than 1, but this is an improvement.
 - It does not handle "2nd Removed," etc. very well.
 - It is mostly designed to work with values in excess of 3 cMs (use values greater than 3 cMs). Therefore, if you see the wrong value, please check the size in cMs first. 


 
 Here is a display of what the cousin calculator equation look like for a few of my cousins:


Autosomal DNA 'CousinCalc' equation for fourth cousin using SNPs vs. cMs.


 Using the Cousin Calculator version 2 returns the expected value for the cousin relationship on the largest segment. The smaller segments suggest an older ancestral relationship.



Autosomal DNA 'CousinCalc' equation for fourth cousin, once removed using SNPs vs. cMs.

In the above, there are several segments that return (roughly) the expected value.

 
Autosomal DNA 'CousinCalc' equation for fourth cousin using SNPs vs. cMs.

 
Autosomal DNA 'CousinCalc' equation for fifth cousin using SNPs vs. cMs.



The next step should be to try to gather enough data regarding the results of this equation in order to determine if this is a valid calculation that I can use in my spreadsheet. If the statistics do not bear it out as valid, then the following step should be to determine if the problems mentioned above could be remedied (or avoided) by use of a program.

I use the cousin calculator in an examination of autosomal DNA segment triads here:

 http://hamcountry-blog.blogspot.com/2015/09/autosomal-small-segment-triangulation.html

  
I used the information from the cousin calculator to create a 'Dean McGee' style Time to Most Recent Common Ancestor (TMRCA) table within the above report. It was interesting to see a TMRCA table from females for a change. That information (in years) can be used to create a phylogenetic tree. For the years, I used the calculation:

   Years = 2 * (Cousin Cal V2 value) * (25 years per generation)
 
Robert James Liguori subsequently posted his own calculation tool, but that site is no longer available (see comments).






Updated 03/27/2014 - fix for math error in table for Frank, made hyperlinks active.

---------------------------------------------------------------------------------------------------------------- 
Update 08/25/2015 - I posted an improved equation to the Genealogy-DNA email list:

Hello,

I have been playing around with my cousin calculator again, and have tried to have it work better at the extreme limits. That is, have it return a small result when the cMs are huge, and return a huge result when the cMs are small. I received some cMs, SNP counts, and relationships from Robert James Liguori, which includes some data on close relationships that I do not have. 

  
If anyone would care to humor me and plug it into your spreadsheet from FTDNA, my cousin calculator version 2 equation now looks like this: 

  
= SQRT(1/SQRT((F3*F3) / G3)*(0.75*SQRT(G3/F3))*(G3/(F3*600))) 

  
where:

   F3 is the cM segment values from column 'F' on line 3
   G3 is the SNP segment value from column 'G' on line 3 

  
I would imagine that some academics would prefer exponential or natural logs in the equation, but this one was fairly straightforward for me to test. It certainly can be improved. 

  
A few things I know at the moment:

 - This works better on segments than it does on sums.
 - It still does not work well for cousins less than 1, but this is an improvement.
 - It does not handle "2nd Removed," etc. very well.
 - It is mostly designed to work with values in excess of 3 cMs (use values greater than 3 cMs). Therefore, if you see the wrong value, please check the size in cMs first. 

  
   I designed it so that it could handle small values (large cousin values), just so I could see how large a cousin value it would return. The largest value that I have seen generated is around 100th cousin, which I would guess would be in the vicinity of 200 generations, or 5,000 years at 25 years per generation. 

  
Thanks for the data from Robert James Liguori.


Fun stuff.


---------------------------------------------------------------------------------------------------------------- 
Updated:  09/11/2015 It appears that Huff Labs no longer the web interface to their ERSA software. Updated to indicate that you can download their software.

---------------------------------------------------------------------------------------------------------------- 
Updated:  10/05/2015
Re-phrasing on the reference to Tim Janzen's data, updated to include the new calculation derived from the data of Robert James Liguori, and an update of the graphics in order to illustrate the use of sums vs using individual segments.