[adegenet-forum] DAPC and map
Maisano Delser, Pierpaolo
pm244 at leicester.ac.uk
Mon Jul 11 16:47:47 CEST 2011
Dear Thibaut Jombart and List members,
I am performing the DAPC analysis on my dataset and I am particularly interested in reproducing the figure 5 (Jombart T et al._2010_BMCgenetics) with my data.
Before doing that I tried to follow the example on the eHGDP dataset in order to reproduce the figure 5. So I performed the DAPC on that dataset with n.pca=1000 in order to get a result as much comparable as possible to that one in the paper.
The barplot of the eigenvalues is exactly the same to the published one but the colored pattern I got by plotting all the populations is quite different. It seems to be much more similar to the figure 7 (same paper) where the number of inferred clusters is equal to 4 even if I used the original 79 populations as clusters.
I used these commands as written in the help file:
if(require(maps)){
xy <- cbind(eHGDP$other$popInfo$Longitude, eHGDP$other$popInfo$Latitude)
par(mar=rep(.1,4))
map(fill=TRUE, col="lightgrey")
colorplot(xy, -dapc1$grp.coord, cex=3, add=TRUE, trans=FALSE)
}
Moreover another point I did not get is about that minus sign in front of dapc1$grp.coord...in that dataset each column (each discriminant function) could assume both positive and negative values...how could they be converted into rgb colors?
In order to understand something more I tried to read through the colorplot.default function by using my little R knowledge. I understood that those values are standardized by dividing them for their maximum within each column but I did not get what happen for the negative ones...are they substituted by their original value plus the absolute value of the minimum in that column?
Probably (I am not sure!) this is the part of the colorplot function responsible for that:
f1 <- function(x) {
if (any(x < 0)) {
x <- x + abs(min(x))
}
return(x)
So my question is just to understand how to plot the DAPC results by using the rgb colors like in figure 5.
Any suggestions would be really appreciated.
Thank you so much for your help!
Best wishes,
Pierpaolo
More information about the adegenet-forum
mailing list