snpgdsDrawTree: Draw a dendrogram

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/AllUtilities.R

Description

To draw a dendrogram or the distribution of Z scores

Usage

1
2
3
4
5
6
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.

Details

The details will be described in future.

Value

None.

Author(s)

Xiuwen Zheng

See Also

snpgdsCutTree

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# 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"))

Example output

Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
Individual dissimilarity analysis on genotypes:
Excluding 365 SNPs on non-autosomes
Excluding 1 SNP (monomorphic: TRUE, MAF: NaN, missing rate: NaN)
Working space: 279 samples, 8,722 SNPs
    using 1 (CPU) core
Dissimilarity:    the sum of all selected genotypes (0,1,2) = 2446510
Dissimilarity:	Mon Mar 26 14:59:33 2018	0%
Dissimilarity:	Mon Mar 26 14:59:34 2018	100%
Determine groups by permutation (Z threshold: 15, outlier threshold: 5):
Create 3 groups.

SNPRelate documentation built on Nov. 8, 2020, 5:31 p.m.