uqrmaie1 / admixtools

https://uqrmaie1.github.io/admixtools
74 stars 14 forks source link

qpWave returning one fewer ranks than expected #69

Open breslie opened 5 months ago

breslie commented 5 months ago

Hi, I'm having some issues running qpWave (with a genotype file as an input rather than f2_blocks):

In the original Admixtools the number of ranks outputted is the number of left populations -1, however when using admixtools2 (and in the qpWave example in the admixtools2 docs) the highest rank in $rankdrop is the number of left populations -2. Is there a reason for excluding the n-1 rank from results? Additionally when I run qpWave this way it also does not output anything for the f4 dataframe.

Thanks! All the best, E

uqrmaie1 commented 5 months ago

I think I didn't include the n-1 rank results in the qpwave output because a rank of n-1 corresponds to 0 degrees of freedom and a chi-squared value of 0. And so chisqdiff should always just be chisq from the n-2 rank column, and p_nested/taildiff would be p/tail from the n-2 rank column. Do you have an example of qpWave output where the n-1 rank row contains information that is not also in the n-2 rank row? If yes, what's the command that you're using?

qpwave() is just a wrapper around the qpadm() function with target = NULL. qpadm() has an argument return_f4, so you could run qpadm('data/prefix', left, right, target = NULL, return_f4 = TRUE) to get the f4 dataframe.