# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())
pop.group <- as.factor(read.gdsn(index.gdsn(
genofile, "sample.annot/pop.group")))
pop.level <- levels(pop.group)
diss <- snpgdsDiss(genofile)
hc <- snpgdsHCluster(diss)
# close the genotype file
snpgdsClose(genofile)
# split
set.seed(100)
rv <- snpgdsCutTree(hc, label.H=TRUE, label.Z=TRUE)
# draw dendrogram
snpgdsDrawTree(rv, main="HapMap Phase II",
edgePar=list(col=rgb(0.5,0.5,0.5, 0.75), t.col="black"))
Run the code above in your browser using DataLab