Hi Anna,
Sorry for the late reply.
You can calculate the effective number of alleles using the dartR function gl.report.diversity(), as shown in the code below. This function is based on the paper of Bill Sherwin:
Sherwin, William B., et al. "Information theory broadens the spectrum of molecular ecology and evolution." Trends in ecology & evolution 32.12 (2017): 948-963.
The effective number of alleles is very sensitive to rare alleles and unequal sample sizes, so it can be biased if you don't have a large sample size. The best way to deal with this is calculating allelic richness using the rarefaction method as implemented in the package Hierfstat, as shown in the code below. If you want to know more about how allelic richness is calculated, see:
El Mousadik, A., and R. J. Petit. "High level of genetic differentiation
for allelic richness among populations of the argan tree [Argania
spinosa (L.) Skeels] endemic to Morocco." Theoretical and applied genetics 92.7 (1996): 832-839.
library(dartR)
test <-
platypus.glres <- gl.report.diversity(test)
# this is the effective number of alleles
res_2 <- res$zero_D_alpha
# printing results
res_2
library(hierfstat)
test_2 <-
platypus.gl# filtering loci with all missing data
test_2 <- gl.filter.allna(test_2)
#converting to genind
genind_2 <- gl2gi(test_2)
#converting to hierfstat
hierfstat <- genind2hierfstat(genind_2)
# calculating allelic richness
res_3 <- allelic.richness(hierfstat)
# calculating mean by column
res_4 <- colMeans(res_3$Ar,na.rm = TRUE)
#printing results
res_4
Cheers,
Luis