You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to verify I was getting correct answers from my hapbin iHS analysis, so I designed a minimal test case for iHS data.
Briefly, the dataset consists of 19 SNPs, where the haplotype structure is symmetrical around the 10th central SNP. This SNP has 5 ancestral allele haplotypes, which decay quickly by one haplotype per SNP. And 5 derived SNP haplotypes, which maintain their haplotype for 4 SNPs, before decaying at exactly the same rate as the ancestral.
The genetic distance is uniform, with 1 unit per SNP.
I manually calculated the iHS here to be log((4 + 4 + 1.5 + 1.5)/(1.5 + 1.5)) = 1.29928.
However, when I run this dataset through ihsbin, it fails to give me a value for this SNP.
Remember to use --alt with selscan. Hapbin uses frequency squared, not binomial coefficients for EHH.
I did some digging and it looks like selscan has an off by one error for ehh. Using selscan, if you generate the ehh for rs8, you get the tree for the central locus, rs9.
ihsbin, isn't outputting the result because the standardized score is nan. However, it works out correctly with ehhbin:
Thanks for the super quick reply- much appreciated. I wasn't aware of 2 different methods for calculating EHH. That would explain a lot!
EHH is the probability that two haplotypes drawn from the distribution are identical (at least from Sabeti). So according to the frequency squared method, you can never decay below EHH=0.2 with 5 core haplotypes? That seems a bit strange to me. I guess the difference is that the freq sq method has the idea of sampling with replacement, so then 0.2 would make sense. I would expect the 2 methods to be at their most different when the frequency of the core SNP is either low or high?
Additionally should ihsbin not report values even if no standardization possible (due to n=1)? I guess it's a moot point for analyses, but handy for test cases.
Sorry to bug you again. I ran the same data using xpehhbin. Splitting the first 5 haplotypes (ancestral) and the second 5 haplotypes (derived) into popA and popB.
The xpehh score should match the ehh score for this SNP, ie 0.76214 as established above.
This result just looks a bit odd to me, surely the data should be symmetrical on the SNPs reported?
Additionally, the rs9 SNP doesn't agree with ihsbin. Should we even be getting any data here, as the ehh will never decay to 0.05? Unless you calculate EHH across all samples to determine the cutoff position?
I increased the cutoff, as I thought that might explain the difference observed with rs9.
Sorry it took me so long to get back to you. I was on vacation, then forgot for a couple days. This should be fixed in Pull #34.
I also added binomial coefficient support. Just use --binom. Keep in mind that for this test the combined-population EHH falls to 0.0222222 before it goes to 0.0, so -c 0 is necessary to go all the way.
Activity
camaclean commentedon Jul 14, 2016
Hi,
Remember to use --alt with selscan. Hapbin uses frequency squared, not binomial coefficients for EHH.
I did some digging and it looks like selscan has an off by one error for ehh. Using selscan, if you generate the ehh for rs8, you get the tree for the central locus, rs9.
ihsbin, isn't outputting the result because the standardized score is nan. However, it works out correctly with ehhbin:
hardingnj commentedon Jul 15, 2016
Thanks for the super quick reply- much appreciated. I wasn't aware of 2 different methods for calculating EHH. That would explain a lot!
EHH is the probability that two haplotypes drawn from the distribution are identical (at least from Sabeti). So according to the frequency squared method, you can never decay below EHH=0.2 with 5 core haplotypes? That seems a bit strange to me. I guess the difference is that the freq sq method has the idea of sampling with replacement, so then 0.2 would make sense. I would expect the 2 methods to be at their most different when the frequency of the core SNP is either low or high?
Additionally should ihsbin not report values even if no standardization possible (due to n=1)? I guess it's a moot point for analyses, but handy for test cases.
Thanks again
hardingnj commentedon Jul 15, 2016
Hi,
Sorry to bug you again. I ran the same data using xpehhbin. Splitting the first 5 haplotypes (ancestral) and the second 5 haplotypes (derived) into popA and popB.
The xpehh score should match the ehh score for this SNP, ie 0.76214 as established above.
Running with:
xpehhbin --hapApopA.hap --hapB popB.hap --map snp_desc.map --out result --minmaf 0.05 -c 0.05gives:
This result just looks a bit odd to me, surely the data should be symmetrical on the SNPs reported?
Additionally, the rs9 SNP doesn't agree with ihsbin. Should we even be getting any data here, as the ehh will never decay to 0.05? Unless you calculate EHH across all samples to determine the cutoff position?
I increased the cutoff, as I thought that might explain the difference observed with rs9.
xpehhbin --hapApopA.hap --hapB popB.hap --map snp_desc.map --out result --minmaf 0.05 -c 0.2gives:
This looks more sensible, but rs8 and rs10 have slightly different values, when they should be the same?
Also, the rs9 value is a bit off when compared to the ehh value; any idea of the reason for this?
camaclean commentedon Aug 2, 2016
Sorry it took me so long to get back to you. I was on vacation, then forgot for a couple days. This should be fixed in Pull #34.
I also added binomial coefficient support. Just use --binom. Keep in mind that for this test the combined-population EHH falls to 0.0222222 before it goes to 0.0, so -c 0 is necessary to go all the way.
hardingnj commentedon Aug 3, 2016
Much appreciated- thanks!