Goal
Check that allele frequency is estimated correctly for autosomal and X chromosome.
Proposed approach
Allele frequency for diploids is estimated as sum(g) / (2 * nInd) where g are genotypes coded as [0, 1, 2] and 2 * nInd is the total number of alleles. With X chromosome, we have in males only g = [0, 1] so the total number of alleles is smaller, hence the correct formula for allele freq in that case is sum(g) / (2 * nFemales + nMales). We should of course work with underlying genotype probabilities, but these are added up into allele dosages (g) anyway.
I think the actions are:
- Take a small example and calculate allele frequencies for the founder by hand
- Compare the above calculation with what AlphaPeel - if they match, we have no issue, but might still want to add a unit test; if they don't match, we should fix the calculation
Scope
What files/modules are affected? Would have to check;)
#270 reported that in the code, we have the following warning (edited 2026-05-25):
if peelingInfo.isXChr:
warnings.warn(
"Updating error rates and alternative allele frequencies for X chromosomes are not well test and will break in interesting ways. Recommend running without that option."
)
Done when
The above proposed check, tests, and changes are sorted, and lastly the warning is removed. (edited 2026-05-25).
Goal
Check that allele frequency is estimated correctly for autosomal and X chromosome.
Proposed approach
Allele frequency for diploids is estimated as
sum(g) / (2 * nInd)wheregare genotypes coded as[0, 1, 2]and2 * nIndis the total number of alleles. With X chromosome, we have in males onlyg = [0, 1]so the total number of alleles is smaller, hence the correct formula for allele freq in that case issum(g) / (2 * nFemales + nMales). We should of course work with underlying genotype probabilities, but these are added up into allele dosages (g) anyway.I think the actions are:
Scope
What files/modules are affected? Would have to check;)
#270 reported that in the code, we have the following warning (edited 2026-05-25):
Done when
The above proposed check, tests, and changes are sorted, and lastly the warning is removed. (edited 2026-05-25).