millanek / Dsuite

Fast calculation of Patterson's D (ABBA-BABA) and the f4-ratio statistics across many populations/species
160 stars 26 forks source link

Mixed ploidy within populations #80

Open elsemikk opened 11 months ago

elsemikk commented 11 months ago

Hello,

I am working with a sample of mixed males and females, and am interested in comparing levels of introgression on autosomes vs the sex chromosome. I have the females genotyped as haploid on their sex chromosome Z (it is a ZW species) and males genotyped as diploid. I was wondering if it is possible to analyze this type of mixed ploidy dataset in Dsuite?

Before, I was using Dsuite version 0.4r42, and artificially turning the haploid female genotypes into diploid homozygous genotypes in order to run it (it would give very extreme results if I didn't diploidize the females). I noticed that in the current version, it gives nearly identical results whether I "diploidize" the females or give it my VCF mixed with haploid females and diploid males.

Is the new version of Dsuite able to handle mixed ploidy? Is it turning the haploids into homozygous diploids, or counting them as haploids?

(In case it helps clarify, here is an example of a site in my VCF file showing the mixed ploidy)

chr_Z   3115858 .       C       G       211.87  .       DP=3117;VDB=7.46147e-19;SGB=73.2583;RPBZ=0.200087;MQBZ=-0.295486;MQSBZ=0.128793;BQBZ=-1.86751;SCBZ=-0.343654;MQ0F=0.000320821;AC=1;AN=106;DP4=1491,1594,12,20;MQ=59     GT:PL:DP:SP:AD:GP:GQ    0/0:0,178,255:59:0:59,0:1,0,0:127       0/0:0,75,255:25:0:25,0:1,0,0:127        0/0:0,75,255:25:0:25,0:1,0,0:127        0/0:0,93,255:31:0:31,0:1,0,0:127        0/0:0,96,255:32:0:32,0:1,0,0:127        0/0:0,87,255:29:0:29,0:1,3.23813e-11,2.08224e-30:104    0/0:0,78,255:26:0:26,0:1,2.57214e-10,2.08224e-30:95     0:0,110:3:0:3,0:1,8.11456e-14:127       0/0:0,193,255:64:0:64,0:1,8.13383e-22,2.08224e-30:127   0/0:0,126,255:42:0:42,0:1,4.07657e-15,2.08224e-30:127   0:0,255:15:0:15,0:1,2.56605e-28:127     0/0:0,235,255:78:0:78,0:1,5.1321e-26,2.08224e-30:127    0/0:0,30,226:10:0:10,0:0.999984,1.62289e-05,1.65395e-27:47      0/0:0,190,255:63:0:63,0:1,1.62291e-21,2.08224e-30:127   0/0:0,51,255:17:0:17,0:1,1.28912e-07,2.08224e-30:68     0/0:0,48,255:16:0:16,0:1,2.57214e-07,2.08223e-30:65     0/0:0,27,242:9:0:9,0:0.999968,3.23803e-05,4.15447e-29:44        0/0:0,12,141:4:0:4,0:0.998977,0.00102294,5.22499e-19:29 0/0:0,15,152:5:0:5,0:0.999487,0.000512947,4.15248e-20:32        0/0:0,21,183:7:0:7,0:0.999871,0.000128896,3.2997e-23:38 0/0:0,211,255:70:0:70,0:1,1.28912e-23,2.08224e-30:127   0:13,196:8:0:7,1:1,4.06691e-21:127      0:0,67:2:0:2,0:1,1.61907e-09:87 0:0,255:32:0:32,0:1,2.56605e-28:127     0/1:255,0,255:33:1:18,15:1.94852e-24,1,1.28302e-28:127  0:0,243:10:0:10,0:1,4.06691e-27:127     0/0:0,175,255:58:0:58,0:1,5.1321e-20,2.08224e-30:127    0/0:0,238,255:79:0:79,0:1,2.57214e-26,2.08224e-30:127   0/0:0,27,249:9:0:9,0:0.999968,3.23803e-05,8.28926e-30:44        0:0,195:7:0:7,0:1,2.56605e-22:127       0:0,77:2:0:2,0:1,1.61907e-10:97 0:0,150:5:0:5,0:1,8.11456e-18:127       0:0,255:18:0:18,0:1,2.56605e-28:127     0/0:0,21,213:7:0:7,0:0.999871,0.000128896,3.2997e-26:38 0/0:0,172,255:57:0:57,0:1,1.02399e-19,2.08224e-30:127   0/0:0,39,255:13:0:13,0:0.999998,2.04312e-06,2.08223e-30:56      0/0:0,27,252:9:0:9,0:0.999968,3.23803e-05,4.15447e-30:44        0:0,70:2:0:2,0:1,8.11456e-10:90 0:0,255:15:0:15,0:1,2.56605e-28:127     0/0:0,255,255:85:0:85,0:1,5.1321e-28,2.08224e-30:127    0:0,130:4:0:4,0:1,8.11456e-16:127       0/0:0,63,255:21:0:21,0:1,8.13383e-09,2.08224e-30:80     0:0,138:4:0:4,0:1,1.28607e-16:127       0/0:0,27,244:9:0:9,0:0.999968,3.23803e-05,2.62129e-29:44        0/0:0,226,255:75:0:75,0:1,4.07657e-25,2.08224e-30:127   0/0:0,232,255:77:0:77,0:1,1.02399e-25,2.08224e-30:127   0/0:0,30,249:10:0:10,0:0.999984,1.62289e-05,8.28939e-30:47      0:0,254:10:0:10,0:1,3.23046e-28:127     0:0,80:2:0:2,0:1,8.11456e-11:100        0:0,37:1:0:1,0:0.999998,1.61906e-06:57  0:0,213:7:0:7,0:1,4.06691e-24:127       0/0:0,30,255:10:0:10,0:0.999984,1.62289e-05,2.0822e-30:47

Thanks for making such a useful program!

millanek commented 9 months ago

Yes, exactly, the newer versions (since July 2022) should be able to handle arbitrary ploidy, including mixed ploidy, based on request from Nélida Padilla and Filip Kolar. Did I not mention it in the documentation?

elsemikk commented 9 months ago

Fantastic, that is great to hear! I didn't see anything about ploidy in the documentation, although I see now that the change log mentions support for arbitrary ploidy in Dtrios. Glad to hear that it includes mixed ploidy datasets!