grunwaldlab / poppr

🌶 An R package for genetic analysis of populations with mixed (clonal/sexual) reproduction
https://grunwaldlab.github.io/poppr
68 stars 26 forks source link

Genetic distance calculation yields NAs #225

Closed elizeng closed 3 years ago

elizeng commented 4 years ago

Please place an "x" in all the boxes that apply


I am trying to calculate genetic distance using rogers.dist

The string of code I use is:

library(xlsx)
library("poppr")
MROB_gp <- read.genepop("MROB_genepop.gen", ncode = 3)
MROB_gen_dist<- rogers.dist(MROB_gp)
MROB_gen_dist_mat<-as.matrix(MROB_gen_dist)

write.xlsx(MROB_gen_dist_mat, "MROB_gd.xlsx")

trangely this code works for my other datasets, whereas for the dataset above which is by far the largest at 34,710 loci, the output I get is just a string of NAs

I do not think its an issue with the input file as it was generated exactly the same way as that of the others, but I am not sure why this particular dataset is generating NAs

I am attaching the text version of the genepop file for testing.. as github doesn't allow the upload of the .gen file.

MROB_genepop2.txt


zkamvar commented 4 years ago

Hello,

It could be that you have missing data in all of your samples. Roger's distance cannot handle missing data. That's why you are getting all NAs. You might consider removing loci that have missing data with missingno()

zkamvar commented 3 years ago

I am closing this issue as resolved and stale. Please open with new information if it was not resolved.