jgx65 / hierfstat

the hierfstat package
24 stars 14 forks source link

pairwise.neifst doesn't work if I use diploid=FALSE #26

Closed akang1414 closed 5 years ago

akang1414 commented 5 years ago

I am calculating pairwise.neifst for a haploid organism like below pairwise.neifst(data, diploid=FALSE)

It returns NA for all the comparisons. But if i remove diploid then it does give out some values. pairwise.neifst(data)

How do I fix this? Thanks!

jgx65 commented 5 years ago

I am puzzled, if I run it on a toy example:

 x<-matrix(sample(9,size=1000,replace=TRUE),nrow=100) 
pop<-rep(1:10,each=10) 
pairwise.neifst(cbind(pop,x),diploid=FALSE) 

it works:

         1       2       3       4       5       6       7       8       9      10
1       NA -0.0023 -0.0101  0.0066  0.0062  0.0119 -0.0054 -0.0066  0.0009 -0.0102
2  -0.0023      NA -0.0014  0.0040  0.0169  0.0126 -0.0080 -0.0126 -0.0118  0.0007
3  -0.0101 -0.0014      NA  0.0140  0.0278 -0.0075  0.0056 -0.0057 -0.0128 -0.0025
4   0.0066  0.0040  0.0140      NA -0.0010 -0.0066 -0.0093 -0.0219 -0.0176 -0.0084
5   0.0062  0.0169  0.0278 -0.0010      NA  0.0221 -0.0214 -0.0030 -0.0056 -0.0043
6   0.0119  0.0126 -0.0075 -0.0066  0.0221      NA  0.0118 -0.0212 -0.0261  0.0170
7  -0.0054 -0.0080  0.0056 -0.0093 -0.0214  0.0118      NA -0.0169 -0.0230  0.0010
8  -0.0066 -0.0126 -0.0057 -0.0219 -0.0030 -0.0212 -0.0169      NA -0.0415 -0.0288
9   0.0009 -0.0118 -0.0128 -0.0176 -0.0056 -0.0261 -0.0230 -0.0415      NA -0.0129
10 -0.0102  0.0007 -0.0025 -0.0084 -0.0043  0.0170  0.0010 -0.0288 -0.0129      NA
jgx65 commented 5 years ago

Could you post a toy example with your problem?

akang1414 commented 5 years ago
> x<-matrix(sample(9,size=1000,replace=TRUE),nrow=100) 
> pop<-rep(1:10,each=10) 
> pairwise.neifst(cbind(pop,x),diploid=FALSE) 

Doesn't work
1 2 3 4 5 6 7 8 9 10 1 NA NA NA NA NA NA NA NA NA NA 2 NA NA NA NA NA NA NA NA NA NA 3 NA NA NA NA NA NA NA NA NA NA 4 NA NA NA NA NA NA NA NA NA NA 5 NA NA NA NA NA NA NA NA NA NA 6 NA NA NA NA NA NA NA NA NA NA 7 NA NA NA NA NA NA NA NA NA NA 8 NA NA NA NA NA NA NA NA NA NA 9 NA NA NA NA NA NA NA NA NA NA 10 NA NA NA NA NA NA NA NA NA NA

jgx65 commented 5 years ago

Which version of hierfstat are you running? ( SessionInfo() )

akang1414 commented 5 years ago

hierfstat_0.04-22

jgx65 commented 5 years ago

Install the latest version (0.04-29):

library(devtools)
install_github("jgx65/hierfstat")
library("hierfstat")

and retry please

akang1414 commented 5 years ago

Works fine with the new version! For some combinations I see very high FST values (0.91) with both Nei and WC methods. Can I say two populations are very different?

jgx65 commented 5 years ago

I don't know the biological underpinning but indeed, these values are high. Regards