Hierarchical cluster analysis

Description

To perform hierarchical cluster analysis on the dissimilarity matrix

Usage

1
snpgdsHCluster(dist, sample.id=NULL, need.mat=TRUE, hang=0.25)

Arguments

dist

an object of "snpgdsDissClass" from snpgdsDiss, an object of "snpgdsIBSClass" from snpgdsIBS, or a square matrix for dissimilarity

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.

Details

Call the function hclust to perform hierarchical cluster analysis, using method = "complete".

Value

Return a list (class "snpgdsHCClass"):

sample.id

the sample ids used in the analysis

hclust

an object returned from hclust

dendrogram
dist

the dissimilarity matrix, if need.mat = TRUE

Author(s)

Xiuwen Zheng

See Also

snpgdsIBS, snpgdsDiss, snpgdsCutTree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# open an example dataset (HapMap)
genofile <- openfn.gds(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)
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 genotype file
closefn.gds(genofile)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.