SNPRelate Dendrogram Point Colors and Shapes
1
0
Entering edit mode
@rfriedman22-10926
Last seen 8.5 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)

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?

 

SNPRelate R • 1.7k views
ADD COMMENT
0
Entering edit mode
zhengx ▴ 30
@zhengx-7950
Last seen 5.4 years ago
United States

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

 

 

ADD COMMENT

Login before adding your answer.

Traffic: 500 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6