Closed themrca closed 3 years ago
I've updated the code of pop.freq
, could you check that it works for you now (and close the issue if it does)?
> data(nancycats)
> nancy<-genind2hierfstat(nancycats)
> pairwise.WCfst(nancy[,1:2])
P01 P02 P03 P04 P05 P06
P01 NA 0.09323373 0.24021645 0.157060170 0.0815597343 0.22567262
P02 0.093233729 NA 0.18542956 0.132852641 0.1191556811 0.17250886
P03 0.240216450 0.18542956 NA -0.022826980 0.0233107512 0.07660228
P04 0.157060170 0.13285264 -0.02282698 NA -0.0023630816 0.05949314
P05 0.081559734 0.11915568 0.02331075 -0.002363082 NA 0.09146862
P06 0.225672619 0.17250886 0.07660228 0.059493136 0.0914686152 NA
P07 0.023267785 0.03806949 0.10147960 0.047847669 0.0454095905 0.10999849
P08 0.043771064 0.09653632 0.08437396 0.025497622 0.0003747424 0.14233079
P09 0.072295193 0.10882885 0.10284643 0.044245614 0.0236636323 0.13958471
P10 -0.008143676 0.15227212 0.24162943 0.184539722 0.0884438858 0.21358575
P11 0.101921513 0.12489942 0.08164284 0.071301585 0.0551098469 0.07688131
P12 0.145163743 0.06363464 0.05724643 0.038597605 0.0495844523 0.09183223
P13 0.258465793 0.05762875 0.21103359 0.178395155 0.1811275861 0.21678755
P14 0.116906946 0.07337098 0.01552991 -0.002740003 0.0096153846 0.04090290
P15 0.035236989 0.09568104 0.08585023 0.037584622 -0.0202418025 0.14140271
P16 0.130137107 0.15636123 0.12210866 0.077406319 0.0359802578 0.02813110
P17 0.169114599 0.10822873 0.14855712 0.115878404 0.1370953412 0.17178073
P07 P08 P09 P10 P11 P12
P01 0.023267785 0.0437710644 0.07229519 -0.008143676 0.10192151 0.14516374
P02 0.038069494 0.0965363212 0.10882885 0.152272123 0.12489942 0.06363464
P03 0.101479599 0.0843739578 0.10284643 0.241629425 0.08164284 0.05724643
P04 0.047847669 0.0254976217 0.04424561 0.184539722 0.07130159 0.03859760
P05 0.045409590 0.0003747424 0.02366363 0.088443886 0.05510985 0.04958445
P06 0.109998494 0.1423307894 0.13958471 0.213585746 0.07688131 0.09183223
P07 NA -0.0065469582 0.01230315 0.087668454 0.03997591 0.02498091
P08 -0.006546958 NA -0.04768452 0.114131434 0.10272892 0.08355250
P09 0.012303150 -0.0476845194 NA 0.137579258 0.12326224 0.09258043
P10 0.087668454 0.1141314336 0.13757926 NA 0.06482531 0.14943311
P11 0.039975907 0.1027289236 0.12326224 0.064825307 NA 0.04586027
P12 0.024980908 0.0835524952 0.09258043 0.149433107 0.04586027 NA
P13 0.171172220 0.2113610894 0.21534463 0.276605851 0.20078256 0.13116513
P14 0.009330044 0.0457893052 0.04487560 0.139401698 0.03781000 0.01761559
P15 0.026187318 -0.0134611175 0.01861267 0.069918699 0.08688964 0.08123570
P16 0.112270760 0.1020125759 0.11920430 0.099313242 0.07665083 0.11018574
P17 0.048836461 0.1614980446 0.19504276 0.205339420 0.08046843 0.10781245
P13 P14 P15 P16 P17
P01 0.25846579 0.116906946 0.03523699 0.13013711 0.16911460
P02 0.05762875 0.073370980 0.09568104 0.15636123 0.10822873
P03 0.21103359 0.015529909 0.08585023 0.12210866 0.14855712
P04 0.17839516 -0.002740003 0.03758462 0.07740632 0.11587840
P05 0.18112759 0.009615385 -0.02024180 0.03598026 0.13709534
P06 0.21678755 0.040902902 0.14140271 0.02813110 0.17178073
P07 0.17117222 0.009330044 0.02618732 0.11227076 0.04883646
P08 0.21136109 0.045789305 -0.01346112 0.10201258 0.16149804
P09 0.21534463 0.044875599 0.01861267 0.11920430 0.19504276
P10 0.27660585 0.139401698 0.06991870 0.09931324 0.20533942
P11 0.20078256 0.037809997 0.08688964 0.07665083 0.08046843
P12 0.13116513 0.017615587 0.08123570 0.11018574 0.10781245
P13 NA 0.133533883 0.19319820 0.22248173 0.22087884
P14 0.13353388 NA 0.02230556 0.06171288 0.03932543
P15 0.19319820 0.022305564 NA 0.05745064 0.12268705
P16 0.22248173 0.061712879 0.05745064 NA 0.18800976
P17 0.22087884 0.039325427 0.12268705 0.18800976 NA
Works perfectly. Thanks a lot!
Hi,
I have a multiallelic and multilocus dataset and I use pairwise.WCfst to quantify pairwise population differentiation. The function works without problem for the complete dataset bu when I try to estimate pairwise fst for each loci separately, I get an error "Error in pop.freq(dat, diploid) : error in frequency estimation. Exiting"
I did not get the same error with gtrunchier dataset but I was able to replicate it with the nancycats dataset of adegenet.
Yet, when I try pop.freq(nancycats_hf[,c(1,2)]) I get the allele frequencies per population without problem. I thought that might be related to missing data but third column does not contain any missing data and pairwise.WCfst(nancycats_hf[,c(1,3)]) raises the same error with a different wording;
Error in pop.freq(cbind(rep(1, length(pop)), dat[, -1]), diploid) : error in frequency estimation. Exiting
I could not find a way around it. I would appreciate any help! If there is a better way to calculate pairwise fst per loci I would also be happy to hear about it.
Best, Onur