Creative morphometrics

Using R and python for colorful research of biological shape

Delaunay Triangulation Experiment

Since landmark data consists of x and y Cartesian coordinates, it would be useful if they could be represented by one summary number, that would preserve the spatial information. This is just a proposal of one possiblity using Delaunay triangulation between landmark configurations, and the average area of all triangles emanating from individual landmarks. Since landmark position within the triangulation grid would influence the shape and size as well as number of triangles around it, the area should preserve enoguh information about the spatial relationships of landmarks. Dataset for this post consists of ventral aspect half configurations from here. Delaunay triangulation will be performed using deldir R package, since it reports the mentioned triangle areas as a part of object summary.

Importing data, basic GM, calculating the triangulation, extracting areas and plotting
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
library(deldir)
library(geomorph)
load("capSample.RData")

capreolusGPA <- gpagen(capSample)
capGPAcoords <- capreolusGPA$coords

delCap <- deldir(capSample[,,10][,1], capSample[,,10][,2]) #extract any individual from an array for visualization
plot(delCap, col=c("lightblue","lightgrey",1,1,1), lwd = c(2,2), xlim = c(150, 400), cex = 0.1, ann = FALSE)
points(capSample[,,10], col = "orange", pch = 16, cex = 1.4)
text(capSample[,,10], label = c(1:16), pos = 3, ceo = 0.5)

areaCap <- t(apply(capGPAcoords, 3, function(A) deldir(A[,1],A[,2])$summary[,4])) #calcuate areas per landmark
areaCap <- data.frame(areaCap)
names(areaCap) <- paste("lm", c(1:16), sep = "")

Values in the areaCap matrix represent average areas of all triangles emanating from the landmark in question, so its dimensions are 60x16. Correlation matrix (16x16) can be calculated from the areaCap matrix, and it should reflect relative positioning of landmarks through spatial grouping pattern. This can be checked visually using corrplot package visualization of the correlation matrix, which allows direct assesment of emerging patterns in the matrix. Additionally, this package allows reordering of rows and columns according to hierarchical clustering algorhithms and representing the desired number of clusters with rectangles in the correlation plot. This can only be considered as an idea of general modularity, since landmarks from the same cranial region should be correlated more than distant landmarks. But the transformation of xy coordinates to average triangle areas may have introduced non-biological variation or obscured some of the natural variation and these procedures as well as subsequent analyses may be treated only as a fun experiment and visualization tool for now.

Drawing correlation plot
1
2
3
library(corrplot)
capCor <- cor(areaCap)
corrplot(capCor, method = "circle", tl.cex = 0.93, order = "hclust", addrect = 3)

Correlation plot with three proposed general landmark groups in the matrix reveals that the correlations are, on average, higher for locally grouped landmaks, especially the anterior ones, from 1 to 7. This can`t be used as a reliablie test for modularity hypothesis, but it can serve as a basis for further analyses based on construcing linked graphs or networks using correlation matrices from landmark data, where the xy coordinates are transformed to one number. Also this can be a useful way of representing modular structure visually, since both Delaunay and correlation plots are highly customizable, and can be colored according to real modularity hypotheses. Testing some of these will be the subject of future posts.