I'm trying to use SNPRelate to build a dendrogram to show the relatedness between 2 different sets of individuals. I want to color-code points on the dendrogram based on one of the 9 groups that result from hierarchical clustering. I also want to plot the points as one of two different shapes depending on which of sets the individual originally came from.
I can already build a dendrogram and color-code it accordingly using the following code:
genofile <- snpgdsOpen("my.gds")
ibs <- snpgdsIBS(genofile, num.thread=2)
set.seed(100)
ibs.hc <- snpgdsHCluster(snpgdsIBS(genofile, num.thread=2))
sample.id <- read.gdsn(index.gdsn(genofile, "sample.id"))
pop_code <- scan("colors.txt", what = character())
rv <- snpgdsCutTree(ibs.hc, samp.group = as.factor(pop_code))
plot(rv$dendrogram, leaflab="perpendicular")
I see in the documentation for snpgdsCutTree that there is a pch.list option to specify the plotting character for different clusters. I've tried adding this option, but it assigns shapes in the same way as the colors are assigned--in other words, by group. Is there any way that I can assign the plotting shape by individual, rather than by group?