SNPRelate Dendrogram Point Colors and Shapes
Entering edit mode
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")

ibs <- snpgdsIBS(genofile, num.thread=2)

ibs.hc <- snpgdsHCluster(snpgdsIBS(genofile, num.thread=2)) <- read.gdsn(index.gdsn(genofile, ""))
pop_code <- scan("colors.txt", what = character())
rv <- snpgdsCutTree(ibs.hc, = 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
Entering edit mode
zhengx ▴ 30
Last seen 2.2 years ago
United States

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




Login before adding your answer.

Traffic: 287 users visited in the last hour
Help About
Access RSS

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6