jgx65 / hierfstat

the hierfstat package
24 stars 14 forks source link

pairwise.WCfst Error in 1:sum(data[, 1] == i) : NA/NaN argument #32

Closed piotyama closed 4 years ago

piotyama commented 4 years ago

Hi, I transformed my vcf data using <genind2hierfstat(loci2genind(d), pop=ind.desc$Continents)>, as suggested in the tutorial.

My data has 1120 samples and 2056 unlinked variants.

However when I use <pairwise.WCfst(dat,diploid=TRUE)> I get this error message: Error in 1:sum(data[, 1] == i) : NA/NaN argument

I can't seem to find a solution to this from the 4 existing issues posted. Any help is highly appreciated. I converted my pop identifiers to integers but that didn't solve the error. Basically all of the hierfstat programs return this error, which suggests maybe it's not recognizing my data. From my standpoint, everything looks OK with data following transformation (very similar to the example data file: gtrunchier).

Here's a sample of the transformed data I am working with: sample_data_129x30.txt

I can also share the original vcf file if it is helpful in reproducing the error. Thanks!

piotyama commented 4 years ago

I figured this out: what the error was telling me is pretty obvious - I needed walk away and come back fresh to see it :)

In my data, the first column (data[,1]), cannot contain NA or NaN. So I removed all cases where pop was defined as NA. Everything works after that!

jgx65 commented 4 years ago

Glad you could solve it!