plotClusters2D: Plot phylogenetic tree clusters as a 2D graph

Description Usage Arguments Value Author(s) References Examples

View source: R/ClustPlot.R

Description

A function that plots clusters on a 2D graph using dimensionality reduction by PCA, with a given clustering and options of coloring scheme and whether to show the leaf names.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
plotClusters2D(
  tree,
  clustering,
  col.palette = NULL,
  show.centers = NULL,
  center.symbol = " * ",
  symbol.cex = 1,
  node.cex = 1,
  maxDim = NULL,
  title = "Tree Clusters Biplot"
)

Arguments

tree

A phylo tree object.

clustering

An positive integer vector, usually the from the output of clustEM, indicating index of specific colors from the palette. The integers in this vector must be at most the length of palette. Values of 0 indicate that the node is not assigned a cluster and therefore will not be labeled. If show.centers is not NULL, then all cluster centers indicated in the show.centers must not have a clustering value of 0. clustering should be the same length as the number of leaves in the tree.

col.palette

A character vector indicating the colors used for different clusters. If no value is given, the palette will be generated from rainbow.

show.centers

A character vector indicating leaf names of the cluster centers. Default value is NULL.

center.symbol

A character vector indicating the symbol or text representative of the cluster centers. Default value is " * ". If the length of center.symbol is less than the number of cluster centers specified in show.centers, then the symbols are recycled. This argument is ignored when show.centers is NULL.

symbol.cex

A numeric indicating factor scaling of center symbols. Default value is 1. This can be a numeric vector indicating scaling of each symbol. If the vector is shorter than the number of cluster centers, the numbers will be recycled. This argument is ignored if show.centers is NULL.

node.cex

A numeric indicating factor scaling of node circles. Default value is 1. This can be a numeric vector indicating scaling of each node (that is not a cluster center). If the vector is shorter than the number of nodes, the numbers will be recycled.

maxDim

A positive integer that is at least 2, indicating the max dimension of the coordinates that represent tree leaves. The dimensions will be less than or equal to the number of leaves. The default value of maxDim is NULL, for which the full dimension will be used. maxDim can be set smaller to decrease runtime of PCA at the cost of discarding the least significant dimensions beyond maxDim.

title

A character string indicating the title of the plot. Default value is "Tree Clusters Biplot".

Value

Returns a biplot of different clusters with different colors and an S3 object of class treeDimred with the coordinate matrix and PCA results.

Author(s)

Yuzi Li, rainal.li@mail.utoronto.ca

References

Paradis E, Schliep K (2019). “ape 5.0: an environment for modern phylogenetics and evolutionary analyses in R.” Bioinformatics, 35, 526-528.

Examples

1
2
3
4
5
pam <- clustPAM(6, text = NwkTree2)
dimRedInfoPAM <- plotClusters2D(pam$phyloTree,
                                pam$clustering,
                                show.centers = pam$medoids,
                                center.symbol = pam$medoids)

rainali475/ClustPhy documentation built on Dec. 22, 2021, 12:03 p.m.