Open fdchevalier opened 5 years ago
Hi @fdchevalier,
Thanks for bringing this to my attention! I currently do not have any projects using haploids, so I wan't likely to discover this. And I feel your post is timely. In this issue https://github.com/knausb/vcfR/issues/117#issue-381217071 that I'm currently working on I should make sure addresses your issue as well. This comment is here to remind me they're related.
Thanks!
Hello,
I have an issue related to missing data with the function
extract.haps()
. I have diploid data that was processed by different tools before being loaded in R. One of the tools seems to recode the filtered out data with a single.
and not./.
. This has some consequences when this coded missing data is the first value of the dataset: the ploidy is not recognized and the function returns an unexpected result.Here is a reproducible example:
Here is the code that leads to this behavior: https://github.com/knausb/vcfR/blob/c76017b6bb66db44b4d84a3a61a1dc27fa53a8ec/R/extract_gt.R#L174-L177
A solution would be to not search for the first non
NA
value but to actually search for the genotype separator (/
or|
or:
if haploid data). Here is the piece of code that fixes it:This is different from #29 which, if I am right, is the C function that will actually extract the haplotypes.
Anyway, thank you for fixing this.
Fred