Hi Luis,
thank you so much for this explanation. I realized I had read about how the data is re-coded in the genlight object but I had totally forgot about it....sorry about that!
Thanks a lot for your explanation!
Anyways, I have another question about the individual heterozygosity values reported by the 2 functions filter.heterozygosity & report.heterozygosity.
In my data, the histogram for report.heterozygosity (method=ind) gives an histogram with values from 0.08 to 0.016 on the x-axis, but if I set as thresholds 0.10 and 0.15 (within the range of the reported values from the report.heterozygosity function) for the filter.heterozygosity function then i get the error "subscript out of bound" and the function tells me min individual heterozygosity is 3.5 and max is 9, so very different values.
I looked up the source code for the 2 functions and I noticed that:
- in report.heterozygosity: individual heetrozygosity is calculated as % of heterozygous loci for each individual over all individuals dived by the number of loci (
" c.hets[i] <- sum(m[i,]==1,na.rm=TRUE)/(nLoc(x)-c.na[i]) ")
- in filter.heterozygosity: individual heterozygosity is calculated as % of heterozygous loci for each individual over all individuals BUT divided by the number of individuals ("
c.hets[i] <- sum(m[i,]==1,na.rm=TRUE)/(nInd(x)-c.na[i])" )
How come there is this difference in the calculation? Shouldn't the 2 function report the same thing or am I missing something?
Thanks a lot!
Gabriella