SNPRelate Dendrogram Point Colors and Shapes
1
0
Entering edit mode
@rfriedman22-10926
Last seen 5.4 years ago
Washington University in St. Louis

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")

set.seed(100)
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?

SNPRelate R • 920 views
0
Entering edit mode
zhengx ▴ 30
@zhengx-7950
Last seen 2.2 years ago
United States

Please try dendrapply() function, snpgdsCutTree() use dendrapply() internally to add different pch and colors.