snpgdsHCluster | R Documentation |
Perform hierarchical cluster analysis on the dissimilarity matrix.
snpgdsHCluster(dist, sample.id=NULL, need.mat=TRUE, hang=0.25)
dist |
an object of "snpgdsDissClass" from |
sample.id |
to specify sample id, only work if dist is a matrix |
need.mat |
if TRUE, store the dissimilarity matrix in the result |
hang |
The fraction of the plot height by which labels should hang below the rest of the plot. A negative value will cause the labels to hang down from 0. |
Call the function hclust
to perform hierarchical cluster
analysis, using method="average"
.
Return a list (class "snpgdsHCClass"):
sample.id |
the sample ids used in the analysis |
hclust |
an object returned from |
dendrogram |
|
dist |
the dissimilarity matrix, if |
Xiuwen Zheng
snpgdsIBS
, snpgdsDiss
,
snpgdsCutTree
# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())
pop.group <- read.gdsn(index.gdsn(genofile, "sample.annot/pop.group"))
pop.group <- as.factor(pop.group)
pop.level <- levels(pop.group)
diss <- snpgdsDiss(genofile)
hc <- snpgdsHCluster(diss)
rv <- snpgdsCutTree(hc)
rv
# call 'plot' to draw a dendrogram
plot(rv$dendrogram, leaflab="none", main="HapMap Phase II")
# the distribution of Z scores
snpgdsDrawTree(rv, type="z-score", main="HapMap Phase II")
# draw dendrogram
snpgdsDrawTree(rv, main="HapMap Phase II",
edgePar=list(col=rgb(0.5,0.5,0.5, 0.75), t.col="black"))
# close the file
snpgdsClose(genofile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.