I found a minor bug in the WC_FST_Diploids_2Alleles function. Presently the p_freqs object tallies the homozygous absent counts (Sample_Mat[, 1], instead of Sample_Mat[, 3]), along with half the heterozygotes to tabulate the meanAlleleFreq output.
Here's an example of the Sample_Mat object layout:
> Sample_Mat
0 1 2
1 701 1595 2704
2 4524 180 296
So the meanAlleleFreq output is actually tallying up the frequency of the ancestral, or REF, alleles, instead of the the derived, or ALT, alleles. This leads to a meanAlleleFreq value that's 1-p if you're interested in the ALT allele frequency. I highlighted the change in the function below with #'s.
Hello,
I found a minor bug in the
WC_FST_Diploids_2Alleles
function. Presently the p_freqs object tallies the homozygous absent counts (Sample_Mat[, 1], instead of Sample_Mat[, 3]), along with half the heterozygotes to tabulate the meanAlleleFreq output. Here's an example of the Sample_Mat object layout:So the meanAlleleFreq output is actually tallying up the frequency of the ancestral, or REF, alleles, instead of the the derived, or ALT, alleles. This leads to a meanAlleleFreq value that's 1-p if you're interested in the ALT allele frequency. I highlighted the change in the function below with #'s.