⌛ 45 min
Centrality-marginality hypothesis (CMH) predicts the changes of genetic variation when moving from central to marginal populations in a species’ range. In marginal populations, connectivity is reduced and effective population size is increased. This thus reduces within-population variation but increases among-population variation.

Guo (2012) Mol Ecol. https://doi.org/10.1111/mec.12012
<aside> 💡 In this activity, we will test a widely-debated hypothesis known as the Centrality-Marginality Hypothesis (CMH) and achieve these objectives:
<aside> 📥 Download
</aside>
[ ] First, open this test.csv in your favourite spreadsheet software (e.g. Excel). What data do we have there?
[ ] We will load this file in R and extract the coordinate data from this meta data.
df <- read.csv("test.csv")
coords <- data.frame(x = df$Lon, y = df$Lat)
[ ] We will visualise what we have for now. We will plot a map by using a world map data, but it will of course be too large. We can use the function range() to specify the ranges of the longitude and latitude, and input that to the xlim and ylim arguments for the map plotting.
map <- map("world", xlim = _____, ylim = _____)
[ ] We will then add the populations to the plot by using points().
points(coords)
[ ] There are many ways to define centrality-marginality of a population. One simple way is to calculate its distance from the centroid (centre of mass of a spatial polygon).
[ ] The centroid of a set of points is the mean point position, that is, the sum of all point coordinates divided by the number of points. This definition can be fuzzy on different projections and planes but we will stick with it for simplicity.
centroid <- data.frame(x = mean(df$Lon), y = mean(df$Lat))
[ ] We will add the centroid to the map plot.
points(centroid, col = "red", pch = 19)
[ ] We can use a fancier plotting tool the ggplot2 to get everything together. If you have difficulty in understanding this code, get help from your peer, the lecturer, or the demonstrators.
# Always a good practice to erase the canvas before plotting a new object
dev.off()
# This gets the world map data from a source called "rnaturalerath"
world <- ne_countries(scale = "medium", returnclass = "sf")
# This plots the map
ggplot(data = world) + # the background canvas is the world map
geom_sf() + # defining it is a spatial feature object
coord_sf(xlim = range(coords$x), ylim = range(coords$y)) + # setting the coordinates of the sf object
geom_point(data = df, aes(x = Lon, y = Lat, col = H)) + # plotting the populations as points and colouring them according the observed heterozygosity
geom_point(data = centroid, aes(x = x, y = y), col = "red", size = 2) # plotting the centroid and making it larger than other points