Open code

Standardized population genetic diversity

We provide code to estimate standardized genetic diversity to the smallest number of individuals under multiple randomizations.

Genetic diversity estimation per site or group of sites can be biased due to unbalanced sampling designs. There is an expected relationship between the number of sampled individuals in a single population and genetic diversity (e.g., as allelic richness; the total number of alleles).

To overcome the issue, standardized allelic richness and standardized number of private alleles can be determined to the smallest number of individuals within sites or group of sites under multiple randomizations.

The sites or groups of sites with higher standardized genetic diversity than the global mean can be also assessed by testing the proportion of randomizations retrieving higher values than observed.

Standardized population genetic diversity

# Source main function

# Get example data file at: <- "sampleData.gtx" <- 0
replace <- FALSE
ncode <- 3 <- FALSE
resample.number <- 20
discard.pops <- NULL
number.iteractions <- 999
alfa.test <- 0.05
savefile <- FALSE
save.filename <- "richness"

# Define a vector to cluster populations
clustering.vector <- c(1,1,2,2)

# Run function
Rambo(,, ncode, replace,, resample.number, discard.pops, number.iteractions, alfa.test, clustering.vector, savefile, save.filename)

Main reference

Assis, J., Coelho, N. C., Lamy, T., Valero, M., Alberto, F., & Serrão, E. A. (2016). Deep reefs are climatic refugia for genetic diversity of marine forests. Journal of Biogeography, (43), 833–844.

  • Featured code
Downloading biodiversity records from iNaturalist

Automatically download biodiversity records from iNaturalist, the most recognised citizen science initiative.

Marine climate layers for ecological modelling

High-resolution marine data layers to model the distribution of species at global scales.


Jorge Assis [PhD, Associate Researcher]
Centre of Marine Sciences, University of Algarve [Faro, Portugal]
© 2023 Biodiversity Data Science, All Rights Reserved