StoreyLab/popkin

missing value where TRUE/FALSE needed

melop opened this issue · 4 comments

melop commented

We are running R 4.3.0 and we encountered the following error. It is kind of difficult to interpret. Any ideas why this might have happened?


> X <- BEDMatrix("converted.bed")
Extracting number of samples and rownames from converted.fam...
Extracting number of variants and colnames from converted.bim...
> dim(X)
[1]      31 2846611
> kinship <- popkin(X)
Error in if (any(!indexes_not_fixed)) { : 
  missing value where TRUE/FALSE needed

On R 4.3.2, all my unit tests passed. My guess is that there's something pathological about your data that our code isn't considering (though it's usually robust to common edge cases). Perhaps you have a SNP with all of its values missing? I'm happy to look at your data if you're able to share it. Otherwise, try more QC before applying popkin? Let me know if you figured out the issue after trying these suggestions, perhaps I can improve our code as a consequence.

melop commented

Hi Alex, yes it must be the data. I previously ran popkin with no problem but after adding more individuals the error appears. The file is pretty big for online transfer. Is there a way to quickly figure out what's throwing off the code? The current error message isn't very helpful for pinpointing the cause. I will try filtering out any SNP with completely missing genotypes.

melop commented

Hi Alex, yes it must be the data. I previously ran popkin with no problem but after adding more individuals the error appears. The file is pretty big for online transfer. Is there a way to quickly figure out what's throwing off the code? The current error message isn't very helpful for pinpointing the cause. I will try filtering out any SNP with completely missing genotypes.

melop commented

Ok, filtering the data with F_MISSING<0.1 using bcftools solved the problem. Must be due to missing data.