Closed eilishmcmaster closed 2 years ago
Hi @eilishmcmaster , where did you get this from? To get allelic frequencies, use hierfstat::pop.freq
. To get observed heterozygosities, you can indeed use hierfstat::basic.stats
. Example below:
library(hierfstat)
data(diploid)
pop.freq(diploid)
basic.stats(diploid)$Ho
Best wishes
@eilishmcmaster , can you let me know if I have answered your question, and if so, can you close the issue? many thanks.
Hi Jerome,
Please find the example attached. It contains the calculations by Hierfstat for Ho, my manual recreation of this to show that the calculation is not Ho, and how Ho could be calculated. I was wrong initially in saying the Hierfstat is calculating allele frequency instead of Ho; it appears to be finding the proportion of each population that contains allele 'A'. Observed heterozygosity (Ho) should be the number of individuals heterozygous at a locus (Aa = 1 in genotype matrix) divided by the number of individuals in the population to get the heterozygote frequency ( https://www.mun.ca/biology/scarr/2900_Population_Genetics.html) -- my example in the doc shows this.
If I have misunderstood anything please forgive me, but if this error is what I think it is it should be addressed.
Thanks for your time, Eilish
On Tue, Jul 19, 2022 at 5:05 PM E. S. McMaster @.***> wrote:
Hi Jerome,
Sorry for the delay, I'm just making an example to show you. I'll get back to you within the next couple of days if that's ok.
Thanks, Eilish
On Mon, Jul 18, 2022 at 8:03 PM Jerome Goudet @.***> wrote:
@eilishmcmaster https://github.com/eilishmcmaster , can you let me know if I have answered your question, and if so, can you close the issue? many thanks.
— Reply to this email directly, view it on GitHub https://github.com/jgx65/hierfstat/issues/60#issuecomment-1187006045, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQCT7Q5ODKNEAIIQ3BQ6QQTVUUTYJANCNFSM53QHNGVQ . You are receiving this because you were mentioned.Message ID: @.***>
Thanks @eilishmcmaster .
I don't see any attachment, unfortunately. I strongly suspect the issue you have is with your input data format. Have a look at the vignette importing data in hierfstat, it might help. If this does not solve your problem, you might want to paste a reproducible example in your comment? Best wishes
The Ho output by
basic.stats
is allele frequency; it sums the alleles for each group in each loci and then divides by the number of individuals in that group and 2 to get allele frequency. Ho is meant to find the actual number of heterozygous individuals and divide that by the total number of individuals in the group.