Learn R Programming

SNPRelate (version 1.6.4)

snpgdsDrawTree: Draw a dendrogram

Description

To draw a dendrogram or the distribution of Z scores

Usage

snpgdsDrawTree(obj, clust.count=NULL, dend.idx=NULL, type=c("dendrogram", "z-score"), yaxis.height=TRUE, yaxis.kinship=TRUE, y.kinship.baseline=NaN, y.label.kinship=FALSE, outlier.n=NULL, shadow.col=c(rgb(0.5, 0.5, 0.5, 0.25), rgb(0.5, 0.5, 0.5, 0.05)), outlier.col=rgb(1, 0.50, 0.50, 0.5), leaflab="none", labels=NULL, y.label=0.2, ...)

Arguments

obj
an object returned by snpgdsCutTree
clust.count
the counts for clusters, drawing shadows
dend.idx
the index of sub tree, plot obj$dendrogram[[dend.idx]], or NULL for the whole tree
type
"dendrogram", draw a dendrogram; or "z-score", draw the distribution of Z score
yaxis.height
if TRUE, draw the left Y axis: height of tree
yaxis.kinship
if TRUE, draw the right Y axis: kinship coefficient
y.kinship.baseline
the baseline value of kinship; if NaN, it is the height of the first split from top in a dendrogram; only works when yaxis.kinship = TRUE
y.label.kinship
if TRUE, show 'PO/FS' etc on the right axis
outlier.n
the cluster with size less than or equal to outlier.n is considered as outliers; if NULL, let outlier.n = obj$outlier.n
shadow.col
two colors for shadow
outlier.col
the colors for outliers
leaflab
a string specifying how leaves are labeled. The default "perpendicular" write text vertically (by default). "textlike" writes text horizontally (in a rectangle), and "none" suppresses leaf labels.
labels
the legend for different regions
y.label
y positions of labels
...
Arguments to be passed to the method "plot(, ...)", such as graphical parameters.

Value

None.

Details

The details will be described in future.

See Also

snpgdsCutTree

Examples

Run this code
# 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