Open hungweichen0327 opened 11 months ago
There are number of parameters that can affect f3-statistics. The default parameters in Admixtools 2 mostly match those of Admixtools, but there are some differences:
f3(A; B, C)
is ABC
in Admixtools 2, and BCA
in Admixtools.poly_only = TRUE
).When the outgroup or target population is a single pseudodiploid sample, bias correction can't be done, and Admixtools 2 will only give f3 results without bias correction when the bias correction is turned off.
In addition to that, the set of populations used when pre-computing f2-statistics affects which SNPs are used. To get identical results, that set of populations should be the same as the populations for which f3-statistics are calculated.
Here is an example for how to compute f3-statistics in 3 different settings in Admixtools 2 and Admixtools (via wrapper functions), so that the results are almost identical:
library(admixtools)
library(tidyverse)
prefix = '~/Downloads/v42.1_small'
qp3pop = '~/Downloads/AdmixTools/bin/qp3Pop'
pops = dimnames(example_f2_blocks)[[1]]
f2b = f2_from_geno(prefix, pops = pops[1:3], poly_only = F)
# target diploid
# outgroupmode NO (default with geno prefix, not possible with precomputed f2)
qp3pop_wrapper(prefix, pops[2], pops[3], pops[1], bin = qp3pop, outgroupmode = F)
f3(prefix, pops[1], pops[2], pops[3]) # est, se, z match well; n is higher
f3(prefix, pops[1], pops[2], pops[3], poly_only = T) # est, se, z match less well; n is identical
# outgroupmode YES
qp3pop_wrapper(prefix, pops[2], pops[3], pops[1], bin = qp3pop, outgroupmode = T)
f3(prefix, pops[1], pops[2], pops[3], outgroupmode = T) # est, se, z match (except *1000)
f3(f2b, pops[1], pops[2], pops[3])
# target pseudodiploid
qp3pop_wrapper(prefix, pops[1], pops[3], pops[2], bin = qp3pop, outgroupmode = T)
f3(prefix, pops[2], pops[1], pops[3], outgroupmode = T, apply_corr = F) # est, se, z match (except *1000)
Please let me know if you still aren't able to get matching results from Admixtools and Admixtools 2!
Dear @uqrmaie1 and community,
I would like to ask the outgroup f3 value between admixtools and admixtools2. I used the same dataset to run admixtools and admixtools2:
admixtools:
The script-
admixtools2:
The script in R library (admixtools)-
However, the output value of f3 is quite different. For example: admixtools:
admixtools2:
The f3 values are 3.26 in admixtools vs 0.22 in admixtools2.
Thank you for the help.