[adegenet-forum] propShared problems

Jombart, Thibaut t.jombart at imperial.ac.uk
Fri Aug 13 14:11:01 CEST 2010


Dear Tim,

Issues are always possible, but it would be nice if you could point out a particular case where calculations are 'clearly wrong'. For now it is not clear to me that the function is wrong. It works with the example dataset, and it works with the first rows of your dataset too:

> tab <- genind2df(x)
> tab
        X119 X123 X191 X197 X199 X201 X138 X140 X099 X099.1 X173 X175 X136
Nph0003  119  121  191  191  203  203  136  144  097    099  159  169  132
Nph0004  119  121  191  191  203  203  136  136  097    097  159  171  132
Nph0005  119  119  191  191  203  203  132  138  097    099  159  161  132
Nph0007 <NA> <NA>  191  191  201  205  136  136  097    099  159  159  132
        X136.1 X168 X170 X144 X144.1
Nph0003    132 <NA> <NA>  146    150
Nph0004    132  158  160  146    152
Nph0005    132  160  160  146    148
Nph0007    134  158  160  148    150

> propShared(x)
          Nph0003   Nph0004   Nph0005   Nph0007
Nph0003 1.0000000 0.7500000 0.6875000 0.5714286
Nph0004 0.7500000 1.0000000 0.6111111 0.5625000
Nph0005 0.6875000 0.6111111 1.0000000 0.4375000
Nph0007 0.5714286 0.5625000 0.4375000 1.0000000

> mean(tab[1,]==tab[2,], na.rm=TRUE)  # OK
[1] 0.75
> mean(tab[1,]==tab[3,], na.rm=TRUE) # OK
[1] 0.6875
> mean(tab[1,]==tab[4,], na.rm=TRUE) # OK
[1] 0.5714286
> mean(tab[2,]==tab[3,], na.rm=TRUE) # OK
[1] 0.6111111
> mean(tab[2,]==tab[4,], na.rm=TRUE) # OK
[1] 0.5625
> mean(tab[3,]==tab[4,], na.rm=TRUE) #OK
[1] 0.4375

All these results are right. Obviously the proportion of shared alleles is computed for sampled loci only; for instance, for proportion of shared alleles between individuals 1 and 2 equates 12/16, and not 12/18.

Can you please provide a sample of code illustrating an issue in the calculations?

Best

Thibaut.
________________________________________
From: adegenet-forum-bounces at lists.r-forge.r-project.org [adegenet-forum-bounces at lists.r-forge.r-project.org] On Behalf Of Timothy Frasier [timothy.frasier at SMU.CA]
Sent: 12 August 2010 15:15
To: adegenet-forum at lists.r-forge.r-project.org
Subject: [adegenet-forum] propShared problems

Hi,

I am trying to use the propShared function, and realized that there is an issue with the calculation - the results are clearly not calculating the proportion of shared alleles properly.  I browsed through both the R and C code to try to find the issue, but nothing immediately jumped out at me.  I will keep looking, but thought that you could likely find and fix it faster than I could.

I've attached a small example data set that I am working with (35 individuals typed at 9 microsatellite loci).  Its size is good because it is easy to calculate the proportion of shared alleles manually and then compare that to the results obtained from the propShared function.

Thanks for your help!

Sincerely,
Tim Frasier


More information about the adegenet-forum mailing list